Commit f7fc04d3 by TengFengLian

修复测试问题

parent 63691b2e
...@@ -5,6 +5,7 @@ Page({ ...@@ -5,6 +5,7 @@ Page({
data: { data: {
formType: 1, formType: 1,
appointmentDate: '', appointmentDate: '',
appointmentEndDate: '',
appointmentComplete: false, appointmentComplete: false,
formName: '', formName: '',
...@@ -32,12 +33,15 @@ Page({ ...@@ -32,12 +33,15 @@ Page({
setReset: function () { setReset: function () {
let funcDate = iMiment(new Date().getTime()).format('YYYY-MM-DD') let funcDate = iMiment(new Date().getTime()).format('YYYY-MM-DD')
let endDate = this.getNextDay(funcDate, 3)
console.log('endDate', endDate)
this.setData({ this.setData({
formName: '', formName: '',
formPhone: '', formPhone: '',
formQuantity: this.data.formType === 1 ? 0 : 1, formQuantity: this.data.formType === 1 ? 0 : 1,
formDate: funcDate, formDate: funcDate,
appointmentDate: funcDate, appointmentDate: funcDate,
appointmentEndDate: endDate,
}) })
if (this.data.formType === 1) { // 入园预约 if (this.data.formType === 1) { // 入园预约
this.getResidue() this.getResidue()
...@@ -240,4 +244,15 @@ Page({ ...@@ -240,4 +244,15 @@ Page({
}, },
getNextDay(d,t){
console.log(d,t)//格式为---2019-02-13 3
d = new Date(d);
console.log(d)//格式为---Wed Feb 13 2019 08:00:00 GMT+0800 (中国标准时间)
d = +d + (1000*60*60*24)*t;
console.log(d)//格式为--时间戳1550275200000
d = new Date(d);
console.log(d)//格式为---Sat Feb 16 2019 08:00:00 GMT+0800 (中国标准时间)
return iMiment(new Date(d)).format("YYYY-MM-DD") //格式为"2019-02-16 00:00:00"
},
}) })
\ No newline at end of file
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<text>期</text> <text>期</text>
</view> </view>
<view class="input-wrap row con-b align-c"> <view class="input-wrap row con-b align-c">
<picker class="input-picker" mode="date" value="{{date}}" start="{{appointmentDate}}" bindchange="onSelectionDate"> <picker class="input-picker" mode="date" value="{{date}}" start="{{appointmentDate}}" end="{{appointmentEndDate}}" bindchange="onSelectionDate">
<view class="picker text">{{formDate}}</view> <view class="picker text">{{formDate}}</view>
</picker> </picker>
<image class="input-icon" src="../../image/more.png"></image> <image class="input-icon" src="../../image/more.png"></image>
......
...@@ -32,6 +32,7 @@ Page({ ...@@ -32,6 +32,7 @@ Page({
}, },
strategy: [], strategy: [],
strategyList: [], strategyList: [],
strategyOriginList: [],
loading: false, loading: false,
moreData: true, moreData: true,
...@@ -54,6 +55,7 @@ Page({ ...@@ -54,6 +55,7 @@ Page({
success: function(token) { success: function(token) {
that.getBanner() that.getBanner()
that.loadVisiterPlanList() that.loadVisiterPlanList()
that.getNoticeList()
} }
}) })
}, },
...@@ -271,23 +273,14 @@ Page({ ...@@ -271,23 +273,14 @@ Page({
var that = this var that = this
app.wxRequest({ app.wxRequest({
url: '/api/v1/strategy/getList', url: '/api/v1/strategy/getList',
data: { pageSize: that.data.pageSize, pageNo: that.data.pageNo}, data: { pageSize: that.data.pageSize+'', pageNo: that.data.pageNo+''},
success: function (res) { success: function (res) {
if (that.data.pageSize > Number(res.data.count)) {
that.setData({
moreData: false
})
} else {
that.setData({
moreData: true
})
}
that.setData({ that.setData({
loading: false loading: false
}) })
if (res.data.list.length > 0) { if (res.data.list.length > 0) {
let count = that.data.strategyList.length let count = that.data.strategyOriginList.length
let tempArray = [] let tempArray = []
for(let i = 0; i < res.data.list.length; i++) { for(let i = 0; i < res.data.list.length; i++) {
let item = res.data.list[i] let item = res.data.list[i]
...@@ -308,24 +301,30 @@ Page({ ...@@ -308,24 +301,30 @@ Page({
var firstItem = tempArray[0] var firstItem = tempArray[0]
console.log('firstItem', firstItem) console.log('firstItem', firstItem)
that.setData({ that.setData({
moreData: (tempArray.length >= Number(res.data.count)) ? false : true,
['strategyFirstItem.id']: firstItem.id, ['strategyFirstItem.id']: firstItem.id,
['strategyFirstItem.image']: firstItem.image, ['strategyFirstItem.image']: firstItem.image,
['strategyFirstItem.title']: firstItem.title, ['strategyFirstItem.title']: firstItem.title,
['strategyFirstItem.date']: firstItem.date, ['strategyFirstItem.date']: firstItem.date,
strategyList: newArr strategyList: newArr,
strategyOriginList: tempArray,
}) })
} else { } else {
that.setData({ that.setData({
// strategyList: that.data.strategyList.concat(tempArray) moreData: (count + tempArray.length >= Number(res.data.count)) ? false : true,
strategyList: tempArray strategyOriginList: that.data.strategyOriginList.concat(tempArray),
strategyList: tempArray,
}) })
} }
// 游客攻略瀑布列表 // 游客攻略瀑布列表
wx.lin.renderWaterFlow(that.data.strategyList, false, () => {}) wx.lin.renderWaterFlow(that.data.strategyList, that.data.pageNo == 1 ? true : false, () => {})
} else { } else {
} }
}, },
fail: function(err) { fail: function(err) {
that.setData({ that.setData({
...@@ -343,6 +342,37 @@ Page({ ...@@ -343,6 +342,37 @@ Page({
this.data.pageNo += 1 this.data.pageNo += 1
this.loadVisiterPlanList() this.loadVisiterPlanList()
} },
// 最新动态列表
getNoticeList() {
var that = this
app.wxRequest({
url: '/api/v1/dynamic/getList',
data: { pageSize: 5, pageNo: 1, orderBy: " a.release_time desc "},
success: function(res) {
var tmpArr = [];
res.data.list.forEach(item => {
var content = item.content.replace(/<img/gi, '<img style="max-width:100%;height:auto;display:block" ')
.replace(/<section/g, '<div')
.replace(/\/section>/g, '\div>');
var tmpItem = {
id: item.id,
cover: item.imgs.length > 0 ? item.imgs[0] : '',
title: item.title,
date: item.releaseTime,
describe: content,
}
tmpArr.push(tmpItem)
})
if (that.data.pageNo == 1) {
that.setData({
notice: tmpArr
})
}
}
})
},
}) })
\ No newline at end of file
...@@ -96,23 +96,26 @@ Page({ ...@@ -96,23 +96,26 @@ Page({
*/ */
userInfoHandler(res) { userInfoHandler(res) {
console.log('userInfo', res) console.log('userInfo', res)
if (!res.detail.userInfo) {
return
}
let avatarUrl = res.detail.userInfo.avatarUrl let avatarUrl = res.detail.userInfo.avatarUrl
let nickName = res.detail.userInfo.nickName let nickName = res.detail.userInfo.nickName
let gender = res.detail.userInfo.gender // let gender = res.detail.userInfo.gender
wx.setStorageSync('avatarUrl', avatarUrl)
wx.setStorageSync('nickName', nickName)
wx.setStorageSync('sex', gender)
let that = this let that = this
this.registUserInfo({ this.registUserInfo({
param: { param: {
avatarUrl: avatarUrl, avatarUrl: avatarUrl,
nickName: nickName, nickName: nickName,
sex: gender, // sex: gender,
sessionKey: '', sessionKey: '',
encryptedData: '', encryptedData: '',
iv: '', iv: '',
}, },
success: function(res) { success: function(res) {
wx.setStorageSync('avatarUrl', avatarUrl)
wx.setStorageSync('nickName', nickName)
// wx.setStorageSync('sex', gender)
that.setData({ that.setData({
islogin: true islogin: true
}) })
...@@ -128,6 +131,9 @@ Page({ ...@@ -128,6 +131,9 @@ Page({
*/ */
userPhoneHandler(res) { userPhoneHandler(res) {
console.log('userPhone', res) console.log('userPhone', res)
if (!res.detail.encryptedData) {
return
}
let sessionKey = wx.getStorageSync('session_key') let sessionKey = wx.getStorageSync('session_key')
let that = this let that = this
this.registUserInfo({ this.registUserInfo({
......
...@@ -62,18 +62,10 @@ Page({ ...@@ -62,18 +62,10 @@ Page({
url: '/api/v1/dynamic/getList', url: '/api/v1/dynamic/getList',
data: { pageSize: that.data.pageSize, pageNo: that.data.pageNo}, data: { pageSize: that.data.pageSize, pageNo: that.data.pageNo},
success: function(res) { success: function(res) {
if (that.data.pageSize > Number(res.data.count)) {
that.setData({
moreData: false
})
} else {
that.setData({
moreData: true
})
}
that.setData({ that.setData({
loading: false loading: false
}) })
let count = that.data.notice.length
var tmpArr = []; var tmpArr = [];
res.data.list.forEach(item => { res.data.list.forEach(item => {
var content = item.content.replace(/<img/gi, '<img style="max-width:100%;height:auto;display:block" ') var content = item.content.replace(/<img/gi, '<img style="max-width:100%;height:auto;display:block" ')
...@@ -90,10 +82,12 @@ Page({ ...@@ -90,10 +82,12 @@ Page({
}) })
if (that.data.pageNo == 1) { if (that.data.pageNo == 1) {
that.setData({ that.setData({
moreData: (tmpArr.length >= Number(res.data.count)) ? false : true,
notice: tmpArr notice: tmpArr
}) })
} else { } else {
that.setData({ that.setData({
moreData: (tmpArr.length + count >= Number(res.data.count)) ? false : true,
notice: that.data.notice.concat(tempArray) notice: that.data.notice.concat(tempArray)
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment