This commit is contained in:
JiXinHui 2026-03-18 11:08:49 +08:00
commit 1536637159
9 changed files with 290 additions and 118 deletions

View File

@ -41,11 +41,11 @@ const install = (Vue, vm) => {
let updateTeacherInfo = (params = {}) => let updateTeacherInfo = (params = {}) =>
vm.$u.post("api/BasicDataMaintenance/UpdateTeacher", params); vm.$u.post("api/BasicDataMaintenance/UpdateTeacher", params);
let getData = (params = {}) => let getData = (params = {}) =>
vm.$u.get("api/BasicDataMaintenance/GetData", params); vm.$u.get("api/BasicDataMaintenance/GetData", params);
// 获取排班数据 // 获取排班数据
let getShiftSchedulingData = (params = {}) => let getShiftSchedulingData = (params = {}) =>
vm.$u.get("api/BasicDataMaintenance/GetShiftSchedulingData", params); vm.$u.get("api/BasicDataMaintenance/GetShiftSchedulingData", params);
// 登录 // 登录
let LoginApp = (params = {}) => vm.$u.post("api/Token/LoginApp", params); let LoginApp = (params = {}) => vm.$u.post("api/Token/LoginApp", params);
@ -251,14 +251,17 @@ const install = (Vue, vm) => {
// 转人工服务 // 转人工服务
let TransferToALiveAgentApi = (params = {}) => let TransferToALiveAgentApi = (params = {}) =>
vm.$u.post("api/Dialogue/TransferToALiveAgent", params); vm.$u.post("api/Dialogue/TransferToALiveAgent", params);
// 结束人工服务
let EndLiveAgentApi = (params = {}) =>
vm.$u.post("api/Dialogue/EndLiveAgent", params);
// 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下 // 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下
vm.$u.api = { vm.$u.api = {
UploadSingleImage, UploadSingleImage,
getTeacherInfo, getTeacherInfo,
getData, getData,
getShiftSchedulingData, getShiftSchedulingData,
updateTeacherInfo, updateTeacherInfo,
LoginApp, LoginApp,
RegisterUser, RegisterUser,
saveUserInfo, saveUserInfo,
@ -322,6 +325,7 @@ const install = (Vue, vm) => {
ReadMessageApi, ReadMessageApi,
DeleteDialogueApi, DeleteDialogueApi,
TransferToALiveAgentApi, TransferToALiveAgentApi,
EndLiveAgentApi,
}; };
}; };

View File

@ -10,11 +10,31 @@
> >
<view class="phone-popup"> <view class="phone-popup">
<view class="phone-title">招生电话</view> <view class="phone-title">招生电话</view>
<view class="phone-content">0790-6764666/6765666</view>
<view class="phone-card-list">
<view class="phone-card" @click="makeCall('0790-6764666')">
<view class="icon-wrapper">
<u-icon name="phone-fill" color="#ffffff" size="40"></u-icon>
</view>
<view class="info-wrapper">
<text class="phone-number">0790-6764666</text>
<text class="phone-desc">拨打招生电话1</text>
</view>
</view>
<view class="phone-card" @click="makeCall('0790-6765666')">
<view class="icon-wrapper">
<u-icon name="phone-fill" color="#ffffff" size="40"></u-icon>
</view>
<view class="info-wrapper">
<text class="phone-number">0790-6765666</text>
<text class="phone-desc">拨打招生电话2</text>
</view>
</view>
</view>
<view class="phone-button"> <view class="phone-button">
<u-button class="cancel-button" type="default" @click="closePopup" <view class="cancel-btn" @click="closePopup">取消</view>
>取消</u-button
>
</view> </view>
</view> </view>
</u-popup> </u-popup>
@ -48,6 +68,11 @@ export default {
}, },
}, },
methods: { methods: {
makeCall(phoneNumber) {
uni.makePhoneCall({
phoneNumber,
});
},
closePopup() { closePopup() {
this.showPopup = false; this.showPopup = false;
this.$emit("update:show", false); this.$emit("update:show", false);
@ -66,7 +91,6 @@ export default {
background-size: 630rpx 100rpx; background-size: 630rpx 100rpx;
background-position: -20rpx 0; background-position: -20rpx 0;
.phone-title { .phone-title {
text-align: center; text-align: center;
font-family: DouyinSans; font-family: DouyinSans;
@ -76,19 +100,72 @@ export default {
margin-bottom: 40rpx; margin-bottom: 40rpx;
} }
.phone-content { .phone-card-list {
margin-bottom: 120rpx; padding: 0 48rpx;
text-align: center; margin-bottom: 60rpx;
font-family: PingFang SC;
font-size: 32rpx; .phone-card {
color: #333333; display: flex;
align-items: center;
padding: 30rpx 40rpx;
margin-bottom: 24rpx;
background: #ffffff;
border: 1px solid #f0f0f0;
box-shadow: 0px 4rpx 12rpx rgba(0, 0, 0, 0.05);
border-radius: 16rpx;
&:last-child {
margin-bottom: 0;
}
.icon-wrapper {
width: 80rpx;
height: 80rpx;
background: #5ac799;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
margin-right: 30rpx;
flex-shrink: 0;
}
.info-wrapper {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
flex: 1;
.phone-number {
font-size: 36rpx;
font-weight: bold;
color: #333333;
letter-spacing: 2rpx;
margin-bottom: 10rpx;
}
.phone-desc {
font-size: 24rpx;
color: #999999;
}
}
}
} }
.phone-button { .phone-button {
padding: 0 40rpx; padding: 0 48rpx;
.cancel-button { .cancel-btn {
width: 100%;
height: 88rpx;
line-height: 88rpx;
text-align: center;
background: #ffffff;
border: 1px solid #e5e5e5;
border-radius: 16rpx; border-radius: 16rpx;
font-size: 32rpx;
color: #333333;
} }
} }
} }

View File

@ -2,9 +2,24 @@
<view class="home-container"> <view class="home-container">
<header-bar <header-bar
title="源小新" title="源小新"
:showLeftIcon="false"
leftIcon="list" leftIcon="list"
@leftClick="handleLeftClick" @leftClick="handleLeftClick"
></header-bar> >
<image
slot="left"
class="header-icon"
src="/static/common/images/icon-userSetting.png"
@click="handleSettingClick"
></image>
<!-- 记录干掉了 -->
<!-- <image
slot="right"
class="header-icon"
src="/static/common/images/icon-userRecord.png"
@click="handleRecordClick"
></image> -->
</header-bar>
<!-- 这是新版 --> <!-- 这是新版 -->
@ -61,10 +76,16 @@
:style="{ :style="{
background: item.background, background: item.background,
}" }"
@click="handleFeatureClick(item)"
> >
<image :src="item.icon" class="feature-icon"></image> <image :src="item.icon" class="feature-icon"></image>
<text class="feature-text">{{ item.title }}</text> <view class="feature-text-wrapper">
<text class="feature-title">{{ item.title }}</text>
<text class="feature-tip">{{ item.tip }}</text>
</view>
<view class="feature-action-btn" @click="handleFeatureClick(item)">
<text>去咨询</text>
<u-icon name="arrow-right" size="24" color="#ffffff"></u-icon>
</view>
</view> </view>
</view> </view>
</view> </view>
@ -318,7 +339,7 @@
<view class="floating-tabs"> <view class="floating-tabs">
<view <view
class="tab-item" class="tab-item"
v-for="(tab, index) in floatingTabs" v-for="(tab, index) in displayFloatingTabs"
:key="index" :key="index"
@click="handleFeatureClick({ title: tab.title, path: tab.path })" @click="handleFeatureClick({ title: tab.title, path: tab.path })"
> >
@ -424,16 +445,17 @@ export default {
"我什么时候能推知道自己是否被录取?", "我什么时候能推知道自己是否被录取?",
], ],
features: [ features: [
{ // {
title: "在线咨询", // title: "线",
icon: "/static/common/images/icon_admissions.png", // icon: "/static/common/images/icon_admissions.png",
path: "/pages/home/admissions/index", // path: "/pages/home/admissions/index",
background: "linear-gradient(0deg, #F4FBFE 0%, #F4FBFE 100%)", // background: "linear-gradient(0deg, #F4FBFE 0%, #F4FBFE 100%)",
}, // },
{ {
title: "电话咨询", title: "电话咨询",
icon: "/static/common/images/icon_phone.png", tip: "欢迎致电本校招生咨询热线",
background: "linear-gradient(0deg, #F4FBF9 0%, #F4FBF9 100%)", icon: "/static/common/images/icon-phone1.png",
background: "#fff",
}, },
], ],
floatingTabs: [ floatingTabs: [
@ -441,11 +463,11 @@ export default {
title: "首页", title: "首页",
icon: "/static/common/images/icon_home.png", icon: "/static/common/images/icon_home.png",
}, },
{ // {
title: "招生在线", // title: "线",
icon: "/static/common/images/icon_admissions2.png", // icon: "/static/common/images/icon_admissions2.png",
path: "/pages/home/admissions/index", // path: "/pages/home/admissions/index",
}, // },
{ {
title: "转人工", title: "转人工",
icon: "/static/common/images/icon_conversation.png", icon: "/static/common/images/icon_conversation.png",
@ -518,6 +540,10 @@ export default {
}, },
displayFeatures() { displayFeatures() {
const list = Array.isArray(this.features) ? this.features : []; const list = Array.isArray(this.features) ? this.features : [];
return list;
},
displayFloatingTabs() {
const list = Array.isArray(this.floatingTabs) ? this.floatingTabs : [];
return list.map((item) => { return list.map((item) => {
if (item && item.title === "转人工") { if (item && item.title === "转人工") {
return { return {
@ -578,6 +604,18 @@ export default {
this.handlePopupShow(); this.handlePopupShow();
}, },
//
handleSettingClick() {
uni.navigateTo({
url: "/pages/home/userSetting/index",
});
},
//
// handleRecordClick() {
// console.log("");
// },
// //
resetChatState({ resetChatState({
conversationId = "", conversationId = "",
@ -660,38 +698,44 @@ export default {
extraOffset: 200, extraOffset: 200,
}); });
}, },
//
handleFeatureClick(item) { handleFeatureClick(item) {
if (item.title === "首页") { const actions = {
this.resetChatState({ isChat: false }); "首页": () => this.resetChatState({ isChat: false }),
return; "转人工": () => this.handleTransferEntryClick(),
} "结束会话": () => this.handleEndConversation(),
if (item.title === "转人工") { "电话咨询": () => { this.advicePhoneShow = true; }
this.handleTransferEntryClick(); };
return;
}
if (item.title === "结束会话") {
this.$store.commit("set_IsTransferChat", false);
return;
}
if (item.title === "电话咨询") { const action = actions[item.title];
this.advicePhoneShow = true; if (action) {
return; action();
} else if (item.path) { } else if (item.path) {
uni.navigateTo({ uni.navigateTo({ url: item.path });
url: item.path,
});
return;
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({ title: "暂未开放", type: "warning" });
title: "暂未开放",
type: "warning",
});
return;
} }
}, },
//
handleEndConversation() {
this.$u.api
.EndLiveAgentApi({
dialogueManagementId: this.vuex_msgUser?.dialogueManagementId,
teacherManagementId: this.vuex_msgUser?.receiverId,
})
.then((res) => {
if (res.succeed) {
this.$store.commit("set_IsTransferChat", false);
this.$u.toast("会话已结束");
} else {
this.$u.toast(res.error || "会话结束失败");
}
});
},
//
createLocalUserTextMessage(messageText) { createLocalUserTextMessage(messageText) {
return { return {
id: Math.random().toString(36).substring(2, 15), id: Math.random().toString(36).substring(2, 15),
@ -706,6 +750,7 @@ export default {
}; };
}, },
//
createTransferCardMessage() { createTransferCardMessage() {
return { return {
id: "transfer_" + Math.random().toString(36).substring(2, 15), id: "transfer_" + Math.random().toString(36).substring(2, 15),
@ -724,6 +769,7 @@ export default {
}; };
}, },
//
handleTransferEntryClick() { handleTransferEntryClick() {
if (!this.isChat) { if (!this.isChat) {
this.resetChatState(); this.resetChatState();
@ -809,22 +855,14 @@ export default {
return; return;
} }
// dialogueManagementId
const dialogueManagementId = const dialogueManagementId =
this.currentDMid || (res && res.data && res.data.dialogueManagementId) || "";
(res && // receiverId 线
res.data && const receiverId = (res && res.data && res.data.receiverId) || "";
(res.data.dialogueManagementId ||
res.data.DialogueManagementId)) || console.log(dialogueManagementId, "dialogueManagementId");
""; console.log(receiverId, "receiverId");
const receiverId =
(res &&
res.data &&
(res.data.receiverId ||
res.data.ReceiverId ||
res.data.liveAgentId ||
res.data.agentId ||
res.data.userId)) ||
"";
if (!this.currentDMid && dialogueManagementId) { if (!this.currentDMid && dialogueManagementId) {
this.currentDMid = dialogueManagementId; this.currentDMid = dialogueManagementId;
@ -837,12 +875,17 @@ export default {
if (dialogueManagementId && receiverId) { if (dialogueManagementId && receiverId) {
this.$store.commit("set_IsTransferChat", true); this.$store.commit("set_IsTransferChat", true);
this.$store.commit("update_MsgUser", {
dialogueManagementId,
receiverId,
});
this.$store.dispatch("selectTeacherChatItem", { this.$store.dispatch("selectTeacherChatItem", {
id: dialogueManagementId, id: dialogueManagementId,
receiverId, receiverId,
navigate: false, navigate: false,
}); });
} }
console.log(this.vuex_msgUser, "vuex_msgUser");
}) })
.catch(() => { .catch(() => {
updateTransferCard({ updateTransferCard({
@ -967,10 +1010,11 @@ export default {
}, },
// //
handleQAClick(item) { async handleQAClick(item) {
// //
if (!this.isChat) { if (!this.isChat) {
this.resetChatState(); // this.resetChatState();
await this.handleStartChat(); // ,
} }
const sendMessage = item.content; const sendMessage = item.content;
@ -1122,11 +1166,11 @@ export default {
// //
handleGetConversationDetail() { handleGetConversationDetail() {
if (!this.currentDMid) return; // if (!this.currentDMid) return;
this.$u.api return this.$u.api
.GetConversationDetail({ .GetConversationDetail({
"Item1.Id": this.currentDMid, // "Item1.Id": "08de2e31-4cdf-4b0c-8b83-d3185f604a5a",
PageIndex: this.pageQuery.PageIndex, PageIndex: this.pageQuery.PageIndex,
PageSize: this.pageQuery.PageSize, PageSize: this.pageQuery.PageSize,
}) })
@ -1147,14 +1191,14 @@ export default {
// >1退 // >1退
refreshPageWithFallback() { refreshPageWithFallback() {
if (!this.currentDMid) return; // if (!this.currentDMid) return;
const currentIndex = this.pageQuery.PageIndex || 1; const currentIndex = this.pageQuery.PageIndex || 1;
const pageSize = this.pageQuery.PageSize; const pageSize = this.pageQuery.PageSize;
return this.$u.api return this.$u.api
.GetConversationDetail({ .GetConversationDetail({
"Item1.Id": this.currentDMid, // "Item1.Id": this.currentDMid,
PageIndex: currentIndex, PageIndex: currentIndex,
PageSize: pageSize, PageSize: pageSize,
}) })
@ -1164,7 +1208,7 @@ export default {
const prevIndex = currentIndex - 1; const prevIndex = currentIndex - 1;
return this.$u.api return this.$u.api
.GetConversationDetail({ .GetConversationDetail({
"Item1.Id": this.currentDMid, // "Item1.Id": this.currentDMid,
PageIndex: prevIndex, PageIndex: prevIndex,
PageSize: pageSize, PageSize: pageSize,
}) })
@ -1195,6 +1239,9 @@ export default {
// //
handleStartChat() { handleStartChat() {
this.resetChatState(); this.resetChatState();
//
return this.handleGetConversationDetail();
}, },
// //
@ -1221,7 +1268,7 @@ export default {
this.pageQuery.PageIndex++; this.pageQuery.PageIndex++;
this.$u.api this.$u.api
.GetConversationDetail({ .GetConversationDetail({
"Item1.Id": this.currentDMid, // "Item1.Id": this.currentDMid,
PageIndex: this.pageQuery.PageIndex, PageIndex: this.pageQuery.PageIndex,
PageSize: this.pageQuery.PageSize, PageSize: this.pageQuery.PageSize,
}) })
@ -1328,6 +1375,11 @@ export default {
/* Header样式移至HeaderBar组件 */ /* Header样式移至HeaderBar组件 */
.header-icon {
width: 40rpx;
height: 40rpx;
}
.main-content { .main-content {
padding: 30rpx; padding: 30rpx;
padding-top: 60rpx; padding-top: 60rpx;
@ -1466,29 +1518,59 @@ export default {
border-radius: 16rpx; border-radius: 16rpx;
padding: 30rpx; padding: 30rpx;
display: flex; display: flex;
flex-direction: column;
justify-content: space-between; justify-content: space-between;
margin-top: 32rpx; margin-top: 32rpx;
gap: 30rpx; gap: 30rpx;
.feature-item { .feature-item {
height: 150rpx; height: 140rpx;
border-radius: 16rpx; border-radius: 16rpx;
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
padding-left: 30rpx; // padding-left: 30rpx;
gap: 20rpx; gap: 30rpx;
flex: 1; flex: 1;
.feature-icon { .feature-icon {
width: 80rpx; width: 80rpx;
height: 80rpx; height: 80rpx;
margin-top: 16rpx;
} }
.feature-text { .feature-text-wrapper {
font-size: 26rpx; display: flex;
color: #333333; flex-direction: column;
justify-content: space-between;
gap: 12rpx;
flex: 1;
.feature-title {
font-size: 28rpx;
color: #333333;
font-weight: bold;
}
.feature-tip {
font-size: 24rpx;
color: #999;
}
}
.feature-action-btn {
display: flex;
align-items: center;
justify-content: center;
padding: 14rpx 20rpx 14rpx 24rpx;
gap: 10rpx;
// height: 56rpx;
background: linear-gradient(-33deg, #6079ff 0%, #418ded 100%);
box-shadow: 0px 4rpx 16rpx 0rpx rgba(62, 106, 255, 0.6);
border-radius: 28rpx;
text {
font-size: 24rpx;
color: #ffffff;
margin-right: 4rpx;
}
} }
} }
} }

View File

@ -1,4 +1,5 @@
<template> <template>
<!-- 留言板页面 此页面已废弃 -->
<view class="message-board-page"> <view class="message-board-page">
<header-bar title="留言板" @leftClick="handleLeftClick"></header-bar> <header-bar title="留言板" @leftClick="handleLeftClick"></header-bar>
<view class="custom-tabs-box"> <view class="custom-tabs-box">

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 872 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -149,6 +149,14 @@ const store = new Vuex.Store({
}); });
} }
}, },
// 更新当前聊天用户的部分属性
update_MsgUser(state, payload) {
if (state.vuex_msgUser) {
state.vuex_msgUser = { ...state.vuex_msgUser, ...payload };
} else {
state.vuex_msgUser = payload;
}
},
// 现在没有id先覆盖整个list // 现在没有id先覆盖整个list
push_MsgList(state, list) { push_MsgList(state, list) {
state.vuex_msgList = list || []; state.vuex_msgList = list || [];
@ -173,7 +181,7 @@ const store = new Vuex.Store({
// 注现在的消息没有id无法去重暂时用push_MsgList // 注现在的消息没有id无法去重暂时用push_MsgList
if (!msg || !msg.id) return; if (!msg || !msg.id) return;
const exists = (state.vuex_msgList || []).some( const exists = (state.vuex_msgList || []).some(
(item) => item && item.id === msg.id (item) => item && item.id === msg.id,
); );
if (!exists) { if (!exists) {
state.vuex_msgList.push(msg); state.vuex_msgList.push(msg);
@ -198,15 +206,14 @@ const store = new Vuex.Store({
if (!msgId) return; if (!msgId) return;
const exists = (state.vuex_aiMessageGroups || []).some( const exists = (state.vuex_aiMessageGroups || []).some(
(item) => item && item.id === msgId (item) => item && item.id === msgId,
); );
if (exists) return; if (exists) return;
const userId = const userId =
(state.vuex_user && (state.vuex_user.Id || state.vuex_user.id)) || ""; (state.vuex_user && (state.vuex_user.Id || state.vuex_user.id)) || "";
const senderId = msg.senderId || msg.SenderId || ""; const senderId = msg.senderId || msg.SenderId || "";
const isSelf = const isSelf = userId && senderId && String(userId) === String(senderId);
userId && senderId && String(userId) === String(senderId);
state.vuex_aiMessageGroups.push({ state.vuex_aiMessageGroups.push({
id: msgId, id: msgId,
@ -243,7 +250,7 @@ const store = new Vuex.Store({
push_AiMsg(state, msg) { push_AiMsg(state, msg) {
if (!msg || !msg.id) return; if (!msg || !msg.id) return;
const exists = (state.vuex_aiMessageGroups || []).some( const exists = (state.vuex_aiMessageGroups || []).some(
(item) => item && item.id === msg.id (item) => item && item.id === msg.id,
); );
if (!exists) { if (!exists) {
state.vuex_aiMessageGroups.push(msg); state.vuex_aiMessageGroups.push(msg);
@ -266,7 +273,7 @@ const store = new Vuex.Store({
// WebSocket 实时消息:更新会话列表的未读数、文案与时间 // WebSocket 实时消息:更新会话列表的未读数、文案与时间
apply_RealtimeMessageToList( apply_RealtimeMessageToList(
state, state,
{ dialogueId, message, sendDate, senderId, receiverId } { dialogueId, message, sendDate, senderId, receiverId },
) { ) {
if (!dialogueId) return; if (!dialogueId) return;
const activeId = const activeId =
@ -286,10 +293,7 @@ const store = new Vuex.Store({
found = true; found = true;
const currentUnread = const currentUnread =
Number( Number(
item?.unReadCount ?? item?.unReadCount ?? item?.unreadCount ?? item?.unread ?? 0,
item?.unreadCount ??
item?.unread ??
0
) || 0; ) || 0;
const nextUnread = isActive ? 0 : currentUnread + 1; const nextUnread = isActive ? 0 : currentUnread + 1;
return { return {
@ -386,7 +390,7 @@ const store = new Vuex.Store({
// avatar: item.avatar, // avatar: item.avatar,
unReadCount, unReadCount,
}; };
} },
); );
commit("set_UserMsgList", list); commit("set_UserMsgList", list);
return list; return list;
@ -403,7 +407,7 @@ const store = new Vuex.Store({
// 获取聊天记录(私聊)——仅在进入聊天页时加载一次 // 获取聊天记录(私聊)——仅在进入聊天页时加载一次
async fetchChatRecord( async fetchChatRecord(
{ commit }, { commit },
{ dialogueManagementId, PageIndex = 1, PageSize = 20 } { dialogueManagementId, PageIndex = 1, PageSize = 20 },
) { ) {
return Vue.prototype.$u.api return Vue.prototype.$u.api
.GetChatHistoryDataApi({ .GetChatHistoryDataApi({
@ -412,11 +416,13 @@ const store = new Vuex.Store({
PageSize, PageSize,
}) })
.then((res) => { .then((res) => {
const list = const list = (
(res && res.data && Array.isArray(res.data.item1) res && res.data && Array.isArray(res.data.item1)
? res.data.item1 ? res.data.item1
: [] : []
).slice().reverse(); )
.slice()
.reverse();
commit("push_MsgList", list); commit("push_MsgList", list);
return list; return list;
}); });
@ -425,7 +431,7 @@ const store = new Vuex.Store({
// 获取下一页历史消息(滚动到顶部触发) // 获取下一页历史消息(滚动到顶部触发)
async fetchChatRecordNextPage( async fetchChatRecordNextPage(
{ commit }, { commit },
{ dialogueManagementId, PageIndex = 1, PageSize = 20 } { dialogueManagementId, PageIndex = 1, PageSize = 20 },
) { ) {
return Vue.prototype.$u.api return Vue.prototype.$u.api
.GetChatHistoryDataApi({ .GetChatHistoryDataApi({
@ -434,11 +440,13 @@ const store = new Vuex.Store({
PageSize, PageSize,
}) })
.then((res) => { .then((res) => {
const list = const list = (
(res && res.data && Array.isArray(res.data.item1) res && res.data && Array.isArray(res.data.item1)
? res.data.item1 ? res.data.item1
: [] : []
).slice().reverse(); )
.slice()
.reverse();
if (!list.length) return []; if (!list.length) return [];
commit("prepend_MsgList", list); commit("prepend_MsgList", list);
return list; return list;
@ -462,7 +470,7 @@ const store = new Vuex.Store({
// 点击聊天记录,切换到该会话 // 点击聊天记录,切换到该会话
selectTeacherChatItem( selectTeacherChatItem(
{ commit, dispatch }, { commit, dispatch },
{ id, receiverId, navigate = true } = {} { id, receiverId, navigate = true } = {},
) { ) {
if (!id || !receiverId) return; if (!id || !receiverId) return;
// 清空消息列表,避免旧消息干扰 // 清空消息列表,避免旧消息干扰
@ -472,7 +480,7 @@ const store = new Vuex.Store({
.GetReceiverUserInfoApi({ Id: receiverId }) .GetReceiverUserInfoApi({ Id: receiverId })
.then((res) => { .then((res) => {
if (res.succeed && res.data) { if (res.succeed && res.data) {
commit("set_MsgUser", { ...res.data, dialogueManagementId: id }); commit("update_MsgUser", { ...res.data, dialogueManagementId: id });
if (navigate) { if (navigate) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/chat/index`, url: `/pages/chat/index`,