discovery.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view class="discovery tn-safe-area-inset-bottom" style="max-height: 100vh">
  3. <view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
  4. <view style="width: 100%;padding-bottom: 0;">
  5. <view style="display: flex;width: 100%;background: linear-gradient(0deg, #fff, #f8f8f">
  6. <view style="margin:16px">
  7. <image style="width: 56px; height: 50px; margin-right: 12px;" :mode="fit"
  8. src="../../static/logo.png"></image>
  9. </view>
  10. <view style="margin:16px 0;margin-left: -8px;">
  11. <view style="font-weight: bold;font-size: 22px;">速立保</view>
  12. <text style="margin-top:12px;color:#888;font-size:15px">生物制药产业一站式产品资源供需平台</text>
  13. </view>
  14. </view>
  15. </view>
  16. <view style="padding: 0px 0 4px 16px;font-weight: bold;">
  17. 优质入驻企业 ▼
  18. </view>
  19. <swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" >
  20. <swiper-item v-for="(item,index) of companyList" :key="item.id" style="position:relative">
  21. <!-- <view style="position: absolute;bottom: 28px;right: 16px;color: #ffffff75;" class="swiper-item uni-bg-red">{{item.company}}</view> -->
  22. <image :src="item.picUrl?item.picUrl:'../../static/bg.png'" @click="showImgs(index,companyList)" mode="aspectFill" style="width: 100%;height: 100%;"></image>
  23. </swiper-item>
  24. </swiper>
  25. <view style="padding: 16px 0 4px 16px;font-weight: bold;">
  26. 优质供应 ▼
  27. </view>
  28. <swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" >
  29. <swiper-item v-for="(item,index) of prodList" :key="item.id">
  30. <!-- <view style="position: absolute;bottom: 28px;right: 16px;color: #ffffff75;" class="swiper-item uni-bg-red">{{item.company}}</view> -->
  31. <image :src="item.picUrl?item.picUrl:'../../static/bg.png'" @click="showImgs(index,prodList)" style="width: 100%;height: 100%;" mode="aspectFill"></image>
  32. </swiper-item>
  33. </swiper>
  34. <!-- <image style="width: 180px;height: 150px" src="../../static/logo.png"></image>
  35. <view style="margin-top:24px"><text style="font-size:30px;">生物制药产业</text></view>
  36. <view><text style="font-size:30px">国际产品展示中心</text></view>
  37. <view style="margin-top:24px"><text style="font-size:20px;">生物制药产业一站式产品资源供需平台</text></view> -->
  38. <view style="display: flex;margin-top:32px;margin: 24px;">
  39. <view style="flex: 1;padding: 0 16px;" class="bg01" @click="showAdd">
  40. <text style="font-size: 32px;margin-right: 10px;vertical-align: sub;" class="tn-icon-email-fill" ></text>
  41. <text style="line-height: 72px;font-size: 18px;">我要什么</text>
  42. </view>
  43. <view style="flex: 1;padding: 0 16px;" class="bg02" @click="showAdd2">
  44. <text style="font-size: 32px;margin-right: 10px;vertical-align: sub;" class="tn-icon-paperbag-fill" ></text>
  45. <text style="line-height: 72px;font-size: 18px;">我有什么</text>
  46. </view>
  47. </view>
  48. <view class='tn-tabbar-height'></view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import request from '../../utils/request'
  54. export default {
  55. data() {
  56. return {
  57. indicatorDots: true,
  58. autoplay: false,
  59. companyList:[],
  60. prodList:[]
  61. }
  62. },
  63. onLoad(){
  64. this.loadData();
  65. },
  66. onReady() {
  67. this.$nextTick(() => {
  68. this.loadData()
  69. this.loadData2()
  70. })
  71. },
  72. methods: {
  73. fetchData(){
  74. this.loadData()
  75. this.loadData2()
  76. },
  77. loadData() {
  78. let that = this;
  79. request.post('/slbTopad/premiumCompanies', {
  80. }).then(res => {
  81. if (res&&res.success) {
  82. let dataList = res.list||[];
  83. let newList = [];
  84. for(let i=0;i<dataList.length;i++){
  85. if(dataList[i].showFlag=='是'){
  86. newList.push(dataList[i]);
  87. }
  88. }
  89. that.companyList = newList;
  90. }
  91. })
  92. },
  93. loadData2() {
  94. let that = this;
  95. request.post('/slbTopad/premiumShareCompanies', {
  96. }).then(res => {
  97. if (res&&res.success) {
  98. let dataList = res.list||[];
  99. let newList = [];
  100. for(let i=0;i<dataList.length;i++){
  101. if(dataList[i].showFlag=='是'){
  102. newList.push(dataList[i]);
  103. }
  104. }
  105. that.prodList = newList;
  106. }
  107. })
  108. },
  109. showImgs(index, list){
  110. let urls = [];
  111. for(let i=0;i<list.length;i++){
  112. urls.push(list[i].picUrl);
  113. }
  114. // 预览图片
  115. uni.previewImage({
  116. urls: urls,
  117. current: index,
  118. });
  119. },
  120. showAdd(){
  121. if(uni.getStorageSync('userNo')){
  122. uni.navigateTo({
  123. url:'/circlePages/circle'
  124. })
  125. }else{
  126. uni.navigateTo({
  127. url:'/pages/login/login'
  128. })
  129. }
  130. },
  131. showAdd2(){
  132. if(uni.getStorageSync('userNo')){
  133. uni.navigateTo({
  134. url:'/circlePages/addShare'
  135. })
  136. }else{
  137. uni.navigateTo({
  138. url:'/pages/login/login'
  139. })
  140. }
  141. }
  142. }
  143. }
  144. </script>
  145. <style>
  146. .swiper-item {
  147. text-align: center;
  148. }
  149. .swiper{
  150. height: 200px;
  151. }
  152. .bg01{
  153. color: #fff;
  154. background-image: url(./../../static/bg01.png);
  155. background-size: cover;
  156. height: 72px;
  157. border-radius: 20px;
  158. margin-right: 16px;
  159. }
  160. .bg02{
  161. color: #fff;
  162. background-image: url(./../../static/bg02.png);
  163. background-size: cover;
  164. height: 72px;
  165. border-radius: 20px;
  166. }
  167. /* 底部安全边距 start*/
  168. .tn-tabbar-height {
  169. min-height: 120rpx;
  170. height: calc(140rpx + env(safe-area-inset-bottom) / 2);
  171. height: calc(140rpx + constant(safe-area-inset-bottom));
  172. }
  173. </style>