titles.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <!-- 标题 -->
  3. <common-wrapper :config="configData" v-show="!isSortType">
  4. <view :style="[titleWrapStyle]">
  5. <view
  6. @click="goLink"
  7. class="title acea-row row-middle row-between"
  8. :style="[titleLocation]"
  9. >
  10. <view :style="[titleStyle]">{{ dataConfig.titleConfig.value }}</view>
  11. <view
  12. class="more"
  13. v-if="!dataConfig.buttonConfig.tabVal"
  14. :style="[moreStyle]"
  15. >
  16. {{ dataConfig.titleConfigRight.value }}
  17. <text class="iconfont icon-ic_rightarrow"></text>
  18. </view>
  19. </view>
  20. </view>
  21. </common-wrapper>
  22. </template>
  23. <script>
  24. import commonWrapper from "./commonWrapper.vue";
  25. export default {
  26. components: { commonWrapper },
  27. name: "titles",
  28. props: {
  29. dataConfig: {
  30. type: Object,
  31. default: () => {},
  32. },
  33. isSortType: {
  34. type: String | Number,
  35. default: 0,
  36. },
  37. },
  38. computed: {
  39. configData() {
  40. return {
  41. ...this.dataConfig,
  42. paddingConfig: this.dataConfig.paddingConfig || {
  43. isAll: false,
  44. valList: [
  45. {
  46. val: this.dataConfig.topConfig
  47. ? this.dataConfig.topConfig.val
  48. : 0,
  49. },
  50. {
  51. val: this.dataConfig.prConfig ? this.dataConfig.prConfig.val : 0,
  52. },
  53. {
  54. val: this.dataConfig.bottomConfig
  55. ? this.dataConfig.bottomConfig.val
  56. : 0,
  57. },
  58. {
  59. val: this.dataConfig.prConfig ? this.dataConfig.prConfig.val : 0,
  60. },
  61. ],
  62. },
  63. marginConfig: this.dataConfig.marginConfig || {
  64. isAll: false,
  65. valList: [
  66. {
  67. val: this.dataConfig.mbConfig ? this.dataConfig.mbConfig.val : 0,
  68. },
  69. {
  70. val: 0,
  71. },
  72. {
  73. val: 0,
  74. },
  75. {
  76. val: 0,
  77. },
  78. ],
  79. },
  80. };
  81. },
  82. titleWrapStyle() {
  83. let borderRadius = `${this.dataConfig.fillet.val * 2}rpx`;
  84. if (this.dataConfig.fillet.type) {
  85. borderRadius = `${this.dataConfig.fillet.valList[0].val * 2}rpx ${
  86. this.dataConfig.fillet.valList[1].val * 2
  87. }rpx ${this.dataConfig.fillet.valList[3].val * 2}rpx ${
  88. this.dataConfig.fillet.valList[2].val * 2
  89. }rpx`;
  90. }
  91. return {
  92. "border-radius": borderRadius,
  93. background: `linear-gradient(90deg, ${this.dataConfig.moduleColor.color[0].item} 0%, ${this.dataConfig.moduleColor.color[1].item} 100%)`,
  94. };
  95. },
  96. titleStyle() {
  97. let style = {
  98. "font-size": `${this.dataConfig.fontSize.val * 2}rpx`,
  99. color: this.dataConfig.themeColor.color[0].item,
  100. };
  101. switch (this.dataConfig.textStyle.tabVal) {
  102. case 1:
  103. style["font-style"] = "italic";
  104. break;
  105. case 2:
  106. style["font-weight"] = "bold";
  107. break;
  108. }
  109. return style;
  110. },
  111. titleLocation() {
  112. if (this.dataConfig.buttonConfig.tabVal) {
  113. let style = {};
  114. switch (this.dataConfig.textPosition.tabVal) {
  115. case 1:
  116. style["justify-content"] = "center";
  117. break;
  118. case 2:
  119. style["justify-content"] = "flex-end";
  120. break;
  121. }
  122. return style;
  123. }
  124. },
  125. moreStyle() {
  126. return {
  127. "font-size": `${this.dataConfig.buttonText.val * 2}rpx`,
  128. color: this.dataConfig.buttonColor.color[0].item,
  129. };
  130. },
  131. },
  132. methods: {
  133. goLink() {
  134. this.$util.JumpPath(this.dataConfig.linkConfig.value);
  135. },
  136. },
  137. };
  138. </script>
  139. <style lang="scss">
  140. .title {
  141. justify-content: space-between;
  142. padding: 26rpx 24rpx;
  143. border-radius: 16rpx 16rpx 0rpx 0rpx;
  144. font-weight: 500;
  145. font-size: 32rpx;
  146. line-height: 44rpx;
  147. color: #333333;
  148. .more {
  149. font-weight: 400;
  150. font-size: 24rpx;
  151. line-height: 34rpx;
  152. color: #999999;
  153. }
  154. .iconfont {
  155. font-size: 24rpx;
  156. }
  157. }
  158. </style>