Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jz_Travel
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
zhengke
jz_Travel
Commits
cb33fc1e
Commit
cb33fc1e
authored
Sep 30, 2021
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
3feb2fbf
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1291 additions
and
930 deletions
+1291
-930
index.vue
components/auth/index.vue
+20
-78
user-center.vue
pages/user-center/user-center.vue
+1271
-852
No files found.
components/auth/index.vue
View file @
cb33fc1e
...
...
@@ -23,18 +23,12 @@
></button>
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<!--
<button
:style=
"sureStyle"
class=
"hotsopt"
open-type=
"getAuthorize"
v-if=
"!canIUseGetUserProfile"
@
getuserinfo=
"showLogin ? getoldUser() : ''"
></button>
-->
<button
:style=
"sureStyle"
class=
"hotsopt"
v-if=
"canIUseGetUserProfile"
@
tap=
"showLogin ? getUserInfoAli() : ''"
open-type=
"getAuthorize"
@
getAuthorize=
"onGetAuthorize"
scope=
"userInfo"
></button>
<!-- #endif -->
<button
:style=
"cancelStyle"
class=
"hotsopt"
@
click=
"close"
></button>
...
...
@@ -284,73 +278,30 @@ export default {
},
// -------------------------------支付宝登录---------------------------------
getUserProfileAli
()
{
//新的获取用户资料
var
that
=
this
;
wx
.
getUserProfile
({
desc
:
"用于完善资料"
,
// 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success
:
(
info
)
=>
{
console
.
log
(
info
);
this
.
msg
=
{
Id
:
0
,
AliasName
:
info
.
userInfo
.
nickName
,
Photo
:
info
.
userInfo
.
avatarUrl
,
};
that
.
getUserInfo
(
info
);
},
fail
:
()
=>
{
uni
.
showToast
({
title
:
"微信登录授权失败"
,
icon
:
"none"
,
});
onGetAuthorize
(
res
)
{
let
that
=
this
;
my
.
getOpenUserInfo
({
success
:
(
_res
)
=>
{
let
userInfo
=
JSON
.
parse
(
_res
.
response
).
response
;
// 以下方的报文格式解析两层 response
that
.
getUserInfoAli
(
userInfo
);
},
});
},
getUserInfoAli
(
info
)
{
var
that
=
this
;
that
.
showDialog
=
true
;
// uni.login({
// scopes: "auth_user",
// success: (res) => {
// //这里请求接口
// let obj = {
// Source: 1,
// OpenId: "",
// Name: info.userInfo.nickName,
// Photo: info.userInfo.avatarUrl,
// Gender: info.userInfo.gender,
// Moblie: "",
// SuperiorId: 0,
// code: res.code,
// };
// // that.getCode(obj);
//
// },
// fail: () => {
// uni.showToast({
// title: "授权失败",
// icon: "none",
// });
// },
// });
my
.
getAuthCode
({
scopes
:
"auth_
user
"
,
// 主动授权(弹框):auth_user,静默授权(不弹框):auth_base
scopes
:
"auth_
base
"
,
// 主动授权(弹框):auth_user,静默授权(不弹框):auth_base
success
:
(
res
)
=>
{
console
.
log
(
296
,
res
);
if
(
res
.
authCode
)
{
let
obj
=
{
// Source: 1,
// OpenId: "",
// Name: info.userInfo.nickName,
// Photo: info.userInfo.avatarUrl,
// Gender: info.userInfo.gender,
// Moblie: "",
// SuperiorId: 0,
Name
:
info
.
nickName
,
Photo
:
info
.
avatar
?
info
.
avatar
:
"123"
,
Gender
:
info
.
gender
===
"m"
?
1
:
info
.
gender
===
"f"
?
2
:
0
,
Moblie
:
""
,
code
:
res
.
authCode
,
};
// console.log(app.serverUrl + '/login/' + res.authCode);
// 调用自己的服务端接口,让服务端进行后端的授权认证
that
.
getBaseInfoAli
();
console
.
log
(
327
,
res
);
that
.
getCodeAli
(
obj
);
}
},
...
...
@@ -362,22 +313,13 @@ export default {
},
});
},
getBaseInfoAli
()
{
my
.
getOpenUserInfo
({
success
:
(
res
)
=>
{
let
userInfo
=
JSON
.
parse
(
res
.
response
).
response
;
// 以下方的报文格式解析两层 response
console
.
log
(
369
,
res
,
userInfo
);
},
});
},
//调用获取code
getCodeAli
(
obj
)
{
var
that
=
this
;
//
uni.showLoading({
//
title: "登录中",
//
});
uni
.
showLoading
({
title
:
"登录中"
,
});
//这里请求接口
var
OpenId
=
""
;
that
.
request2
(
{
url
:
"/api/mall/GetAliCode"
,
...
...
@@ -388,7 +330,7 @@ export default {
(
res
)
=>
{
if
(
res
.
resultCode
==
1
)
{
obj
.
OpenId
=
res
.
data
;
//
that.getLoginAli(obj);
that
.
getLoginAli
(
obj
);
}
}
);
...
...
@@ -413,7 +355,7 @@ export default {
{
url
:
"/api/AppletLogin/Login"
,
data
:
{
Source
:
1
,
Source
:
2
,
OpenId
:
obj
.
OpenId
,
Name
:
obj
.
Name
,
Photo
:
obj
.
Photo
,
...
...
pages/user-center/user-center.vue
View file @
cb33fc1e
This diff is collapsed.
Click to expand it.
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