tremble 6 years ago
parent
commit
3747d7ae6c

+ 8 - 2
app.wxss

@@ -68,19 +68,25 @@ html, body, page {
   top: 25rpx;
   right: 20rpx;
   font-size: 20rpx;
-  border-radius: 15rpx;
+  border-radius: 8rpx;
   font-weight: bold;
 }
 
+.fdkz-card-tag_offline{
+  background: #fff;
+}
+
 .fdkz-card-tag_coming{
   background: #3199ce;
   
 }
 .fdkz-card-tag_finish{
   background: #666;
-  
 }
 
+.fdkz-card-tag_offline .fdkz-card-tag-txt{
+  color: #e02f2f
+}
 .fdkz-card-tag-txt {
   color: #fff;
 }

BIN
imgs/swkz.png


BIN
imgs/swkz_active.png


BIN
imgs/tongcheng.png


BIN
imgs/tongcheng_active.png


BIN
imgs/user.png


BIN
imgs/user_active.png


BIN
imgs/yuezhan.png


BIN
imgs/yuezhan_active.png


+ 3 - 2
pages/tongcheng/index.js

@@ -1,6 +1,6 @@
 //index.js
 //获取应用实例
-const { request, serverName } = require('../../utils/services');
+const { request, serverName,imgServer } = require('../../utils/services');
 const { Toast, qqmapsdk } = require('../../utils/util.js');
 const { defaultImg, noExhibitionImg } = require('../../utils/images');
 const WxParse = require('../../common/component/wxParse/wxParse.js');
