Commit 507de7bb authored by 李超鹏's avatar 李超鹏

修改登录错误提示

parent 0d9b1840
<template> <template>
<view class="quick"> <view class="quick">
<view class="quick-color"> <view class="quick-color">
<view class="quick-color-cancel" :style="{ 'padding-top': platform == '3' ? 0 : statusBarHeight + 'px' }"><u-icon name="close" @click="toIndex"></u-icon></view> <view class="quick-color-cancel" :style="{ 'padding-top': platform == '3' ? 0 : statusBarHeight + 'px' }">
<u-icon name="close" @click="toIndex"></u-icon></view>
</view> </view>
<view class="quick-background"> <view class="quick-background">
<image :src="logoImage" mode="" class="quick-background-logo"></image> <image :src="logoImage" mode="" class="quick-background-logo"></image>
...@@ -20,7 +21,7 @@ ...@@ -20,7 +21,7 @@
</view> </view>
</template> </template>
<script> <script>
import { baseUrl } from '@/utils/config.js'; import { baseUrl } from '@/utils/config.js';
import log from '@/utils/log.js'; import log from '@/utils/log.js';
import { showToast } from '@/utils/common.js'; import { showToast } from '@/utils/common.js';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
...@@ -28,7 +29,7 @@ export default { ...@@ -28,7 +29,7 @@ export default {
components: {}, components: {},
data() { data() {
return { return {
logoImage:baseUrl+'login-logo@3x.png', logoImage: baseUrl + 'login-logo@3x.png',
needAuth: true, needAuth: true,
canIUseGetUserProfile: false, canIUseGetUserProfile: false,
...@@ -41,7 +42,7 @@ export default { ...@@ -41,7 +42,7 @@ export default {
computed: { computed: {
...mapGetters(['platform', 'isIOS', 'systemInfo']) ...mapGetters(['platform', 'isIOS', 'systemInfo'])
}, },
onLoad: function(options) { onLoad: function (options) {
switch (this.platform) { switch (this.platform) {
case '1': // 微信 case '1': // 微信
if (uni.canIUse('getUserProfile')) { if (uni.canIUse('getUserProfile')) {
...@@ -61,9 +62,9 @@ export default { ...@@ -61,9 +62,9 @@ export default {
} }
}, },
methods: { methods: {
toIndex(){ toIndex() {
uni.navigateBack({ uni.navigateBack({
delta:1 delta: 1
}) })
}, },
// setLoginStatus() { // setLoginStatus() {
...@@ -130,8 +131,22 @@ export default { ...@@ -130,8 +131,22 @@ export default {
that.loginSignup(); that.loginSignup();
}, },
fail: function(res) { fail: function (res) {
console.log('授权失败', res); // App.track('wxlogin_getUserInfo_fail', {}) console.log('授权失败', res);
uni.getNetworkType({
success(res) {
const networkType = res.networkType;
if (networkType === 'none') {
uni.showToast({ title: '网络请求错误,请检查网络连接', icon: 'none' });
} else {
uni.showToast({
title: '授权失败,请重新授权',
icon: 'none'
});
}
}
});
// App.track('wxlogin_getUserInfo_fail', {})
// uni.switchTab({ // uni.switchTab({
// url: '/pages/index/index' // url: '/pages/index/index'
// }); // });
...@@ -182,7 +197,7 @@ export default { ...@@ -182,7 +197,7 @@ export default {
}); });
}, },
loginSignup: function() { loginSignup: function () {
var that = this; var that = this;
login login
.wxLogin() .wxLogin()
...@@ -242,7 +257,7 @@ export default { ...@@ -242,7 +257,7 @@ export default {
}); });
console.log('--------------', res); console.log('--------------', res);
this.$store this.$store
.dispatch('Auto_login',userInfo) .dispatch('Auto_login', userInfo)
.then(res => { .then(res => {
console.log('登录成功', res); console.log('登录成功', res);
setTimeout(() => { setTimeout(() => {
...@@ -252,7 +267,7 @@ export default { ...@@ -252,7 +267,7 @@ export default {
url: this.returnUrl, url: this.returnUrl,
type: isSwitchTab ? 'switchTab' : 'redirectTo', type: isSwitchTab ? 'switchTab' : 'redirectTo',
}) })
}else { } else {
uni.switchTab({ uni.switchTab({
url: '/pages/index/index' url: '/pages/index/index'
}); });
...@@ -264,8 +279,21 @@ export default { ...@@ -264,8 +279,21 @@ export default {
console.log('登录失败', err); console.log('登录失败', err);
}); });
}, },
fail: function(res) { fail: function (res) {
console.log('授权失败', res); console.log('授权失败', res);
uni.getNetworkType({
success(res) {
const networkType = res.networkType;
if (networkType === 'none') {// TODO 精确判断的话,还是通过ping实际接口来判断
uni.showToast({ title: '无网络连接', icon: 'none' });
} else {
uni.showToast({
title: '授权失败,请重新授权',
icon: 'none'
});
}
}
});
return; return;
} }
}); });
...@@ -279,7 +307,7 @@ export default { ...@@ -279,7 +307,7 @@ export default {
title: '提示', title: '提示',
showCancel: false, showCancel: false,
content: '未授权不能完成自动注册', content: '未授权不能完成自动注册',
success: function(res) {} success: function (res) { }
}); });
} else { } else {
console.log('用户同意', e.detail); console.log('用户同意', e.detail);
...@@ -296,7 +324,7 @@ export default { ...@@ -296,7 +324,7 @@ export default {
this.$store this.$store
.dispatch('Get_UserInfo') .dispatch('Get_UserInfo')
.then(() => { .then(() => {
this.showToast('登录成功',true); this.showToast('登录成功', true);
setTimeout(() => { setTimeout(() => {
if (this.returnUrl) { // 需要跳转到特定页面 if (this.returnUrl) { // 需要跳转到特定页面
var isSwitchTab = this.returnUrl.indexOf('pages/index/') != -1 var isSwitchTab = this.returnUrl.indexOf('pages/index/') != -1
...@@ -304,7 +332,7 @@ export default { ...@@ -304,7 +332,7 @@ export default {
url: this.returnUrl, url: this.returnUrl,
type: isSwitchTab ? 'switchTab' : 'redirectTo', type: isSwitchTab ? 'switchTab' : 'redirectTo',
}) })
}else { } else {
uni.switchTab({ uni.switchTab({
url: '/pages/index/index' url: '/pages/index/index'
}); });
...@@ -439,7 +467,7 @@ export default { ...@@ -439,7 +467,7 @@ export default {
url: this.returnUrl, url: this.returnUrl,
type: isSwitchTab ? 'switchTab' : 'redirectTo', type: isSwitchTab ? 'switchTab' : 'redirectTo',
}) })
}else { } else {
uni.switchTab({ uni.switchTab({
url: '/pages/index/index' url: '/pages/index/index'
}); });
...@@ -454,7 +482,7 @@ export default { ...@@ -454,7 +482,7 @@ export default {
handleClick(e) { handleClick(e) {
var type = e.currentTarget.dataset.type; var type = e.currentTarget.dataset.type;
uni.navigateTo({ uni.navigateTo({
animationType:'pop-in', animationType: 'pop-in',
url: '/pages/login/agreement?type=' + type url: '/pages/login/agreement?type=' + type
}); });
} }
...@@ -468,11 +496,13 @@ export default { ...@@ -468,11 +496,13 @@ export default {
background: #ffffff; background: #ffffff;
position: relative; position: relative;
color: #333333; color: #333333;
&-color { &-color {
width: 100%; width: 100%;
height: 30%; height: 30%;
background: linear-gradient(180deg, #F4FFFC 0%, #ffffff 100%); background: linear-gradient(180deg, #F4FFFC 0%, #ffffff 100%);
overflow: hidden; overflow: hidden;
&-cancel { &-cancel {
width: 60upx; width: 60upx;
height: 60upx; height: 60upx;
...@@ -482,6 +512,7 @@ export default { ...@@ -482,6 +512,7 @@ export default {
font-size: 32upx; font-size: 32upx;
} }
} }
&-background { &-background {
position: absolute; position: absolute;
overflow: hidden; overflow: hidden;
...@@ -492,16 +523,19 @@ export default { ...@@ -492,16 +523,19 @@ export default {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
&-logo { &-logo {
width: 216upx; width: 216upx;
height: 216upx; height: 216upx;
} }
&-slogn { &-slogn {
width: 362upx; width: 362upx;
height: 38upx; height: 38upx;
margin-top: 10upx; margin-top: 10upx;
} }
} }
&-mark { &-mark {
// overflow: hidden; // overflow: hidden;
width: 100%; width: 100%;
...@@ -510,13 +544,16 @@ export default { ...@@ -510,13 +544,16 @@ export default {
top: 50%; top: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
} }
&-center { &-center {
position: relative; position: relative;
width: 100%; width: 100%;
.submit-button-box { .submit-button-box {
width: 100%; width: 100%;
padding: 0 80upx; padding: 0 80upx;
margin-bottom: 54upx; margin-bottom: 54upx;
.submit-button { .submit-button {
position: relative; position: relative;
width: 100%; width: 100%;
...@@ -533,9 +570,11 @@ export default { ...@@ -533,9 +570,11 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
&:active { &:active {
background: #41c845; background: #41c845;
} }
.submit-button-icon { .submit-button-icon {
width: 38upx; width: 38upx;
height: 32upx; height: 32upx;
...@@ -543,6 +582,7 @@ export default { ...@@ -543,6 +582,7 @@ export default {
} }
} }
} }
.auth-tip { .auth-tip {
margin-top: 80rpx; margin-top: 80rpx;
margin-bottom: 40rpx; margin-bottom: 40rpx;
...@@ -551,11 +591,13 @@ export default { ...@@ -551,11 +591,13 @@ export default {
color: #8d8d8d; color: #8d8d8d;
line-height: 1; line-height: 1;
} }
&-buttons { &-buttons {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.login-refuse { .login-refuse {
width: 292rpx; width: 292rpx;
height: 104rpx; height: 104rpx;
...@@ -567,6 +609,7 @@ export default { ...@@ -567,6 +609,7 @@ export default {
font-weight: bold; font-weight: bold;
background: #ffffff; background: #ffffff;
} }
.login-accept { .login-accept {
color: #ffffff; color: #ffffff;
background: $default-color; background: $default-color;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment