goods-instrument.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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="linkId == 6" :style="{paddingBottom :isIphoneX ? '68rpx' : '34rpx'}">
  6. <view class="btn" @click="NavToH5Page">超皮秒防伪查询</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. }
  57. },
  58. onLoad(option) {
  59. console.log(option)
  60. let _self = this
  61. this.linkId = option.linkId
  62. this.linkTitle = option.title
  63. uni.setNavigationBarTitle({title:_self.linkTitle});
  64. this.GetPageTopicInfo()
  65. },
  66. methods:{
  67. GetPageTopicInfo(){//获取数据
  68. this.ProductService.GetPageTopic({type:this.linkId}).then(response =>{
  69. let data = response.data
  70. this.list = data
  71. this.GetPageTopicBanner()
  72. this.skeletonShow = false
  73. }).catch(error =>{
  74. this.$util.msg(error.msg,2000)
  75. })
  76. },
  77. GetPageTopicBanner(){//获取banner
  78. this.ProductService.GetPageTopicBanner({type:this.linkId}).then(response =>{
  79. let data = response.data
  80. this.banner = data.image
  81. this.content = data.content
  82. }).catch(error =>{
  83. this.$util.msg(error.msg,2000)
  84. })
  85. },
  86. NavToDetailPage(floor) {//跳转
  87. console.log(floor)
  88. /**
  89. * 页面跳转类型
  90. * 1、二级页面,2、搜索项目仪器,3、直播页面,4、自由页面,5、商品详情,6、仪器项目详情,7、供应商主页
  91. * 8、专题活动页,9、二手市场介绍,10、二手商品列表,11、二手商品发布,12、商品搜索,13、信息详情
  92. * 14、品牌招商介绍页,15、维修保养介绍页,16、首页,17、注册页,18、信息中心,19、供应商列表
  93. **/
  94. if(floor.linkType){
  95. const typeMap = {
  96. 1:`/pages/goods/goods-instrument?linkId=${floor.linkParam.id}&title=${floor.title}`,
  97. 2:`/pages/search/search-instrument?keyword=${floor.title}`,
  98. 5:`/pages/goods/product?id=${floor.linkParam.id}`,
  99. 6:`/pages/goods/instrument-details?id=${floor.linkParam.id}`,
  100. 7:`/supplier/pages/user/my-shop?shopId=${floor.linkParam.id}`,
  101. 8:`/h5/pages/activity/activity-list`,
  102. 9:`/second/pages/form/introduce`,
  103. 10:`/second/pages/product/product-list`,
  104. 11:`/second/pages/form/form`,
  105. 12:`/pages/search/search?keyWord=${floor.title}`,
  106. 13:`/h5/pages/article/page?link=${floor.link}`,
  107. 14:`/h5/pages/article/page?link=${floor.link}`,
  108. 15:`/h5/pages/article/page?link=${floor.link}`,
  109. 17:`/pages/login/register-select`,
  110. 18:`/h5/pages/article/page?link=${floor.link}`,
  111. 19:`/pages/search/search-supplier?keyWord=${floor.title}`
  112. }
  113. const url = typeMap[floor.linkType];
  114. this.$api.navigateTo(url)
  115. }
  116. },
  117. NavToH5Page() {//跳转H5超皮秒防伪查询
  118. this.$api.navigateTo(`/h5/pages/article/page?linkType=100`)
  119. }
  120. },
  121. onPageScroll(e){//实时获取到滚动的值
  122. if(e.scrollTop>600){
  123. this.isScrollTop = true
  124. }else{
  125. this.isScrollTop = false
  126. }
  127. },
  128. onShow() {
  129. }
  130. }
  131. </script>
  132. <style lang="scss">
  133. page{
  134. background-color: #F7F7F7;
  135. }
  136. .instrument{
  137. width: 100%;
  138. height: auto;
  139. .banner{
  140. box-sizing: border-box;
  141. padding:24rpx;
  142. background-color: #FFFFFF;
  143. width: 100%;
  144. .banner-image{
  145. width: 100%;
  146. height: 248rpx;
  147. border-radius: 4rpx;
  148. float: left;
  149. image{
  150. width: 100%;
  151. height: 248rpx;
  152. border-radius: 4rpx;
  153. }
  154. }
  155. .content{
  156. width: 100%;
  157. margin-top: 10rpx;
  158. float: left;
  159. box-sizing: border-box;
  160. background-color: #FFFFFF;
  161. font-size: $font-size-26;
  162. color: #666666;
  163. text-align: justify;
  164. line-height: 36rpx;
  165. }
  166. }
  167. .instrument-btn{
  168. width: 100%;
  169. box-sizing: border-box;
  170. padding: 7rpx 24rpx;
  171. background-color: #FFFFFF;
  172. position: fixed;
  173. bottom: 0;
  174. left: 0;
  175. z-index: 999;
  176. .btn{
  177. width: 100%;
  178. height: 100%;
  179. background-image: $btn-confirm;
  180. line-height: 84rpx;
  181. border-radius: 42rpx;
  182. text-align: center;
  183. font-size: 26rpx;
  184. color: #FFFFFF;
  185. }
  186. }
  187. .instrument-list{
  188. width: 100%;
  189. height: auto;
  190. box-sizing: border-box;
  191. padding: 0 24rpx;
  192. .list-item-cell{
  193. width: 100%;
  194. height: auto;
  195. float: left;
  196. .list-item-title{
  197. width: 100%;
  198. height: 88rpx;
  199. line-height: 88rpx;
  200. float: left;
  201. .title{
  202. font-size: $font-size-28;
  203. line-height: 80rpx;
  204. color: $text-color;
  205. font-weight: bold;
  206. &.float{
  207. float: left;
  208. }
  209. }
  210. .more{
  211. font-size: $font-size-26;
  212. line-height: 80rpx;
  213. color: #999999;
  214. height: 80rpx;
  215. float: right;
  216. .icon-xiangyou{
  217. font-size: $font-size-28;
  218. margin-left: 10rpx;
  219. }
  220. }
  221. }
  222. .list-item-pros{
  223. width: 100%;
  224. height: auto;
  225. float: left;
  226. .item-pros{
  227. width: 340rpx;
  228. height: 414rpx;
  229. float: left;
  230. margin-right: 20rpx;
  231. margin-bottom: 20rpx;
  232. background-color: #FFFFFF;
  233. border-radius: 4rpx;
  234. &:nth-child(2n){
  235. margin-right: 0;
  236. }
  237. .item-pros-image{
  238. width: 340rpx;
  239. height: 340rpx;
  240. float: left;
  241. image{
  242. width: 340rpx;
  243. height: 340rpx;
  244. display: block;
  245. border-radius: 4rpx 4rpx 0 0;
  246. }
  247. }
  248. .item-pros-name{
  249. width: 100%;
  250. height: 74rpx;
  251. line-height: 74rpx;
  252. box-sizing: border-box;
  253. padding: 0 24rpx;
  254. white-space: normal;
  255. word-break: break-all;
  256. overflow: hidden;
  257. text-overflow: ellipsis;
  258. display: -webkit-box;
  259. -webkit-box-orient: vertical;
  260. -webkit-line-clamp: 1;
  261. text-align: center;
  262. font-size: $font-size-26;
  263. line-height: 74rpx;
  264. text-align: center;
  265. }
  266. }
  267. }
  268. }
  269. }
  270. }
  271. </style>