Commit ce8271ae by TengFengLian

用户信息、手机号绑定、我的活动、我的预约

parent c1ef5c61
App({ App({
globalData: { globalData: {
userInfo: null, userInfo: null,
baseUrl: 'http://sm-web.meiqicloud.com',//测试 baseUrl: 'https://sm-web.meiqicloud.com',//测试
// baseUrl: 'https://zmj.zhengmao.net',//生产 // baseUrl: 'https://zmj.zhengmao.net',//生产
debug: true, debug: true,
}, },
onLaunch: function () { onLaunch: function () {
this.setUnitProportion() this.setUnitProportion()
// 登录
this.login()
}, },
onShow: function (options) { onShow: function (options) {
...@@ -47,7 +44,7 @@ App({ ...@@ -47,7 +44,7 @@ App({
console.log("返回:", res); console.log("返回:", res);
let code = res.data.code * 1; let code = res.data.code * 1;
if (200 == code) { if (200 == code && true == res.data.success) {
if (obj.success) { if (obj.success) {
obj.success(res.data) obj.success(res.data)
} }
...@@ -90,34 +87,58 @@ App({ ...@@ -90,34 +87,58 @@ App({
}, },
login(obj) { login(obj) {
var that = this var token = wx.getStorageSync('token')
wx.login({ if (token) {
success: res => { if (obj.success) {
// 发送 res.code 到后台换取 openId, sessionKey, unionId obj.success(token)
console.log('wx.login:', res); }
var token = wx.getStorageSync('token') } else {
if (!token) { wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
console.log('wx.login:', res);
this.wxRequest({ this.wxRequest({
url: '/api/v1/login/getSmallSession?code='+res.code, url: '/api/v1/login/getSmallSession?code='+res.code,
method: 'GET', method: 'GET',
success: function (res) { success: function (res) {
wx.setStorageSync('expires_in', res.data.expires_in) wx.setStorageSync('expires_in', res.data.expires_in)
wx.setStorageSync('openid', res.data.openid) wx.setStorageSync('openid', res.data.openid)
wx.setStorageSync('token', res.data.token)
wx.setStorageSync('refreshToken', res.data.refreshToken) wx.setStorageSync('refreshToken', res.data.refreshToken)
wx.setStorageSync('session_key', res.data.session_key) wx.setStorageSync('session_key', res.data.session_key)
wx.setStorageSync('token', res.data.token)
wx.setStorageSync('mobile', res.data.mobile) wx.setStorageSync('mobile', res.data.mobile)
wx.setStorageSync('nickName', res.data.nickName) wx.setStorageSync('nickName', res.data.nickName)
wx.setStorageSync('avatarUrl', res.data.avatarUrl) wx.setStorageSync('avatarUrl', res.data.avatarUrl)
wx.setStorageSync('userType', res.data.userType) wx.setStorageSync('userType', res.data.userType)
} if (obj.success) {
obj.success(res.data.token)
}
},
}) })
} }
})
}
},
registUserInfo(obj) {
this.wxRequest({
url: '/api/v1/login/getDecryptData',
data: obj.param,
success: function(res) {
if (obj.success) {
obj.success(res)
}
},
fail: function (err) {
if (obj.fail) {
obj.fail(err)
}
} }
}) })
}, },
refreshToken(obj) { refreshToken(obj) {
this.wxRequest({ this.wxRequest({
url: '/api/v1/login/refreshToken', url: '/api/v1/login/refreshToken',
......
...@@ -21,7 +21,12 @@ Page({ ...@@ -21,7 +21,12 @@ Page({
this.setData({ this.setData({
id: options.id id: options.id
}) })
this.getActivityDetail() var that = this
app.login({
success: function() {
that.getActivityDetail()
}
})
}, },
/** /**
......
...@@ -35,7 +35,12 @@ Page({ ...@@ -35,7 +35,12 @@ Page({
// this.setReset() // this.setReset()
this.getEnrollView() var that = this
app.login({
success: function() {
that.getEnrollView()
}
})
}, },
// setReset: function () { // setReset: function () {
...@@ -112,7 +117,12 @@ Page({ ...@@ -112,7 +117,12 @@ Page({
}, },
onSubmit: function () { onSubmit: function () {
this.doActivityEnroll() var that = this
app.login({
success: function() {
that.doActivityEnroll()
}
})
}, },
onEntryComplete: function () { onEntryComplete: function () {
......
...@@ -10,8 +10,14 @@ Page({ ...@@ -10,8 +10,14 @@ Page({
onLoad: function () { onLoad: function () {
// this.queryActivity() // this.queryActivity()
// this.queryOther() // this.queryOther()
this.getActivityList(1) var that = this
this.getActivityList(0) app.login({
success: function() {
that.getActivityList(1)
that.getActivityList(0)
}
})
}, },
queryActivity: function () { queryActivity: function () {
......
// pages/activityDetail/activityDetail.js // pages/activityDetail/activityDetail.js
const app = getApp()
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
type:'', type:'1',
cover: '',
activityName: '',
activeDate: '',
name: '',
mobile: '',
enrollDate: '',
enrollNum: '',
// 接口参数
enrollId: '',
}, },
/** /**
...@@ -16,8 +29,15 @@ Page({ ...@@ -16,8 +29,15 @@ Page({
console.log(options); console.log(options);
// var options = JSON.parse(options); // var options = JSON.parse(options);
that.setData({ that.setData({
type : options.type enrollId : options.enrollid
})
app.login({
success: function() {
that.getMyActivityDetail()
}
}) })
}, },
/** /**
...@@ -67,5 +87,48 @@ Page({ ...@@ -67,5 +87,48 @@ Page({
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {
},
// 我的活动详情
getMyActivityDetail() {
let that = this
wx.lin.showToast({
icon: 'loading',
title: '正在加载',
show: true,
})
app.wxRequest({
url: '/api/v1/activity/getMyActivityDetail',
data: {
enrollId: this.data.enrollId
},
success: function(res) {
wx.lin.hideToast()
let state = res.data.activeState*1
let type = 0
switch (state) {
case 0: type = 1;break;
case 1: type = 0;break;
case 2: type = 2;break;
}
that.setData({
type: type,
cover: res.data.cover,
activityName: res.data.activityName,
activeDate: res.data.activeDate + ' ' + res.data.activeTime,
name: res.data.name,
mobile: res.data.mobile,
enrollDate: res.data.enrollDate,
enrollNum: res.data.enrollNum + '人',
})
},
fail: function(err) {
wx.lin.hideToast()
wx.lin.showToast({
icon: 'error',
title: err.msg,
})
}
})
} }
}) })
\ No newline at end of file
<l-toast></l-toast>
<navigation class="navigation" titleText="报名详情" backIcon="/image/back.png"></navigation> <navigation class="navigation" titleText="报名详情" backIcon="/image/back.png"></navigation>
<view class="container"> <view class="container">
...@@ -13,10 +14,10 @@ ...@@ -13,10 +14,10 @@
<view class="activityBody"> <view class="activityBody">
<view class="title">报名活动</view> <view class="title">报名活动</view>
<view class="item"> <view class="item">
<image class="activity-contanier-img" src="../mine/image/mine.png"></image> <image class="activity-contanier-img" src="{{cover}}"></image>
<view class="my-activities-content"> <view class="my-activities-content">
<view class="my-activities-title clamp-ellipsis">日落观光游船体验活动之船行碧波共赏美景</view> <view class="my-activities-title clamp-ellipsis">{{activityName}}</view>
<view class="time ellipsis">6月30日-7月15日 10:00-12:00</view> <view class="time ellipsis">{{activeDate}}</view>
</view> </view>
<l-icon name="right" color="rgb(172,172,174)" size="26" style="margin-right:12rpx;"/> <l-icon name="right" color="rgb(172,172,174)" size="26" style="margin-right:12rpx;"/>
...@@ -25,19 +26,19 @@ ...@@ -25,19 +26,19 @@
<view class="info-item"> <view class="info-item">
<text>姓名</text> <text>姓名</text>
<text>张笑寒</text> <text>{{name}}</text>
</view> </view>
<view class="info-item"> <view class="info-item">
<text>手机号</text> <text>手机号</text>
<text>136859705822 </text> <text>{{mobile}} </text>
</view> </view>
<view class="info-item"> <view class="info-item">
<text>报名日期</text> <text>报名日期</text>
<text>6月30日 10:00</text> <text>{{enrollDate}}</text>
</view> </view>
<view class="info-item"> <view class="info-item">
<text>报名人数</text> <text>报名人数</text>
<text>1人</text> <text>{{enrollNum}}</text>
</view> </view>
</view> </view>
......
...@@ -162,41 +162,49 @@ Page({ ...@@ -162,41 +162,49 @@ Page({
}, },
onSubmit: function () { onSubmit: function () {
if (!this.data.isSubmit) { var that = this
this.inspectForm() app.login({
return success: function() {
}
if (!that.data.isSubmit) {
wx.lin.showToast({ that.inspectForm()
icon: 'loading', return
title: '提交中', }
show: true,
})
let that = this
app.wxRequest({
url: '/api/v1/subscribe/doSubscribe',
data: {
mobile: that.data.formPhone,
subscribeNum: that.data.formQuantity,
subscribeDate: that.data.formDate + ' 00:00:00',
name: that.data.formName,
type: this.data.formType === 1 ? 0 : 1,
},
success: function(res) {
that.setData({
appointmentComplete: true
})
wx.lin.hideToast()
},
fail: function(err) {
wx.lin.hideToast()
wx.lin.showToast({ wx.lin.showToast({
icon: 'error', icon: 'loading',
title: err.msg, title: '提交中',
show: true,
}) })
app.wxRequest({
url: '/api/v1/subscribe/doSubscribe',
data: {
mobile: that.data.formPhone,
subscribeNum: that.data.formQuantity,
subscribeDate: that.data.formDate + ' 00:00:00',
name: that.data.formName,
type: that.data.formType === 1 ? 0 : 1,
},
success: function(res) {
that.setData({
appointmentComplete: true
})
wx.lin.hideToast()
},
fail: function(err) {
wx.lin.hideToast()
wx.lin.showToast({
icon: 'error',
title: err.msg,
})
}
})
} }
}) })
}, },
onAppointmentComplete: function () { onAppointmentComplete: function () {
...@@ -211,21 +219,26 @@ Page({ ...@@ -211,21 +219,26 @@ Page({
// 预约入园查询返回剩余名额 // 预约入园查询返回剩余名额
getResidue() { getResidue() {
var that = this var that = this
app.wxRequest({ app.login({
url: '/api/v1/subscribe/getResidue', success: function() {
data: { app.wxRequest({
subscribeDate: that.data.formDate + ' 00:00:00', url: '/api/v1/subscribe/getResidue',
type: 0, data: {
}, subscribeDate: that.data.formDate + ' 00:00:00',
success: function(res) { type: 0,
},
that.setData({ success: function(res) {
total: res.data.total,
winQuota: true, that.setData({
total: res.data.total,
winQuota: true,
})
}
}) })
} }
}) })
}, },
}) })
\ No newline at end of file
...@@ -46,8 +46,13 @@ Page({ ...@@ -46,8 +46,13 @@ Page({
this.setNavigationLogo() this.setNavigationLogo()
// //
this.getBanner() var that = this
this.loadVisiterPlanList() app.login({
success: function(token) {
that.getBanner()
that.loadVisiterPlanList()
}
})
}, },
/** /**
......
...@@ -7,7 +7,12 @@ Page({ ...@@ -7,7 +7,12 @@ Page({
data: { data: {
phone:'13685970580', phone:'13685970580',
hotline:false,//客服热线 hotline:false,//客服热线
type:1,//夜间入园 type:0,//夜间入园
name: '',
mobile: '',
num: '',
time: '',
}, },
showHotline(){ showHotline(){
this.setData({ this.setData({
...@@ -31,7 +36,15 @@ Page({ ...@@ -31,7 +36,15 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
console.log('.............', options.detail)
let detail=JSON.parse(options.detail);
this.setData({
type: detail.type,
name: detail.name,
mobile: detail.mobile,
num: detail.num,
time: detail.time,
})
}, },
/** /**
......
<navigation class="navigation" titleText="预约凭证" color="#FFFFFF" backIcon="/image/back-w.png"></navigation> <navigation class="navigation" titleText="预约凭证" color="#FFFFFF" backIcon="/image/back-w.png"></navigation>
<view class="container"> <view class="container">
<image class="Img" wx:if="{{type == 1}}" src="http://upload.miaomiao-bao.com/f6dfe202008192103225871.jpg"></image> <image class="Img" wx:if="{{type == 0}}" src="http://upload.miaomiao-bao.com/f6dfe202008192103225871.jpg"></image>
<image class="Img" wx:if="{{type == 2}}" src="http://upload.miaomiao-bao.com/8883f202008192105356616.jpg"></image> <image class="Img" wx:if="{{type == 1}}" src="http://upload.miaomiao-bao.com/8883f202008192105356616.jpg"></image>
<view class="appiont-container"> <view class="appiont-container">
<image wx:if="{{type == 1}}" class="bgcImg" src="http://upload.miaomiao-bao.com/f8e92202008192102227949.jpg"></image> <image wx:if="{{type == 0}}" class="bgcImg" src="http://upload.miaomiao-bao.com/f8e92202008192102227949.jpg"></image>
<image wx:if="{{type == 2}}" class="bgcImg" src="http://upload.miaomiao-bao.com/11174202008192100431340.jpg"></image> <image wx:if="{{type == 1}}" class="bgcImg" src="http://upload.miaomiao-bao.com/11174202008192100431340.jpg"></image>
<image class="icon" src="../../image/logo-w.png"></image> <image class="icon" src="../../image/logo-w.png"></image>
<view class="form"> <view class="form">
<image class="card" src="http://upload.miaomiao-bao.com/b6d15202008192102456807.png"></image> <image class="card" src="http://upload.miaomiao-bao.com/b6d15202008192102456807.png"></image>
<view wx:if="{{type == 1}}" class="title">夜间入园预约凭证</view> <view wx:if="{{type == 0}}" class="title">夜间入园预约凭证</view>
<view wx:if="{{type == 2}}" class="title">看房预约凭证</view> <view wx:if="{{type == 1}}" class="title">看房预约凭证</view>
<view class="form-content"> <view class="form-content">
<view class="form-item"> <view class="form-item">
<view class="form-item-nav">姓名</view> <view class="form-item-nav">姓名</view>
<view class="form-item-content">张笑寒</view> <view class="form-item-content">{{name}}</view>
</view> </view>
<view class="form-item"> <view class="form-item">
<view class="form-item-nav">手机号</view> <view class="form-item-nav">手机号</view>
<view class="form-item-content">13947484939</view> <view class="form-item-content">{{mobile}}</view>
</view> </view>
<view class="form-item" wx:if="{{type == 1}}"> <view class="form-item" wx:if="{{type == 0}}">
<view class="form-item-nav">入园人数</view> <view class="form-item-nav">入园人数</view>
<view class="form-item-content">1人</view> <view class="form-item-content">{{num}}人</view>
</view> </view>
<view class="form-item" wx:if="{{type == 1}}"> <view class="form-item" wx:if="{{type == 0}}">
<view class="form-item-nav">入园时间</view> <view class="form-item-nav">入园时间</view>
<view class="form-item-content">6月30日 20:00-24:00</view> <view class="form-item-content">{{time}}</view>
</view> </view>
<view class="form-item" wx:if="{{type == 2}}"> <view class="form-item" wx:if="{{type == 1}}">
<view class="form-item-nav">看房日期</view> <view class="form-item-nav">看房日期</view>
<view class="form-item-content">6月30日 20:00-24:00</view> <view class="form-item-content">{{time}}</view>
</view> </view>
</view> </view>
......
// pages/login/login.js // pages/login/login.js
const app = getApp()
Page({ Page({
/** /**
...@@ -6,17 +8,25 @@ Page({ ...@@ -6,17 +8,25 @@ Page({
*/ */
data: { data: {
height:'', height:'',
isphone:true, islogin:false,
islogin:true, isphone:false,
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
let mobile = wx.getStorageSync('mobile')
let nickName = wx.getStorageSync('nickName')
let avatarUrl = wx.getStorageSync('avatarUrl')
this.setData({ this.setData({
height: wx.getSystemInfoSync().windowHeight, //获取屏幕的高度 height: wx.getSystemInfoSync().windowHeight, //获取屏幕的高度
islogin: (nickName && avatarUrl) ? true : false,
isphone: (mobile) ? true : false,
}) })
}, },
/** /**
...@@ -66,5 +76,93 @@ Page({ ...@@ -66,5 +76,93 @@ Page({
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {
},
/*
* 返回
*/
back: function(e) {
if (this.data.islogin && this.data.isphone) {
console.log('授权及绑定成功')
} else {
wx.switchTab({
url: '../home/home',
})
}
},
/*
* 获取用户信息
*/
userInfoHandler(res) {
console.log('userInfo', res)
let avatarUrl = res.detail.userInfo.avatarUrl
let nickName = res.detail.userInfo.nickName
wx.setStorageSync('avatarUrl', avatarUrl)
wx.setStorageSync('nickName', nickName)
let that = this
this.registUserInfo({
param: {
avatarUrl: avatarUrl,
nickName: nickName,
sessionKey: '',
encryptedData: '',
iv: '',
},
success: function(res) {
that.setData({
islogin: true
})
setTimeout(() => {
that.checkFinish()
}, 1000)
}
})
},
/*
* 绑定手机号
*/
userPhoneHandler(res) {
console.log('userPhone', res)
let sessionKey = wx.getStorageSync('session_key')
let that = this
this.registUserInfo({
param: {
avatarUrl: wx.getStorageSync('avatarUrl'),
nickName: wx.getStorageSync('nickName'),
sessionKey: sessionKey,
encryptedData: res.detail.encryptedData,
iv: res.detail.iv,
},
success: function(res) {
wx.setStorageSync('mobile', res.data.phoneNumber)
that.setData({
isphone: true
})
setTimeout(() => {
that.checkFinish()
}, 1000)
}
})
},
registUserInfo(obj) {
app.registUserInfo({
param: obj.param,
success: function (res) {
if (obj.success) {
obj.success(res)
}
}
})
},
checkFinish() {
if (this.data.islogin && this.data.isphone) {
wx.navigateBack({})
}
} }
}) })
\ No newline at end of file
<!--pages/login/login.wxml--> <!--pages/login/login.wxml-->
<navigation class="navigation" backIcon="/image/back-w.png"></navigation> <navigation class="navigation" backIcon="/image/back-w.png" bindback="back"></navigation>
<view class="container" > <view class="container" >
<image class="bgClass" src="http://upload.miaomiao-bao.com/97b52202008201410189925.png"></image> <image class="bgClass" src="http://upload.miaomiao-bao.com/97b52202008201410189925.png"></image>
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
<image class="font" src="./image/xhslqj@2x.png" style="width:228rpx"></image> <image class="font" src="./image/xhslqj@2x.png" style="width:228rpx"></image>
<image class="font" src="./image/syrs@2x.png" style="width:228rpx"></image> <image class="font" src="./image/syrs@2x.png" style="width:228rpx"></image>
<view class="btn-contanier"> <view class="btn-contanier">
<view class="loginBtn" hidden="{{islogin}}">微信授权登录</view> <button class="loginBtn" hidden="{{islogin}}" open-type="getUserInfo" bindgetuserinfo="userInfoHandler">微信授权登录</button>
<view class="isloginBtn loginBtn" hidden="{{!islogin}}"> <view style="margin-right:10rpx;">已授权</view> <l-icon name="success" color="rgba(255,255,255,1);" size="28" /></view> <view class="isloginBtn loginBtn" hidden="{{!islogin}}"> <view style="margin-right:10rpx;">已授权</view> <l-icon name="success" color="rgba(255,255,255,1);" size="28" /></view>
<view class="loginBtn" hidden="{{isphone}}">绑定手机号</view> <button class="loginBtn" hidden="{{isphone}}" open-type="getPhoneNumber" bindgetphonenumber="userPhoneHandler">绑定手机号</button>
<view class="isloginBtn loginBtn" hidden="{{!isphone}}"><view style="margin-right:10rpx;">已绑定手机号</view><l-icon name="success" color="rgba(255,255,255,1);" size="28"/></view> <view class="isloginBtn loginBtn" hidden="{{!isphone}}"><view style="margin-right:10rpx;">已绑定手机号</view><l-icon name="success" color="rgba(255,255,255,1);" size="28"/></view>
</view> </view>
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
text-align: center; text-align: center;
color:rgba(255,255,255,1); color:rgba(255,255,255,1);
margin-bottom: 44rpx; margin-bottom: 44rpx;
font-size: 32rpx;
} }
.isloginBtn{ .isloginBtn{
......
...@@ -7,9 +7,15 @@ Page({ ...@@ -7,9 +7,15 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
mobile: '180****3535',
nickName: 'nickName',
avatarUrl: '/pages/mine/image/avatar.png',
mask:false, mask:false,
type:1, //判断是否是认证的了 type:1, //判断是否是认证的了
approveList:['园区门票优惠','餐厅价格优惠','SPA服务优惠','免费观看电影','无须预约入园','尽享多重特权'] approveList:['园区门票优惠','餐厅价格优惠','SPA服务优惠','免费观看电影','无须预约入园','尽享多重特权'],
activityList: [],
appointmentList: [],
}, },
//去认证 //去认证
goApprove(){ goApprove(){
...@@ -33,48 +39,69 @@ Page({ ...@@ -33,48 +39,69 @@ Page({
animation: true, animation: true,
}) })
}, },
myAppoinment(){
wx.navigateTo({
url: '../../pages/home/home.wxml',
})
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
}, },
onShow: function () { onShow: function () {
this.getMyActivityList() let mobile = wx.getStorageSync('mobile')
}, let nickName = wx.getStorageSync('nickName')
getUserInfo: function (funcEvent) { let avatarUrl = wx.getStorageSync('avatarUrl')
console.log(funcEvent) if (mobile && nickName && avatarUrl) {
// 用户拒绝授权 this.setData({
if (funcEvent.detail.errMsg === 'getUserInfo:fail auth deny') { mobile: this.toHide(mobile),
return nickName: nickName,
avatarUrl: avatarUrl,
})
} }
let userType = wx.getStorageSync('userType')
// 用户授权获取用户信息 this.setData({
if (funcEvent.detail.errMsg === 'getUserInfo:ok') { type: userType == 1 ? 1 : 0,
wx.login({ })
success: function (result) { },
let param = { /**
'code': result.code, * 监听 TabBar 切换点击
} */
iRequest.request({ url: 'v1/login/getSmallSession', params: param, method: 'get' }) onTabItemTap: function (item) {
.then(function (response) { console.log(item)
console.log(response) if (item.index == 3) {
}) let that = this
.catch(function (response) { app.login({
console.log(response) success: function(token) {
}) that.getMyActivityList()
}, that.getList()
fail: function (response) { let mobile = wx.getStorageSync('mobile')
console.log(response) let nickName = wx.getStorageSync('nickName')
let avatarUrl = wx.getStorageSync('avatarUrl')
let userType = wx.getStorageSync('userType')
if (mobile && nickName && avatarUrl) {
that.setData({
mobile: mobile,
nickName: nickName,
avatarUrl: avatarUrl,
type: userType == 1 ? 1 : 0,
})
} else {
wx.navigateTo({
url: '../login/login',
})
} }
}) }
})
} }
},
activityDetail(e){
wx.navigateTo({
url: '../activityDetail/activityDetail?enrollid='+e.currentTarget.dataset.enrollid,
})
},
//预约凭证
gohotelAccommodation(e){
wx.navigateTo({
url: '../hotelAccommodation/hotelAccommodation?detail='+JSON.stringify(e.currentTarget.dataset.item),
})
}, },
//点击前往修改页面 //点击前往修改页面
...@@ -91,9 +118,80 @@ Page({ ...@@ -91,9 +118,80 @@ Page({
url: '/api/v1/activity/getMyActivityList', url: '/api/v1/activity/getMyActivityList',
data: { activeState: '0,1', pageSize: 10, pageNo: 1 }, data: { activeState: '0,1', pageSize: 10, pageNo: 1 },
success: function(res) { success: function(res) {
let list = res.data.list
let tmpArr = []
list.forEach(item => {
let state = item.activeState*1
let type = 0
switch (state) {
case 0: type = 1;break;
case 1: type = 0;break;
case 2: type = 2;break;
}
let obj = {
time: item.activeDate + ' ' + item.activeTime,
type: type,
content: item.address,
title: item.name,
enrollId: item.enrollId,
}
tmpArr.push(obj)
})
that.setData({
activityList: tmpArr
})
} }
}) })
}, },
// 预约列表/我的预约
getList() {
let that = this
app.wxRequest({
url: '/api/v1/subscribe/getList',
data: {
state: '1',
type: ''//0 入园预约 1 看房预约 全部 空字符
},
success: function(res) {
let tmpArr = []
res.data.forEach(item => {
let type = item.type*1
let title = ''
let url = ''
switch (type) {
case 0:
title = '夜间入园预约'
url = 'http://upload.miaomiao-bao.com/36acd202008141719598303.jpg'
break;
case 1:
title = '看房预约'
url = 'http://upload.miaomiao-bao.com/4c644202008141702599692.jpg'
break;
}
let obj = {
title:title,
type: type,
time: item.subscribeDate,
num: item.subscribeNum,
url: url,
id: item.id,
mobile: item.mobile,
name: item.name,
}
tmpArr.push(obj)
})
that.setData({
appointmentList: tmpArr
})
}
})
},
toHide: function(array) {
var mphone = array.substring(0, 3) + '****' + array.substring(7);
return mphone;
}
}) })
\ No newline at end of file
...@@ -5,15 +5,15 @@ ...@@ -5,15 +5,15 @@
<image class="background-image" src="./image/mine.png"></image> <image class="background-image" src="./image/mine.png"></image>
<view class="row align-c"> <view class="row align-c">
<view class="mine-avatar"> <view class="mine-avatar">
<l-avatar size="112" src="/pages/mine/image/avatar.png"/> <l-avatar size="112" src="{{avatarUrl}}"/>
</view> </view>
<view class="mine-info col"> <view class="mine-info col">
<view class="row align-c"> <view class="row align-c">
<text>张笑寒</text> <text>{{nickName}}</text>
<image src="./image/inform.png" bindtap="goMyInfo"></image> <image src="./image/inform.png" bindtap="goMyInfo"></image>
</view> </view>
<view> <view>
<text>180****2524</text> <text>{{mobile}}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -23,15 +23,15 @@ ...@@ -23,15 +23,15 @@
<image class="background-image" style="height:512rpx;" src="http://upload.miaomiao-bao.com/8f046202008201043321555.jpg"></image> <image class="background-image" style="height:512rpx;" src="http://upload.miaomiao-bao.com/8f046202008201043321555.jpg"></image>
<view class="row align-c approve"> <view class="row align-c approve">
<view class="mine-avatar"> <view class="mine-avatar">
<l-avatar size="112" src="/pages/mine/image/avatar.png"/> <l-avatar size="112" src="{{avatarUrl}}"/>
</view> </view>
<view class="mine-info col"> <view class="mine-info col">
<view class="row align-c"> <view class="row align-c">
<text style="color:#F0DABB;font-weight:500;">张笑寒</text> <text style="color:#F0DABB;font-weight:500;">{{nickName}}</text>
<image src="/image/inform-w.png" bindtap="goMyInfo"></image> <image src="/image/inform-w.png" bindtap="goMyInfo"></image>
</view> </view>
<view> <view>
<text>180****2524</text> <text>{{mobile}}</text>
</view> </view>
</view> </view>
<view bindtap="maskShow" class="align-c" style="positive:relative;margin-left:68rpx;display:flex;"> <view bindtap="maskShow" class="align-c" style="positive:relative;margin-left:68rpx;display:flex;">
...@@ -55,37 +55,28 @@ ...@@ -55,37 +55,28 @@
<view class="menu"> <view class="menu">
<l-list url="../myActivity/myActivity" l-content-class="menu-title" title="我的活动"></l-list> <l-list url="../myActivity/myActivity" l-content-class="menu-title" title="我的活动"></l-list>
<!-- 我的活动 --> <!-- 我的活动 -->
<view class="my-activities"> <view class="my-activities" wx:if="{{activityList.length > 0}}">
<view class="my-activities-item"> <view class="my-activities-item" data-enrollid="{{item.enrollId}}" wx:for="{{activityList}}" wx:for-index="index" wx:for-item="item" wx:key="index" bindtap="activityDetail">
<view class="my-activities-top"> <view class="my-activities-top">
6月30日 10:00-12:00 {{item.time}}
</view> </view>
<view class="my-activities-bottom"> <view class="my-activities-bottom">
<view class="my-activities-title">艺术花仿插画体验</view> <view class="my-activities-title">{{item.title}}</view>
<view class="my-activities-content">草坪温室1号厅</view> <view class="my-activities-content">{{item.content}}</view>
</view>
</view>
<view class="my-activities-item">
<view class="my-activities-top">
6月30日 10:00-12:00
</view>
<view class="my-activities-bottom" >
<view class="my-activities-title">艺术花仿插画体验</view>
<view class="my-activities-content">草坪温室1号厅</view>
</view> </view>
</view> </view>
</view> </view>
<l-list l-content-class="menu-title" title="我的预约" url="../myAppointment/myAppointment"></l-list> <l-list l-content-class="menu-title" title="我的预约" url="../myAppointment/myAppointment"></l-list>
<!-- 我的预约 --> <!-- 我的预约 -->
<view class="my-activities"> <view class="my-activities" wx:if="{{appointmentList.length > 0}}">
<view class="my-activities-item"> <view class="my-activities-item" wx:for="{{appointmentList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="my-activities-top"> <view class="my-activities-top">
6月30日 10:00-12:00 {{item.time}}
</view> </view>
<view class="my-activities-bottom"> <view class="my-activities-bottom">
<view class="my-activities-title">夜间入院预约</view> <view class="my-activities-title">{{item.title}}</view>
<view class="my-activities-content">预约人数 3人</view> <view class="my-activities-content" wx:if="{{item.type == 0}}">预约人数 {{item.num}}人</view>
<view class="subscribe" bindtap="myAppoinment">预约凭证</view> <view class="subscribe" data-item="{{item}}" bindtap="gohotelAccommodation">预约凭证</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -106,7 +97,7 @@ ...@@ -106,7 +97,7 @@
<image src="/image/xingxing.png" class="mask-icon"></image> <image src="/image/xingxing.png" class="mask-icon"></image>
</view> </view>
<view class="mask-items"> <view class="mask-items">
<view class="maskItem" wx:for="{{approveList}}">{{item}}</view> <view class="maskItem" wx:for="{{approveList}}" wx:key="index">{{item}}</view>
</view> </view>
</view> </view>
<view class="close" bindtap="close"> <view class="close" bindtap="close">
......
// pages/myActivity/myActivity.js // pages/myActivity/myActivity.js
const app = getApp()
Page({ Page({
/** /**
...@@ -12,21 +14,19 @@ Page({ ...@@ -12,21 +14,19 @@ Page({
{content:'已结束',type:'3'}, {content:'已结束',type:'3'},
], ],
height:0, height:0,
data:[ data:[],
{time:'6月30日 10:00-12:00',type:'0',content:'云之亭广场外侧',title:'海滩夏日音乐节'},
{time:'6月30日 10:00-12:00',type:'1',content:'云之亭广场外侧',title:'海滩夏日音乐节'},
{time:'6月30日 10:00-12:00',type:'2',content:'云之亭广场外侧',title:'海滩夏日音乐节'},
],
active:0, active:0,
}, },
chageNav(e){ chageNav(e){
let index = e.currentTarget.dataset.index
this.setData({ this.setData({
active:e.currentTarget.dataset.index active: index
}) })
this.getMyActivityList(index)
}, },
activityDetail(e){ activityDetail(e){
wx.navigateTo({ wx.navigateTo({
url: '../activityDetail/activityDetail?type='+e.currentTarget.dataset.type, url: '../activityDetail/activityDetail?enrollid='+e.currentTarget.dataset.enrollid,
}) })
}, },
/** /**
...@@ -36,6 +36,7 @@ Page({ ...@@ -36,6 +36,7 @@ Page({
this.setData({ this.setData({
height: wx.getSystemInfoSync().windowHeight, //获取屏幕的高度 height: wx.getSystemInfoSync().windowHeight, //获取屏幕的高度
}) })
this.getMyActivityList(this.data.active)
}, },
/** /**
...@@ -85,5 +86,50 @@ Page({ ...@@ -85,5 +86,50 @@ Page({
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {
} },
// 我的活动
getMyActivityList(index) {
let state = ''
switch (index) {
case 0: state = ''; break;
case 1: state = 0; break;
case 2: state = 1; break;
case 3: state = 2; break;
}
var that = this
app.login({
success: function() {
app.wxRequest({
url: '/api/v1/activity/getMyActivityList',
data: { activeState: state, pageSize: 10, pageNo: 1 },
success: function(res) {
let list = res.data.list
let tmpArr = []
list.forEach(item => {
let state = item.activeState*1
let type = 0
switch (state) {
case 0: type = 1;break;
case 1: type = 0;break;
case 2: type = 2;break;
}
let obj = {
time: item.activeDate + ' ' + item.activeTime,
type: type,
content: item.address,
title: item.name,
enrollId: item.enrollId,
}
tmpArr.push(obj)
})
that.setData({
data: tmpArr
})
}
})
}
})
},
}) })
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<view bindtap="chageNav" data-index="{{index}}" wx:for="{{navItem}}" wx:key="index" class="navItem {{index == active? 'active':''}}">{{item.content}}</view> <view bindtap="chageNav" data-index="{{index}}" wx:for="{{navItem}}" wx:key="index" class="navItem {{index == active? 'active':''}}">{{item.content}}</view>
</view> </view>
<view class="activity-body" style="min-height:{{height}}rpx;"> <view class="activity-body" style="min-height:{{height}}rpx;">
<view class="my-activities-item " data-type="{{item.type}}" wx:for="{{data}}" wx:key="index" bindtap="activityDetail"> <view class="my-activities-item " data-enrollid="{{item.enrollId}}" wx:for="{{data}}" wx:key="index" bindtap="activityDetail">
<view class="my-activities-top {{item.type == 2?'timeendColor':''}}"> <view class="my-activities-top {{item.type == 2?'timeendColor':''}}">
{{item.time}} {{item.time}}
</view> </view>
......
// pages/myAppointment/myAppointment.js // pages/myAppointment/myAppointment.js
const app = getApp()
Page({ Page({
/** /**
...@@ -11,28 +12,30 @@ Page({ ...@@ -11,28 +12,30 @@ Page({
{content:'看房预约',type:'2'}, {content:'看房预约',type:'2'},
], ],
data:[ // 假数据数组,type=0入园预约,type=1 看房预约 data:[ // 假数据数组,type=0入园预约,type=1 看房预约
{title:'夜间入园预约',type:'0',time:'6月30日 20:00-24:00',num:3,url:'http://upload.miaomiao-bao.com/36acd202008141719598303.jpg'}, // {title:'夜间入园预约',type:'0',time:'6月30日 20:00-24:00',num:3,url:'http://upload.miaomiao-bao.com/36acd202008141719598303.jpg'},
{title:'看房预约',type:'1',time:'6月30日',num:3,url:' http://upload.miaomiao-bao.com/4c644202008141702599692.jpg'}, // {title:'看房预约',type:'1',time:'6月30日',num:3,url:' http://upload.miaomiao-bao.com/4c644202008141702599692.jpg'},
], ],
active:0, active:0,
}, },
// 点击导航切换,默认是全部的 // 点击导航切换,默认是全部的
chageNav(e){ chageNav(e){
let index = e.currentTarget.dataset.index
this.setData({ this.setData({
active:e.currentTarget.dataset.index active: index
}) })
this.getList(index)
}, },
//预约凭证 //预约凭证
gohotelAccommodation(){ gohotelAccommodation(e){
wx.navigateTo({ wx.navigateTo({
url: '../hotelAccommodation/hotelAccommodation', url: '../hotelAccommodation/hotelAccommodation?detail='+JSON.stringify(e.currentTarget.dataset.item),
}) })
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.getList(this.data.active)
}, },
/** /**
...@@ -82,5 +85,57 @@ Page({ ...@@ -82,5 +85,57 @@ Page({
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {
},
// 预约列表/我的预约
getList(index) {
let type = ''
switch (index) {
case 0: type = ''; break;
case 1: type = 0; break;
case 2: type = 1; break;
}
let that = this
app.wxRequest({
url: '/api/v1/subscribe/getList',
data: {
state: '',
type: type//0 入园预约 1 看房预约 全部 空字符
},
success: function(res) {
let tmpArr = []
res.data.forEach(item => {
let type = item.type*1
let title = ''
let url = ''
switch (type) {
case 0:
title = '夜间入园预约'
url = 'http://upload.miaomiao-bao.com/36acd202008141719598303.jpg'
break;
case 1:
title = '看房预约'
url = 'http://upload.miaomiao-bao.com/4c644202008141702599692.jpg'
break;
}
let obj = {
title:title,
type: type,
time: item.subscribeDate,
num: item.subscribeNum,
url: url,
id: item.id,
mobile: item.mobile,
name: item.name,
}
tmpArr.push(obj)
})
that.setData({
data: tmpArr
})
}
})
} }
}) })
\ No newline at end of file
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
<view bindtap="chageNav" data-index="{{index}}" wx:for="{{navItem}}" wx:key="index" class="navItem {{index == active? 'active':''}}">{{item.content}}</view> <view bindtap="chageNav" data-index="{{index}}" wx:for="{{navItem}}" wx:key="index" class="navItem {{index == active? 'active':''}}">{{item.content}}</view>
</view> </view>
<view class="myAppointment-body"> <view class="myAppointment-body">
<view class="myAppointment-item" wx:for="{{data}}" :key="index"> <view class="myAppointment-item" wx:for="{{data}}" wx:key="index">
<image src="{{item.url}}" class="item-img"></image> <image src="{{item.url}}" class="item-img"></image>
<view class="item-content"> <view class="item-content">
<view class="item-title {{item.type == 0 ?'item-num-1' : ''}}">{{item.title}}</view> <view class="item-title {{item.type == 0 ?'item-num-1' : ''}}">{{item.title}}</view>
<view class="item-time {{item.type == 1 ?'item-time-1' : ''}}">预约时间 {{item.time}}</view> <view class="item-time {{item.type == 1 ?'item-time-1' : ''}}">预约时间 {{item.time}}</view>
<view wx:if="{{item.type == 0}}" class="item-num">预约人数 {{item.num}}人</view> <view wx:if="{{item.type == 0}}" class="item-num">预约人数 {{item.num}}人</view>
</view> </view>
<view class="button" bindtap="gohotelAccommodation">预约凭证</view> <view class="button" data-item="{{item}}" bindtap="gohotelAccommodation">预约凭证</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
height: 360rpx; height: 360rpx;
margin: auto; margin: auto;
margin-bottom: 50rpx; margin-bottom: 50rpx;
background-color: red; background-color: rgb(220, 214, 220);
border-radius: 4px; border-radius: 4px;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
......
...@@ -5,7 +5,9 @@ Page({ ...@@ -5,7 +5,9 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
mobile: '',
nickName: '',
avatarUrl: '',
}, },
/** /**
...@@ -13,6 +15,14 @@ Page({ ...@@ -13,6 +15,14 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
let mobile = wx.getStorageSync('mobile')
let nickName = wx.getStorageSync('nickName')
let avatarUrl = wx.getStorageSync('avatarUrl')
this.setData({
mobile: this.toHide(mobile),
nickName: nickName,
avatarUrl: avatarUrl,
})
}, },
/** /**
...@@ -62,5 +72,10 @@ Page({ ...@@ -62,5 +72,10 @@ Page({
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {
},
toHide: function(array) {
var mphone = array.substring(0, 3) + '****' + array.substring(7);
return mphone;
} }
}) })
\ No newline at end of file
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
<view class="myInfo"> <view class="myInfo">
<l-list is-hover="{{false}}" l-content-class="menu-title" title="头像" is-link="{{false}}"> <l-list is-hover="{{false}}" l-content-class="menu-title" title="头像" is-link="{{false}}">
<view style="margin-bottom:30rpx;" slot="right-section"> <view style="margin-bottom:30rpx;" slot="right-section">
<l-avatar size="100" icon="user" /> <l-avatar size="100" src="{{avatarUrl}}"/>
</view> </view>
</l-list> </l-list>
<l-list is-hover="{{false}}" l-content-class="menu-title" title="姓名" is-link="{{false}}"> <l-list is-hover="{{false}}" l-content-class="menu-title" title="姓名" is-link="{{false}}">
<view slot="right-section"> <view slot="right-section">
<input style="text-align:right;" value="张楚涵" /> <input style="text-align:right;" value="{{nickName}}" />
</view> </view>
</l-list> </l-list>
<l-list is-hover="{{false}}" l-content-class="menu-title" title="性别" is-link="{{false}}"> <l-list is-hover="{{false}}" l-content-class="menu-title" title="性别" is-link="{{false}}">
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
</l-list> </l-list>
<l-list is-hover="{{false}}" l-content-class="menu-title" title="手机号" is-link="{{false}}"> <l-list is-hover="{{false}}" l-content-class="menu-title" title="手机号" is-link="{{false}}">
<view slot="right-section"> <view slot="right-section">
<view class="phone">{{phone.toHide("13685970580")}}</view> <view class="phone">{{mobile}}</view>
<!-- <view class="phone">{{phone.toHide("13685970580")}}</view> -->
</view> </view>
</l-list> </l-list>
</view> </view>
......
...@@ -13,7 +13,13 @@ Page({ ...@@ -13,7 +13,13 @@ Page({
this.setData({ this.setData({
id: options.id id: options.id
}) })
this.getNoticeDetail() let that = this
app.login({
success: function() {
that.getNoticeDetail()
}
})
}, },
queryNotice: function () { queryNotice: function () {
......
...@@ -14,7 +14,12 @@ Page({ ...@@ -14,7 +14,12 @@ Page({
onLoad: function () { onLoad: function () {
// this.queryNotice() // this.queryNotice()
this.getNoticeList() var that = this
app.login({
success: function(token) {
that.getNoticeList()
}
})
}, },
queryNotice: function () { queryNotice: function () {
......
...@@ -67,7 +67,13 @@ Page({ ...@@ -67,7 +67,13 @@ Page({
this.setData({ this.setData({
id: options.id, id: options.id,
}) })
this.loadStrategyDetail() var that = this
app.login({
success: function() {
that.loadStrategyDetail()
}
})
}, },
setInitData: function (funcIndex) { setInitData: function (funcIndex) {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"ignore": [] "ignore": []
}, },
"setting": { "setting": {
"urlCheck": false, "urlCheck": true,
"es6": true, "es6": true,
"enhance": true, "enhance": true,
"postcss": true, "postcss": true,
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
"checkInvalidKey": true, "checkInvalidKey": true,
"checkSiteMap": true, "checkSiteMap": true,
"uploadWithSourceMap": true, "uploadWithSourceMap": true,
"compileHotReLoad": false,
"babelSetting": { "babelSetting": {
"ignore": [], "ignore": [],
"disablePlugins": [], "disablePlugins": [],
"outputPath": "" "outputPath": ""
}, },
"compileHotReLoad": false,
"useIsolateContext": true, "useIsolateContext": true,
"useCompilerModule": false, "useCompilerModule": false,
"userConfirmedUseCompilerModuleSwitch": false "userConfirmedUseCompilerModuleSwitch": false
......
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