discovery.vue 7.0 KB

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