update:优化未登录进入砍价弹窗,以及点击头像登录弹窗

This commit is contained in:
lihaoyuan 2025-11-19 18:12:59 +08:00
parent d069df8461
commit 851b48f822
2 changed files with 76 additions and 25 deletions

View File

@ -3,7 +3,7 @@
<view style="background: rgb(41, 36, 56)"> <view style="background: rgb(41, 36, 56)">
<view class="bargin" v-if="show == false"> <view class="bargin" v-if="show == false">
<view class="top-sty"> <view class="top-sty">
<view class="user-info"> <view class="user-info" @tap="handleAvatarClick">
<image class="user-img" lazy-load :src="imgPath"></image> <image class="user-img" lazy-load :src="imgPath"></image>
<view class="username">{{ user_nickname }}</view> <view class="username">{{ user_nickname }}</view>
</view> </view>
@ -338,7 +338,7 @@
:shareDataDefault="shareData" :shareDataDefault="shareData"
ref="shareBoxApp" ref="shareBoxApp"
></share-box-app> ></share-box-app>
<loginPopup :show="showLoginPopup" @close="closeLoginPopup"></loginPopup> <loginPopup :show="showLoginPopup" @close="closeLoginPopup" @loginSuccess="handleLoginSuccess"></loginPopup>
</view> </view>
</template> </template>
@ -441,30 +441,37 @@ export default {
options.uid = paramsArray[3]; options.uid = paramsArray[3];
} }
options.sid options.sid
? t.setData({ ? t.setData({
imgPath: this.userInfo.user_avatar, imgPath: t.userInfo.user_avatar,
user_nickname: this.userInfo.user_nickname, user_nickname: t.userInfo.user_nickname,
mid: options.mid, mid: options.mid,
uid: options.sid, uid: options.sid,
participantId: this.userInfo.user_id, participantId: t.userInfo.user_id,
pid: options.pid, pid: options.pid,
}) })
: t.setData({ : t.setData({
imgPath: this.userInfo.user_avatar, imgPath: t.userInfo.user_avatar,
user_nickname: this.userInfo.user_nickname, user_nickname: t.userInfo.user_nickname,
mid: options.mid, mid: options.mid,
uid: options.uid || this.userInfo.user_id, uid: options.uid || t.userInfo.user_id,
participantId: this.userInfo.user_id, participantId: t.userInfo.user_id,
pid: options.pid, pid: options.pid,
}); });
this.forceUserInfo(function (user) { //
t.GetOtherCutPriceActivityList(); if (t.hasLogin) {
}); t.forceUserInfo(function (user) {
//t.getTime() t.GetOtherCutPriceActivityList();
}, });
}
},
onShow: function () { onShow: function () {
//
if (!this.hasLogin) {
this.showLoginPopup = true; //
return;
}
this.GetVendorCutPriceEventDetail(); this.GetVendorCutPriceEventDetail();
}, },
onBackPress() { onBackPress() {
@ -549,6 +556,43 @@ export default {
} }
}, },
}); });
},
//
handleAvatarClick() {
const that = this;
if (!that.hasLogin) {
that.showLoginPopup = true; //
return;
}
},
handleLoginSuccess() {
const that = this;
that.showLoginPopup = false; //
// Vuex userInfo
that.getUserInfo();
// 500ms userInfo
setTimeout(() => {
const user_info = that.userInfo || {};
//
that.setData({
imgPath: user_info.user_avatar || "https://media-mall-prod-1259811287.cos.ap-guangzhou.myqcloud.com/static/xcxfile/appicon/default-avatar.png",
user_nickname: user_info.user_nickname || "亲爱的用户",
participantId: user_info.user_id || "",
uid: user_info.user_id || that.uid,
});
//
if (that.mid) {
that.GetVendorCutPriceEventDetail(); //
that.GetOtherCutPriceActivityList(); //
}
// 5. DOM
that.$forceUpdate();
}, 500); // 500ms
}, },
closeLoginPopup() { closeLoginPopup() {
this.showLoginPopup = false; this.showLoginPopup = false;

View File

@ -259,9 +259,16 @@ export default {
UserInfo: user_info, UserInfo: user_info,
}); });
}); });
//
that.$emit("loginSuccess"); //
that.close(); that.close();
}, },
fail: function () {
// 使
that.$emit("loginSuccess");
that.close();
that.$.confirm("登录成功,但获取用户信息失败,请重试");
},
}); });
}, },
}, },