Commit f7fc04d3 by TengFengLian

修复测试问题

parent 63691b2e
......@@ -5,6 +5,7 @@ Page({
data: {
formType: 1,
appointmentDate: '',
appointmentEndDate: '',
appointmentComplete: false,
formName: '',
......@@ -32,12 +33,15 @@ Page({
setReset: function () {
let funcDate = iMiment(new Date().getTime()).format('YYYY-MM-DD')
let endDate = this.getNextDay(funcDate, 3)
console.log('endDate', endDate)
this.setData({
formName: '',
formPhone: '',
formQuantity: this.data.formType === 1 ? 0 : 1,
formDate: funcDate,
appointmentDate: funcDate,
appointmentEndDate: endDate,
})
if (this.data.formType === 1) { // 入园预约
this.getResidue()
......@@ -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 @@
<text>期</text>
</view>
<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>
</picker>
<image class="input-icon" src="../../image/more.png"></image>
......
......@@ -32,6 +32,7 @@ Page({
},
strategy: [],
strategyList: [],
strategyOriginList: [],
loading: false,
moreData: true,
......@@ -54,6 +55,7 @@ Page({
success: function(token) {
that.getBanner()
that.loadVisiterPlanList()
that.getNoticeList()
}
})
},
......@@ -271,23 +273,14 @@ Page({
var that = this
app.wxRequest({
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) {
if (that.data.pageSize > Number(res.data.count)) {
that.setData({
moreData: false
})
} else {
that.setData({
moreData: true
})
}
that.setData({
loading: false
})
if (res.data.list.length > 0) {
let count = that.data.strategyList.length
let count = that.data.strategyOriginList.length
let tempArray = []
for(let i = 0; i < res.data.list.length; i++) {
let item = res.data.list[i]
......@@ -308,24 +301,30 @@ Page({
var firstItem = tempArray[0]
console.log('firstItem', firstItem)
that.setData({
moreData: (tempArray.length >= Number(res.data.count)) ? false : true,
['strategyFirstItem.id']: firstItem.id,
['strategyFirstItem.image']: firstItem.image,
['strategyFirstItem.title']: firstItem.title,
['strategyFirstItem.date']: firstItem.date,
strategyList: newArr
strategyList: newArr,
strategyOriginList: tempArray,
})
} else {
that.setData({
// strategyList: that.data.strategyList.concat(tempArray)
strategyList: tempArray
moreData: (count + tempArray.length >= Number(res.data.count)) ? false : true,
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 {
}
},
fail: function(err) {
that.setData({
......@@ -343,6 +342,37 @@ Page({
this.data.pageNo += 1
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({
*/
userInfoHandler(res) {
console.log('userInfo', res)
if (!res.detail.userInfo) {
return
}
let avatarUrl = res.detail.userInfo.avatarUrl
let nickName = res.detail.userInfo.nickName
let gender = res.detail.userInfo.gender
wx.setStorageSync('avatarUrl', avatarUrl)
wx.setStorageSync('nickName', nickName)
wx.setStorageSync('sex', gender)
// let gender = res.detail.userInfo.gender
let that = this
this.registUserInfo({
param: {
avatarUrl: avatarUrl,
nickName: nickName,
sex: gender,
// sex: gender,
sessionKey: '',
encryptedData: '',
iv: '',
},
success: function(res) {
wx.setStorageSync('avatarUrl', avatarUrl)
wx.setStorageSync('nickName', nickName)
// wx.setStorageSync('sex', gender)
that.setData({
islogin: true
})
......@@ -128,6 +131,9 @@ Page({
*/
userPhoneHandler(res) {
console.log('userPhone', res)
if (!res.detail.encryptedData) {
return
}
let sessionKey = wx.getStorageSync('session_key')
let that = this
this.registUserInfo({
......
......@@ -62,18 +62,10 @@ Page({
url: '/api/v1/dynamic/getList',
data: { pageSize: that.data.pageSize, pageNo: that.data.pageNo},
success: function(res) {
if (that.data.pageSize > Number(res.data.count)) {
that.setData({
moreData: false
})
} else {
that.setData({
moreData: true
})
}
that.setData({
loading: false
})
let count = that.data.notice.length
var tmpArr = [];
res.data.list.forEach(item => {
var content = item.content.replace(/<img/gi, '<img style="max-width:100%;height:auto;display:block" ')
......@@ -90,10 +82,12 @@ Page({
})
if (that.data.pageNo == 1) {
that.setData({
moreData: (tmpArr.length >= Number(res.data.count)) ? false : true,
notice: tmpArr
})
} else {
that.setData({
moreData: (tmpArr.length + count >= Number(res.data.count)) ? false : true,
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