goods-instrument.vue 6.4 KB

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