|
@@ -208,10 +208,19 @@
|
|
</view>
|
|
</view>
|
|
<!--#ifdef MP-WEIXIN -->
|
|
<!--#ifdef MP-WEIXIN -->
|
|
<image v-if="isRealname" style="width: 96rpx;height: 31rpx;margin-left: 14rpx;" src="https://t17.9026.com/web/statics/image/index/ysm.png" mode=""></image>
|
|
<image v-if="isRealname" style="width: 96rpx;height: 31rpx;margin-left: 14rpx;" src="https://t17.9026.com/web/statics/image/index/ysm.png" mode=""></image>
|
|
- <button class="u-refresh dir-left-nowrap main-between cross-center "
|
|
|
|
- open-type="getUserInfo" @getAuthorize="getUserInfo" @click="getUserInfo">
|
|
|
|
- <icon class="u-icon" type></icon>
|
|
|
|
- <text>刷新</text>
|
|
|
|
|
|
+ <button class="u-refresh dir-left-nowrap main-between cross-center " v-if="canIUseGetUserProfile"
|
|
|
|
+ open-type="getUserInfo"
|
|
|
|
+ @click="getUserInfoClick"
|
|
|
|
+ >
|
|
|
|
+ <icon class="u-icon" type></icon>
|
|
|
|
+ <text>刷新</text>
|
|
|
|
+ </button>
|
|
|
|
+ <button class="u-refresh dir-left-nowrap main-between cross-center " v-else open-type="getUserInfo"
|
|
|
|
+ @getAuthorize="getUserInfo"
|
|
|
|
+ @getuserinfo="getUserInfo"
|
|
|
|
+ >
|
|
|
|
+ <icon class="u-icon" type></icon>
|
|
|
|
+ <text>刷新</text>
|
|
</button>
|
|
</button>
|
|
<!-- #endif-->
|
|
<!-- #endif-->
|
|
<!--#ifdef H5 -->
|
|
<!--#ifdef H5 -->
|
|
@@ -330,6 +339,9 @@
|
|
return 'https://shop.9026.com/web/statics/img/mall/static/user-default-avatar.png';
|
|
return 'https://shop.9026.com/web/statics/img/mall/static/user-default-avatar.png';
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ canIUseGetUserProfile() {
|
|
|
|
+ return this.$user.canIUseGetUserProfile();
|
|
|
|
+ },
|
|
getMemberPicUrl() {
|
|
getMemberPicUrl() {
|
|
return this.memberPicUrl;
|
|
return this.memberPicUrl;
|
|
// todo 此处选哪个图标待确认
|
|
// todo 此处选哪个图标待确认
|
|
@@ -368,77 +380,67 @@
|
|
url: '/pages/member/index/index',
|
|
url: '/pages/member/index/index',
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ getUserInfoClick(userInfoResult) {
|
|
|
|
+ console.log('userInfoResult',userInfoResult)
|
|
|
|
+ this.$user.getUserProfile(userInfoResult).then(e => {
|
|
|
|
+ this.getUserInfo(e);
|
|
|
|
+ }).catch(e => {
|
|
|
|
+ console.log(e)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
getUserInfo(userInfoResult) {
|
|
getUserInfo(userInfoResult) {
|
|
- // #ifdef MP
|
|
|
|
-
|
|
|
|
- let _this = this;
|
|
|
|
- wx.getUserProfile({
|
|
|
|
- desc: "用于完善会员资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
|
|
|
- success: (res) => {
|
|
|
|
- wx.getUserInfo({
|
|
|
|
- success: (res2) => {
|
|
|
|
- res2.rawData = res.rawData;
|
|
|
|
- uni.login({
|
|
|
|
- scopes: 'auth_user',
|
|
|
|
- success(loginResult) {
|
|
|
|
- const data = {
|
|
|
|
- encryptedData: res2.encryptedData,
|
|
|
|
- iv: res2.iv,
|
|
|
|
- rawData: res2.rawData,
|
|
|
|
- signature: res2.signature,
|
|
|
|
- code: loginResult.code,
|
|
|
|
- };
|
|
|
|
- _this.$request({
|
|
|
|
- url: _this.$api.passport.login,
|
|
|
|
- method: 'post',
|
|
|
|
- data: data
|
|
|
|
- }).then(response => {
|
|
|
|
- uni.hideLoading();
|
|
|
|
- if (response.code === 0) {
|
|
|
|
- uni.showToast({
|
|
|
|
- title: '资料已更新',
|
|
|
|
- icon: 'none'
|
|
|
|
- });
|
|
|
|
- _this.$storage.setStorageSync(
|
|
|
|
- '_USER_ACCESS_TOKEN',
|
|
|
|
- response.data.access_token);
|
|
|
|
- } else {
|
|
|
|
- return reject(response.msg);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- fail: (res2) => {},
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- fail: (res) => {
|
|
|
|
- console.log("fail", res);
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- // #endif
|
|
|
|
- // #ifdef H5
|
|
|
|
- this.$request({
|
|
|
|
- url: this.$api.registered.url,
|
|
|
|
- method: 'get',
|
|
|
|
- data: {
|
|
|
|
- scope: 'snsapi_userinfo',
|
|
|
|
- response_type: 'code',
|
|
|
|
- url: `${window.location.href}`
|
|
|
|
- }
|
|
|
|
- }).then(res => {
|
|
|
|
- if (res.code === 0) {
|
|
|
|
- this.$storage.setStorageSync('_USER_SIGN', true);
|
|
|
|
- window.location.replace(res.data.url);
|
|
|
|
- } else {
|
|
|
|
- uni.navigateTo({
|
|
|
|
- url: '/pages/registered/sign'
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- // #endif
|
|
|
|
|
|
+ // #ifdef MP
|
|
|
|
+ let _this = this;
|
|
|
|
+ uni.login({
|
|
|
|
+ scopes: 'auth_user',
|
|
|
|
+ success(loginResult) {
|
|
|
|
+ console.log('loginResult',loginResult)
|
|
|
|
+ const data = {
|
|
|
|
+ encryptedData: userInfoResult.detail.encryptedData,
|
|
|
|
+ iv: userInfoResult.detail.iv,
|
|
|
|
+ rawData: userInfoResult.detail.rawData,
|
|
|
|
+ signature: userInfoResult.detail.signature,
|
|
|
|
+ code: loginResult.code,
|
|
|
|
+ };
|
|
|
|
+ _this.$request({
|
|
|
|
+ url: _this.$api.passport.login,
|
|
|
|
+ method: 'post',
|
|
|
|
+ data: data
|
|
|
|
+ }).then(response => {
|
|
|
|
+ uni.hideLoading();
|
|
|
|
+ if (response.code === 0) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: '资料已更新',
|
|
|
|
+ icon: 'none'
|
|
|
|
+ });
|
|
|
|
+ _this.$storage.setStorageSync('_USER_ACCESS_TOKEN', response.data.access_token);
|
|
|
|
+ } else {
|
|
|
|
+ return reject(response.msg);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ // #endif
|
|
|
|
+ // #ifdef H5
|
|
|
|
+ this.$request({
|
|
|
|
+ url: this.$api.registered.url,
|
|
|
|
+ method: 'get',
|
|
|
|
+ data: {
|
|
|
|
+ scope: 'snsapi_userinfo',
|
|
|
|
+ response_type: 'code',
|
|
|
|
+ url: `${window.location.href}`
|
|
|
|
+ }
|
|
|
|
+ }).then(res => {
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ this.$storage.setStorageSync('_USER_SIGN', true);
|
|
|
|
+ window.location.replace(res.data.url);
|
|
|
|
+ } else {
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/pages/registered/sign'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ // #endif
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -688,8 +690,8 @@
|
|
|
|
|
|
|
|
|
|
.u-refresh {
|
|
.u-refresh {
|
|
- border-radius: 18upx;
|
|
|
|
- border: 1upx solid #CDCCCB;
|
|
|
|
|
|
+ border-radius: 8rpx;
|
|
|
|
+ border: 1rpx solid #CDCCCB;
|
|
min-width: 69upx;
|
|
min-width: 69upx;
|
|
margin: 0 0 0 10upx;
|
|
margin: 0 0 0 10upx;
|
|
box-sizing: content-box;
|
|
box-sizing: content-box;
|
|
@@ -709,7 +711,7 @@
|
|
|
|
|
|
text {
|
|
text {
|
|
line-height: 1;
|
|
line-height: 1;
|
|
- color: #CDCCCB;
|
|
|
|
|
|
+ color: #999999;
|
|
font-size: 21upx;
|
|
font-size: 21upx;
|
|
}
|
|
}
|
|
}
|
|
}
|