app-associated-link.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <view class="app-associated-link dir-left-nowrap main-left cross-center" :style="{backgroundColor: background}">
  3. <app-jump-button style="width: 100%" form :open_type="link.open_type" :url="link.value" :params="link.params">
  4. <view class="dir-left-nowrap" :class="[`${className}`]" :style="{backgroundColor: background}">
  5. <view v-if="styleNum == '1'" class="app-link-title box-grow-1" :style="{textAlign: position}">
  6. <image class="app-title-icon" v-if="picSwitch" :src="picUrl">
  7. </image>
  8. <text :style="{color: color}">{{title}}</text>
  9. </view>
  10. <view v-else-if="styleNum == '2'" class="app-link-title box-grow-1 main-center cross-center">
  11. <image :style="{backgroundColor: styleColor}" class="app-title-line" :src="styleImg.line"></image>
  12. <view :style="{color: color}">{{title}}</view>
  13. <image :style="{backgroundColor: styleColor}" class="app-title-line" :src="styleImg.line"></image>
  14. </view>
  15. <view v-else-if="styleNum == '3'" class="app-link-title box-grow-1 main-center cross-center">
  16. <view class="app-title-line star">
  17. <view :style="{backgroundColor: styleColor}" class="top-icon"></view>
  18. <view :style="{backgroundColor: styleColor}" class="bottom-icon"></view>
  19. </view>
  20. <view :style="{color: color}">{{title}}</view>
  21. <view class="app-title-line star">
  22. <view :style="{backgroundColor: styleColor}" class="top-icon"></view>
  23. <view :style="{backgroundColor: styleColor}" class="bottom-icon"></view>
  24. </view>
  25. </view>
  26. <view v-else-if="styleNum == '4'" class="app-link-title box-grow-1 dir-left-nowrap cross-center">
  27. <image :style="{backgroundColor: styleColor}" class="app-title-line div" :src="styleImg.div"></image>
  28. <view :style="{color: color}">{{title}}</view>
  29. </view>
  30. <view v-else-if="styleNum == '5'" class="app-link-title box-grow-1 dir-left-nowrap cross-center">
  31. <view :style="[{'border-color':`${styleColor}`,'background-color':`${background}`}]" class="app-title-line radius"></view>
  32. <view :style="{color: color}">{{title}}</view>
  33. </view>
  34. <block v-if="arrowsSwitch">
  35. <view class="app-more-btn">
  36. <text>进入会场</text>
  37. <icon class="app-icon"></icon>
  38. </view>
  39. </block>
  40. </view>
  41. </app-jump-button>
  42. </view>
  43. </template>
  44. <script>
  45. import {mapState, mapGetters} from 'vuex';
  46. export default {
  47. name: "app-associated-link",
  48. data() {
  49. return {
  50. className: '',
  51. }
  52. },
  53. computed: {
  54. ...mapState({
  55. styleImg: state => state.mallConfig.__wxapp_img.diy,
  56. }),
  57. },
  58. props: {
  59. arrowsSwitch: {
  60. type: Boolean,
  61. default: function() {
  62. return false;
  63. }
  64. },
  65. background: {
  66. type: String,
  67. default: function() {
  68. return '#E11B1B';
  69. }
  70. },
  71. color: {
  72. type: String,
  73. default: function() {
  74. return '#F4EBEB';
  75. }
  76. },
  77. link: {
  78. type: Object,
  79. default: function() {
  80. return {
  81. open_type: "tel",
  82. params: [
  83. {
  84. value: "111",
  85. }
  86. ],
  87. }
  88. }
  89. },
  90. styleColor: {
  91. type: String,
  92. default: function() {
  93. return '#353535';
  94. }
  95. },
  96. picSwitch: {
  97. type:Boolean,
  98. default: function() {
  99. return false;
  100. }
  101. },
  102. picUrl: {
  103. type: String,
  104. default: function() {
  105. return '';
  106. }
  107. },
  108. position: {
  109. type: String,
  110. default: function() {
  111. return 'left';
  112. }
  113. },
  114. title: {
  115. type: String,
  116. default: function() {
  117. return '';
  118. }
  119. },
  120. styleNum: {
  121. type: String,
  122. default: function() {
  123. return '1';
  124. }
  125. },
  126. fontSize: {
  127. type: String,
  128. default: function() {
  129. return '36';
  130. }
  131. }
  132. },
  133. created() {
  134. let that = this;
  135. if(this.fontSize == '36') {
  136. this.className = 'big-style'
  137. }else if(this.fontSize == '28') {
  138. this.className = 'medium-style'
  139. }else {
  140. this.className = 'small-style'
  141. }
  142. },
  143. }
  144. </script>
  145. <style scoped lang="scss">
  146. .app-associated-link {
  147. width: #{750rpx};
  148. height: #{90rpx};
  149. position: relative;
  150. display: flex;
  151. align-items: center;
  152. .app-more-text {
  153. font-size: #{24rpx};
  154. color: #999;
  155. white-space: nowrap;
  156. }
  157. .app-more-btn{
  158. min-width: 200rpx;
  159. color: #ffffff;
  160. -webkit-border-radius: 7px;
  161. border-radius: 30rpx;
  162. display: flex;
  163. align-items: center;
  164. justify-content: center;
  165. font-size: 30rpx;
  166. height: 60rpx;
  167. margin-right: 20rpx;
  168. background: #F84469;
  169. }
  170. .app-icon {
  171. background-image: url("../../../static/image/icon/arrow-right-white.png");
  172. width: #{12rpx};
  173. height: #{22rpx};
  174. background-repeat: no-repeat;
  175. background-size: cover;
  176. margin-left: 10rpx;
  177. }
  178. .app-link-title {
  179. flex-grow: 1;
  180. width: 100%;
  181. padding: 0 24rpx;
  182. .app-title-line {
  183. width: 82rpx;
  184. height: 5rpx;
  185. margin: 0 20rpx;
  186. }
  187. .app-title-line.star {
  188. width: 28rpx;
  189. height: 20rpx;
  190. .top-icon {
  191. width: 28rpx;
  192. height: 4rpx;
  193. margin-bottom: 12rpx;
  194. }
  195. .bottom-icon {
  196. width: 28rpx;
  197. height: 4rpx;
  198. }
  199. }
  200. .app-title-line.div {
  201. width: 8rpx;
  202. height: 28rpx;
  203. margin: 0 10rpx 0 0;
  204. }
  205. .app-title-line.radius {
  206. width: 28rpx;
  207. margin: 0 10rpx 0 0;
  208. border-radius: 14rpx;
  209. border: 2rpx solid #353535;
  210. height: 28rpx;
  211. }
  212. }
  213. .big-style {
  214. height: 65rpx;
  215. line-height: 65rpx;
  216. font-size: 32rpx;
  217. width: 100%;
  218. // padding-right: 48rpx;
  219. .app-title-icon {
  220. width: 65rpx;
  221. height: 65rpx;
  222. margin-right: 16rpx;
  223. vertical-align: top;
  224. }
  225. }
  226. .medium-style {
  227. height: 36rpx;
  228. line-height: 36rpx;
  229. font-size: 28rpx;
  230. width: 100%;
  231. padding-right: 48rpx;
  232. .app-title-icon {
  233. width: 36rpx;
  234. height: 36rpx;
  235. margin-right: 16rpx;
  236. vertical-align: top;
  237. }
  238. }
  239. .small-style {
  240. height: 28rpx;
  241. line-height: 28rpx;
  242. font-size: 24rpx;
  243. width: 100%;
  244. padding-right: 48rpx;
  245. .app-title-icon {
  246. width: 28rpx;
  247. height: 28rpx;
  248. margin-right: 16rpx;
  249. vertical-align: top;
  250. }
  251. }
  252. }
  253. </style>