@@ -91,7 +91,8 @@ Page({
     this.setData({
       serverName,
       noExhibitionImg,
-      defaultImg
+      defaultImg,
+      imgServer
     })
   },
   onShareAppMessage: function () {

+ 2 - 2
pages/tongcheng/index.wxml

@@ -23,10 +23,10 @@
   </view>
   <navigator hover-class='none' url="{{item.hasProduct&&!item.hasPay?('../yuezhan/pay_page/index?id='+item.id):(item.hasProduct?'../wv_page/index?id='+item.id:'../zl_detail/index?id='+item.id)}}" wx:for="{{exhibitionList}}" wx:key="index" class='fdkz-card'>
     <view class='fdkz-card-img'>
-      <view class="fdkz-card-tag">
+      <view class="fdkz-card-tag fdkz-card-tag_offline">
         <text class='fdkz-card-tag-txt'>{{item.statusText||'常设展'}}</text>
       </view>
-      <image src="{{item.imageUrl||defaultImg}}" mode="aspectFill" class='item-img'></image>
+      <image src="{{imgServer+item.imageUrl||defaultImg}}" mode="aspectFill" class='item-img'></image>
     </view>
     <view class='fdkz-card-info'>
       <view class='fdkz-card-info-title'>

+ 0 - 10
pages/tongcheng/index.wxss

@@ -125,13 +125,3 @@
   height: 100%;
   transition: all ease 0.3s;
 }
-
-
-.fdkz-card-tag{
-  background: #fff;
-  border-radius:10rpx;
-}
-
-.fdkz-card-tag-txt{
-  color: #E02F2F;
-}

+ 116 - 75
pages/yuezhan/index.js

@@ -1,7 +1,16 @@
 //index.js
-const { request, serverName } = require('../../utils/services');
-const { Toast } = require('../../utils/util.js');
-const { defaultImg, noExhibitionImg } = require('../../utils/images');
+const {
+  request,
+  serverName,
+  imgServer
+} = require('../../utils/services');
+const {
+  Toast
+} = require('../../utils/util.js');
+const {
+  defaultImg,
+  noExhibitionImg
+} = require('../../utils/images');
 
 
 const WxParse = require('../../common/component/wxParse/wxParse.js');
@@ -24,16 +33,17 @@ Page({
     currentPage: 1,
     exhibitionList: [],
     likes: {},
-    tag: 0
+    tag: 0,
+    latitude: null,
+    longitude: null
   },
 
-  onLoad: function () {
-
-
+  onLoad: function() {
     this.setData({
       serverName,
       defaultImg,
       noExhibitionImg,
+      imgServer
       // isLogin
     })
 
@@ -42,7 +52,7 @@ Page({
     this.getList(1);
   },
 
-  loadMore: function () {
+  loadMore: function() {
     if (!this.data.lastPage) {
       console.log(this.data.currentPage + 1)
       this.getList(this.data.currentPage + 1);
@@ -51,26 +61,22 @@ Page({
     }
   },
 
-  onReachBottom: function () {
+  onReachBottom: function() {
     if (!this.data.loading) {
       this.loadMore();
       console.log('reach Bottom');
     }
-
   },
 
-  onShow: function () {
-    let { collectedArr, collectedChange } = app.globalData;
-    let {  exhibitionList } = this.data
+  onShow: function() {
+    let {
+      collectedArr,
+      collectedChange
+    } = app.globalData;
+    let {
+      exhibitionList
+    } = this.data
     let isLogin = app.globalData.isLogin;
-    
-
-    // this.setData({
-    //   exhibitionList: []
-    // });
-    // this.getBanner();
-    // this.getList(1);
-    console.log('dwdwasda', isLogin)
     this.setData({
       isLogin
     })
@@ -82,8 +88,7 @@ Page({
             exhibitionList[i].hasCollect = collectedArr[j].status
             if (exhibitionList[i].hasCollect) {
               exhibitionList[i].collectionsCount += 1;
-            }
-            else {
+            } else {
               exhibitionList[i].collectionsCount -= 1;
             }
             if (exhibitionList[i].collectionsCount < 0) {
@@ -96,14 +101,14 @@ Page({
       }
       this.setData({
         exhibitionList,
-        
+
       })
     }
     // app.globalData.clickToSelect = false;
     app.globalData.collectedChange = false;
 
   },
-  onPullDownRefresh: function () {
+  onPullDownRefresh: function() {
     this.setData({
       exhibitionList: [],
       currentPage: 1
@@ -111,24 +116,26 @@ Page({
     this.getList(1);
   },
 
-
-  getList: function (page) {
-    let type = this.data.tag;
-    console.log(this.data.tag)
-    this.setData({
-      loading: true
-    })
+  fetchData: function (page){
     request["getExhibitionList"]({
       page: page,
-      type: type
+      type: 0,
+      lat: this.data.latitude,
+      lng: this.data.longitude
     }, '', res => {
 
-      let tempContent = this.data.exhibitionList
-        ? this.data.exhibitionList
-        : [];
-      let { last: lastPage, totalPages, content: exhibitionList } = res.data.data;
-
-      let { openTime } = exhibitionList;
+      let tempContent = this.data.exhibitionList ?
+        this.data.exhibitionList :
+        [];
+      let {
+        last: lastPage,
+        totalPages,
+        content: exhibitionList
+      } = res.data.data;
+
+      let {
+        openTime
+      } = exhibitionList;
       console.log(res)
       this.setData({
         currentPage: res.data.data.number + 1,
@@ -137,8 +144,6 @@ Page({
         exhibitionList: tempContent.concat(exhibitionList),
       });
       console.log(exhibitionList)
-      
-
       // WxParse.wxParseTemArray("replyTemArray", 'reply', replyArr.length, that)
 
     }, err => {
@@ -148,13 +153,36 @@ Page({
     })
   },
 
-  getBanner: function () {
-    request["getBannerList"]({
-    }, '', res => {
-      let { content: commodityImgs } = res.data.data;
+
+  getList: function(page) {
+    let type = this.data.tag;
+    this.setData({
+      loading: true
+    })
+    if (this.data.latitude||this.data.longitude) {
+      this.fetchData(page)
+    } else {
+      wx.getLocation({
+        type: 'wgs84',
+        success: (res) => {
+          this.setData({
+            latitude: res.latitude,
+            longitude: res.longitude
+          })
+          this.fetchData(page)
+        },
+      })
+    }
+  },
+
+  getBanner: function() {
+    request["getBannerList"]({}, '', res => {
+      let {
+        content: commodityImgs
+      } = res.data.data;
       // console.log("wdwdwd",commodityImgs)
       this.setData({
-        commodityImgs: commodityImgs||[]
+        commodityImgs: commodityImgs || []
       });
     }, err => {
 
@@ -163,14 +191,21 @@ Page({
     })
   },
 
-  addLike: function (e) {
-    let { type, id, idx } = e.currentTarget.dataset;
+  addLike: function(e) {
+    let {
+      type,
+      id,
+      idx
+    } = e.currentTarget.dataset;
     console.log(idx, type, id)
 
     let likes = this.data.likes;
     likes[id] = !likes[id];
     let exhibitionList = this.data.exhibitionList;
-    let { collectedArr, collectedChange } = app.globalData, hasItem = true;
+    let {
+      collectedArr,
+      collectedChange
+    } = app.globalData, hasItem = true;
 
 
     console.log('type', type)
@@ -216,7 +251,7 @@ Page({
     }, err => {
 
     }, complete => {
-     
+
       Toast.hideLoading();
     })
     // }
@@ -224,11 +259,11 @@ Page({
     console.log(this.data.exhibitionList)
   },
 
-  tabClick: function (e) {
+  tabClick: function(e) {
     // console.log(e.currentTarget.dataset)
 
     // if (e.currentTarget.id == 1) {
-      
+
     //   wx.switchTab({
     //     url: '../swkz/index',
     //     success: function (res) { },
@@ -237,24 +272,30 @@ Page({
     //   })
     // }
     // else {
-      this.setData({
-        exhibitionList: [],
-        activeIndex: e.currentTarget.id,
-        tag: e.currentTarget.dataset.tag,
-        currentPage: 1
-      });
-      this.getList(1);
+    this.setData({
+      exhibitionList: [],
+      activeIndex: e.currentTarget.id,
+      tag: e.currentTarget.dataset.tag,
+      currentPage: 1
+    });
+    this.getList(1);
     // }
   },
-  onShareAppMessage: function () {
+  onShareAppMessage: function() {
 
   },
 
 
-  to_pay: function (e) {
+  to_pay: function(e) {
     // console.log('dwdwdw', e.currentTarget.dataset)
 
-    let { url, pagetype, urltype, hasproduct, haspay } = e.currentTarget.dataset;
+    let {
+      url,
+      pagetype,
+      urltype,
+      hasproduct,
+      haspay
+    } = e.currentTarget.dataset;
 
 
     app.globalData.currentUrl = url
@@ -266,9 +307,9 @@ Page({
       case 0:
         wx.navigateTo({
           url: `../wv_page/index`,
-          success: function (res) { },
-          fail: function (res) { },
-          complete: function (res) { },
+          success: function(res) {},
+          fail: function(res) {},
+          complete: function(res) {},
         })
         break;
       case 1:
@@ -276,25 +317,25 @@ Page({
           case 0:
             wx.navigateTo({
               url: `../cg_detail/index?id=${url}`,
-              success: function (res) { },
-              fail: function (res) { },
-              complete: function (res) { },
+              success: function(res) {},
+              fail: function(res) {},
+              complete: function(res) {},
             })
             break;
           case 1:
             if (hasproduct) {
               wx.navigateTo({
                 url: `./pay_page/index?id=${url}`,
-                success: function (res) { },
-                fail: function (res) { },
-                complete: function (res) { },
+                success: function(res) {},
+                fail: function(res) {},
+                complete: function(res) {},
               })
             } else {
               wx.navigateTo({
                 url: `../zl_detail/index?id=${url}`,
-                success: function (res) { },
-                fail: function (res) { },
-                complete: function (res) { },
+                success: function(res) {},
+                fail: function(res) {},
+                complete: function(res) {},
               })
             }
 
@@ -333,4 +374,4 @@ Page({
 
 
   }
-})
+})

+ 5 - 5
pages/yuezhan/index.wxml

@@ -16,17 +16,17 @@
   </view>
   <swiper wx:if="{{tag==0&&commodityImgs.length>0}}" class='swiper-style' circular="true" indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
     <swiper-item  wx:for="{{commodityImgs}}" bindtap='to_pay' data-pageType="{{item.pageType}}" data-urlType="{{item.urlType}}" data-hasProduct="{{item.hasProduct}}" data-hasPay="{{item.hasPay}}" data-url="{{item.url}}" data-id="{{item.id}}" wx:key="{{item.id}}">
-      <image mode="aspectFill" src="{{item.imageUrl||defaultImg}}" class="yuezhan-img" />
+      <image mode="aspectFill" src="{{imgServer+item.imageUrl||defaultImg}}" class="yuezhan-img" />
     </swiper-item>
   </swiper>
   <view class='yuezhan-navigator'>
     <view class='navigator-title'>推荐展览</view>
     <navigator hover-class='none' url="{{item.hasProduct&&!item.hasPay?('./pay_page/index?id='+item.id):(item.hasProduct?'../wv_page/index?id='+item.id:'../zl_detail/index?id='+item.id)}}" wx:for="{{exhibitionList}}" wx:key="index" class='fdkz-card'>
       <view class='fdkz-card-img'>
-        <view class="fdkz-card-tag {{item.statusText=='展览中'||item.statusText==''?'':item.statusText=='已结束'?'fdkz-card-tag_finish':'fdkz-card-tag_coming'}}">
+        <view class="fdkz-card-tag {{item.hasProduct?'':'fdkz-card-tag_offline'}}">
           <text class='fdkz-card-tag-txt'>{{item.statusText||'常设展'}}</text>
         </view>
-        <image src="{{item.imageUrl||defaultImg}}" mode="aspectFill" class='item-img'></image>
+        <image src="{{imgServer+item.imageUrl||defaultImg}}" mode="aspectFill" class='item-img'></image>
       </view>
       <view class='fdkz-card-info'>
         <view class='fdkz-card-info-title'>
@@ -43,8 +43,8 @@
             <view class='date-day'>{{item.statusTextDesp}}</view>
           </view>
           <view class='right'>
-            <view class='date-icon iconfont  icon-zuobiao'></view>
-            <text class='distance'>30km</text>
+            <view class="date-icon iconfont  {{item.hasProduct?'iconredu':'iconweizhi'}}"></view>
+            <text class='distance'>{{item.hasProduct?item.pv:(item.distance+' km')}}</text>
           </view>
           <!-- <view class='changguan_title'>
             <text class='iconfont icon-comment'>   {{item.commentCount}}</text>

+ 3 - 2
pages/yuezhan/index.wxss

@@ -67,6 +67,8 @@
 
 .fdkz-card-info-date .right{
   align-self:  flex-end;
+  display: flex;
+  align-items: center;
 }
 .fdkz-card-info-date .date-icon{
   display: inline-block;
@@ -74,7 +76,7 @@
   margin-right: 12rpx;
 }
 
-.fdkz-card-info-date .icon-zuobiao{
+.fdkz-card-info-date .iconweizhi,.fdkz-card-info-date .iconredu{
   font-size: 20rpx;
 }
 .date-txt{
@@ -83,7 +85,6 @@
   white-space: nowrap; 
    width: 400rpx; 
   display: inline-block;
-  margin-top: 24rpx;
 }
 .changguan_title{
   float:right;

+ 4 - 0
pages/zl_detail/index.wxss

@@ -308,4 +308,8 @@
   float: right;
   color: #e02f2f;
   font-size: 28rpx;
+}
+
+.iconyishoucang{
+  color: #e02f2f;
 }

+ 3 - 1
utils/services.js

@@ -5,6 +5,7 @@ const {
 // const serverName = 'https://www.4dmuseum.cn'; // 正式
 const serverName = 'http://192.168.0.100:8081'; // 本地
 
+const imgServer = 'https://www.4dmuseum.cn'
 
 const urls = {
   //用户API
@@ -175,4 +176,5 @@ Object.keys(urls).forEach(function(key) {
 
 
 module.exports.request = requestFns;
-module.exports.serverName = serverName;
+module.exports.serverName = serverName;
+module.exports.imgServer = imgServer;