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.

178 lines
4.6 KiB

3 years ago
// pages/release/index.js
3 years ago
const app = getApp();
3 years ago
Page({
/**
* 页面的初始数据
*/
data: {
3 years ago
userInfo: {},
authStatus: 0,
authType: null,
3 years ago
completeState: null,
authInfo:{}
3 years ago
},
back(){
wx.switchTab({
url: '/pages/index/index',
})
},
toPersonlAuth(){
if(this.data.authStatus == 0){
wx.navigateTo({
url: '/pages/release/personAuth/index',
})
3 years ago
} else if(this.data.authStatus == 3){
let authInfo = encodeURIComponent(JSON.stringify(this.data.authInfo));
wx.navigateTo({
url: '/pages/release/personAuth/index?authInfo=' + authInfo,
})
3 years ago
} else if(this.data.authStatus == 1){
wx.showToast({
title: '认证申请审核中,请等待!',
icon: 'none'
})
}
},
toCompanyAuth(){
if(this.data.authStatus == 0){
wx.navigateTo({
url: '/pages/release/companyAuth/index',
})
3 years ago
} else if(this.data.authStatus == 3){
let authInfo = encodeURIComponent(JSON.stringify(this.data.authInfo));
wx.navigateTo({
url: '/pages/release/companyAuth/index?authInfo=' + authInfo,
})
3 years ago
} else if(this.data.authStatus == 1){
wx.showToast({
title: '认证申请审核中,请等待!',
icon: 'none'
})
}
3 years ago
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
3 years ago
3 years ago
},
3 years ago
isAuthentication(){
app.http('get','user/isAuthentication').then((res)=>{
if(res.data.success){
this.setData({
authStatus: res.data.data.authenticationState,
authType: res.data.data.authorizationType,
3 years ago
completeState: res.data.data.completeState,
authInfo: res.data.data.authInfo
3 years ago
})
}
})
},
toResources(){
let that = this;
3 years ago
console.log(this.data.authStatus,'authStatus')
console.log(this.data.authType,'authType')
console.log(this.data.completeState,'completeState')
3 years ago
if(this.data.authStatus == 2 && this.data.authType == 1 && this.data.completeState == true){
wx.navigateTo({
url: '/pages/user/editNeeds/index?type=1',
})
} else if(this.data.authStatus == 2 && this.data.authType == 1 && this.data.completeState == false){
wx.showModal({
title: '提示!',
content: '您还未完善企业信息,点击确定去完善吧~',
success(res){
if(res.confirm){
wx.navigateTo({
3 years ago
url: '/pages/release/perfectCompanyInfo/index',
3 years ago
})
}
}
})
3 years ago
} else if(this.data.authStatus == 0 && (this.data.authType == 1 || this.data.authType == 0) && this.data.completeState == false){
3 years ago
wx.showModal({
title: '提示!',
3 years ago
content: '您还未完成企业认证,点击确定去认证吧~',
3 years ago
success(res){
3 years ago
if(res.confirm){
wx.navigateTo({
url: '/pages/release/companyAuth/index',
})
}
3 years ago
}
})
}
},
toNeeds(){
3 years ago
if(this.data.authStatus == 2 && (this.data.authType == 2 || this.data.authType == 0) && this.data.completeState == true){
3 years ago
wx.navigateTo({
url: '/pages/user/editNeeds/index?type=2',
})
3 years ago
} else if(this.data.authStatus == 2 && (this.data.authType == 2 || this.data.authType == 0) && this.data.completeState == false){
3 years ago
wx.showModal({
title: '提示!',
content: '您还未完善个人信息,点击确定去完善吧~',
success(res){
wx.navigateTo({
url: '/pages/release/perfectPersonInfo/index',
})
}
})
3 years ago
} else if(this.data.authStatus == 0 && (this.data.authType == 2 || this.data.authType == 0) && this.data.completeState == false){
3 years ago
wx.showModal({
title: '提示!',
3 years ago
content: '您还未完成认证,点击上方按钮去认证吧!',
3 years ago
})
}
3 years ago
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
3 years ago
let userInfo = wx.getStorageSync('userInfo')
if(userInfo.phone && userInfo.phone != ''){
this.isAuthentication();
} else{
wx.navigateTo({
url: '/pages/login/index',
})
}
3 years ago
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})