app-associated-link.vue 7.1 KB

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