index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <template>
  2. <view style="background-color: #f7f7f7;">
  3. <view class="discovery tn-safe-area-inset-bottom" >
  4. <tn-nav-bar customBack>
  5. <view slot="back" class='tn-custom-nav-bar__back' >
  6. <image style="width: 30px;height: 28px;margin-left:4px" @click="reFetchData()" src="../../static/logo.png"></image>
  7. </view>
  8. <view slot="default" style="display: flex;">
  9. <view style="flex:1;">
  10. <text :style="{fontSize:(wxFontSize)+'px'}">速立保</text>
  11. </view>
  12. </view>
  13. </tn-nav-bar>
  14. <view :style="{paddingTop: vuex_custom_bar_height + 'px'}" >
  15. <view style="width: 100%;padding-bottom: 0;background-color: #fff;">
  16. <view style="display: flex;width: 100%;">
  17. <view style="flex:1; margin:16px; text-align: center;border-radius: 47px;" class="bg-slogan">
  18. <text style="margin-top:12px;color:#fff;font-size:17px;margin: 16px;font-weight: 600;" :style="{fontSize:(fontSize)+'px'}">生物制药产业国际产品供需平台</text>
  19. </view>
  20. </view>
  21. </view>
  22. <view style="padding: 16px;color:#333;font-weight: 600;" :style="{fontSize:(fontSize-1)+'px'}">
  23. 优质入驻企业
  24. </view>
  25. <swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" v-if="!hideComps">
  26. <swiper-item v-for="(item,index) of companyList" :key="item.id" style="position:relative">
  27. <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>
  28. <image :src="item.picUrl?item.picUrl:'../../static/tu/needbg.png'" @click="showImgs(index,companyList)" mode="aspectFill" style="width: 100%;height: 100%;"></image>
  29. </swiper-item>
  30. </swiper>
  31. <view v-if="hideComps" style="height: 200px;display: flex;align-items: center;justify-content: center;color: #2196f36e;">
  32. <text @click="showComps()">〈恢复展示〉</text>
  33. </view>
  34. <view style="padding: 16px;color:#333;font-weight: 600;" :style="{fontSize:(fontSize-1)+'px'}">
  35. 优质供应
  36. </view>
  37. <swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" v-if="!hideProds">
  38. <swiper-item v-for="(item,index) of prodList" :key="item.id">
  39. <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>
  40. <image :src="item.picUrl?item.picUrl:'../../static/tu/needbg.png'" @click="showImgs(index,prodList)" style="width: 100%;height: 100%;" mode="aspectFill"></image>
  41. </swiper-item>
  42. </swiper>
  43. <view v-if="hideProds" style="height: 200px;display: flex;align-items: center;justify-content: center;color: #2196f36e;">
  44. <text @click="showProds()">〈恢复展示〉</text>
  45. </view>
  46. <!-- <image style="width: 180px;height: 150px" src="../../static/logo.png"></image>
  47. <view style="margin-top:24px"><text style="font-size:30px;">生物制药产业</text></view>
  48. <view><text style="font-size:30px">国际产品展示中心</text></view>
  49. <view style="margin-top:24px"><text style="font-size:20px;">生物制药产业国际产品供需平台</text></view> -->
  50. <view style="display: flex;margin-top:32px;margin: 24px 16px;">
  51. <view style="flex: 1;padding: 0 0 0 16px;" class="bg01" @click="showAdd">
  52. <image src="../../static/tu/needi.png" style="width: 36px;height: 36px; vertical-align: middle;margin-top: -6px;margin-right: 8px;"></image>
  53. <text style="line-height: 72px;font-size: 18px;font-weight: 600;" :style="{fontSize:(fontSize+1)+'px'}">我要什么</text>
  54. </view>
  55. <view style="flex: 1;padding: 0 0 0 16px;" class="bg02" @click="showAdd2">
  56. <image src="../../static/tu/sharei.png" style="width: 36px;height: 36px; vertical-align: middle;margin-top: -6px;margin-right: 8px;"></image>
  57. <text style="line-height: 72px;font-size: 18px;font-weight: 600;" :style="{fontSize:(fontSize+1)+'px'}">我有什么</text>
  58. </view>
  59. </view>
  60. <view class='tn-tabbar-height'></view>
  61. </view>
  62. <Auth ref="authRef"></Auth>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. import Auth from '../index/autoLogin.vue'
  68. import Home from '../home/home.vue'
  69. import Comm from '../comm/comm.vue'
  70. import Discovery from '../discovery/discovery.vue'
  71. import Mine from '../mine/mine.vue'
  72. import request from '../../utils/request'
  73. export default {
  74. components: {
  75. Auth,
  76. Home,
  77. Comm,
  78. Discovery,
  79. Mine
  80. },
  81. data() {
  82. return {
  83. indicatorDots: true,
  84. autoplay: false,
  85. companyList:[],
  86. prodList:[],
  87. hideComps: false,
  88. hideProds: false,
  89. fontSize:17
  90. }
  91. },
  92. onReady() {
  93. const appBaseInfo = wx.getAppBaseInfo();
  94. this.fontSize = uni.getStorageSync('fontSize')||appBaseInfo.fontSizeSetting||17;
  95. },
  96. onShow(options){
  97. if(uni.getStorageSync('nextPage')&&uni.getStorageSync('userNo')){
  98. let nextPage = uni.getStorageSync('nextPage')
  99. uni.removeStorageSync('nextPage');
  100. uni.navigateTo({
  101. url: nextPage
  102. })
  103. }else{
  104. uni.removeStorageSync('nextPage')
  105. }
  106. if (wx.canIUse('getUpdateManager')) {
  107. const updateManager = wx.getUpdateManager();
  108. updateManager && updateManager.onCheckForUpdate((res) => {
  109. if (res.hasUpdate) {
  110. updateManager.onUpdateReady(() => {
  111. uni.showModal({
  112. title: '更新提示',
  113. content: '新版本已经准备好,是否重启应用?',
  114. success: (res) => {
  115. if (res.confirm) {
  116. uni.clearStorageSync() // 更新完成后刷新storage的数据
  117. updateManager.applyUpdate()
  118. }
  119. }
  120. })
  121. })
  122. updateManager.onUpdateFailed(() => {
  123. uni.reLaunch({
  124. url:'/pages/index/index'
  125. })
  126. })
  127. } else {
  128. //没有更新
  129. }
  130. })
  131. }
  132. this.$nextTick(() => {
  133. this.loadData()
  134. this.loadData2()
  135. })
  136. },
  137. methods: {
  138. //关闭banner1
  139. closeComps(){
  140. this.hideComps = true;
  141. },
  142. //关闭banner2
  143. closeProds(){
  144. this.hideProds = true;
  145. },
  146. //显示banner2
  147. showProds(){
  148. this.hideProds = false;
  149. },
  150. //显示banner1
  151. showComps(){
  152. this.hideComps = false;
  153. },
  154. fetchData(){
  155. this.loadData()
  156. this.loadData2()
  157. },
  158. loadData() {
  159. let that = this;
  160. request.post('/slbTopad/premiumCompanies', {
  161. }).then(res => {
  162. if (res&&res.success) {
  163. let dataList = res.list||[];
  164. let newList = [];
  165. for(let i=0;i<dataList.length;i++){
  166. if(dataList[i].showFlag=='是'){
  167. newList.push(dataList[i]);
  168. }
  169. }
  170. that.companyList = newList;
  171. }
  172. })
  173. },
  174. loadData2() {
  175. let that = this;
  176. request.post('/slbTopad/premiumShareCompanies', {
  177. }).then(res => {
  178. if (res&&res.success) {
  179. let dataList = res.list||[];
  180. let newList = [];
  181. for(let i=0;i<dataList.length;i++){
  182. if(dataList[i].showFlag=='是'){
  183. newList.push(dataList[i]);
  184. }
  185. }
  186. that.prodList = newList;
  187. }
  188. })
  189. },
  190. showImgs(index, list){
  191. let urls = [];
  192. for(let i=0;i<list.length;i++){
  193. urls.push(list[i].picUrl);
  194. }
  195. // 预览图片
  196. uni.previewImage({
  197. urls: urls,
  198. current: index,
  199. });
  200. },
  201. showAdd(){
  202. if(uni.getStorageSync('userNo')){
  203. uni.navigateTo({
  204. url:'/circlePages/circle'
  205. })
  206. }else{
  207. uni.setStorageSync('nextPage','/circlePages/circle');
  208. uni.navigateTo({
  209. url:'/pages/login/login'
  210. })
  211. }
  212. },
  213. showAdd2(){
  214. if(uni.getStorageSync('userNo')){
  215. uni.navigateTo({
  216. url:'/circlePages/addShare'
  217. })
  218. }else{
  219. uni.setStorageSync('nextPage','/circlePages/addShare');
  220. uni.navigateTo({
  221. url:'/pages/login/login'
  222. })
  223. }
  224. }
  225. }
  226. }
  227. </script>
  228. <style lang="scss" scoped>
  229. .swiper-item {
  230. text-align: center;
  231. }
  232. .swiper{
  233. height: 200px;
  234. }
  235. .bg01{
  236. color: #fff;
  237. background-image: url(./../../static/tu/needbg.png);
  238. background-size: cover;
  239. height: 72px;
  240. border-radius: 20px;
  241. margin-right: 16px;
  242. }
  243. .bg02{
  244. color: #fff;
  245. background-image: url(./../../static/tu/sharebg.png);
  246. background-size: cover;
  247. height: 72px;
  248. border-radius: 20px;
  249. }
  250. .bg-slogan{
  251. color: #fff;
  252. background-image: url(./../../static/tu/slogan-min.png);
  253. background-size: cover;
  254. line-height: 40px;
  255. background-repeat: no-repeat;
  256. }
  257. /* 底部安全边距 start*/
  258. .tn-tabbar-height {
  259. min-height: 120rpx;
  260. height: calc(140rpx + env(safe-area-inset-bottom) / 2);
  261. height: calc(140rpx + constant(safe-area-inset-bottom));
  262. }
  263. </style>