discovery.vue 7.1 KB

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