|
@@ -1,25 +1,62 @@
|
|
|
//index.js
|
|
|
//获取应用实例
|
|
|
const { request, serverName } = require('../../utils/services');
|
|
|
-const { Toast } = require('../../utils/util.js');
|
|
|
+const { Toast, qqmapsdk } = require('../../utils/util.js');
|
|
|
const { defaultImg, noExhibitionImg } = require('../../utils/images');
|
|
|
const WxParse = require('../../common/component/wxParse/wxParse.js');
|
|
|
|
|
|
-const QQMapWX = require('../../common/component/mapSDK/qqmap-wx-jssdk.min.js');
|
|
|
-var qqmapsdk = "";
|
|
|
+// const QQMapWX = require('../../common/component/mapSDK/qqmap-wx-jssdk.min.js');
|
|
|
|
|
|
const app = getApp();
|
|
|
+const distItems = [
|
|
|
+ {
|
|
|
+ name: '综合排序',
|
|
|
+ id: '综合排序',
|
|
|
+ idx:0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '按距离排序',
|
|
|
+ id: '距离排序',
|
|
|
+ idx: 1
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '按热度排序',
|
|
|
+ id: '热度排序',
|
|
|
+ idx: 2
|
|
|
+ }
|
|
|
+]
|
|
|
+const typeItems = [
|
|
|
+ {
|
|
|
+ name: '展览中',
|
|
|
+ id: '展览中',
|
|
|
+ idx: 1
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '即将开始',
|
|
|
+ id: '即将开始',
|
|
|
+ idx: 2
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '已结束',
|
|
|
+ id: '已结束',
|
|
|
+ idx: 3
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '全部状态',
|
|
|
+ id: '全部状态',
|
|
|
+ idx: 0
|
|
|
+ }
|
|
|
+]
|
|
|
|
|
|
Page({
|
|
|
data: {
|
|
|
- navItem: [{ title: '', tag: 5 }, { title: '附近', tag: "" }, { title: '热门', tag: 0 }, { title: '展览中', tag: 4 }, { title: '即将开始', tag: 2 }, { title: '已结束', tag: 6 }],
|
|
|
+ navItem: distItems,
|
|
|
indicatorDots: true,
|
|
|
autoplay: true,
|
|
|
interval: 5000,
|
|
|
duration: 1000,
|
|
|
activeIndex: 0,
|
|
|
locationName: "珠海",
|
|
|
- animationData: {},
|
|
|
isLike: false,
|
|
|
showConfirm: false,
|
|
|
tag: "",
|
|
@@ -27,11 +64,14 @@ Page({
|
|
|
commodityImgs: [
|
|
|
'../../imgs/testImg/thumbSmallImg.jpg',
|
|
|
'../../imgs/testImg/thumbSmallImg.jpg',
|
|
|
-
|
|
|
],
|
|
|
type: 5,
|
|
|
testImg: '../../imgs/testImg/fdkz.png',
|
|
|
- getLocationBtn: false
|
|
|
+ getLocationBtn: false,
|
|
|
+ isShow: false,
|
|
|
+ exhiNum:0,
|
|
|
+ activeDist:'综合排序',
|
|
|
+ activeType:'全部状态'
|
|
|
},
|
|
|
|
|
|
to_search_exhibition: function () {
|
|
@@ -44,25 +84,12 @@ Page({
|
|
|
},
|
|
|
|
|
|
onLoad: function () {
|
|
|
- this.getList(1)
|
|
|
- qqmapsdk = new QQMapWX({
|
|
|
- key: '2Z3BZ-H7EWO-F4YWX-SG5JF-2VOK2-S2FUB'
|
|
|
- });
|
|
|
+
|
|
|
this.getLocationName();
|
|
|
-
|
|
|
- var animation = wx.createAnimation({
|
|
|
- duration: 400,
|
|
|
- timingFunction: 'ease-in-out',
|
|
|
- })
|
|
|
-
|
|
|
- this.animation = animation
|
|
|
-
|
|
|
- animation.scale(1.5, 1.5).step();
|
|
|
- animation.scale(1, 1).step();
|
|
|
+ // this.getList(1)
|
|
|
|
|
|
this.setData({
|
|
|
serverName,
|
|
|
- animationData: animation.export(),
|
|
|
noExhibitionImg,
|
|
|
defaultImg
|
|
|
})
|
|
@@ -73,13 +100,13 @@ Page({
|
|
|
onShow: function () {
|
|
|
let { city, clickToSelect, collectedArr, collectedChange } = app.globalData;
|
|
|
let { activeIndex, exhibitionList } = this.data
|
|
|
-
|
|
|
- if (clickToSelect){
|
|
|
+
|
|
|
+ if (clickToSelect) {
|
|
|
// console.log(city)
|
|
|
this.setData({
|
|
|
locationName: city || "珠海",
|
|
|
exhibitionList: [],
|
|
|
- activeIndex:0,
|
|
|
+ activeIndex: 0,
|
|
|
type: 5
|
|
|
});
|
|
|
|
|
@@ -91,9 +118,9 @@ Page({
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- if (collectedChange){
|
|
|
- for (let i = 0; i < exhibitionList.length; i++ ){
|
|
|
- for (let j = 0; j < collectedArr.length;j++){
|
|
|
+ if (collectedChange) {
|
|
|
+ for (let i = 0; i < exhibitionList.length; i++) {
|
|
|
+ for (let j = 0; j < collectedArr.length; j++) {
|
|
|
if (collectedArr[j].collectedId == exhibitionList[i].id) {
|
|
|
exhibitionList[i].hasCollect = collectedArr[j].status
|
|
|
if (exhibitionList[i].hasCollect) {
|
|
@@ -108,7 +135,7 @@ Page({
|
|
|
}
|
|
|
}
|
|
|
// console.log(collectedArr.status, collectedArr.collectedId)
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
this.setData({
|
|
|
exhibitionList
|
|
@@ -116,9 +143,6 @@ Page({
|
|
|
}
|
|
|
app.globalData.clickToSelect = false;
|
|
|
// app.globalData.collectedChange = false;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
|
|
|
addLike: function (e) {
|
|
@@ -178,7 +202,31 @@ Page({
|
|
|
console.log(this.data.exhibitionList)
|
|
|
},
|
|
|
|
|
|
-
|
|
|
+ showDrop: function (e) {
|
|
|
+ let tag = e.target.dataset.id
|
|
|
+ let name = e._relatedInfo.anchorTargetText
|
|
|
+ console.log(tag)
|
|
|
+ if (tag==='type'){
|
|
|
+ this.setData({
|
|
|
+ navItem: {
|
|
|
+ type: tag,
|
|
|
+ name: name,
|
|
|
+ arr: typeItems
|
|
|
+ },
|
|
|
+ isShow: !this.data.isShow
|
|
|
+ })
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.setData({
|
|
|
+ navItem: {
|
|
|
+ type: tag,
|
|
|
+ name: name,
|
|
|
+ arr: distItems
|
|
|
+ },
|
|
|
+ isShow: !this.data.isShow
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
getLocationName: function () {
|
|
|
// 调用接口
|
|
@@ -203,6 +251,7 @@ Page({
|
|
|
this.setData({
|
|
|
locationName
|
|
|
})
|
|
|
+ this.getList(1)
|
|
|
},
|
|
|
fail: function (res) {
|
|
|
console.log(res)
|
|
@@ -219,37 +268,44 @@ Page({
|
|
|
},
|
|
|
|
|
|
getList: function (page) {
|
|
|
- let { type, locationName } = this.data;
|
|
|
+ let { locationName, latitude, longitude, activeDist, activeType } = this.data;
|
|
|
let loginSessionKey = wx.getStorageSync("token");
|
|
|
- console.log(loginSessionKey)
|
|
|
- console.log(type, locationName);
|
|
|
+ let sort = distItems.find(item => item.id === activeDist).idx
|
|
|
+ let type = typeItems.find(item => item.id === activeType).idx
|
|
|
+ console.log(sort, type)
|
|
|
+ console.log(type, locationName, latitude, longitude);
|
|
|
|
|
|
this.setData({
|
|
|
loading: true
|
|
|
})
|
|
|
- request["getExhibitionList"]({
|
|
|
+ request["getExhibitionListOffline"]({
|
|
|
page: page,
|
|
|
type: type,
|
|
|
loginSessionKey,
|
|
|
- city: locationName
|
|
|
+ city: locationName,
|
|
|
+ sort,
|
|
|
+ type,
|
|
|
+ lng: longitude,
|
|
|
+ lat: latitude
|
|
|
}, '', res => {
|
|
|
-
|
|
|
let tempContent = this.data.exhibitionList
|
|
|
? this.data.exhibitionList
|
|
|
: [];
|
|
|
let { last: lastPage, totalPages, totalElements, content: exhibitionList } = res.data.data;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
let { openTime } = exhibitionList;
|
|
|
- console.log(res)
|
|
|
this.setData({
|
|
|
currentPage: res.data.data.number + 1,
|
|
|
lastPage,
|
|
|
loading: false,
|
|
|
exhibitionList: tempContent.concat(exhibitionList),
|
|
|
+ exhiNum: totalElements
|
|
|
});
|
|
|
- console.log(exhibitionList)
|
|
|
+ console.log(this.data.exhibitionList)
|
|
|
wx.stopPullDownRefresh();
|
|
|
-
|
|
|
// WxParse.wxParseTemArray("replyTemArray", 'reply', replyArr.length, that)
|
|
|
|
|
|
}, err => {
|
|
@@ -264,7 +320,7 @@ Page({
|
|
|
let loginSessionKey = wx.getStorageSync("token");
|
|
|
|
|
|
wx.getSetting({
|
|
|
- success:res=>{
|
|
|
+ success: res => {
|
|
|
if (!res.authSetting['scope.userLocation']) {
|
|
|
Toast.showToast('tip', "无法获取用户位置", () => {
|
|
|
return;
|
|
@@ -278,12 +334,11 @@ Page({
|
|
|
loading: true,
|
|
|
getLocationBtn: false
|
|
|
})
|
|
|
- if(!longitude&&!latitude){
|
|
|
+ if (!longitude && !latitude) {
|
|
|
wx.getLocation({
|
|
|
success: res => {
|
|
|
let longitude = (this.longitude = res.longitude);
|
|
|
let latitude = (this.latitude = res.latitude);
|
|
|
- console.log("dqwdwd6w5d465ad4w")
|
|
|
request["getNearByList"]({
|
|
|
page: page,
|
|
|
loginSessionKey,
|
|
@@ -319,7 +374,7 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
})
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
request["getNearByList"]({
|
|
|
page: page,
|
|
|
loginSessionKey,
|
|
@@ -343,23 +398,15 @@ Page({
|
|
|
});
|
|
|
console.log(exhibitionList)
|
|
|
wx.stopPullDownRefresh();
|
|
|
-
|
|
|
- // WxParse.wxParseTemArray("replyTemArray", 'reply', replyArr.length, that)
|
|
|
-
|
|
|
}, err => {
|
|
|
-
|
|
|
}, complete => {
|
|
|
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
|
|
|
closeDialog: function () {
|
|
@@ -367,6 +414,7 @@ Page({
|
|
|
showConfirm: false
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
loadMore: function () {
|
|
|
let { activeIndex } = this.data
|
|
|
if (!this.data.lastPage) {
|
|
@@ -377,12 +425,11 @@ Page({
|
|
|
else {
|
|
|
this.getList(this.data.currentPage + 1);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
} else {
|
|
|
return;
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
onReachBottom: function () {
|
|
|
if (!this.data.loading) {
|
|
|
this.loadMore();
|
|
@@ -391,7 +438,6 @@ Page({
|
|
|
|
|
|
},
|
|
|
|
|
|
-
|
|
|
tabClick: function (e) {
|
|
|
// console.log(e.currentTarget.dataset)
|
|
|
this.setData({
|
|
@@ -408,6 +454,22 @@ Page({
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ onIsclose: function (e) {
|
|
|
+ this.setData({
|
|
|
+ isShow: e.detail
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ getActiveItem:function(e){
|
|
|
+ console.log(e)
|
|
|
+ let { activeDist, activeType} = e.detail
|
|
|
+ this.setData({
|
|
|
+ activeDist,
|
|
|
+ activeType,
|
|
|
+ exhibitionList:[]
|
|
|
+ })
|
|
|
+ this.getList(1)
|
|
|
+ },
|
|
|
to_search: function () {
|
|
|
wx.navigateTo({
|
|
|
url: './search/index',
|