|
|
|
@ -4,7 +4,7 @@ |
|
|
|
|
<view class="dzhi_top"> |
|
|
|
|
<!-- <image src="" class="dzhi_t_bg" mode="aspectFill"></image> --> |
|
|
|
|
<view class="mode_com mode_coms"> |
|
|
|
|
<view class="dly_flex person_inf"> |
|
|
|
|
<view class="dly_flex person_inf" @click="oauthUser()"> |
|
|
|
|
<view class="pers_box"> |
|
|
|
|
<view class="pes_img"> |
|
|
|
|
<button class="btn_dzhi"> |
|
|
|
@ -15,7 +15,7 @@ |
|
|
|
|
</button> --> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="pes_inf aml_30" @click="oauthUser()"> |
|
|
|
|
<view class="pes_inf aml_30" > |
|
|
|
|
<!-- 用户昵称 --> |
|
|
|
|
<view class="t_adm_box"> |
|
|
|
|
<!-- <text class="t_nic">{{nickname}}阳光夏~小葵</text> -- 已登录状态 显示用户昵称 --> |
|
|
|
@ -142,6 +142,7 @@ export default { |
|
|
|
|
onShow() { |
|
|
|
|
if (!uni.getStorageSync('unionid') || uni.getStorageSync('unionid') == '' || uni.getStorageSync('unionid') == null) { |
|
|
|
|
this.isLogin = false; |
|
|
|
|
this.headimgurl = '' |
|
|
|
|
}else{ |
|
|
|
|
this.nickname = uni.getStorageSync('nickname') |
|
|
|
|
this.headimgurl = uni.getStorageSync('headimgurl') |
|
|
|
@ -247,7 +248,6 @@ export default { |
|
|
|
|
setTimeout(function () { |
|
|
|
|
wx.login({ |
|
|
|
|
success: (res) => { |
|
|
|
|
console.log(res, '登录获取的code'); |
|
|
|
|
var datas = { |
|
|
|
|
code: res.code |
|
|
|
|
}; |
|
|
|
@ -257,8 +257,28 @@ export default { |
|
|
|
|
method: 'post', |
|
|
|
|
success: function (res) { |
|
|
|
|
const obj = JSON.parse(res.data.msg); |
|
|
|
|
console.log(obj.openid); |
|
|
|
|
this_.isLogin = true; |
|
|
|
|
const da = { |
|
|
|
|
userkey:this_.$param.userkey, |
|
|
|
|
openid:obj.openid |
|
|
|
|
} |
|
|
|
|
this_.$Request.post(this_.$config.getUser,da).then((res)=>{ |
|
|
|
|
if(res.data == null){ |
|
|
|
|
uni.setStorageSync('nickname', '微信用户'); |
|
|
|
|
uni.setStorageSync('headimgurl', 'https://www.lbgjtoa.com/appImg/icon-person-01.png'); |
|
|
|
|
uni.setStorageSync('oauthTime', new Date().getTime()); |
|
|
|
|
this_.nickname = '微信用户'; |
|
|
|
|
this_.headimgurl = 'https://www.lbgjtoa.com/appImg/icon-person-01.png'; |
|
|
|
|
this_.$forceUpdate(); |
|
|
|
|
}else{ |
|
|
|
|
uni.setStorageSync('nickname', res.data.wxNickname); |
|
|
|
|
uni.setStorageSync('headimgurl', res.data.wxHeadimgurl); |
|
|
|
|
uni.setStorageSync('oauthTime', new Date().getTime()); |
|
|
|
|
this_.nickname = res.data.wxNickname; |
|
|
|
|
this_.headimgurl = res.data.wxHeadimgurl; |
|
|
|
|
this_.$forceUpdate(); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
uni.setStorageSync('unionid', obj.openid); |
|
|
|
|
}, |
|
|
|
|
fail: function (err) { |
|
|
|
@ -271,25 +291,7 @@ export default { |
|
|
|
|
console.log('login failed ' + error); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
wx.getUserInfo({ |
|
|
|
|
provider: 'weixin', |
|
|
|
|
success: (res) => { |
|
|
|
|
uni.setStorageSync('nickname', '微信用户'); |
|
|
|
|
uni.setStorageSync('headimgurl', 'https://www.lbgjtoa.com/appImg/icon-person-01.png'); |
|
|
|
|
uni.setStorageSync('oauthTime', new Date().getTime()); |
|
|
|
|
this_.nickname = '微信用户'; |
|
|
|
|
this_.$forceUpdate(); |
|
|
|
|
this_.headimgurl = 'https://www.lbgjtoa.com/appImg/icon-person-01.png'; |
|
|
|
|
}, |
|
|
|
|
fail: function (error) { |
|
|
|
|
console.log('login failed ' + error); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
// uni.showToast({ |
|
|
|
|
// title:"授权失败,点击"+that.nickname+"重新授权", |
|
|
|
|
// icon:"none", |
|
|
|
|
// duration: 1500 |
|
|
|
|
// }) |
|
|
|
|
|
|
|
|
|
this_.$forceUpdate(); |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
}, 3000); |
|
|
|
@ -299,6 +301,46 @@ export default { |
|
|
|
|
|
|
|
|
|
// #endif |
|
|
|
|
}, |
|
|
|
|
saveProfile:function(){ |
|
|
|
|
let this_ = this |
|
|
|
|
// wx.getUserInfo({ |
|
|
|
|
// provider: 'weixin', |
|
|
|
|
// success: (res) => { |
|
|
|
|
// uni.setStorageSync('nickname', '微信用户'); |
|
|
|
|
// uni.setStorageSync('headimgurl', 'https://www.lbgjtoa.com/appImg/icon-person-01.png'); |
|
|
|
|
// uni.setStorageSync('oauthTime', new Date().getTime()); |
|
|
|
|
// this_.nickname = '微信用户'; |
|
|
|
|
// this_.headimgurl = 'https://www.lbgjtoa.com/appImg/icon-person-01.png'; |
|
|
|
|
// this_.$forceUpdate(); |
|
|
|
|
const obj = { |
|
|
|
|
headimgurl:this_.headimgurl, |
|
|
|
|
openid:uni.getStorageSync('unionid'), |
|
|
|
|
nickname:this_.nickname |
|
|
|
|
} |
|
|
|
|
console.log(obj,'请求参数') |
|
|
|
|
var data = { |
|
|
|
|
"data": JSON.stringify(obj), |
|
|
|
|
userkey:this_.$param.userkey |
|
|
|
|
} |
|
|
|
|
this_.$Request.post(this_.$config.saveUser,data).then(res => { |
|
|
|
|
var flag = this_.$util.isSuccess(res); |
|
|
|
|
if (!flag) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
var userid = res.data; |
|
|
|
|
console.log(userid,'保存返回') |
|
|
|
|
}) |
|
|
|
|
// }, |
|
|
|
|
// fail: function (error) { |
|
|
|
|
// console.log('login failed ' + error); |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
// uni.showToast({ |
|
|
|
|
// title:"授权失败,点击"+that.nickname+"重新授权", |
|
|
|
|
// icon:"none", |
|
|
|
|
// duration: 1500 |
|
|
|
|
// }) |
|
|
|
|
}, |
|
|
|
|
callBackMethod: function () { |
|
|
|
|
// clearTimeout(timer); |
|
|
|
|
this.isLogin = true; |
|
|
|
@ -398,7 +440,7 @@ export default { |
|
|
|
|
content: '确定退出登录?', |
|
|
|
|
success: function (res) { |
|
|
|
|
if (res.confirm) { |
|
|
|
|
that.deleteUserApp(); |
|
|
|
|
// that.deleteUserApp(); |
|
|
|
|
(this.scenicGZType = 'NO'), (this.lineGZType = 'NO'), (this.foodGZType = 'NO'), (this.methodGZType = 'NO'), uni.removeStorageSync('nickname'); |
|
|
|
|
uni.removeStorageSync('headimgurl'); |
|
|
|
|
uni.removeStorageSync('nickname'); |
|
|
|
@ -406,7 +448,7 @@ export default { |
|
|
|
|
uni.removeStorageSync('openid'); |
|
|
|
|
uni.removeStorageSync('unionid'); |
|
|
|
|
that.nickname = '点击授权'; |
|
|
|
|
that.headimgurl = ''; |
|
|
|
|
that.headimgurl = 'https://www.lbgjtoa.com/appImg/icon-person-01.png'; |
|
|
|
|
that.isLogin = false; |
|
|
|
|
} else if (res.cancel) { |
|
|
|
|
} |
|
|
|
@ -492,7 +534,7 @@ export default { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<style> |
|
|
|
|