index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <div class="commenting" @click.stop>
  3. <p class="qtitle">请选择虚拟解说形象</p>
  4. <div class="qline">
  5. <img :src="require(`@/assets/images/icon/star.png`)" alt="" />
  6. </div>
  7. <div class="comment">
  8. <ul>
  9. <li :class="{active:item.id==active.id}" v-for="(item, i) in commentalist" :key="i" >
  10. <img @click="handleItem(item)" :src="require(`@/assets/images/project/commentator/${item.id}${item.id == active.id?'_active':''}.png`)" alt="" />
  11. </li>
  12. </ul>
  13. </div>
  14. <div class="comment_btn">
  15. <span>当前虚拟解说形象:{{active.name}}</span>
  16. </div>
  17. <img
  18. @click="$emit('close')"
  19. class="close"
  20. :src="require('@/assets/images/project/close1.png')"
  21. alt=""
  22. />
  23. </div>
  24. </template>
  25. <script>
  26. let list = [
  27. {
  28. id:'female_2',
  29. name:'军绿英姿'
  30. },
  31. {
  32. id:'female_1',
  33. name:'迷彩飒爽'
  34. },
  35. {
  36. id:'male',
  37. name:'圣洁白衣'
  38. },
  39. {
  40. id:'none',
  41. name:'无'
  42. },
  43. ]
  44. export default {
  45. data() {
  46. return {
  47. active: list[2],
  48. commentalist:list
  49. };
  50. },
  51. methods: {
  52. handleItem(item){
  53. localStorage.setItem('xunirole',item.id)
  54. this.active=item
  55. this.$bus.$emit('xunirole',item)
  56. }
  57. },
  58. mounted() {
  59. let id = localStorage.getItem('xunirole')
  60. let active = list.find(item=>item.id==id)
  61. this.active = active || list[2]
  62. },
  63. };
  64. </script>
  65. <style lang="less" scoped>
  66. .commenting {
  67. margin: 0 auto;
  68. position: fixed;
  69. height: 530px;
  70. top: 50%;
  71. left: 50%;
  72. transform: translate(-50%, -50%);
  73. z-index: 99;
  74. background: rgba(3, 51, 48, 0.5);
  75. color: #fff;
  76. padding: 34px 0;
  77. border-top: 8px solid #ccaf8f;
  78. border-bottom: 8px solid #ccaf8f;
  79. .qtitle {
  80. margin-top: 6px;
  81. text-align: center;
  82. font-size: 28px;
  83. font-weight: bold;
  84. line-height: 38px;
  85. color: #ffe0a6;
  86. }
  87. .qline {
  88. width: 100%;
  89. height: 1px;
  90. margin: 26px 0 0;
  91. position: relative;
  92. background: linear-gradient(
  93. 90deg,
  94. rgba(255, 255, 255, 0) 0%,
  95. #ffffff 48%,
  96. rgba(255, 255, 255, 0) 100%
  97. );
  98. > img {
  99. position: absolute;
  100. left: 50%;
  101. transform: translateX(-50%);
  102. width: 32px;
  103. top: -12px;
  104. }
  105. }
  106. .comment {
  107. width: 100%;
  108. overflow-y: auto;
  109. margin: 0 auto;
  110. padding: 33px 38px;
  111. background-color: rgba(255, 255, 255, 0.7);
  112. >ul{
  113. display: flex;
  114. justify-content: space-between;
  115. align-items: center;
  116. >li{
  117. width: 200px;
  118. cursor: pointer;
  119. margin: 0 12px;
  120. >img{
  121. width: 100%;
  122. }
  123. &.active{
  124. background: #fff;
  125. box-shadow: 0px 0px 30px rgba(138,106,72,1);
  126. border: 1px solid rgba(0, 0, 0, 0.2);
  127. }
  128. }
  129. }
  130. }
  131. .comment_btn {
  132. > span {
  133. display: inline-block;
  134. color: #fcf5d3;
  135. font-size: 18px;
  136. cursor: pointer;
  137. width: 100%;
  138. margin: 20px auto 0;
  139. }
  140. }
  141. .close {
  142. position: absolute;
  143. top: 40px;
  144. right: 50px;
  145. width: 24px;
  146. height: 24px;
  147. cursor: pointer;
  148. z-index: 9999999;
  149. }
  150. }
  151. </style>