fix(聊天): 修复默认头像路径并优化消息用户信息获取逻辑

This commit is contained in:
yangzhe 2025-12-15 10:39:55 +08:00
parent d670da4f3c
commit a4876b3ef6
3 changed files with 5 additions and 5 deletions

View File

@ -179,6 +179,8 @@ export default {
onLoad(options) { onLoad(options) {
console.log(this.vuex_msgList); console.log(this.vuex_msgList);
console.log(this.vuex_msgUser,'this.vuex_msgUser');
this.baseUrl = this.$u.http.config.baseUrl; this.baseUrl = this.$u.http.config.baseUrl;
@ -197,7 +199,7 @@ export default {
return this.baseUrl + "/" + this.vuex_msgUser.receiverHeadSculptureUrl; return this.baseUrl + "/" + this.vuex_msgUser.receiverHeadSculptureUrl;
} }
return "/static/common/images/avatar_default.jpg"; return "/static/common/images/avatar_default2.png";
}, },
headSculptureUrl() { headSculptureUrl() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@ -282,18 +282,16 @@ const store = new Vuex.Store({
(i) => i && (i.receiverId === friendId || i.friendId === friendId) (i) => i && (i.receiverId === friendId || i.friendId === friendId)
); );
if (target) { if (target) {
// 获取消息接收方用户信息 commit("set_MsgUser", target);
Vue.prototype.$u.api Vue.prototype.$u.api
.GetReceiverUserInfoApi({ Id: friendId }) .GetReceiverUserInfoApi({ Id: friendId })
.then((res) => { .then((res) => {
if (res.succeed && res.data) { if (res.succeed && res.data) {
commit("set_MsgUser", { ...target, ...res.data }); commit("set_MsgUser", { ...target, ...res.data });
} else {
commit("set_MsgUser", target);
} }
}); });
// 跳转到对话页,参数按需调整
uni.navigateTo({ uni.navigateTo({
url: `/pages/chat/index`, url: `/pages/chat/index`,
}); });