|
@@ -15,6 +15,10 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
onLoad(page) {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '登录中...',
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
let local = window.location.href;
|
|
|
let locationLocaturl = window.location.search;
|
|
|
// 微信返回的回调地址
|
|
@@ -56,9 +60,6 @@ export default {
|
|
|
methods: {
|
|
|
// 通过code获取 openId等用户信息
|
|
|
handleGetWXInfo(code) {
|
|
|
- uni.showLoading({
|
|
|
- title: '加载中'
|
|
|
- });
|
|
|
this.$u.api
|
|
|
.getWXInfo(code)
|
|
|
.then((res) => {
|
|
@@ -85,37 +86,33 @@ export default {
|
|
|
* @param {Object} openId
|
|
|
*/
|
|
|
getToken(openId) {
|
|
|
- this.$u.api.codeV2Api
|
|
|
- .sendSmsCodeV2api({
|
|
|
- openId
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.$u.vuex('vuex_token', res.data.accessToken);
|
|
|
- this.$u.vuex('vuex_hasLogin', true);
|
|
|
- if (res.data.needVerify) {
|
|
|
- localStorage.setItem('backUrl', this.backUrl);
|
|
|
- this.$u.route({
|
|
|
- url: 'pages/center/phoneLogin/phoneLogin',
|
|
|
- type: 'reLaunch'
|
|
|
- });
|
|
|
+ this.$u.api.codeV2Api.sendSmsCodeV2api({ openId }).then((res) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$u.vuex('vuex_token', res.data.accessToken);
|
|
|
+ this.$u.vuex('vuex_hasLogin', true);
|
|
|
+ if (res.data.needVerify) {
|
|
|
+ localStorage.setItem('backUrl', this.backUrl);
|
|
|
+ this.$u.route({
|
|
|
+ url: 'pages/center/phoneLogin/phoneLogin',
|
|
|
+ type: 'reLaunch'
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$u.vuex('vuex_user', res.data);
|
|
|
+ if (this.backUrl.indexOf('wechatLogin') > -1) {
|
|
|
+ location.href = '/';
|
|
|
} else {
|
|
|
- this.$u.vuex('vuex_user', res.data);
|
|
|
- if (this.backUrl.indexOf('wechatLogin') > -1) {
|
|
|
- location.href = '/';
|
|
|
- } else {
|
|
|
- location.href = this.backUrl;
|
|
|
- }
|
|
|
+ location.href = this.backUrl;
|
|
|
}
|
|
|
- uni.hideLoading();
|
|
|
- } else {
|
|
|
- this.$refs.uToast.show({
|
|
|
- title: res.msg || '获取用户信息失败!',
|
|
|
- type: 'error'
|
|
|
- });
|
|
|
- uni.hideLoading();
|
|
|
}
|
|
|
- });
|
|
|
+ uni.hideLoading();
|
|
|
+ } else {
|
|
|
+ this.$refs.uToast.show({
|
|
|
+ title: res.msg || '获取用户信息失败!',
|
|
|
+ type: 'error'
|
|
|
+ });
|
|
|
+ uni.hideLoading();
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
/**
|
|
|
* @description:
|