You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
174 lines
4.4 KiB
174 lines
4.4 KiB
// pages/serve/serve.js
|
|
const app = getApp()
|
|
|
|
import { getUserInfo as fetchUserInfo } from "../../api/user";
|
|
import { selectMzGraduateInfo } from "../../api/index";
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
userInfo: {},
|
|
bindPhone: false,
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
this.setData({
|
|
statusHeight: app.globalData.deviceInfo.statusHeight,
|
|
navigationHeight: app.globalData.deviceInfo.navigationHeight,
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
this.getUserInfo()
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
},
|
|
getUserInfo() {
|
|
fetchUserInfo().then((res) => {
|
|
app.globalData.userInfo = res.data;
|
|
this.setData({
|
|
userInfo: res.data,
|
|
bindPhone: !Boolean(res.data && res.data.phone)
|
|
});
|
|
})
|
|
},
|
|
toEventAdd(){
|
|
wx.navigateTo({
|
|
url: '/subpages/eventAdd/add/add',
|
|
})
|
|
},
|
|
selectMzGraduateInfo(obj) {
|
|
selectMzGraduateInfo({ idCard: obj.idCard })
|
|
.then((res) => {
|
|
if (res.data.signType === 0 && res.data.contract) {
|
|
app.globalData.userInfo.chooseRoomId = res.data.chooseRecId;
|
|
res.data.contract = res.data.contract.replace(
|
|
"https://h5.esign.cn",
|
|
"https://hxm5112004501.h5.esign.cn"
|
|
);
|
|
wx.navigateTo({
|
|
url:
|
|
"/pages/webView/webView?url=" +
|
|
encodeURIComponent(res.data.contract),
|
|
});
|
|
} else if (res.data.signType === 1) {
|
|
wx.navigateTo({
|
|
url: "/pages/noData/noData?msg=暂无合同签订&idCard=" + obj.idCard,
|
|
});
|
|
} else {
|
|
wx.navigateTo({
|
|
url: "/pages/noData/noData?msg=暂无合同签订&idCard=" + obj.idCard,
|
|
});
|
|
}
|
|
})
|
|
.catch(() => {
|
|
wx.navigateTo({
|
|
url: "/pages/noData/noData?msg=暂无合同签订&idCard=" + obj.idCard,
|
|
});
|
|
});
|
|
},
|
|
toPage(e){
|
|
if (!wx.getStorageSync('token')) {
|
|
return
|
|
}
|
|
console.log(e);
|
|
if(e.currentTarget.dataset.url && e.currentTarget.dataset.url != '/subpages/OCRCard/pages/index/index' && e.currentTarget.dataset.url != '/subpages/index/checkOutConfirm/index/index'){
|
|
if(e.currentTarget.dataset.url === '/pages/serve/serve'){
|
|
wx.switchTab({
|
|
url: '/pages/serve/serve',
|
|
})
|
|
}
|
|
wx.navigateTo({
|
|
url: e.currentTarget.dataset.url,
|
|
})
|
|
}else if(e.currentTarget.dataset.url === '/subpages/OCRCard/pages/index/index'){
|
|
if(!this.data.bindPhone){
|
|
if(this.data.userInfo && this.data.userInfo.idCard){
|
|
this.selectMzGraduateInfo({ idCard: this.data.userInfo.idCard })
|
|
}else{
|
|
wx.navigateTo({
|
|
url: `/subpages/OCRCard/pages/index/index`,
|
|
})
|
|
}
|
|
}else{
|
|
wx.navigateTo({
|
|
url: '/pages/register/register',
|
|
})
|
|
}
|
|
}else if(e.currentTarget.dataset.url === '/subpages/index/checkOutConfirm/index/index'){
|
|
if(!this.data.bindPhone){
|
|
if(this.data.userInfo && this.data.userInfo.idCard){
|
|
wx.navigateTo({
|
|
url: `/subpages/index/checkOutConfirm/index/index`,
|
|
})
|
|
}else{
|
|
wx.navigateTo({
|
|
url: `/subpages/OCRCard/pages/index/index?type=out`,
|
|
})
|
|
}
|
|
}else{
|
|
wx.navigateTo({
|
|
url: '/pages/register/register',
|
|
})
|
|
}
|
|
}
|
|
},
|
|
toBsPage(){
|
|
wx.navigateTo({
|
|
url: '/subpages/bsPage/bsPage/bsPage',
|
|
})
|
|
},
|
|
toYuyue(){
|
|
wx.navigateTo({
|
|
url: '/subpages/space/list/list',
|
|
})
|
|
}
|
|
})
|