goods-instrument.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view class="container instrument">
  3. <tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading ="true" :loadingType="5"></tui-skeleton>
  4. <template v-else>
  5. <view class="banner">
  6. <view class="banner-image">
  7. <image :src="banner" mode=""></image>
  8. </view>
  9. </view>
  10. <view class="instrument-list">
  11. <view class="list-item-cell" v-for="(item,index) in list" :key="index">
  12. <view class="list-item-title">
  13. <view class="title" :class="item.link ? 'float' : ''">
  14. <text>{{ item.title }}</text>
  15. </view>
  16. <view class="more" v-if="item.link" @click="NavToDetailPage(item)">
  17. <text>查看更多</text>
  18. <text class="iconfont icon-xiangyou"></text>
  19. </view>
  20. </view>
  21. <view class="list-item-pros">
  22. <view class="item-pros" v-for="(pros,prosIndex) in item.floorData" :key="prosIndex" @click="NavToDetailPage(pros)">
  23. <view class="item-pros-image">
  24. <image :src="pros.image" mode=""></image>
  25. </view>
  26. <view class="item-pros-name">{{ pros.title }}</view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <!-- 侧边 -->
  33. <scroll-top :isScrollTop="isScrollTop"></scroll-top>
  34. </view>
  35. </template>
  36. <script>
  37. export default{
  38. components:{
  39. },
  40. data(){
  41. return{
  42. banner:'',
  43. list:[],
  44. linkId:0,
  45. isScrollTop:false,
  46. linkTitle:'',
  47. skeletonShow:true
  48. }
  49. },
  50. onLoad(option) {
  51. console.log(option)
  52. let _self = this
  53. this.linkId = option.linkId
  54. this.linkTitle = option.title
  55. uni.setNavigationBarTitle({title:_self.linkTitle});
  56. this.GetPageTopicInfo()
  57. },
  58. methods:{
  59. GetPageTopicInfo(){//获取数据
  60. this.ProductService.GetPageTopic({type:this.linkId}).then(response =>{
  61. let data = response.data
  62. this.list = data
  63. this.GetPageTopicBanner()
  64. this.skeletonShow = false
  65. }).catch(error =>{
  66. this.$util.msg(error.msg,2000)
  67. })
  68. },
  69. GetPageTopicBanner(){//获取banner
  70. this.ProductService.GetPageTopicBanner({type:this.linkId}).then(response =>{
  71. let data = response.data
  72. this.banner = data.image
  73. }).catch(error =>{
  74. this.$util.msg(error.msg,2000)
  75. })
  76. },
  77. NavToDetailPage(floor) {//跳转
  78. console.log(floor)
  79. /**
  80. * 页面跳转类型
  81. * 1、二级页面,2、搜索项目仪器,3、直播页面,4、自由页面,5、商品详情,6、仪器项目详情,7、供应商主页
  82. * 8、专题活动页,9、二手市场介绍,10、二手商品列表,11、二手商品发布,12、商品搜索,13、信息详情
  83. * 14、品牌招商介绍页,15、维修保养介绍页,16、首页,17、注册页,18、信息中心,19、供应商列表
  84. **/
  85. if(floor.linkType){
  86. const typeMap = {
  87. 1:`/pages/goods/goods-instrument?linkId=${floor.linkParam.id}&title=${floor.title}`,
  88. 2:`/pages/search/search-instrument?keyword=${floor.title}`,
  89. 5:`/pages/goods/product?id=${floor.linkParam.id}`,
  90. 6:`/pages/goods/instrument-details?id=${floor.linkParam.id}`,
  91. 7:`/supplier/pages/user/my-shop?shopId=${floor.linkParam.id}`,
  92. 8:`/h5/pages/activity/activity-list`,
  93. 9:`/second/pages/form/introduce`,
  94. 10:`/second/pages/product/product-list`,
  95. 11:`/second/pages/form/form`,
  96. 12:`/pages/search/search?keyWord=${floor.title}`,
  97. 13:`/h5/pages/article/page?link=${floor.link}`,
  98. 14:`/h5/pages/article/page?link=${floor.link}`,
  99. 15:`/h5/pages/article/page?link=${floor.link}`,
  100. 17:`/pages/login/register-select`,
  101. 18:`/h5/pages/article/page?link=${floor.link}`,
  102. 19:`/pages/search/search-supplier?keyWord=${floor.title}`
  103. }
  104. const url = typeMap[floor.linkType];
  105. this.$api.navigateTo(url)
  106. }
  107. }
  108. },
  109. onPageScroll(e){//实时获取到滚动的值
  110. if(e.scrollTop>600){
  111. this.isScrollTop = true
  112. }else{
  113. this.isScrollTop = false
  114. }
  115. },
  116. onShow() {
  117. }
  118. }
  119. </script>
  120. <style lang="scss">
  121. page{
  122. background-color: #F7F7F7;
  123. }
  124. .instrument{
  125. width: 100%;
  126. height: auto;
  127. .banner{
  128. box-sizing: border-box;
  129. padding:24rpx;
  130. background-color: #FFFFFF;
  131. width: 100%;
  132. .banner-image{
  133. width: 100%;
  134. height: 248rpx;
  135. border-radius: 4rpx;
  136. }
  137. image{
  138. width: 100%;
  139. height: 248rpx;
  140. border-radius: 4rpx;
  141. }
  142. }
  143. .instrument-list{
  144. width: 100%;
  145. height: auto;
  146. box-sizing: border-box;
  147. padding: 0 24rpx;
  148. .list-item-cell{
  149. width: 100%;
  150. height: auto;
  151. float: left;
  152. .list-item-title{
  153. width: 100%;
  154. height: 88rpx;
  155. line-height: 88rpx;
  156. float: left;
  157. .title{
  158. font-size: $font-size-28;
  159. line-height: 80rpx;
  160. color: $text-color;
  161. font-weight: bold;
  162. &.float{
  163. float: left;
  164. }
  165. }
  166. .more{
  167. font-size: $font-size-26;
  168. line-height: 80rpx;
  169. color: #999999;
  170. height: 80rpx;
  171. float: right;
  172. .icon-xiangyou{
  173. font-size: $font-size-28;
  174. margin-left: 10rpx;
  175. }
  176. }
  177. }
  178. .list-item-pros{
  179. width: 100%;
  180. height: auto;
  181. float: left;
  182. .item-pros{
  183. width: 340rpx;
  184. height: 414rpx;
  185. float: left;
  186. margin-right: 20rpx;
  187. margin-bottom: 20rpx;
  188. background-color: #FFFFFF;
  189. border-radius: 4rpx;
  190. &:nth-child(2n){
  191. margin-right: 0;
  192. }
  193. .item-pros-image{
  194. width: 340rpx;
  195. height: 340rpx;
  196. float: left;
  197. image{
  198. width: 340rpx;
  199. height: 340rpx;
  200. display: block;
  201. border-radius: 4rpx 4rpx 0 0;
  202. }
  203. }
  204. .item-pros-name{
  205. width: 100%;
  206. height: 74rpx;
  207. line-height: 74rpx;
  208. box-sizing: border-box;
  209. padding: 0 24rpx;
  210. white-space: normal;
  211. word-break: break-all;
  212. overflow: hidden;
  213. text-overflow: ellipsis;
  214. display: -webkit-box;
  215. -webkit-box-orient: vertical;
  216. -webkit-line-clamp: 1;
  217. text-align: center;
  218. font-size: $font-size-26;
  219. line-height: 74rpx;
  220. text-align: center;
  221. }
  222. }
  223. }
  224. }
  225. }
  226. }
  227. </style>