Commit e231f5f1 authored by youjie's avatar youjie

no message

parent 73b2bbce
......@@ -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()
......
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