|
|
@@ -45,7 +45,7 @@
|
|
|
手机号登录
|
|
|
</button> -->
|
|
|
<!-- #ifdef APP -->
|
|
|
- <view class="login-btn wechat" :class="{ disabled: !checked }" :disabled="checked" @click="login">
|
|
|
+ <view class="login-btn wechat" :class="{ disabled: !checked }" :disabled="checked" @click="wxAppLogin">
|
|
|
<image src="@/static/images/jobApplicant/wx.svg" mode="scaleToFill" />微信登录
|
|
|
</view>
|
|
|
<!-- #endif -->
|
|
|
@@ -348,31 +348,119 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- wxGetUserInfo(e) {
|
|
|
- if (this.checked) {
|
|
|
- wx.getUserProfile({
|
|
|
- desc: "业务需要",
|
|
|
- success: (infoRes) => {
|
|
|
- console.log(
|
|
|
- "infoRes.encryptedData__________:" + JSON.stringify(infoRes.userInfo)
|
|
|
- );
|
|
|
- let nickName = infoRes.userInfo.nickName; //昵称
|
|
|
- let avatarUrl = infoRes.userInfo.avatarUrl; //头像
|
|
|
- let sex = infoRes.userInfo.gender; //头像
|
|
|
- try {
|
|
|
- this.$queue.showLoading("正在登录中...");
|
|
|
- this.login(nickName, avatarUrl, sex);
|
|
|
- } catch (e) {}
|
|
|
- },
|
|
|
- });
|
|
|
- } else {
|
|
|
+ // wxGetUserInfo(e) {
|
|
|
+ // if (this.checked) {
|
|
|
+ // wx.getUserProfile({
|
|
|
+ // desc: "业务需要",
|
|
|
+ // success: (infoRes) => {
|
|
|
+ // console.log(
|
|
|
+ // "infoRes.encryptedData__________:" + JSON.stringify(infoRes.userInfo)
|
|
|
+ // );
|
|
|
+ // let nickName = infoRes.userInfo.nickName; //昵称
|
|
|
+ // let avatarUrl = infoRes.userInfo.avatarUrl; //头像
|
|
|
+ // let sex = infoRes.userInfo.gender; //头像
|
|
|
+ // try {
|
|
|
+ // this.$queue.showLoading("正在登录中...");
|
|
|
+ // this.login(nickName, avatarUrl, sex);
|
|
|
+ // } catch (e) {}
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // uni.showToast({
|
|
|
+ // title: "请阅读并同意《隐私协议》和《用户服务协议》",
|
|
|
+ // icon: "none",
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // APP微信登录
|
|
|
+ wxAppLogin() {
|
|
|
+ if (!this.checked) {
|
|
|
uni.showToast({
|
|
|
title: "请阅读并同意《隐私协议》和《用户服务协议》",
|
|
|
icon: "none",
|
|
|
});
|
|
|
+ return;
|
|
|
}
|
|
|
+ let that = this;
|
|
|
+ uni.login({
|
|
|
+ provider: "weixin",
|
|
|
+ success: function(loginRes) {
|
|
|
+ console.log(loginRes);
|
|
|
+ uni.setStorageSync("openId", loginRes.authResult.openid)
|
|
|
+ uni.setStorageSync("unionId", loginRes.authResult.unionid)
|
|
|
+ let data = {
|
|
|
+ wxOpenId: loginRes.authResult.openid,
|
|
|
+ token: loginRes.authResult.access_token
|
|
|
+ };
|
|
|
+ that.$Request.postT("/app/Login/wxAppLogin", data)
|
|
|
+ .then((res) => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.code == 0) {
|
|
|
+ that.$queue.setData("userId", res.user.userId);
|
|
|
+ that.$queue.setData("token", res.token);
|
|
|
+ that.$queue.setData("phone", res.user.phone);
|
|
|
+ that.$queue.setData("userName", res.user.userName);
|
|
|
+ that.$queue.setData("avatar", res.user.avatar);
|
|
|
+ that.$queue.setData("invitationCode", res.user.invitationCode);
|
|
|
+ that.$queue.setData("inviterCode", res.user.inviterCode);
|
|
|
+ that.getIsVip();
|
|
|
+ uni.hideLoading();
|
|
|
+ that.$queue.setData("userType", res.user.userType);
|
|
|
+ //判断是否开启身份选择 是/否
|
|
|
+ that.$Request.get("/app/common/type/339").then((rest) => {
|
|
|
+ if (rest.code == 0) {
|
|
|
+ if (rest.data.value == "是") {
|
|
|
+ // 这里是跳转到选择职场身份的界面
|
|
|
+ uni.reLaunch({
|
|
|
+ url: "/pages/public/selectIdentity/selectIdentity",
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ if (res.user.userType == 2) { //企业
|
|
|
+ // 原有的。判断第一次根据userType ==null
|
|
|
+ uni.reLaunch({
|
|
|
+ url: "/pages/my/index",
|
|
|
+ });
|
|
|
+ } else if (res.user.userType == 1) {
|
|
|
+ uni.reLaunch({
|
|
|
+ url: "/pages/my/index",
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ //表示是第一次进来,走引导页
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pages/my/jobApplicant/guidePage",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (res.user.userType == 2) { //企业
|
|
|
+ // 原有的。判断第一次根据userType ==null
|
|
|
+ uni.reLaunch({
|
|
|
+ url: "/pages/my/index",
|
|
|
+ });
|
|
|
+
|
|
|
+ } else if (res.user.userType == 1) {
|
|
|
+ uni.reLaunch({
|
|
|
+ url: "/pages/my/index",
|
|
|
+ });
|
|
|
+
|
|
|
+ } else {
|
|
|
+ //表示是第一次进来,走引导页
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pages/my/jobApplicant/guidePage",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ } else {
|
|
|
+ uni.hideLoading();
|
|
|
+ that.$queue.showToast(res.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ });
|
|
|
},
|
|
|
- //登录
|
|
|
+ //小程序登录
|
|
|
login(nickName, avatarUrl, sex) {
|
|
|
if (!this.checked) {
|
|
|
uni.showToast({
|
|
|
@@ -392,48 +480,40 @@
|
|
|
code: loginRes.code,
|
|
|
};
|
|
|
that.$Request.get("/app/Login/wxLogin", data)
|
|
|
- .then((res) => {
|
|
|
- if (res.code == 0) {
|
|
|
- uni.hideLoading();
|
|
|
- uni.setStorageSync("openId", res.data.open_id);
|
|
|
- uni.setStorageSync("unionId", res.data.unionId);
|
|
|
- that.sessionkey = res.data.session_key;
|
|
|
- let sendData = {
|
|
|
- openId: uni.getStorageSync("openId"),
|
|
|
- unionId: uni.getStorageSync("unionId"),
|
|
|
- userName: "游客",
|
|
|
- avatar: "",
|
|
|
- sex: "1", //性别
|
|
|
- inviterCode: that.$queue.getData(
|
|
|
- "inviterCode"), //别人登录进来携带你的邀请码
|
|
|
- };
|
|
|
- that.sendDataList = sendData;
|
|
|
- that.flag = res.data.flag;
|
|
|
- // 第一次登录获取手机号
|
|
|
- // console.log(that.phoneNum,'**********************1')
|
|
|
- // console.log(that.flag,'**********************2')
|
|
|
- if (that.flag == "2" && that.phoneNum) {
|
|
|
- that.weixinPhone = true;
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code == 0) {
|
|
|
+ uni.hideLoading();
|
|
|
+ uni.setStorageSync("openId", res.data.open_id);
|
|
|
+ uni.setStorageSync("unionId", res.data.unionId);
|
|
|
+ that.sessionkey = res.data.session_key;
|
|
|
+ let sendData = {
|
|
|
+ openId: uni.getStorageSync("openId"),
|
|
|
+ unionId: uni.getStorageSync("unionId"),
|
|
|
+ userName: "游客",
|
|
|
+ avatar: "",
|
|
|
+ sex: "1", //性别
|
|
|
+ inviterCode: that.$queue.getData(
|
|
|
+ "inviterCode"), //别人登录进来携带你的邀请码
|
|
|
+ };
|
|
|
+ that.sendDataList = sendData;
|
|
|
+ that.flag = res.data.flag;
|
|
|
+ // 第一次登录获取手机号
|
|
|
+ // console.log(that.phoneNum,'**********************1')
|
|
|
+ // console.log(that.flag,'**********************2')
|
|
|
+ if (that.flag == "2" && that.phoneNum) {
|
|
|
+ that.weixinPhone = true;
|
|
|
+ } else {
|
|
|
+ that.getWeixinInfo(sendData);
|
|
|
+ }
|
|
|
} else {
|
|
|
- that.getWeixinInfo(sendData);
|
|
|
+ uni.showToast({
|
|
|
+ icon: "none",
|
|
|
+ title: res.msg,
|
|
|
+ duration: 2000,
|
|
|
+ });
|
|
|
+ console.log(res, "失败");
|
|
|
}
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- icon: "none",
|
|
|
- title: res.msg,
|
|
|
- duration: 2000,
|
|
|
- });
|
|
|
- console.log(res, "失败");
|
|
|
- }
|
|
|
- }).catch((err) => {
|
|
|
- uni.hideLoading();
|
|
|
- console.error("微信登录接口异常:", err);
|
|
|
- uni.showToast({
|
|
|
- icon: "none",
|
|
|
- title: "微信登录接口异常,请稍后再试",
|
|
|
- duration: 2000,
|
|
|
- });
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
@@ -468,6 +548,15 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ getIsVip() {
|
|
|
+ this.$Request.get("/app/UserVip/isUserVip").then((res) => {
|
|
|
+ if (res.code == 0) {
|
|
|
+ // this.isVip = res.data
|
|
|
+ console.log(res.data);
|
|
|
+ this.$queue.setData("isVip", res.data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
//获取个人信息
|
|
|
getWeixinInfo(sendData) {
|
|
|
let that = this;
|
|
|
@@ -511,67 +600,21 @@
|
|
|
url: "/pages/public/selectIdentity/selectIdentity",
|
|
|
});
|
|
|
} else {
|
|
|
- if (res.user.userType == 2) {
|
|
|
- // 这里判断一下看是否是第一次登录如果是就跳到引导页,如果不是就正常跳
|
|
|
- let firstLogin = uni.getStorageSync("firstLogin") || false;
|
|
|
- if (!firstLogin) {
|
|
|
- uni.navigateTo({
|
|
|
- url: "/pages/my/jobApplicant/guidePage",
|
|
|
- });
|
|
|
- } else {
|
|
|
- uni.reLaunch({
|
|
|
- url: "/pages/my/index",
|
|
|
- });
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 这里判断一下看是否是第一次登录如果是就跳到引导页,如果不是就正常跳
|
|
|
- let firstLogin = uni.getStorageSync("firstLogin") || false;
|
|
|
- if (!firstLogin) {
|
|
|
- uni.navigateTo({
|
|
|
- url: "/pages/my/jobApplicant/guidePage",
|
|
|
- });
|
|
|
- } else {
|
|
|
- uni.reLaunch({
|
|
|
- url: "/pages/my/index",
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+ uni.navigateBack();
|
|
|
}
|
|
|
} else {
|
|
|
- if (res.user.userType == 2) {
|
|
|
- // 这里判断一下看是否是第一次登录如果是就跳到引导页,如果不是就正常跳
|
|
|
- let firstLogin = uni.getStorageSync("firstLogin") || false;
|
|
|
- if (!firstLogin) {
|
|
|
- uni.navigateTo({
|
|
|
- url: "/pages/my/jobApplicant/guidePage",
|
|
|
- });
|
|
|
- } else {
|
|
|
- uni.reLaunch({
|
|
|
- url: "/pages/my/index",
|
|
|
- });
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 这里判断一下看是否是第一次登录如果是就跳到引导页,如果不是就正常跳
|
|
|
- let firstLogin = uni.getStorageSync("firstLogin") || false;
|
|
|
- if (!firstLogin) {
|
|
|
- uni.navigateTo({
|
|
|
- url: "/pages/my/jobApplicant/guidePage",
|
|
|
- });
|
|
|
- } else {
|
|
|
- uni.reLaunch({
|
|
|
- url: "/pages/my/index",
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+ uni.navigateBack();
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
- uni.hideLoading();
|
|
|
- this.$queue.showToast(res.msg);
|
|
|
+ uni.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ title: "登录失败",
|
|
|
+ content: res.msg,
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
forget() {
|
|
|
uni.navigateTo({
|
|
|
url: "/pages/public/pwd",
|