Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
account-book
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘文虎
account-book
Commits
507de7bb
Commit
507de7bb
authored
Feb 20, 2025
by
李超鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改登录错误提示
parent
0d9b1840
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
119 additions
and
76 deletions
+119
-76
quick-login.vue
pages/login/quick-login/quick-login.vue
+119
-76
No files found.
pages/login/quick-login/quick-login.vue
View file @
507de7bb
<
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,9 +29,9 @@ export default {
...
@@ -28,9 +29,9 @@ 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
,
agree
:
false
,
agree
:
false
,
params
:
{},
params
:
{},
...
@@ -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'
))
{
...
@@ -57,13 +58,13 @@ export default {
...
@@ -57,13 +58,13 @@ export default {
this
.
statusBarHeight
=
statusBarHeight
;
this
.
statusBarHeight
=
statusBarHeight
;
if
(
options
&&
options
.
path
)
{
if
(
options
&&
options
.
path
)
{
this
.
returnUrl
=
decodeURIComponent
(
decodeURIComponent
(
options
.
path
))
this
.
returnUrl
=
decodeURIComponent
(
decodeURIComponent
(
options
.
path
))
}
}
},
},
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
()
...
@@ -227,48 +242,61 @@ export default {
...
@@ -227,48 +242,61 @@ export default {
},
},
newLoginup
()
{
newLoginup
()
{
uni
.
getUserProfile
({
uni
.
getUserProfile
({
desc
:
'用于授权登录'
,
desc
:
'用于授权登录'
,
success
:
res
=>
{
success
:
res
=>
{
console
.
log
(
'授权成功'
,
res
);
console
.
log
(
'授权成功'
,
res
);
const
userInfo
=
{
const
userInfo
=
{
nickname
:
res
.
userInfo
.
nickName
,
nickname
:
res
.
userInfo
.
nickName
,
avatar
:
res
.
userInfo
.
avatarUrl
avatar
:
res
.
userInfo
.
avatarUrl
};
};
getApp
().
globalData
.
wxUserInfo
=
userInfo
;
getApp
().
globalData
.
wxUserInfo
=
userInfo
;
console
.
log
(
'授权成功'
,
JSON
.
stringify
(
userInfo
));
console
.
log
(
'授权成功'
,
JSON
.
stringify
(
userInfo
));
uni
.
showLoading
({
uni
.
showLoading
({
title
:
'授权中..'
,
title
:
'授权中..'
,
mask
:
true
mask
:
true
});
console
.
log
(
'--------------'
,
res
);
this
.
$store
.
dispatch
(
'Auto_login'
,
userInfo
)
.
then
(
res
=>
{
console
.
log
(
'登录成功'
,
res
);
setTimeout
(()
=>
{
if
(
this
.
returnUrl
)
{
// 需要跳转到特定页面
var
isSwitchTab
=
this
.
returnUrl
.
indexOf
(
'pages/index/'
)
!=
-
1
this
.
$u
.
route
({
url
:
this
.
returnUrl
,
type
:
isSwitchTab
?
'switchTab'
:
'redirectTo'
,
})
}
else
{
uni
.
switchTab
({
url
:
'/pages/index/index'
});
}
},
1000
);
})
.
catch
(
err
=>
{
showToast
(
'登录失败'
);
console
.
log
(
'登录失败'
,
err
);
});
});
console
.
log
(
'--------------'
,
res
);
},
this
.
$store
fail
:
function
(
res
)
{
.
dispatch
(
'Auto_login'
,
userInfo
)
console
.
log
(
'授权失败'
,
res
);
.
then
(
res
=>
{
uni
.
getNetworkType
({
console
.
log
(
'登录成功'
,
res
);
success
(
res
)
{
setTimeout
(()
=>
{
const
networkType
=
res
.
networkType
;
if
(
this
.
returnUrl
)
{
// 需要跳转到特定页面
if
(
networkType
===
'none'
)
{
// TODO 精确判断的话,还是通过ping实际接口来判断
var
isSwitchTab
=
this
.
returnUrl
.
indexOf
(
'pages/index/'
)
!=
-
1
uni
.
showToast
({
title
:
'无网络连接'
,
icon
:
'none'
});
this
.
$u
.
route
({
}
else
{
url
:
this
.
returnUrl
,
uni
.
showToast
({
type
:
isSwitchTab
?
'switchTab'
:
'redirectTo'
,
title
:
'授权失败,请重新授权'
,
})
icon
:
'none'
}
else
{
});
uni
.
switchTab
({
}
url
:
'/pages/index/index'
}
});
});
}
return
;
},
1000
);
}
})
});
.
catch
(
err
=>
{
showToast
(
'登录失败'
);
console
.
log
(
'登录失败'
,
err
);
});
},
fail
:
function
(
res
)
{
console
.
log
(
'授权失败'
,
res
);
return
;
}
});
},
},
signup
(
e
)
{
signup
(
e
)
{
log
.
setFilterMsg
(
'getPhoneNumber'
);
log
.
setFilterMsg
(
'getPhoneNumber'
);
...
@@ -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,19 +324,19 @@ export default {
...
@@ -296,19 +324,19 @@ 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
this
.
$u
.
route
({
this
.
$u
.
route
({
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'
});
});
}
}
},
1000
);
},
1000
);
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
...
@@ -434,15 +462,15 @@ export default {
...
@@ -434,15 +462,15 @@ export default {
});
});
}
else
{
}
else
{
if
(
this
.
returnUrl
)
{
// 需要跳转到特定页面
if
(
this
.
returnUrl
)
{
// 需要跳转到特定页面
var
isSwitchTab
=
this
.
returnUrl
.
indexOf
(
'pages/index/'
)
!=
-
1
var
isSwitchTab
=
this
.
returnUrl
.
indexOf
(
'pages/index/'
)
!=
-
1
this
.
$u
.
route
({
this
.
$u
.
route
({
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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment