RoleChs.vue 4.1 KB

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