app-associated-link.vue 6.9 KB

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