Commit 750e677f authored by Mac's avatar Mac

1

parent 616b7926
......@@ -2,8 +2,8 @@
<div class="auth-page">
<u-popup v-model="showDialog" mode="center" :mask-close-able="false" custom-style="padding:0;background:none;">
<img :src="pageinfo.pic_url" mode="widthFix" />
<!-- <button :style="sureStyle" class="hotsopt" open-type="getUserInfo" @getuserinfo="showLogin==true?getUserInfo():''"></button> -->
<button :style="sureStyle" class="hotsopt" @tap="showLogin==true?getUserProfile():''"></button>
<button :style="sureStyle" class="hotsopt" open-type="getUserInfo" v-if="canIUseGetUserProfile == false" @getuserinfo="showLogin==true?getoldUser():''"></button>
<button :style="sureStyle" class="hotsopt" v-if="canIUseGetUserProfile == true" @tap="showLogin==true?getUserProfile():''"></button>
<button :style="cancelStyle" class="hotsopt" @click="close"></button>
</u-popup>
<coupon v-if="showCoupons" :coupon-message="couponMessage" :cform="ComeFrom" @goLook="goLook" @closeBtn="closeBtn"></coupon>
......@@ -26,23 +26,52 @@
couponMessage: '',
ComeFrom:'',
showLogin:true,
canIUseGetUserProfile:false,
msg:{}
};
},
created() {
this.pageinfo = uni.getStorageSync('basedata') ? uni.getStorageSync('basedata').auth_page : {};
if (wx.getUserProfile) {
console.log('进入新的')
this.canIUseGetUserProfile = true
}
let x = this.pageinfo.hotspot;
let y = this.pageinfo.hotspot_cancel;
this.sureStyle = `height:${x.height}rpx;width:${x.width}rpx;left:${x.left}rpx;top:${x.top}rpx;`;
this.cancelStyle = `height:${y.height}rpx;width:${y.width}rpx;left:${y.left}rpx;top:${y.top}rpx;`;
},
methods: {
getUserProfile(){
getoldUser(){//旧的 兼容电脑端
var that = this;
uni.login({
provider: 'weixin',
success: function (loginRes) {
console.log(loginRes.authResult);
// 获取用户信息
uni.getUserInfo({
provider: 'weixin',
success: function (infoRes) {
console.log(infoRes,'infoRes')
that.getUserInfo(infoRes)
}
});
}
});
},
getUserProfile(){//新的获取用户资料
var that = this;
wx.getUserProfile({
desc: '用于完善资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: info => {
console.log(info.userInfo)
this.msg = {
Id: 0,
AliasName: info.userInfo.nickName,
Photo: info.userInfo.avatarUrl,
};
that.getUserInfo(info)
},
fail: () => {
uni.showToast({
......@@ -161,11 +190,25 @@
uni.removeStorageSync("Up");
uni.removeStorageSync("CounponPassword");
uni.removeStorageSync("KeyWord");
let uid = uni.getStorageSync("mall_UserInfo").UserId;
that.msg.Id = uid
that.updateuserinfo(that.msg);//更新用户头像
}
}
);
},
updateuserinfo(msg) {
this.request2({
url: "/api/MemberUser/SetMemberPhoto",
data: msg,
},
(res) => {
//静默处理不做任何提示
},
(error) => {}
);
},
goLook() {
this.showCoupons = false;
},
......
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