Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
thinkApp
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
游洁
thinkApp
Commits
e231f5f1
Commit
e231f5f1
authored
Sep 29, 2022
by
youjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
73b2bbce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
22 deletions
+47
-22
addFriendsAndRelatives.vue
src/pages/FriendsAndRelatives/addFriendsAndRelatives.vue
+47
-22
No files found.
src/pages/FriendsAndRelatives/addFriendsAndRelatives.vue
View file @
e231f5f1
...
...
@@ -95,16 +95,19 @@
AccountName
:
''
,
shareUnionId
:
''
,
loading
:
true
,
currentWxUserAuth
:{}
currentWxUserAuth
:{},
getUserWxInfo
:
null
});
const
pages
=
getCurrentPages
()
// 获取栈实例
const
currentRoute
=
pages
[
pages
.
length
-
1
].
route
;
// 获取当前页面路由
const
methods
=
{
getUserProfile
()
{
data
.
loading
=
false
//新的获取用户资料
wx
.
getUserProfile
({
desc
:
"用于完善资料"
,
// 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success
:
(
info
)
=>
{
data
.
getUserWxInfo
=
info
uni
.
setStorageSync
(
'userWxInfo'
,
info
)
wx
.
login
({
//成功放回
...
...
@@ -112,7 +115,6 @@
uni
.
showLoading
({
title
:
'尝试授权登陆'
})
console
.
log
(
res
.
code
,
'---'
)
methods
.
loginByOpenCode
(
res
.
code
)
}
})
...
...
@@ -127,6 +129,7 @@
},
loginByOpenCode
(
Code
){
getWeChatOpenId
({
Code
}).
then
(
r
=>
{
uni
.
hideLoading
()
uni
.
setStorageSync
(
'wxUserAuthInfo'
,
r
.
Data
)
data
.
currentWxUserAuth
=
r
.
Data
if
(
r
.
Data
.
unionid
){
...
...
@@ -135,14 +138,18 @@
}).
catch
(
e
=>
{})
},
addFriend
(){
data
.
loading
=
false
uni
.
showLoading
()
SetFriend
({
let
msg
=
{
WeChatImg
:
data
.
getUserWxInfo
.
userInfo
.
avatarUrl
,
WeChatName
:
data
.
getUserWxInfo
.
userInfo
.
nickName
,
OldUnionId
:
data
.
shareUnionId
,
NewUnionId
:
data
.
currentWxUserAuth
.
unionid
//'oV5Rm1J_MpkEVvE0VPEicwCDG1Zo'
}).
then
(
res
=>
{
NewUnionId
:
data
.
currentWxUserAuth
.
unionid
}
uni
.
showLoading
()
SetFriend
(
msg
).
then
(
res
=>
{
if
(
res
.
Code
==
1
)
{
methods
.
setUserLoginByUnionId
(
data
.
currentWxUserAuth
.
unionid
)
uni
.
hideLoading
()
data
.
loading
=
true
methods
.
setUserLoginByUnionId
(
data
.
currentWxUserAuth
.
unionid
,
data
.
getUserWxInfo
.
userInfo
.
nickName
,
data
.
getUserWxInfo
.
userInfo
.
avatarUrl
)
}
else
{
uni
.
hideLoading
()
data
.
loading
=
true
...
...
@@ -152,15 +159,33 @@
icon
:
"none"
,
});
},
2000
)
uni
.
showModal
({
title
:
'提示'
,
// 'OldUnionId='+msg.OldUnionId+'&NewUnionId='+msg.NewUnionId+'&Name='+msg.WeChatName+'&WeChatImg='+msg.WeChatImg
content
:
JSON
.
stringify
(
msg
),
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
}
else
if
(
res
.
cancel
)
{
}
}
});
}
});
},
setUserLoginByUnionId
(
uid
){
loginByUnionId
({
uid
}).
then
(
r
=>
{
setUserLoginByUnionId
(
uid
,
wname
,
wimage
){
loginByUnionId
({
uid
,
wname
,
wimage
}).
then
(
r
=>
{
if
(
r
.
Code
!=
1
){
uni
.
hideLoading
()
data
.
loading
=
true
setTimeout
(()
=>
{
uni
.
showToast
({
title
:
r
.
Message
,
icon
:
"none"
,
});
},
2000
)
}
if
(
r
.
Data
&&
r
.
Data
.
length
>
0
){
uni
.
setStorageSync
(
"ErpStus"
,
r
.
Data
)
...
...
@@ -211,6 +236,14 @@
}
uni
.
hideLoading
()
data
.
loading
=
true
if
(
r
.
Code
!=
1
){
setTimeout
(()
=>
{
uni
.
showToast
({
title
:
r
.
Message
,
icon
:
"none"
,
});
},
2000
)
}
}).
catch
(
e
=>
{
uni
.
hideLoading
()
...
...
@@ -238,6 +271,10 @@
})
},
};
let
that
=
methods
onMounted
(()
=>
{
});
return
{
...
toRefs
(
data
),
...
methods
...
...
@@ -254,18 +291,6 @@
url
:
'/pages/login/login'
})
}
// uni.showModal({
// title: 'options',
// content: JSON.stringify(options),
// success: function (res) {
// if (res.confirm) {
// } else if (res.cancel) {
// }
// }
// });
},
onShow
(){
this
.
getData
()
...
...
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