|
@@ -16,7 +16,9 @@
|
|
|
lanuch: true
|
|
|
}
|
|
|
},
|
|
|
- onShow() {},
|
|
|
+ onShow() {
|
|
|
+
|
|
|
+ },
|
|
|
mounted() {},
|
|
|
onLoad(option) {
|
|
|
console.log(option)
|
|
@@ -31,46 +33,44 @@
|
|
|
},
|
|
|
methods: {
|
|
|
getPhoneNumber(e) {
|
|
|
+ let _this = this
|
|
|
uni.showLoading({
|
|
|
mask: true,
|
|
|
title: '加载中'
|
|
|
});
|
|
|
+ console.log(e.target.encryptedData,'eeeeeee')
|
|
|
if (e.target.errMsg === 'getPhoneNumber:ok') {
|
|
|
uni.login({
|
|
|
- success(result) {
|
|
|
- if (result.code) {
|
|
|
- login({
|
|
|
- code: result.code,
|
|
|
- encryptedData: e.target.encryptedData,
|
|
|
- iv: e.target.iv
|
|
|
- }).then(res => {
|
|
|
- uni.hideLoading();
|
|
|
- if (res.status === '200') {
|
|
|
- console.log(res.data, 'login data')
|
|
|
- uni.setStorageSync('token', res.data.token);
|
|
|
- uni.setStorageSync('phone', res.data.phone);
|
|
|
- uni.setStorageSync('userId', res.data.userId);
|
|
|
- if (this.path === '/pages/index/main' || this.lanuch) {
|
|
|
- uni.reLaunch({
|
|
|
- url: this.path
|
|
|
- });
|
|
|
- } else {
|
|
|
- uni.redirectTo({
|
|
|
- url: this.path
|
|
|
- });
|
|
|
- }
|
|
|
+ success(res) {
|
|
|
+ login({
|
|
|
+ code: res.code,
|
|
|
+ encryptedData: e.target.encryptedData,
|
|
|
+ iv: e.target.iv
|
|
|
+ }).then(res => {
|
|
|
+ uni.hideLoading();
|
|
|
+ console.log(res, 'login data')
|
|
|
+ if (res.status == '200') {
|
|
|
+ console.log(res.data, 'login data')
|
|
|
+ uni.setStorageSync('token', res.data);
|
|
|
+ if (_this.path === '/pages/index/main' || _this.lanuch) {
|
|
|
+ uni.reLaunch({
|
|
|
+ url: _this.path
|
|
|
+ });
|
|
|
} else {
|
|
|
- uni.showToast({
|
|
|
- title: res.message,
|
|
|
- icon: 'none',
|
|
|
- duration: 2500
|
|
|
+ uni.redirectTo({
|
|
|
+ url: _this.path
|
|
|
});
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.message,
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2500
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: '授权失败',
|