discovery.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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" 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;">
  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 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;">我要什么</text>
  51. </view>
  52. <view style="flex: 1;padding: 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;">我有什么</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. }
  73. },
  74. onLoad(){
  75. this.loadData();
  76. },
  77. onReady() {
  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.navigateTo({
  154. url:'/pages/login/login'
  155. })
  156. }
  157. },
  158. showAdd2(){
  159. if(uni.getStorageSync('userNo')){
  160. uni.navigateTo({
  161. url:'/circlePages/addShare'
  162. })
  163. }else{
  164. uni.navigateTo({
  165. url:'/pages/login/login'
  166. })
  167. }
  168. }
  169. }
  170. }
  171. </script>
  172. <style>
  173. .swiper-item {
  174. text-align: center;
  175. }
  176. .swiper{
  177. height: 200px;
  178. }
  179. .bg01{
  180. color: #fff;
  181. background-image: url(./../../static/bg01.png);
  182. background-size: cover;
  183. height: 72px;
  184. border-radius: 20px;
  185. margin-right: 16px;
  186. }
  187. .bg02{
  188. color: #fff;
  189. background-image: url(./../../static/bg02.png);
  190. background-size: cover;
  191. height: 72px;
  192. border-radius: 20px;
  193. }
  194. /* 底部安全边距 start*/
  195. .tn-tabbar-height {
  196. min-height: 120rpx;
  197. height: calc(140rpx + env(safe-area-inset-bottom) / 2);
  198. height: calc(140rpx + constant(safe-area-inset-bottom));
  199. }
  200. </style>