|
@@ -32,20 +32,46 @@
|
|
|
},
|
|
|
methods: {
|
|
|
getPhoneNumber(e) {
|
|
|
+ let _this = this
|
|
|
uni.showLoading({
|
|
|
title: '登录中'
|
|
|
});
|
|
|
- $http.post('/api/v1/mp/user/wxauth/mobile', {
|
|
|
- code: e.detail.code,
|
|
|
- identity: 1
|
|
|
- }).then(res => {
|
|
|
- if (res.code == 0) {
|
|
|
- uni.setStorageSync('token', res.token)
|
|
|
- this.getBaseInfo()
|
|
|
- }
|
|
|
- }).catch(() => {
|
|
|
- uni.hideLoading();
|
|
|
- })
|
|
|
+ console.log(e);
|
|
|
+ if (e.detail & e.detail.code) {
|
|
|
+ $http.post('/api/v1/mp/user/wxauth/mobile', {
|
|
|
+ ...e.detail,
|
|
|
+ identity: 1,
|
|
|
+ noToken: true
|
|
|
+ }).then(res => {
|
|
|
+ uni.hideLoading();
|
|
|
+ if (res.code == 0) {
|
|
|
+ uni.setStorageSync('token', res.token)
|
|
|
+ _this.getBaseInfo()
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ uni.hideLoading();
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uni.login({
|
|
|
+ success(res) {
|
|
|
+ console.log('login', res);
|
|
|
+ $http.post('/api/v1/mp/user/wxauth/mobile', {
|
|
|
+ ...e.detail,
|
|
|
+ loginCode: res.code,
|
|
|
+ identity: 1,
|
|
|
+ noToken: true
|
|
|
+ }).then(res => {
|
|
|
+ uni.hideLoading();
|
|
|
+ if (res.code == 0) {
|
|
|
+ uni.setStorageSync('token', res.token)
|
|
|
+ _this.getBaseInfo()
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ uni.hideLoading();
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
// 关闭授权
|
|
@@ -90,7 +116,7 @@
|
|
|
|
|
|
.login {
|
|
|
flex-direction: column;
|
|
|
-
|
|
|
+
|
|
|
&-image {
|
|
|
flex-direction: column;
|
|
|
padding: 100rpx 0 200rpx;
|