title.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <!-- 标题 -->
  3. <view class="title-box acea-row row-between row-middle" :style="[...boxStyle]" @click="goPage">
  4. <view class="acea-row row-middle" >
  5. <view :style="[...titleStyle]">{{ titleTxt }}</view>
  6. <view class="ml6" :style="[...titleFuStyle]">{{ titleFuTxt }}</view>
  7. </view>
  8. <view v-if="!selectShow" :style="[...titleRightStyle]">{{ titleRightTxt }}<text :style="[...titleRightStyle]" class="iconfont icon-xiangyou"></text></view>
  9. </view>
  10. </template>
  11. <script>
  12. // +----------------------------------------------------------------------
  13. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  14. // +----------------------------------------------------------------------
  15. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  16. // +----------------------------------------------------------------------
  17. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  18. // +----------------------------------------------------------------------
  19. // | Author: CRMEB Team <admin@crmeb.com>
  20. // +----------------------------------------------------------------------
  21. export default {
  22. name: 'titles',
  23. props: {
  24. dataConfig: {
  25. type: Object,
  26. default: () => {}
  27. },
  28. },
  29. computed: {
  30. //最外层盒子的样式
  31. boxStyle() {
  32. return [{
  33. 'border-radius': 2*this.dataConfig.bgTopStyle.val +
  34. 'rpx' +
  35. ' ' +
  36. 2*this.dataConfig.bgTopStyle.val +
  37. 'rpx' +
  38. ' ' +
  39. 2*this.dataConfig.bgDownStyle.val +
  40. 'rpx' +
  41. ' ' +
  42. 2*this.dataConfig.bgDownStyle.val +
  43. 'rpx',
  44. },
  45. {
  46. 'background-image': this.selectStyle ?
  47. `linear-gradient(to right,${this.dataConfig.bgColor.color[0].item}, ${this.dataConfig.bgColor.color[1].item})` :
  48. `url(${this.bgImgUrl})`,
  49. },
  50. {
  51. margin: 2*this.dataConfig.mbConfig.val + 'rpx' + ' ' + 2*this.dataConfig.lrConfig.val + 'rpx' + ' ' +
  52. 0
  53. },
  54. {
  55. padding: 2*this.dataConfig.upConfig.val + 'rpx' + ' ' + '20rpx' + ' ' + 2*this.dataConfig.downConfig
  56. .val + 'rpx'
  57. },
  58. ];
  59. },
  60. titleStyle() {
  61. return [{
  62. 'font-weight': this.dataConfig.textStyle.list[this.dataConfig.textStyle.tabVal].style,
  63. },
  64. {
  65. 'font-style': this.dataConfig.textStyle.list[this.dataConfig.textStyle.tabVal].style
  66. },
  67. {
  68. fontSize: 2*this.dataConfig.fontSize.val + 'rpx',
  69. },
  70. {
  71. color: this.dataConfig.fontColor.color[0].item
  72. },
  73. ];
  74. },
  75. titleFuStyle() {
  76. return [{
  77. fontSize: 2*this.dataConfig.fontFuSize.val + 'rpx',
  78. },
  79. {
  80. color: this.dataConfig.fontFuColor.color[0].item
  81. },
  82. ];
  83. },
  84. titleRightStyle() {
  85. return [{
  86. fontSize: 2*this.dataConfig.fontRightSize.val + 'rpx',
  87. },
  88. {
  89. color: this.dataConfig.fontRightColor.color[0].item
  90. },
  91. ];
  92. },
  93. },
  94. data() {
  95. return {
  96. configObj: null,
  97. titleTxt: '',
  98. titleFuTxt: '',
  99. titleRightTxt: '',
  100. link: '',
  101. txtPosition: '',
  102. txtStyle: '',
  103. fontSize: 0,
  104. mTOP: 0,
  105. titleColor: '',
  106. themeColor: '',
  107. prConfig: 0,
  108. bgStyle: 0,
  109. pageData: {},
  110. selectShow: '',
  111. selectStyle: '',
  112. bgImgUrl: '',
  113. };
  114. },
  115. created() {
  116. this.setConfig()
  117. },
  118. methods: {
  119. setConfig(data) {
  120. this.configObj = this.data;
  121. this.titleTxt = this.dataConfig.titleConfig.val;
  122. this.titleFuTxt = this.dataConfig.titleFuConfig.val;
  123. this.titleRightTxt = this.dataConfig.titleRightConfig.val;
  124. this.link = this.dataConfig.linkConfig.val;
  125. this.bgImgUrl = this.dataConfig.bgImg.url;
  126. this.selectShow = this.dataConfig.selectShow.tabVal;
  127. this.selectStyle = this.dataConfig.selectStyle.tabVal;
  128. },
  129. goPage() {
  130. this.$util.navigateTo(this.dataConfig.linkConfig.val)
  131. }
  132. }
  133. }
  134. </script>
  135. <style scoped lang="scss">
  136. .title-box{
  137. background-repeat: no-repeat;
  138. object-fit: contain;
  139. }
  140. .title {
  141. font-size: 32rpx;
  142. color: #000;
  143. text-align: center;
  144. &.left {
  145. text-align: left;
  146. }
  147. &.right {
  148. text-align: right;
  149. }
  150. &.blod {
  151. font-weight: bold;
  152. }
  153. &.italics {
  154. font-style: italic;
  155. }
  156. }
  157. .ml6 {
  158. margin-left: 12rpx;
  159. }
  160. </style>