Commit ce8271ae by TengFengLian

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

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