|
|
@@ -20,9 +20,30 @@ Page({
|
|
|
data: {
|
|
|
imgServerUrl: imgServerUrl,
|
|
|
userInfo: {},
|
|
|
- noPhone:true,
|
|
|
+ noPhone: true,
|
|
|
canIUse: wx.canIUse('button.open-type.getUserInfo'),
|
|
|
- percent: 0
|
|
|
+ percent: 0,
|
|
|
+ userId: '',
|
|
|
+ memberId: '',
|
|
|
+ isLogin: false, //默认:未登录
|
|
|
+ approveStatus: 0,
|
|
|
+ },
|
|
|
+ onLoad: function(options) {
|
|
|
+ //获取用户user_id和member_id,判断是否处于登录态
|
|
|
+ var userId = wx.getStorageSync("user_id");
|
|
|
+ var memberId = wx.getStorageSync("member_id");
|
|
|
+ var isLogin = false;
|
|
|
+ if (userId && memberId) {
|
|
|
+ isLogin = true;
|
|
|
+ } else {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/login/login',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ phone: updataStorageData("phone"),
|
|
|
+ isLogin: isLogin
|
|
|
+ })
|
|
|
},
|
|
|
onShow: function() {
|
|
|
if (app.globalData.userInfo) {
|
|
|
@@ -30,6 +51,7 @@ Page({
|
|
|
this.setData({
|
|
|
userInfo: app.globalData.userInfo
|
|
|
})
|
|
|
+ this.start();
|
|
|
} else if (this.data.canIUse) {
|
|
|
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|
|
// 所以此处加入 callback 以防止这种情况
|
|
|
@@ -38,6 +60,7 @@ Page({
|
|
|
this.setData({
|
|
|
userInfo: app.globalData.userInfo
|
|
|
})
|
|
|
+ this.start();
|
|
|
}
|
|
|
} else {
|
|
|
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|
|
@@ -48,25 +71,23 @@ Page({
|
|
|
this.setData({
|
|
|
userInfo: useapp.globalData.userInforInfo
|
|
|
})
|
|
|
+ this.start();
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- this.fetchData();
|
|
|
- this.getUserResume();
|
|
|
- if (this.data.noPhone){
|
|
|
- //检查手机号
|
|
|
- checkPhone({
|
|
|
- user_id: app.globalData.userId,
|
|
|
- user_token: app.globalData.userToken
|
|
|
- }).then(data => {
|
|
|
- console.log("hh")
|
|
|
- })
|
|
|
- }
|
|
|
+
|
|
|
},
|
|
|
- onLoad: function (options) {
|
|
|
+ start() {
|
|
|
+ var userId = wx.getStorageSync("user_id");
|
|
|
+ var memberId = wx.getStorageSync("member_id");
|
|
|
+ var isLogin = false;
|
|
|
+ if (userId && memberId) {
|
|
|
+ isLogin = true;
|
|
|
+ this.fetchData();
|
|
|
+ this.getUserResume();
|
|
|
+ }
|
|
|
this.setData({
|
|
|
- phone: updataStorageData("phone"),
|
|
|
- percent:this.data.percent
|
|
|
+ isLogin: isLogin
|
|
|
})
|
|
|
},
|
|
|
//获取用户简历详情
|
|
|
@@ -78,14 +99,14 @@ Page({
|
|
|
Object.assign(paramsObj);
|
|
|
getResume(paramsObj).then(data => {
|
|
|
if (data.data.userResume) {
|
|
|
- var percent=0;
|
|
|
+ var percent = 0;
|
|
|
if (data.data.userResume.phone) {
|
|
|
percent = 40 + percent;
|
|
|
}
|
|
|
- if (data.data.userResume.expectationPosition){
|
|
|
+ if (data.data.userResume.expectationPosition) {
|
|
|
percent = 30 + percent;
|
|
|
}
|
|
|
- if (data.data.userResume.hpResumeWorkExperienceList.length>0) {
|
|
|
+ if (data.data.userResume.hpResumeWorkExperienceList.length > 0) {
|
|
|
percent = 30 + percent;
|
|
|
}
|
|
|
this.setData({
|
|
|
@@ -115,6 +136,12 @@ Page({
|
|
|
|
|
|
// 简历
|
|
|
tojianli() {
|
|
|
+ if (!this.data.isLogin) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/login/login',
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (this.data.hpUserResumeId) {
|
|
|
wx.navigateTo({
|
|
|
url: '../jianli/index?hpUserResumeId=' + this.data.hpUserResumeId,
|
|
|
@@ -127,6 +154,12 @@ Page({
|
|
|
},
|
|
|
//去认证页面
|
|
|
toAuth() {
|
|
|
+ if (!this.data.isLogin) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/login/login',
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
let approveState = this.data.approveStatus
|
|
|
console.log(approveState)
|
|
|
if (approveState == 0) {
|
|
|
@@ -152,28 +185,68 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- apply(){
|
|
|
- //我的申请
|
|
|
+ apply() {
|
|
|
+ if (!this.data.isLogin) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/login/login',
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //我的申请
|
|
|
wx.navigateTo({
|
|
|
url: '../apply-list/index',
|
|
|
})
|
|
|
},
|
|
|
- collection(){
|
|
|
- //我的收藏
|
|
|
+ collection() {
|
|
|
+ if (!this.data.isLogin) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/login/login',
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //我的收藏
|
|
|
wx.navigateTo({
|
|
|
url: '../collection-list/index',
|
|
|
})
|
|
|
},
|
|
|
- interview(){
|
|
|
+ interview() {
|
|
|
+ if (!this.data.isLogin) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/login/login',
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
//面试邀请
|
|
|
wx.navigateTo({
|
|
|
url: '../interview/index',
|
|
|
})
|
|
|
},
|
|
|
- setup(){
|
|
|
+ setup() {
|
|
|
+ if (!this.data.isLogin) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/login/login',
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
//设置
|
|
|
wx.navigateTo({
|
|
|
url: '../set/index',
|
|
|
})
|
|
|
+ },
|
|
|
+ toPayRoll() {
|
|
|
+ if (!this.data.isLogin) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/login/login',
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/check-iphone/index?approveState=' + this.data.approveStatus,
|
|
|
+ })
|
|
|
+ },
|
|
|
+ toLogin() {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/login/login',
|
|
|
+ })
|
|
|
}
|
|
|
})
|