RoleChs.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <!-- -->
  2. <template>
  3. <div class="role-rItem" v-if="curRole">
  4. <span
  5. v-if="curRole.role"
  6. class="adult-book-input-roleText"
  7. :style="{
  8. background: this.curRole.color.touxiang,
  9. fontSize: baseSizePhone + 6 + 'px'
  10. }"
  11. >{{ curRole.role }}</span
  12. >
  13. <img
  14. v-else-if="curRole.img_list.length > 0"
  15. :src="curRole.img_list[0] && curRole.img_list[0].id"
  16. class="adult-book-input-roleImg"
  17. />
  18. <div
  19. class="adult-book-input-roleImg"
  20. :class="['adult-book-input-roleImg' + curRole.simpleHead]"
  21. v-else-if="curRole.simpleHead !== ''"
  22. ></div>
  23. <template v-if="type != 1 && curRole.detail.wordsList.length > 0">
  24. <span
  25. class="pinyin"
  26. :style="{ color: wordColor, fontSize: baseSizePhone + 'px' }"
  27. >{{ curRole.detail.wordsList | handlePinyin }}</span
  28. >
  29. <span
  30. class="chs"
  31. :style="{ color: wordColor, fontSize: baseSizePhone + 2 + 'px' }"
  32. >{{ curRole.detail.wordsList | handleChs }}</span
  33. >
  34. </template>
  35. </div>
  36. </template>
  37. <script>
  38. export default {
  39. components: {},
  40. props: ["curRole", "color", "type", "baseSizePhone"],
  41. filters: {
  42. handlePinyin(wordsList) {
  43. let str = "";
  44. wordsList.forEach((item, index) => {
  45. if (index < wordsList.length - 1) {
  46. str += item.pinyin + " ";
  47. } else {
  48. str += item.pinyin;
  49. }
  50. });
  51. return str;
  52. },
  53. handleChs(wordsList) {
  54. let str = "";
  55. wordsList.forEach((item, index) => {
  56. if (index < wordsList.length - 1) {
  57. str += item.chs + " ";
  58. } else {
  59. str += item.chs;
  60. }
  61. });
  62. return str;
  63. }
  64. },
  65. data() {
  66. return {};
  67. },
  68. computed: {
  69. wordColor: function() {
  70. let color = "rgba(0,0,0,0.85)";
  71. if (this.color) {
  72. color = this.color;
  73. }
  74. return color;
  75. }
  76. },
  77. watch: {},
  78. //方法集合
  79. methods: {},
  80. //生命周期 - 创建完成(可以访问当前this实例)
  81. created() {},
  82. //生命周期 - 挂载完成(可以访问DOM元素)
  83. mounted() {},
  84. beforeCreate() {}, //生命周期 - 创建之前
  85. beforeMount() {}, //生命周期 - 挂载之前
  86. beforeUpdate() {}, //生命周期 - 更新之前
  87. updated() {}, //生命周期 - 更新之后
  88. beforeDestroy() {}, //生命周期 - 销毁之前
  89. destroyed() {}, //生命周期 - 销毁完成
  90. activated() {} //如果页面有keep-alive缓存功能,这个函数会触发
  91. };
  92. </script>
  93. <style lang="scss" scoped>
  94. //@import url(); 引入公共css类
  95. .role-rItem {
  96. display: flex;
  97. justify-content: flex-start;
  98. align-items: center;
  99. .adult-book-input {
  100. &-roleText {
  101. display: flex;
  102. justify-content: center;
  103. align-items: center;
  104. width: 36px;
  105. height: 36px;
  106. background: #a7a7a7;
  107. border-radius: 100%;
  108. text-align: center;
  109. line-height: 20px;
  110. font-size: 20px;
  111. color: #ffffff;
  112. }
  113. &-roleImg {
  114. width: 36px;
  115. height: 36px;
  116. }
  117. &-roleImg0 {
  118. background: url("../../../../assets/NPC/simple1.png") center no-repeat;
  119. background-size: contain;
  120. }
  121. &-roleImg1 {
  122. background: url("../../../../assets/NPC/simple2.png") center no-repeat;
  123. background-size: contain;
  124. }
  125. &-roleImg2 {
  126. background: url("../../../../assets/NPC/simple3.png") center no-repeat;
  127. background-size: contain;
  128. }
  129. &-roleImg3 {
  130. background: url("../../../../assets/NPC/simple4.png") center no-repeat;
  131. background-size: contain;
  132. }
  133. &-roleImg4 {
  134. background: url("../../../../assets/NPC/simple5.png") center no-repeat;
  135. background-size: contain;
  136. }
  137. &-roleImg5 {
  138. background: url("../../../../assets/NPC/simple6.png") center no-repeat;
  139. background-size: contain;
  140. }
  141. &-roleImg6 {
  142. background: url("../../../../assets/NPC/simple7.png") center no-repeat;
  143. background-size: contain;
  144. }
  145. &-roleImg7 {
  146. background: url("../../../../assets/NPC/simple8.png") center no-repeat;
  147. background-size: contain;
  148. }
  149. }
  150. .pinyin {
  151. font-family: "GB-PINYINOK-B";
  152. font-size: 14px;
  153. line-height: 22px;
  154. color: rgba(0, 0, 0, 0.85);
  155. margin-right: 4px;
  156. margin-left: 8px;
  157. }
  158. .chs {
  159. font-family: "FZJCGFKTK";
  160. font-size: 16px;
  161. line-height: 24px;
  162. color: rgba(0, 0, 0, 0.85);
  163. }
  164. }
  165. </style>