提交 25d0e644 编写于 作者: 刘英杰's avatar 刘英杰

1025小程序代码

上级 025909f3
// app.js // app.js
App({ App({
onHide(){
wx.setStorageSync('dialog', '切换到后台')
console.log('整个小程序');
},
onLaunch() { onLaunch() {
// 展示本地存储能力 // 展示本地存储能力
const logs = wx.getStorageSync('logs') || [] const logs = wx.getStorageSync('logs') || []
...@@ -21,5 +25,6 @@ App({ ...@@ -21,5 +25,6 @@ App({
statusBarHeight:wx.getSystemInfoSync().statusBarHeight, statusBarHeight:wx.getSystemInfoSync().statusBarHeight,
pageHeight:wx.getSystemInfoSync().screenHeight-wx.getSystemInfoSync().statusBarHeight -48, pageHeight:wx.getSystemInfoSync().screenHeight-wx.getSystemInfoSync().statusBarHeight -48,
menuHeigth:(wx.getMenuButtonBoundingClientRect().top - wx.getSystemInfoSync().statusBarHeight) * 2 + wx.getMenuButtonBoundingClientRect().height, menuHeigth:(wx.getMenuButtonBoundingClientRect().top - wx.getSystemInfoSync().statusBarHeight) * 2 + wx.getMenuButtonBoundingClientRect().height,
currentAppointmentId: '', // 全局变量
} }
}) })
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
"pages": [ "pages": [
"pages/index/index", "pages/index/index",
"pages/login/login", "pages/login/login",
"pages/showQRcode/showQRcode", "pages/showQRcode/showQRcode",
"pages/subscribe/subscribe", "pages/subscribe/subscribe",
"pages/record/record" "pages/record/record",
"pages/teamAppointmentForm/teamAppointmentForm"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
......
// index.js // index.js
var config = require('../../utils/config')
var http = require('../../utils/http.js') var http = require('../../utils/http.js')
var WxParse = require('../../plugins/wxParse/wxParse.js'); var WxParse = require('../../plugins/wxParse/wxParse.js');
import Toast from '@vant/weapp/toast/toast';
// 获取应用实例 // 获取应用实例
const app = getApp() const app = getApp()
...@@ -12,13 +12,25 @@ Page({ ...@@ -12,13 +12,25 @@ Page({
statusBarHeight:app.globalData.statusBarHeight, statusBarHeight:app.globalData.statusBarHeight,
show: false, show: false,
countdown:0, countdown:0,
initInfo:{} initInfo:{},
hight:null, //高度参数
backgroungImageArray:[],
imageProtocolHost:config.imageProtocolHost,
}, },
ewm(){
wx.scanCode({
scanType:['qrCode'],
success (res) {
console.log(res)
}
})
},
//同意入馆须知 //同意入馆须知
agreeGo(){ agreeGo(){
wx.setStorageSync('isAgreeGo', true) wx.setStorageSync('isAgreeGo', true)
this.setData({ show: false }); this.setData({ show: false });
wx.removeStorageSync('dialog')
}, },
//获取博物馆初始化配置 //获取博物馆初始化配置
...@@ -46,6 +58,27 @@ Page({ ...@@ -46,6 +58,27 @@ Page({
false false
) )
}, },
// 获取小程序主页背景图片
getInitImageList(){
var that = this
http.postData(
'/Carousel/GetUseCarouselList',
// 请求参数
{},
function (res) {
if (res.code == 1) {
let initInfo = res.response;
that.setData({
backgroungImageArray: initInfo
})
}
},
function (err) {
console.log('请求失败:' + err);
},
false
)
},
//展开入馆须知 //展开入馆须知
onClickShow() { onClickShow() {
...@@ -55,19 +88,47 @@ Page({ ...@@ -55,19 +88,47 @@ Page({
//路由跳转 //路由跳转
navigateToSubscribe(e) { navigateToSubscribe(e) {
// console.log("ttttt",e.currentTarget.dataset.url) // console.log("ttttt",e.currentTarget.dataset.url)
// if(wx.getStorage('token')){
// }
wx.navigateTo({ wx.navigateTo({
url: e.currentTarget.dataset.url url: e.currentTarget.dataset.url
}) })
}, },
onLoad() { onLoad() {
wx.login({
success: (res) => {
console.log('rs',res)
},
})
var that = this; var that = this;
var winHeight = wx.getSystemInfoSync().windowHeight //设置变量存放屏幕高度值
console.log(winHeight) //打印屏幕高度
winHeight = winHeight - winHeight*0.6
this.setData({
hight:winHeight //传递值
})
that.getInitInfo() //请求初始化数据 that.getInitInfo() //请求初始化数据
//第一步,启动时判断是否打开入馆须知 //第一步,启动时判断是否打开入馆须知
let isAgreeGo = wx.getStorageSync('isAgreeGo') //判断是否同意 let isAgreeGo = wx.getStorageSync('isAgreeGo') //判断是否同意
if(!isAgreeGo){ // if(!isAgreeGo){
//如果没同意过,打开并启动倒计时5秒 // //如果没同意过,打开并启动倒计时5秒
// this.setData({ show: true,countdown:5 });
// let clock = setInterval(() => {
// if(that.data.countdown === 0) {
// clearInterval(clock);//清除周期
// }else {
// that.data.countdown--
// that.setData({countdown: that.data.countdown})
// }
// }, 1000);
// }
if(!wx.getStorageSync('dialog')){
this.setData({ show: true,countdown:5 }); this.setData({ show: true,countdown:5 });
let clock = setInterval(() => { let clock = setInterval(() => {
if(that.data.countdown === 0) { if(that.data.countdown === 0) {
...@@ -77,11 +138,29 @@ Page({ ...@@ -77,11 +138,29 @@ Page({
that.setData({countdown: that.data.countdown}) that.setData({countdown: that.data.countdown})
} }
}, 1000); }, 1000);
} }
// WxParse.wxParse('content', 'html', that.data.content, that, 10); // WxParse.wxParse('content', 'html', that.data.content, that, 10);
// WxParse.wxParse('jianjie', 'html', that.data.jianjie, that, 10); // WxParse.wxParse('jianjie', 'html', that.data.jianjie, that, 10);
}, },
onShow(){
var that = this;
if(wx.getStorageSync('dialog')){
this.setData({ show: true,countdown:5 });
let clock = setInterval(() => {
if(that.data.countdown === 0) {
clearInterval(clock);//清除周期
}else {
that.data.countdown--
that.setData({countdown: that.data.countdown})
}
}, 1000);
}
that.getInitImageList() //请求初始化swiper 图片数组
},
onShareAppMessage(){
return{
title:'琼台博物馆预约',
path: "pages/index/index",
}
}
}) })
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
"van-overlay": "@vant/weapp/overlay/index", "van-overlay": "@vant/weapp/overlay/index",
"van-divider": "@vant/weapp/divider/index", "van-divider": "@vant/weapp/divider/index",
"van-icon": "@vant/weapp/icon/index", "van-icon": "@vant/weapp/icon/index",
"van-button": "@vant/weapp/button/index" "van-button": "@vant/weapp/button/index",
"van-toast": "@vant/weapp/toast/index"
}, },
"navigationStyle": "custom", "navigationStyle": "custom",
"navigationBarTitleText": "琼台师范学院博物馆" "navigationBarTitleText": "琼台师范学院博物馆"
......
<!--index.wxml--> <!--index.wxml-->
<import src="../../plugins/wxParse/wxParse.wxml" /> <import src="../../plugins/wxParse/wxParse.wxml" />
<view class="home-container"> <view class="home-container">
<view class="top"> <view class="top">
<image mode="widthFix" src="../../images/home.png" />
<!-- 多张 轮播 -->
<swiper autoplay="{{true}}" circular="{{true}}" style="height: {{hight}}px;width: 100%;" wx:if="{{backgroungImageArray.length>1}}">
<swiper-item wx:for="{{backgroungImageArray}}" wx:for-item="item">
<image mode="widthFix" src="{{imageProtocolHost+item.path}}" />
</swiper-item>
</swiper>
<!-- 一张 不轮播 -->
<image wx:if="{{backgroungImageArray.length===1}}" mode="widthFix" wx:for="{{backgroungImageArray}}" wx:for-item="item" src="{{imageProtocolHost+item.path}}" />
<view class="home-logo" style="top:{{statusBarHeight}}px"> <view class="home-logo" style="top:{{statusBarHeight}}px">
<!-- (menu.top - sysInfo.statusBarHeight) * 2 + menu.height --> <!-- (menu.top - sysInfo.statusBarHeight) * 2 + menu.height -->
<!-- style="height:{{menuHeigth}}px" --> <!-- style="height:{{menuHeigth}}px" -->
<image mode="widthFix" src="../../images/logo.png" /> <image mode="widthFix" src="../../images/logo.png" />
</view> </view>
</view> </view>
<view class="box"> <view class="box">
<view class='bg-img'> <view class='bg-img'>
<image src="../../images/home-bg.png" /> <image src="../../images/home-bg.png" />
</view> </view>
<view class="box-content"> <view class="box-content">
<view class="intro"> <view class="intro">
<view class="intro-title"> <view class="intro-title">
...@@ -32,11 +37,13 @@ ...@@ -32,11 +37,13 @@
</view> </view>
</view> </view>
<van-toast id="van-toast" />
<view class="inner"> <view class="inner">
<!-- 散客预约 --> <!-- 散客预约 -->
<view class="item" bindtap="navigateToSubscribe" data-url="../subscribe/subscribe?subscribeType=0&title=散客预约"> <view class="item" bindtap="navigateToSubscribe" data-url="../subscribe/subscribe?subscribeType=0&title=散客预约">
<view class='item-bg-img'> <view class='item-bg-img'>
<image mode="widthFix" src="../../images/view-bg.png" /> <image mode="widthFix" src="../../images/newsktd.png" />
</view> </view>
<view class="item-content"> <view class="item-content">
<view class="item-title">散客预约</view> <view class="item-title">散客预约</view>
...@@ -48,7 +55,7 @@ ...@@ -48,7 +55,7 @@
<!-- 团队预约 --> <!-- 团队预约 -->
<view class="item" bindtap="navigateToSubscribe" data-url="../subscribe/subscribe?subscribeType=1&title=团队预约"> <view class="item" bindtap="navigateToSubscribe" data-url="../subscribe/subscribe?subscribeType=1&title=团队预约">
<view class='item-bg-img'> <view class='item-bg-img'>
<image mode="widthFix" src="../../images/view-bg.png" /> <image mode="widthFix" src="../../images/newsktd.png" />
</view> </view>
<view class="item-content"> <view class="item-content">
<view class="item-title">团队预约</view> <view class="item-title">团队预约</view>
...@@ -60,7 +67,7 @@ ...@@ -60,7 +67,7 @@
<!-- 公务接待预约 --> <!-- 公务接待预约 -->
<view class="long-item" bindtap="navigateToSubscribe" data-url="../subscribe/subscribe?subscribeType=2&title=公务接待预约"> <view class="long-item" bindtap="navigateToSubscribe" data-url="../subscribe/subscribe?subscribeType=2&title=公务接待预约">
<view class='item-bg-img'> <view class='item-bg-img'>
<image mode="widthFix" src="../../images/long-view-bg1.png" /> <image mode="widthFix" src="../../images/newgwjd.png" />
</view> </view>
<view class="item-content"> <view class="item-content">
<view class="item-title">公务接待预约</view> <view class="item-title">公务接待预约</view>
...@@ -73,7 +80,7 @@ ...@@ -73,7 +80,7 @@
<!-- 预约记录 --> <!-- 预约记录 -->
<view class="long-item" bindtap="navigateToSubscribe" data-url="../record/record?title=预约记录"> <view class="long-item" bindtap="navigateToSubscribe" data-url="../record/record?title=预约记录">
<view class='item-bg-img'> <view class='item-bg-img'>
<image mode="widthFix" src="../../images/long-view-bg2.png" /> <image mode="widthFix" src="../../images/newyyjl.png" />
</view> </view>
<view class="item-content"> <view class="item-content">
<view class="item-title">预约记录</view> <view class="item-title">预约记录</view>
...@@ -82,7 +89,8 @@ ...@@ -82,7 +89,8 @@
</view> </view>
</view> </view>
</view> </view>
<view>{{token}}</view>
<!-- <button bindtap="ewm">测</button> -->
</view> </view>
</view> </view>
......
.swiper{
height: 350px;
width: 100%;
}
@import "../../plugins/wxParse/wxParse.wxss"; @import "../../plugins/wxParse/wxParse.wxss";
::-webkit-scrollbar{ ::-webkit-scrollbar{
......
// pages/login/login.js // pages/login/login.js
var http = require('../../utils/http.js') var http = require('../../utils/http.js')
import Toast from '@vant/weapp/toast/toast';
Page({ Page({
/** /**
...@@ -11,20 +13,20 @@ Page({ ...@@ -11,20 +13,20 @@ Page({
codePhone:"无", codePhone:"无",
codeLogin:"无" codeLogin:"无"
}, },
getRealtimePhoneNumber(e) { getRealtimePhoneNumber(e) {
var that = this var that = this
console.log("code: ", e.detail.code) console.log("code: ", e.detail.code)
wx.login({ wx.login({
success(loginRes) { success(loginRes) {
``
if (loginRes.code) { if (loginRes.code) {
console.log("wx.loginCode", loginRes.code) console.log("wx.loginCode", loginRes.code)
that.setData({ that.setData({
codePhone: e.detail.code, codePhone: e.detail.code,
codeLogin: loginRes.code codeLogin: loginRes.code,
}) })
//发起网络请求 //发起网络请求
http.getData( http.getData(
'Login/api/Login/GetMiNiprogramToken', 'Login/api/Login/GetMiNiprogramToken',
...@@ -39,9 +41,12 @@ Page({ ...@@ -39,9 +41,12 @@ Page({
const loginInfo = res.response; const loginInfo = res.response;
wx.setStorageSync('token', loginInfo.access_token.token_content) wx.setStorageSync('token', loginInfo.access_token.token_content)
wx.setStorageSync('refreshToken', loginInfo.refresh_token.token_content); wx.setStorageSync('refreshToken', loginInfo.refresh_token.token_content);
// wx.setStorageSync('Token', loginRes.code)
wx.navigateBack({ wx.navigateBack({
delta: 1 delta: 1
}) })
} }
}, },
function (err) { function (err) {
...@@ -49,6 +54,7 @@ Page({ ...@@ -49,6 +54,7 @@ Page({
}, },
false false
) )
} else { } else {
console.log('登录失败!', loginRes) console.log('登录失败!', loginRes)
wx.showToast({ wx.showToast({
...@@ -59,6 +65,7 @@ Page({ ...@@ -59,6 +65,7 @@ Page({
} }
} }
}) })
}, },
// getRealtimePhoneNumber(){ // getRealtimePhoneNumber(){
// console.log("111111111111111111") // console.log("111111111111111111")
......
{ {
"usingComponents": { "usingComponents": {
"van-button": "@vant/weapp/button/index", "van-button": "@vant/weapp/button/index",
"van-checkbox": "@vant/weapp/checkbox/index" "van-checkbox": "@vant/weapp/checkbox/index",
"van-toast": "@vant/weapp/toast/index"
}, },
"navigationBarTitleText": "登录" "navigationBarTitleText": "登录"
} }
\ No newline at end of file
...@@ -13,10 +13,9 @@ ...@@ -13,10 +13,9 @@
<van-checkbox value="{{ checked }}" icon-size="32rpx" shape="square" bind:change="onChange" /> <van-checkbox value="{{ checked }}" icon-size="32rpx" shape="square" bind:change="onChange" />
<text style="color: #999;">已阅读并同意<text class="tip-text">《隐私权政策》</text><text class="tip-text">《用户协议》</text></text> <text style="color: #999;">已阅读并同意<text class="tip-text">《隐私权政策》</text><text class="tip-text">《用户协议》</text></text>
</view> </view>
<!-- <text style="margin-top: 50px;" selectable>{{codePhone}}</text> <!-- <text style="margin-top: 50px;" selectable>{{codePhone}}</text>
<text style="margin-top: 50px;" selectable>{{codeLogin}}</text> --> <text style="margin-top: 50px;" selectable>{{codeLogin}}</text> -->
<van-toast id="van-toast" />
</view> </view>
</view> </view>
\ No newline at end of file
// pages/record/record.js // pages/record/record.js
var http = require('../../utils/http.js') var http = require('../../utils/http.js')
const app = getApp() const app = getApp()
import Dialog from '@vant/weapp/dialog/dialog';
import Toast from '@vant/weapp/toast/toast';
Page({ Page({
/** /**
...@@ -13,10 +16,189 @@ Page({ ...@@ -13,10 +16,189 @@ Page({
pageIndex: 1,//页 pageIndex: 1,//页
recordList: [], //预约记录 recordList: [], //预约记录
employ_state: 1, employ_state: 1,
currentAppointmentId:'', // 当前分享的组队id
awaitSubmitList:false, // 待提交列表
list: [],
result: [],
teamId:'',
type:'',
arrayLengthzero:'',
timer:'',
},
// 弹窗
modal(res){
if(res.code !== 1){
Toast.fail('异常:'+res.code);
}else{
Toast.success('操作成功!');
}
},
//同意申请
consentApplication(){
const _this = this
if(_this.data.result.length !== 0){
http.postData(
'ChangeCommit/api/changeCommit/BatchInserAppointment',
_this.data.result,
function (res) {
_this.modal(res)
_this.setData({
result:[]
})
},
function (err) {
_this.modal(err)
},
true
)
_this.awaitSubmitListFunction()
}else if(_this.data.result.length=== 0){
Toast.fail('数据为空!');
}
},
//拒绝申请(删除)
daleteInfoMap(){
const _this = this
if(_this.data.result.length !== 0){
_this.data.result.forEach((curent,index)=>{
_this.daleteInfo(curent)
})
setTimeout(()=>{
_this.awaitSubmitListFunction()
},50)
}else if(_this.data.result.length === 0){
Toast.fail('数据为空!')
}
},
daleteInfo(e){
const _this = this
console.log( _this.data.result);
http.getData(
'ChangeCommit/api/changeCommit/ChangeCommitDelete',
{changeCommitId:e},
function (res) {
_this.modal(res)
_this.setData({
result:[]
})
},
function (err) {
console.log(err);
},
true
)
},
//获取同行人视图选中记录Id
onChangeCheckbox(event) {
const _this = this
_this.setData({
result: event.detail,
});
},
// 多选事件
toggle(event) {
console.log(event,'toggle');
const { index } = event.currentTarget.dataset;
const checkbox = this.selectComponent(`.checkboxes-${index}`);
checkbox.toggle();
},
//待提交列表显隐
onClickShow() {
this.setData({ awaitSubmitList: true });
},
//待提交列表显隐
onClickHide() {
this.setData({ awaitSubmitList: false });
this.getSubcsribeInfo()
},
//待提交列表按钮(初始化列表)
awaitSubmitListFunction(e=''){
const _this = this
if(e){
_this.setData({
teamId:e.currentTarget.dataset.appointmentid,
type:e.currentTarget.dataset.type
})
http.getData(
'ChangeCommit/api/changeCommit/GetChangeCommitList',
{appointmentId:_this.data.teamId,page_index:1,page_size:20},
function(res){
console.log(res.response.data);
_this.setData({
list:res.response.data
})
},
function(err){
console.log(err);
},
true
)
}else if(e === ''){
http.getData(
'ChangeCommit/api/changeCommit/GetChangeCommitList',
{appointmentId:_this.data.teamId,page_index:1,page_size:20},
function(res){
console.log(res.response.data,'res.response.data');
_this.setData({
list:res.response.data
})
},
function(err){
console.log(err);
},
true
)
}
_this.setData({
awaitSubmitList:true
})
},
//预约分享获取id
openShareFromFunction(e){
let _this = this
_this.setData({
currentAppointmentId:e.currentTarget.dataset.appointmentid
})
},
// 取消预约按钮事件
cancelAppointment(e){
let _this = this
Dialog.confirm({
title: '取消预约',
message: '是否确认取消此次预约?',
}).then((res) => {
http.getData( 'Background/api/guest/AppointmentCancel' ,
{ "appointmentid":e.currentTarget.dataset.appointmentid},
function(res){
Toast.success(res.msg)
},
function(err){
console.log(err);
}
,true)
_this.getSubcsribeInfo()
})
.catch((err)=>{
console.log(err,2);
})
}, },
onChange(event) { onChange(event) {
console.log(event.detail) console.log(event.detail,'event.detail')
//employ_state 1-待使用 2-已使用 3-预约变更 4-预约过期 //employ_state 1-待使用 2-已使用 3-预约变更 4-预约过期
let employ_state = 1 let employ_state = 1
if (event.detail.title) { if (event.detail.title) {
...@@ -43,13 +225,18 @@ Page({ ...@@ -43,13 +225,18 @@ Page({
}, },
navigateToSubscribe(e) { navigateToSubscribe(e) {
console.log('12312',e);
var that = this
// console.log("ttttt",e.currentTarget.dataset.url) // console.log("ttttt",e.currentTarget.dataset.url)
clearTimeout(that.timer)
that.timer = setTimeout(()=>{
wx.navigateTo({ wx.navigateTo({
url: e.currentTarget.dataset.url url: e.currentTarget.dataset.url
}) })
},500)
}, },
//获取预约记录 //获取预约记录 url, getData, doSuccess, doFail, needToken
getSubcsribeInfo() { getSubcsribeInfo() {
var that = this var that = this
http.getData( http.getData(
...@@ -62,8 +249,32 @@ Page({ ...@@ -62,8 +249,32 @@ Page({
}, },
function (res) { function (res) {
console.log("res", res) console.log("res", res)
if (res.code == 1) { if (res.code === 1) {
var recordList = that.data.recordList.concat(res.response.data) var recordList
if(that.data.employ_state === 1){
that.setData({
recordList: [],
})
}
if(that.data.employ_state === 2){
// recordList.forEach((cur,index)=>{
// if(! !!recordList.length){
// // that.arrayLengthzero = !!recordList.length
// }
// recordList.splice(index, 1);
// })
that.setData({
recordList: [],
})
}
recordList = that.data.recordList.concat(res.response.data)
console.log(recordList,'recordList');
var flag var flag
var pageIndex = that.data.pageIndex var pageIndex = that.data.pageIndex
if (recordList.length < res.response.data_count) { if (recordList.length < res.response.data_count) {
...@@ -105,7 +316,9 @@ Page({ ...@@ -105,7 +316,9 @@ Page({
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad() {
// this.getSubcsribeInfo()
// try { // try {
...@@ -162,7 +375,12 @@ Page({ ...@@ -162,7 +375,12 @@ Page({
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() { onShareAppMessage(e) {
return {
title:'同行人预约填写',
path :`pages/teamAppointmentForm/teamAppointmentForm?currentAppointmentObject=${JSON.stringify(e.target.dataset.detail)}`,
}
// }, 30);
} }
}) })
//?currentAppointmentId=${_this.data.currentAppointmentId}
\ No newline at end of file
...@@ -2,7 +2,17 @@ ...@@ -2,7 +2,17 @@
"usingComponents": { "usingComponents": {
"van-tab": "@vant/weapp/tab/index", "van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index", "van-tabs": "@vant/weapp/tabs/index",
"van-empty": "@vant/weapp/empty/index" "van-empty": "@vant/weapp/empty/index",
"van-button": "@vant/weapp/button/index",
"van-dialog": "@vant/weapp/dialog/index",
"van-overlay": "@vant/weapp/overlay/index",
"van-checkbox": "@vant/weapp/checkbox/index",
"van-checkbox-group": "@vant/weapp/checkbox-group/index",
"van-cell": "@vant/weapp/cell/index",
"van-cell-group": "@vant/weapp/cell-group/index",
"van-popup": "@vant/weapp/popup/index",
"van-toast": "@vant/weapp/toast/index",
"van-submit-bar": "@vant/weapp/submit-bar/index"
}, },
"navigationBarTitleText": "预约记录" "navigationBarTitleText": "预约记录"
} }
\ No newline at end of file
<wxs src="../../wxs/tools.wxs" module="tools" /> <wxs src="../../wxs/tools.wxs" module="tools" />
<view class="record-container"> <view class="record-container">
<van-tabs active="{{ active }}" color="#d59171" title-active-color="#d59171" bind:change="onChange"> <van-tabs active="{{ active }}" color="#d59171" title-active-color="#d59171" bind:change="onChange">
<van-tab title="待使用"> <van-tab title="待使用" >
<scroll-view wx:if="{{recordList.length>0}}" scroll-y="true" style="height: {{windowHeight -60}}px;" bindscrolltolower="loadMore"> <scroll-view wx:if="{{recordList.length>0}}" scroll-y="true" style="height: {{windowHeight -60}}px;" bindscrolltolower="loadMore">
<!-- 一条表单记录 --> <!-- 一条表单记录 -->
<view wx:for="{{recordList}}" wx:for-item="recordItem" class="record-item" bindtap="navigateToSubscribe" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type==1?'团队预约':recordItem.type==2?'公务接待预约':'散客预约'}}" > <view wx:for="{{recordList}}" wx:for-item="recordItem" class="record-item" >
<!-- 记录内容部分 -->
<view bindtap="navigateToSubscribe" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type===1?'团队预约':recordItem.type===2?'公务接待预约':'散客预约'}}">
<!-- 标题 --> <!-- 标题 -->
<view class="record-title-box"> <view class="record-title-box">
{{recordItem.type==1?'团队预约':recordItem.type==2?'公务接待预约':'散客预约'}} {{recordItem.type===1?'团队预约':recordItem.type===2?'公务接待预约':'散客预约'}}
</view> </view>
<!-- 预约详情 --> <!-- 预约详情 -->
<view class="record-content-box"> <view class="record-content-box">
<!-- -->
<view class="record-content-item"> <view class="record-content-item">
<view class="info-item-label">参观日期</view> <view class="info-item-label">参观日期</view>
<view class="info-item-value"> {{tools.formatTimeToDate(recordItem.museum_date, 'Y年M月D日')}} <text>{{recordItem.moment==1?'上午':'下午'}}</text></view> <view class="info-item-value"> {{tools.formatTimeToDate(recordItem.museum_date, 'Y年M月D日')}} <text>{{recordItem.moment===1?'上午':'下午'}}</text></view>
</view> </view>
<!-- -->
<view class="record-content-item"> <view class="record-content-item">
<view class="info-item-label">预约时间</view> <view class="info-item-label">预约时间</view>
<view class="info-item-value"> {{tools.formatTimeToDate(recordItem.createtime, 'Y-M-D h:m:s')}}</view> <!-- <view class="info-item-value"> {{tools.formatTimeToDate(recordItem.createtime, 'Y-M-D h:m:s')}}</view> -->
<view class="info-item-value"> {{tools.formatTimeToDate(recordItem.createtime, 'Y-M-D')}}</view>
</view> </view>
<!-- -->
<view class="record-content-item"> <view class="record-content-item">
<view class="info-item-label">人数</view> <view class="info-item-label">人数</view>
<view class="info-item-value">{{recordItem.num}}人</view> <view class="info-item-value">{{recordItem.num}}人</view>
</view> </view>
</view> </view>
</view>
<!-- 取消预约 -->
<view class="record-content-item">
<view class="info-item-label"></view>
<view class="info-item-value">
<!-- 待提交列表 -->
<van-button wx:if="{{recordItem.type === 1 || recordItem.type === 2}}" color="#D59171" size="small" bind:tap="awaitSubmitListFunction" data-type="{{recordItem.type}}" data-appointmentid="{{recordItem.appointmentid}}" style=" margin-right: 10px;" type="danger">待提交列表</van-button>
<!-- 预约分享 -->
<van-button wx:if="{{recordItem.type === 1 || recordItem.type === 2}}" color="#D59171" size="small" dataset="{{recordItem}}" open-type="share" bind:tap="openShareFromFunction" data-appointmentid="{{recordItem.appointmentid}}" style=" margin-right: 10px;" type="danger">预约分享</van-button>
<!-- 通行凭证 -->
<van-button style="margin-right: 10px;" color="#D59171" size="small" bindtap="navigateToSubscribe" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type===1?'团队预约':recordItem.type===2?'公务接待预约':'散客预约'}}">通行凭证</van-button>
<!-- 取消预约 -->
<van-button color="#D59171" size="small" bind:tap="cancelAppointment" data-appointmentid="{{recordItem.appointmentid}}" type="danger">取消预约</van-button>
</view>
</view>
<!-- <van-button type="primary" bind:click="onClickShow">嵌入内容</van-button> -->
<van-overlay z-index="1" show="{{awaitSubmitList}}" >
<view class="wrapper" >
<van-empty description="暂无数据" wx:if="{{list.length === 0}}"/>
<view class="block" wx:if="{{list.length !== 0}}" >
<scroll-view style="height: 100%;" scroll-y type="list" >
<view style="padding: 20px 20px; display: flex; justify-content: center;">待提交列表</view>
<van-checkbox-group value="{{ result }}" bind:change="onChangeCheckbox" >
<van-cell-group>
<van-cell
wx:for="{{ list }}"
wx:key="index"
value-class="value-class"
clickable
data-index="{{ index }}"
bind:click="toggle"
>
<view slot="title">
<view class="van-cell-text" style="width: 30%;">{{item.name}}</view>
<view class="van-cell-text" style="width: 70%;" wx:if="{{type === 1}}">{{item.identity_num}}</view>
<view class="van-cell-text" style="width: 70%;" wx:if="{{type === 2}}">{{item.position}}</view>
</view>
<van-checkbox
class="checkboxes-{{ index }}"
name="{{item.id}}"
/>
</van-cell>
</van-cell-group>
</van-checkbox-group>
</scroll-view>
<view class="listCustomTabbar">
<van-button color="#D59171" bind:click="onClickHide" size="small" type="warning">关闭界面</van-button>
<van-button color="#D59171" bind:click="daleteInfoMap" size="small" type="warning">删除</van-button>
<van-button color="#D59171" bind:click="consentApplication" size="small" type="warning">同意</van-button>
</view>
</view>
</view>
</van-overlay>
<van-toast id="van-toast" />
<van-dialog id="van-dialog" confirm-button-color="#D59171"/>
<van-toast id="van-toast" />
</view> </view>
</scroll-view> </scroll-view>
<view wx:else> <view wx:else>
<van-empty description="暂无记录" /> <van-empty description="暂无记录" />
</view> </view>
</van-tab> </van-tab>
<van-tab title="已使用"> <van-tab title="已使用" >
<scroll-view wx:if="{{recordList.length>0}}" scroll-y="true" style="height: {{windowHeight -60}}px;" bindscrolltolower="loadMore"> <scroll-view wx:if="{{recordList.length>0}}" scroll-y="true" style="height: {{windowHeight -60}}px;" bindscrolltolower="loadMore">
<!-- 一条表单记录 --> <!-- 一条表单记录 -->
<view wx:for="{{recordList}}" wx:for-item="recordItem" class="record-item" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type==1?'团队预约':recordItem.type==2?'公务接待预约':'散客预约'}}" > <view bindtap="navigateToSubscribe" wx:for="{{recordList}}" wx:for-item="recordItem" class="record-item" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type==1?'团队预约':recordItem.type==2?'公务接待预约':'散客预约'}}" >
<!-- <view bindtap="navigateToSubscribe" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type===1?'团队预约':recordItem.type===2?'公务接待预约':'散客预约'}}"></view> -->
<!-- 标题 --> <!-- 标题 -->
<view class="record-title-box"> <view class="record-title-box">
{{recordItem.type==1?'团队预约':recordItem.type==2?'公务接待预约':'散客预约'}} {{recordItem.type==1?'团队预约':recordItem.type==2?'公务接待预约':'散客预约'}}
...@@ -48,13 +126,19 @@ ...@@ -48,13 +126,19 @@
</view> </view>
<view class="record-content-item"> <view class="record-content-item">
<view class="info-item-label">预约时间</view> <view class="info-item-label">预约时间</view>
<view class="info-item-value"> {{tools.formatTimeToDate(recordItem.createtime, 'Y-M-D h:m:s')}}</view> <!-- <view class="info-item-value"> {{tools.formatTimeToDate(recordItem.createtime, 'Y-M-D h:m:s')}}</view> -->
<view class="info-item-value"> {{tools.formatTimeToDate(recordItem.createtime, 'Y-M-D ')}}</view>
</view> </view>
<view class="record-content-item"> <view class="record-content-item">
<view class="info-item-label">人数</view> <view class="info-item-label">人数</view>
<view class="info-item-value">{{recordItem.num}}人</view> <view class="info-item-value">{{recordItem.num}}人</view>
</view> </view>
<view style="display: flex;justify-content: flex-end;">
<!-- 通行凭证 -->
<van-button color="#D59171" size="small" bindtap="navigateToSubscribe" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type===1?'团队预约':recordItem.type===2?'公务接待预约':'散客预约'}}">通行凭证</van-button>
</view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
...@@ -64,7 +148,7 @@ ...@@ -64,7 +148,7 @@
</view> </view>
</van-tab> </van-tab>
<van-tab title="预约过期"> <van-tab title="预约过期" >
<scroll-view wx:if="{{recordList.length>0}}" scroll-y="true" style="height: {{windowHeight -60}}px;" bindscrolltolower="loadMore"> <scroll-view wx:if="{{recordList.length>0}}" scroll-y="true" style="height: {{windowHeight -60}}px;" bindscrolltolower="loadMore">
<!-- 一条表单记录 --> <!-- 一条表单记录 -->
<view wx:for="{{recordList}}" wx:for-item="recordItem" class="record-item" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type==1?'团队预约':recordItem.type==2?'公务接待预约':'散客预约'}}" > <view wx:for="{{recordList}}" wx:for-item="recordItem" class="record-item" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type==1?'团队预约':recordItem.type==2?'公务接待预约':'散客预约'}}" >
......
...@@ -54,3 +54,37 @@ ...@@ -54,3 +54,37 @@
font-size: 28rpx; font-size: 28rpx;
} }
.wrapper {
display: flex;
/* align-items: center; */
justify-content: center;
height: 100%;
/* opacity:1; */
background-color: #fff;
/* background-color:#ffc993 ; */
}
.block {
width: 100%;
height:90%;
background-color: #fff;
/* background-image: url(../../images/home.jpg); */
}
.listCustomTabbar{
height: 11%;
background-color: #f2eee9;
display: flex ;
justify-content: space-around;
align-items: center;
}
.value-class {
flex: none !important;
}
\ No newline at end of file
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
</view> </view>
<view class="record-content-item"> <view class="record-content-item">
<view class="info-item-label">预约时间</view> <view class="info-item-label">预约时间</view>
<view class="info-item-value">{{tools.formatTimeToDate(record.createtime, 'Y-M-D h:m:s')}}</view> <!-- <view class="info-item-value">{{tools.formatTimeToDate(record.createtime, 'Y-M-D h:m:s')}}</view> -->
<view class="info-item-value">{{tools.formatTimeToDate(record.createtime, 'Y-M-D')}}</view>
</view> </view>
<view class="record-content-item"> <view class="record-content-item">
<view class="info-item-label">人数</view> <view class="info-item-label">人数</view>
......
此差异已折叠。
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
"van-button": "@vant/weapp/button/index", "van-button": "@vant/weapp/button/index",
"van-stepper": "@vant/weapp/stepper/index", "van-stepper": "@vant/weapp/stepper/index",
"van-calendar": "@vant/weapp/calendar/index", "van-calendar": "@vant/weapp/calendar/index",
"van-field": "@vant/weapp/field/index" "van-field": "@vant/weapp/field/index",
"van-toast": "@vant/weapp/toast/index"
}, },
"navigationBarTitleText": "散客预约" "navigationBarTitleText": "散客预约"
} }
\ No newline at end of file
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
</van-calendar> </van-calendar>
<!-- 参观日期及场次 --> <!-- 参观日期及场次 -->
<view class="time-box"> <view class="time-box" >
<!-- style="width: 684rpx; height: 545rpx; display: block; box-sizing: border-box" -->
<view class="time-title"> <view class="time-title">
琼台书院博物馆 琼台书院博物馆
</view> </view>
...@@ -116,16 +117,16 @@ ...@@ -116,16 +117,16 @@
</view> </view>
<form bindsubmit='onSubscribe'> <form bindsubmit='onSubscribe'>
<!-- style="width: 684rpx; height: 459rpx; display: block; box-sizing: content-box" -->
<!-- 参观人员 散客 --> <!-- 参观人员 散客 -->
<view class="person-container" wx:if="{{subscribeType==0}}"> <view class="person-container" wx:if="{{subscribeType==0}}" >
<!-- style="width: 674rpx; height: 723rpx; display: block; box-sizing: border-box" -->
<form bindsubmit="addPerson"> <form bindsubmit="addPerson">
<view class="person-box" wx:for="{{visitFromList}}" wx:for-item="visitItem" wx:key="index"> <view class="person-box" wx:for="{{visitFromList}}" wx:for-item="visitItem" wx:key="index">
<view class="person-title">参观人员{{index+1}}</view> <view class="person-title">参观人员{{index+1}}</view>
<view class="person-info-box"> <view class="person-info-box">
<view class="person-info-del" wx:if="{{visitFromList.length>1}}"> <view class="person-info-del" wx:if="{{visitFromList.length>1}}">
<!-- <view class="person-info-del" > -->
<van-button color="#d89a7c" icon="cross" round formType="submit" data-type="2" data-index="{{index}}" /> <van-button color="#d89a7c" icon="cross" round formType="submit" data-type="2" data-index="{{index}}" />
<!-- <van-icon name="cross" /> --> <!-- <van-icon name="cross" /> -->
</view> </view>
...@@ -147,8 +148,6 @@ ...@@ -147,8 +148,6 @@
</view> </view>
</view> </view>
<view class="add-person-button"> <view class="add-person-button">
<van-button icon="plus" color="#f4ece6" formType="submit" data-type="1" block>添加同行人员</van-button> <van-button icon="plus" color="#f4ece6" formType="submit" data-type="1" block>添加同行人员</van-button>
</view> </view>
...@@ -194,10 +193,11 @@ ...@@ -194,10 +193,11 @@
<form bindsubmit="addPerson" bindreset="delPerson"> <form bindsubmit="addPerson" bindreset="delPerson">
<view class="person-box" wx:for="{{visitFromList}}" wx:for-item="visitItem" wx:key="index"> <view class="person-box" wx:for="{{visitFromListTeam}}" wx:for-item="visitItem" wx:key="index">
<view class="person-title">参观人员{{index+1}}</view> <view class="person-title">参观人员{{index+1}}</view>
<view class="person-info-box"> <view class="person-info-box">
<view class="person-info-del" data-index="{{index}}" wx:if="{{visitFromList.length>1}}"> <!-- <view class="person-info-del" data-index="{{index}}" wx:if="{{visitFromList.length>1}}"> -->
<view class="person-info-del" data-index="{{index}}" >
<van-button color="#d89a7c" icon="cross" round formType="submit" data-type="2" data-index="{{index}}" /> <van-button color="#d89a7c" icon="cross" round formType="submit" data-type="2" data-index="{{index}}" />
<!-- <van-icon name="cross" /> --> <!-- <van-icon name="cross" /> -->
</view> </view>
...@@ -235,8 +235,6 @@ ...@@ -235,8 +235,6 @@
<van-field type="text" name="name" value="{{ visitBusinessFrom.name }}" placeholder="请输入姓名" border="{{ false }}" /> <van-field type="text" name="name" value="{{ visitBusinessFrom.name }}" placeholder="请输入姓名" border="{{ false }}" />
</view> </view>
<view class="person-info-item"> <view class="person-info-item">
<view class="info-item-label">身份证号</view> <view class="info-item-label">身份证号</view>
...@@ -254,7 +252,7 @@ ...@@ -254,7 +252,7 @@
<view class="person-info-item"> <view class="person-info-item">
<view class="info-item-label">人数</view> <view class="info-item-label">人数</view>
<!-- <view class="info-item-value info-placeholder"></view> --> <!-- <view class="info-item-value info-placeholder"></view> -->
<van-stepper bind:change="onSteChange" name="personNum" input-width="50px" value="{{ personNum }}" min="1" /> <van-stepper bind:plus="plus" bind:minus="minus" bind:change="onSteChange" name="personNum" input-width="50px" value="{{ personNum }}" min="1" />
</view> </view>
</view> </view>
...@@ -263,7 +261,9 @@ ...@@ -263,7 +261,9 @@
<view class="person-box" wx:for="{{visitLeaderist}}" wx:for-item="visitItem"> <view class="person-box" wx:for="{{visitLeaderist}}" wx:for-item="visitItem">
<view class="person-title">领导信息{{index+1}}</view> <view class="person-title">领导信息{{index+1}}</view>
<view class="person-info-box"> <view class="person-info-box">
<view class="person-info-del" data-index="{{index}}" wx:if="{{visitLeaderist.length>1}}"> <!-- <view class="person-info-del" data-index="{{index}}" wx:if="{{visitLeaderist.length>1}}"> -->
<view class="person-info-del" data-index="{{index}}" >
<!-- X -->
<van-button color="#d89a7c" icon="cross" round formType="submit" data-type="2" data-index="{{index}}" /> <van-button color="#d89a7c" icon="cross" round formType="submit" data-type="2" data-index="{{index}}" />
<!-- <van-icon name="cross" /> --> <!-- <van-icon name="cross" /> -->
</view> </view>
...@@ -273,7 +273,7 @@ ...@@ -273,7 +273,7 @@
</view> </view>
<view class="person-info-item"> <view class="person-info-item">
<view class="info-item-label">职务</view> <view class="info-item-label">职务</view>
<van-field type="text" name="work{{index+1}}" value="{{ visitItem.work }}" placeholder="请输入职务" border="{{ false }}" /> <van-field type="text" name="position{{index+1}}" value="{{ visitItem.position }}" placeholder="请输入职务" border="{{ false }}" />
</view> </view>
</view> </view>
</view> </view>
...@@ -282,7 +282,6 @@ ...@@ -282,7 +282,6 @@
<view class="add-person-button"> <view class="add-person-button">
<van-button icon="plus" color="#f4ece6" formType="submit" data-type="1" block>添加领导</van-button> <van-button icon="plus" color="#f4ece6" formType="submit" data-type="1" block>添加领导</van-button>
</view> </view>
</form> </form>
...@@ -303,13 +302,20 @@ ...@@ -303,13 +302,20 @@
</view> </view>
<!-- 底部导航栏 --> <!-- 底部导航栏 -->
<view class=" subscribe-footer"> <view class=" subscribe-footer">
<view class="footer-text">总计 <text class="person-num">{{personNum}}</text> 人</view> <!-- 团队 -->
<view class="footer-text" wx:if="{{subscribeType === 1 && teamNum === true}}">总计 <text class="person-num">{{personNum}}</text> 人</view>
<view class="footer-text" wx:if="{{subscribeType == 1 && teamNum == false }}">总计 <text class="person-num">10</text> 人</view>
<!-- 散客、公务 -->
<view class="footer-text" wx:else>总计 <text class="person-num">{{personNum}}</text> 人</view>
<view class="footer-button"> <view class="footer-button">
<van-button formType="submit" color="#d79a7d" size="small">立即预定</van-button> <van-button wx:if="{{subscribeType == 1}}" bind:click="preSubmission" style="margin-right: 10px;" formType="submit" color="#d79a7d" size="small">预提交<view style="font-size: 10px;">(无需满全员)</view></van-button>
<van-button bind:click="makeAnAppointmentNow" style="margin-right: 10px;" formType="submit" color="#d79a7d" size="small">立即预约<view wx:if="{{subscribeType == 1}}" style="font-size: 10px;">(需满全员)</view></van-button>
</view> </view>
</view> </view>
<van-toast id="van-toast" />
</form> </form>
</view> </view>
\ No newline at end of file
...@@ -128,6 +128,8 @@ ...@@ -128,6 +128,8 @@
border-radius: 16rpx; border-radius: 16rpx;
padding: 30rpx; padding: 30rpx;
padding-top: 20rpx; padding-top: 20rpx;
} }
.person-box { .person-box {
...@@ -224,6 +226,8 @@ ...@@ -224,6 +226,8 @@
border: 1px solid #d5c4b9; border: 1px solid #d5c4b9;
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0, 0, 0);
} }
.add-person-button .van-button__text { .add-person-button .van-button__text {
......
module.exports = { module.exports = {
API_URL: "https://asc.hnasct.cn/museumAppointment/api/", API_URL: "https://asc.hnasct.cn/museumAppointment/api/",
// API_URL: "https://ehall.qtnu.edu.cn/museumAppointment/api/",
imageProtocolHost:'https://asc.hnasct.cn/'
} }
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
const config = require('./config.js') const config = require('./config.js')
const host = config.API_URL; // 服务器baseUrl const host = config.API_URL; // 服务器baseUrl
/** /**
* POST请求, * POST请求,
* URL:接口 * URL:接口
...@@ -21,14 +23,31 @@ function postData(url, postData, doSuccess, doFail, needToken) { ...@@ -21,14 +23,31 @@ function postData(url, postData, doSuccess, doFail, needToken) {
mask: true mask: true
}) })
if (needToken) { if (needToken) {
var token = wx.getStorageSync('token'); var token = wx.getStorageSync('token');
if (token == "") { if (token == "") {
console.log("token为空,跳转至登录页") // console.log("token为空,跳转至登录页")
wx.hideLoading() wx.hideLoading()
// wx.navigateTo({
// url: '../login/login',
// })
wx.showModal({
title: '提示',
content: '当前未登录,是否登录?',
complete: (res) => {
if (res.cancel) {
wx.showToast({
title: '用户取消登录',
})
}
if (res.confirm) {
wx.navigateTo({ wx.navigateTo({
url: '../login/login', url: '../login/login',
}) })
}
}
})
} else { } else {
wx.request({ wx.request({
...@@ -53,24 +72,41 @@ function postData(url, postData, doSuccess, doFail, needToken) { ...@@ -53,24 +72,41 @@ function postData(url, postData, doSuccess, doFail, needToken) {
doSuccess(res.data); doSuccess(res.data);
} }
// else if (res.statusCode == 401) { else if (res.statusCode == 401) {
// wx.showToast({ wx.showToast({
// title: '登录过期,请重新登录', title: '登录过期,请重新登录',
// icon: 'none', icon: 'none',
// duration: 2000 duration: 2000
// }) })
wx.showModal({
title: '提示',
content: '当前未登录,是否登录?',
complete: (res) => {
if (res.cancel) {
wx.showToast({
title: '用户取消登录',
})
}
if (res.confirm) {
wx.navigateTo({
url: '../login/login',
})
}
}
})
// wx.navigateTo({ // wx.navigateTo({
// url: '../login/login', // url: '../login/login',
// }) // })
// } }
else { else {
console.log("其他状态码",res) console.log("其他状态码",res)
wx.showToast({ // wx.showToast({
title: res.statusCode + " : " + res.data.msg, // title: res.statusCode + " : " + res.data.msg,
icon: 'none', // icon: 'none',
duration: 4000 // duration: 4000
}) // })
} }
...@@ -109,10 +145,27 @@ function postData(url, postData, doSuccess, doFail, needToken) { ...@@ -109,10 +145,27 @@ function postData(url, postData, doSuccess, doFail, needToken) {
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}) })
// wx.navigateTo({
// url: '../login/login',
// })
wx.showModal({
title: '提示',
content: '登录令牌过期,是否登录?',
complete: (res) => {
if (res.cancel) {
wx.showToast({
title: '用户取消登录',
})
}
if (res.confirm) {
wx.navigateTo({ wx.navigateTo({
url: '../login/login', url: '../login/login',
}) })
} }
}
})
}
else { else {
console.log("其他状态码",res) console.log("其他状态码",res)
wx.showToast({ wx.showToast({
...@@ -151,9 +204,26 @@ function getData(url, getData, doSuccess, doFail, needToken) { ...@@ -151,9 +204,26 @@ function getData(url, getData, doSuccess, doFail, needToken) {
if (token == "") { if (token == "") {
console.log("token为空,跳转至登录页") console.log("token为空,跳转至登录页")
wx.hideLoading() wx.hideLoading()
// wx.navigateTo({
// url: '../login/login',
// })
wx.showModal({
title: '提示',
content: '当前未登录,是否登录?',
complete: (res) => {
if (res.cancel) {
wx.showToast({
title: '用户取消登录',
})
}
if (res.confirm) {
wx.navigateTo({ wx.navigateTo({
url: '../login/login', url: '../login/login',
}) })
}
}
})
} else { } else {
// console.log("token",token) // console.log("token",token)
wx.request({ wx.request({
...@@ -178,10 +248,27 @@ function getData(url, getData, doSuccess, doFail, needToken) { ...@@ -178,10 +248,27 @@ function getData(url, getData, doSuccess, doFail, needToken) {
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}) })
// wx.navigateTo({
// url: '../login/login',
// })
wx.showModal({
title: '提示',
content: '登录令牌过期,是否登录?',
complete: (res) => {
if (res.cancel) {
wx.showToast({
title: '用户取消登录',
})
}
if (res.confirm) {
wx.navigateTo({ wx.navigateTo({
url: '../login/login', url: '../login/login',
}) })
} }
}
})
}
else { else {
console.log("其他状态码",res) console.log("其他状态码",res)
wx.showToast({ wx.showToast({
...@@ -216,6 +303,7 @@ function getData(url, getData, doSuccess, doFail, needToken) { ...@@ -216,6 +303,7 @@ function getData(url, getData, doSuccess, doFail, needToken) {
doSuccess(res.data); doSuccess(res.data);
}else { }else {
// console.log("其他状态码") // console.log("其他状态码")
wx.showToast({ wx.showToast({
title: res.statusCode + " : " + res.data.msg, title: res.statusCode + " : " + res.data.msg,
icon: 'none', icon: 'none',
...@@ -249,3 +337,4 @@ function getData(url, getData, doSuccess, doFail, needToken) { ...@@ -249,3 +337,4 @@ function getData(url, getData, doSuccess, doFail, needToken) {
// } // }
module.exports.postData = postData; module.exports.postData = postData;
module.exports.getData = getData; module.exports.getData = getData;
// module.exports.cancelAppointmentRequest = cancelAppointmentRequest;
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 人 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册 或