goods-instrument.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <view class="container instrument clearfix">
  3. <tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading ="true" :loadingType="5"></tui-skeleton>
  4. <template v-else>
  5. <view class="instrument-btn" v-if="buttonName" :style="{paddingBottom :isIphoneX ? '68rpx' : '34rpx'}">
  6. <view class="btn" @click="ButtonNavigateTo(buttonLinkType,buttonLinkParam.id,buttonLink,buttonLinkKeyword)">{{ buttonName }}</view>
  7. </view>
  8. <view class="banner clearfix">
  9. <view class="banner-image">
  10. <image :src="banner" mode=""></image>
  11. </view>
  12. <view class=content v-if="linkId == 6">
  13. <text>{{ content }}</text>
  14. </view>
  15. </view>
  16. <view class="instrument-list clearfix" :style="{paddingBottom :isIphoneX ? '83px' : '34px'}">
  17. <view class="list-item-cell" v-for="(item,index) in list" :key="index">
  18. <view class="list-item-title">
  19. <view class="title" :class="item.link ? 'float' : ''">
  20. <text>{{ item.title }}</text>
  21. </view>
  22. <view class="more" v-if="item.link" @click="NavToDetailPage(item)">
  23. <text>查看更多</text>
  24. <text class="iconfont icon-xiangyou"></text>
  25. </view>
  26. </view>
  27. <view class="list-item-pros">
  28. <view class="item-pros" v-for="(pros,prosIndex) in item.floorData" :key="prosIndex" @click="NavToDetailPage(pros)">
  29. <view class="item-pros-image">
  30. <image :src="pros.image" mode=""></image>
  31. </view>
  32. <view class="item-pros-name">{{ pros.title }}</view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <!-- 侧边 -->
  39. <scroll-top :isScrollTop="isScrollTop" :bottom="200"></scroll-top>
  40. </view>
  41. </template>
  42. <script>
  43. export default{
  44. components:{
  45. },
  46. data(){
  47. return{
  48. isIphoneX:this.$store.state.isIphoneX,
  49. banner:'',
  50. list:[],
  51. linkId:0,
  52. isScrollTop:false,
  53. linkTitle:'',
  54. skeletonShow:true,
  55. content:'',
  56. buttonName:'',
  57. buttonLink:'',
  58. buttonLinkType:'',
  59. buttonLinkParam:{},
  60. buttonLinkKeyword:''
  61. }
  62. },
  63. onLoad(option) {
  64. console.log(option)
  65. let _self = this
  66. this.linkId = option.linkId
  67. this.linkTitle = option.title
  68. this.GetPageTopicInfo()
  69. },
  70. methods:{
  71. GetPageTopicInfo(){//获取数据
  72. this.ProductService.GetPageTopic({pageId:this.linkId, source:2}).then(response =>{
  73. let { floorList, page } = response.data
  74. this.list = floorList
  75. this.banner = page.image
  76. this.content = page.content
  77. this.buttonLink = page.buttonLink
  78. this.buttonName = page.buttonName
  79. this.buttonLinkType = page.linkType
  80. this.buttonLinkParam = page.linkParam
  81. this.buttonLinkKeyword = page.keywords
  82. uni.setNavigationBarTitle({title:page.title})
  83. uni.setStorageSync('pageLabel',`${page.contentLabel}`)
  84. this.skeletonShow = false
  85. }).catch(error =>{
  86. this.$util.msg(error.msg,2000)
  87. })
  88. },
  89. NavToDetailPage(pros) {//跳转
  90. if(pros.linkType){
  91. const typeMap = {
  92. 1:`/pages/goods/goods-instrument?linkId=${pros.linkParam.id}&title=${pros.title}`,
  93. 2:`/pages/goods/instrument-details?id=${pros.linkParam.id}`,
  94. 4:`/pages/h5/activity/activity?title=${pros.crmTitle}&link=${pros.crmLink}`,
  95. 5:`/pages/goods/product?id=${pros.linkParam.id}`,
  96. // 7:`/pages/supplier/user/my-shop?shopId=${pros.linkParam.id}`,
  97. 8:'/pages/h5/activity/activity-list',
  98. 9:'/pages/second/form/introduce',
  99. 10:'/pages/second/product/product-list',
  100. 11:'/pages/second/form/form',
  101. 12:`/pages/search/search?keyWord=${pros.linkParam.keyword}`,
  102. 13:`/pages/h5/article/path?link=${pros.link}`,
  103. 14:`/pages/h5/article/path?link=${pros.link}`,
  104. 15:`/pages/h5/article/path?link=${pros.link}`,
  105. 17:'/pages/login/register-select',
  106. 18:`/pages/h5/article/path?link=${pros.link}`,
  107. 19:`/pages/search/search-supplier?keyWord=${pros.linkParam.keyword}`
  108. }
  109. const url = typeMap[pros.linkType]
  110. uni.navigateTo({
  111. url:url
  112. })
  113. }
  114. },
  115. ButtonNavigateTo(linkType,linkId,linkHref,keyword) {//跳转
  116. this.$api.BannerNavigateTo(linkType,linkId,linkHref,keyword)
  117. }
  118. },
  119. onPageScroll(e){//实时获取到滚动的值
  120. if(e.scrollTop>600){
  121. this.isScrollTop = true
  122. }else{
  123. this.isScrollTop = false
  124. }
  125. },
  126. onShow() {
  127. }
  128. }
  129. </script>
  130. <style lang="scss">
  131. page{
  132. background-color: #F7F7F7;
  133. }
  134. .instrument{
  135. width: 100%;
  136. height: auto;
  137. .banner{
  138. box-sizing: border-box;
  139. padding:24rpx;
  140. width: 100%;
  141. .banner-image{
  142. width: 100%;
  143. height: 248rpx;
  144. border-radius: 16rpx;
  145. float: left;
  146. image{
  147. width: 100%;
  148. height: 248rpx;
  149. border-radius: 16rpx;
  150. }
  151. }
  152. .content{
  153. width: 100%;
  154. margin-top: 10rpx;
  155. float: left;
  156. box-sizing: border-box;
  157. background-color: #FFFFFF;
  158. font-size: $font-size-26;
  159. color: #666666;
  160. text-align: justify;
  161. line-height: 36rpx;
  162. }
  163. }
  164. .instrument-btn{
  165. width: 100%;
  166. box-sizing: border-box;
  167. padding: 7rpx 24rpx;
  168. background-color: #FFFFFF;
  169. position: fixed;
  170. bottom: 0;
  171. left: 0;
  172. z-index: 999;
  173. .btn{
  174. width: 100%;
  175. height: 100%;
  176. background-image: $btn-confirm;
  177. line-height: 84rpx;
  178. border-radius: 42rpx;
  179. text-align: center;
  180. font-size: 26rpx;
  181. color: #FFFFFF;
  182. }
  183. }
  184. .instrument-list{
  185. width: 100%;
  186. height: auto;
  187. box-sizing: border-box;
  188. padding: 0 24rpx;
  189. .list-item-cell{
  190. width: 100%;
  191. height: auto;
  192. float: left;
  193. .list-item-title{
  194. width: 100%;
  195. height: 88rpx;
  196. line-height: 88rpx;
  197. float: left;
  198. .title{
  199. font-size: $font-size-28;
  200. line-height: 80rpx;
  201. color: $text-color;
  202. font-weight: bold;
  203. &.float{
  204. float: left;
  205. }
  206. }
  207. .more{
  208. font-size: $font-size-26;
  209. line-height: 80rpx;
  210. color: #999999;
  211. height: 80rpx;
  212. float: right;
  213. .icon-xiangyou{
  214. font-size: $font-size-28;
  215. margin-left: 10rpx;
  216. }
  217. }
  218. }
  219. .list-item-pros{
  220. width: 100%;
  221. height: auto;
  222. float: left;
  223. .item-pros{
  224. width: 340rpx;
  225. height: 414rpx;
  226. float: left;
  227. margin-right: 20rpx;
  228. margin-bottom: 20rpx;
  229. background-color: #FFFFFF;
  230. border-radius: 16rpx;
  231. &:nth-child(2n){
  232. margin-right: 0;
  233. }
  234. .item-pros-image{
  235. width: 340rpx;
  236. height: 340rpx;
  237. float: left;
  238. image{
  239. width: 340rpx;
  240. height: 340rpx;
  241. display: block;
  242. border-radius: 16rpx 16rpx 0 0;
  243. }
  244. }
  245. .item-pros-name{
  246. width: 100%;
  247. height: 74rpx;
  248. line-height: 74rpx;
  249. box-sizing: border-box;
  250. padding: 0 24rpx;
  251. white-space: normal;
  252. word-break: break-all;
  253. overflow: hidden;
  254. text-overflow: ellipsis;
  255. display: -webkit-box;
  256. -webkit-box-orient: vertical;
  257. -webkit-line-clamp: 1;
  258. text-align: center;
  259. font-size: $font-size-26;
  260. line-height: 74rpx;
  261. text-align: center;
  262. }
  263. }
  264. }
  265. }
  266. }
  267. }
  268. </style>