From 6201973ca43f4f9eab9e9bf82f432c5110278138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kaizheng=28=E9=83=91=E5=87=AF=29?= Date: Sat, 15 Feb 2025 17:49:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=99=BB=E5=BD=95=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 2 +- src/hooks/useVideoPlay.js | 18 +- src/hooks/useWebSocket.js | 6 +- src/hooks/useWebsocketMsg.js | 26 ++- src/store/index.js | 6 +- src/views/Circle/components/ChatFrame.vue | 12 +- src/views/Circle/hooks/useChatData.js | 4 +- src/views/Circle/hooks/useWebSocket.js | 8 +- src/views/Circle/interact.vue | 2 +- src/views/Login/index.vue | 23 +- src/views/SerialDetail/index.vue | 2 +- .../ShotVideoPlay/components/ChatFrame.vue | 2 +- src/views/ShotVideoPlay/index.vue | 4 +- src/views/VideoPlay/components/ChatFrame.vue | 14 +- src/views/VideoPlay/hComponents/ChatFrame.vue | 216 ++++++++++++------ src/views/VideoPlay/index.vue | 12 +- src/views/test.vue | 23 +- 17 files changed, 227 insertions(+), 153 deletions(-) diff --git a/src/App.vue b/src/App.vue index b652427..3a14b74 100644 --- a/src/App.vue +++ b/src/App.vue @@ -30,7 +30,7 @@ const forbidLogin = computed(() => { if (terminalType === "App") { window.upNativeComm.addEventListener("UPUser", (opt) => { - if (opt.action == "userChange" && store.state.userInfo.account) { + if (opt.action == "userChange" && store.state.userInfo.userId) { console.log("userChange-->", opt); // app里监听用户资金账号切换 userLogin(); diff --git a/src/hooks/useVideoPlay.js b/src/hooks/useVideoPlay.js index 06689eb..1a899c8 100644 --- a/src/hooks/useVideoPlay.js +++ b/src/hooks/useVideoPlay.js @@ -14,7 +14,7 @@ export default function useVideoPlay( let playCtx = ref(); let showPlayBtn = ref(false); let sessionId = localStorage.getItem( - `sessionId-${store.state.userInfo.account}-${detail.id}` + `sessionId-${store.state.userInfo.userId}-${detail.id}` ); console.log("sessionId", sessionId); const playVideo = async (videoEl) => { @@ -78,7 +78,7 @@ export default function useVideoPlay( setPlayCtx({ playCtx: playCtx.value }); playCtx.value.on("loadedmetadata", () => { const currentTime = localStorage.getItem( - `${store.state.userInfo.account}-${detail.id}-videoPlayTime`, + `${store.state.userInfo.userId}-${detail.id}-videoPlayTime`, playCtx.value.currentTime() ); if (playCtx.value && currentTime) { @@ -94,7 +94,7 @@ export default function useVideoPlay( // 做一些处理 console.log("play", { reportVideoTopic: `/app/chat/report/video/${detail.id}`, - userId: store.state.userInfo.account, + userId: store.state.userInfo.userId, reportType: 2, GroupId: detail.id, }); @@ -104,7 +104,7 @@ export default function useVideoPlay( stompClient.value.publish({ destination: `/app/chat/report/video/${detail.id}`, headers: { - userId: store.state.userInfo.account, + userId: store.state.userInfo.userId, reportType: 2, GroupId: detail.id, sessionId, @@ -117,7 +117,7 @@ export default function useVideoPlay( // 做一些处理 console.log("pause", { reportVideoTopic: `/app/chat/report/video/${detail.id}`, - userId: store.state.userInfo.account, + userId: store.state.userInfo.userId, reportType: 1, GroupId: detail.id, }); @@ -127,7 +127,7 @@ export default function useVideoPlay( stompClient.value.publish({ destination: `/app/chat/report/video/${detail.id}`, headers: { - userId: store.state.userInfo.account, + userId: store.state.userInfo.userId, reportType: 1, GroupId: detail.id, sessionId, @@ -182,7 +182,7 @@ export default function useVideoPlay( }); playCtx.value.on("timeupdate", () => { localStorage.setItem( - `${store.state.userInfo.account}-${detail.id}-videoPlayTime`, + `${store.state.userInfo.userId}-${detail.id}-videoPlayTime`, playCtx.value.currentTime() ); }); @@ -229,7 +229,7 @@ export default function useVideoPlay( stompClient.value.publish({ destination: `/app/chat/report/video/${detail.id}`, headers: { - userId: store.state.userInfo.account, + userId: store.state.userInfo.userId, reportType: 2, GroupId: detail.id, sessionId, @@ -247,7 +247,7 @@ export default function useVideoPlay( stompClient.value.publish({ destination: `/app/chat/report/video/${detail.id}`, headers: { - userId: store.state.userInfo.account, + userId: store.state.userInfo.userId, reportType: 1, GroupId: detail.id, sessionId, diff --git a/src/hooks/useWebSocket.js b/src/hooks/useWebSocket.js index 81e332a..4a538c2 100644 --- a/src/hooks/useWebSocket.js +++ b/src/hooks/useWebSocket.js @@ -29,15 +29,15 @@ export default function ({ id, subMessage, chatMessage, saleUserId }) { console.log("connect建立连接"); const frontToken = store.state.token; if ( - localStorage.getItem(`sessionId-${store.state.userInfo.account}-${id}`) + localStorage.getItem(`sessionId-${store.state.userInfo.userId}-${id}`) ) { sessionId = localStorage.getItem( - `sessionId-${store.state.userInfo.account}-${id}` + `sessionId-${store.state.userInfo.userId}-${id}` ); } else { sessionId = Math.random().toString(36).substring(2, 8); localStorage.setItem( - `sessionId-${store.state.userInfo.account}-${id}`, + `sessionId-${store.state.userInfo.userId}-${id}`, sessionId ); } diff --git a/src/hooks/useWebsocketMsg.js b/src/hooks/useWebsocketMsg.js index 26a9def..029be79 100644 --- a/src/hooks/useWebsocketMsg.js +++ b/src/hooks/useWebsocketMsg.js @@ -45,8 +45,11 @@ export default function ({ detail, videoClass }) { onMounted(async () => { if ( - [$liveStatusObj.InLive, $liveStatusObj.PausePlay].includes(liveStatus.value) || - ((liveStatus.value === $liveStatusObj.FinishPlay || detail.playType === 2)&& + [$liveStatusObj.InLive, $liveStatusObj.PausePlay].includes( + liveStatus.value + ) || + ((liveStatus.value === $liveStatusObj.FinishPlay || + detail.playType === 2) && detail.libraryList && detail.libraryList.length) ) { @@ -74,7 +77,7 @@ export default function ({ detail, videoClass }) { function processingData(data) { if (data && data.type === 3) { online.value = data.online; - if (store.state.userInfo.account !== data.userId) { + if (store.state.userInfo.userId !== data.userId) { // 判断是否是本人进入直播间 // informMsgList.value.push(data); store.commit("setInteractMsg", { @@ -235,10 +238,10 @@ export default function ({ detail, videoClass }) { msgObj.isOpen = msgBody.data.isOpen; msgObj.show = (!msgObj.replyBasic && msgObj.isOpen !== 2) || - store.state.userInfo.account === msgObj.phone || + store.state.userInfo.userId === msgObj.phone || (msgObj.replyBasic && (msgObj.replyBasic.isOpen === 1 || - store.state.userInfo.account === msgObj.replyBasic.userId)); + store.state.userInfo.userId === msgObj.replyBasic.userId)); } var replyMsgObj = @@ -249,11 +252,10 @@ export default function ({ detail, videoClass }) { replyMsgObj.replyBasic.isOpen = msgBody.data.isOpen; replyMsgObj.show = (!replyMsgObj.replyBasic && replyMsgObj.isOpen !== 2) || - store.state.userInfo.account === replyMsgObj.phone || + store.state.userInfo.userId === replyMsgObj.phone || (replyMsgObj.replyBasic && (replyMsgObj.replyBasic.isOpen === 1 || - store.state.userInfo.account === - replyMsgObj.replyBasic.userId)); + store.state.userInfo.userId === replyMsgObj.replyBasic.userId)); } break; case 11: @@ -262,7 +264,7 @@ export default function ({ detail, videoClass }) { !questionnaireTipRef.value.showPopup && !questionnaireTipRef.value.questionnairePopupRef.showPopup && !msgBody.data.questionVO.userIdList.includes( - store.state.userInfo.account + store.state.userInfo.userId ) ) { questionId.value = msgBody.data.questionVO?.id; @@ -286,7 +288,9 @@ export default function ({ detail, videoClass }) { break; case 16: // 隐藏用户昵称 - emitter.emit("updateVideoDetail", { showNickname: msgBody.data.openQW }); + emitter.emit("updateVideoDetail", { + showNickname: msgBody.data.openQW, + }); break; default: break; @@ -301,7 +305,7 @@ export default function ({ detail, videoClass }) { case 1: // 文本详细 ret = await liveMsgSend({ - from: store.state.userInfo.account, + from: store.state.userInfo.userId, groupId: detail.id, text, type, diff --git a/src/store/index.js b/src/store/index.js index d913472..a7d363f 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -86,16 +86,16 @@ export default createStore({ let chatTime = dayjs(item.createTime).format("MM-DD HH:mm"); item.show = (!item.replyBasic && item.isOpen !== 2) || - state.userInfo.account === item.phone || + state.userInfo.userId === item.phone || (item.replyBasic && (item.replyBasic.isOpen === 1 || - state.userInfo.account === item.replyBasic.userId)); + state.userInfo.userId === item.replyBasic.userId)); if (payload.type === 1) { // 新消息 // 公开的或者是本人发的文本消息 if ( ((item.userId && item.isOpen === 1) || - item.phone === state.userInfo.account) && + item.phone === state.userInfo.userId) && item.type === 1 ) { state.interactMsgObj.newTreeMsg.push(item); diff --git a/src/views/Circle/components/ChatFrame.vue b/src/views/Circle/components/ChatFrame.vue index eb8a5ad..6864e46 100644 --- a/src/views/Circle/components/ChatFrame.vue +++ b/src/views/Circle/components/ChatFrame.vue @@ -19,7 +19,7 @@ v-for="item in msgList" :class="[ `li${item.id}`, - item.userId === store.state.userInfo.account ? 'row-reverse' : '', + item.userId === store.state.userInfo.userId ? 'row-reverse' : '', ]" :key="item.id" > @@ -27,7 +27,7 @@ v-if=" item.status === 2 || (item.userType === 2 && - item.userId === store.state.userInfo.account) + item.userId === store.state.userInfo.userId) " >
@@ -36,7 +36,7 @@
{{ item.userType === 2 - ? item.userId === store.state.userInfo.account + ? item.userId === store.state.userInfo.userId ? "我" : detail.showNickName === 2 ? maskUserName(item.userName) @@ -81,7 +81,7 @@ >
-
{{ detail.advisorBasic.name }}({{detail.advisorBasic.license}})
+
+ {{ detail.advisorBasic.name + }}({{ detail.advisorBasic.license }}) +
  • @@ -50,17 +55,24 @@ -
    {{ isTg ? item.tgChatTime : item.chatTime }}
    +
    + {{ isTg ? item.tgChatTime : item.chatTime }} +
    {{ - item.phone === store.state.userInfo.account + item.phone === store.state.userInfo.userId ? "我" - : detail.showNickname === 2 ? maskUserName(item.userName) : item.userName + : detail.showNickname === 2 + ? maskUserName(item.userName) + : item.userName }}:分享了直播间 @@ -69,7 +81,7 @@ v-else :class="[ 'flex', - item.phone === store.state.userInfo.account ? 'row-reverse' : '', + item.phone === store.state.userInfo.userId ? 'row-reverse' : '', ]" >
    @@ -91,10 +103,14 @@

    {{ item.userId - ? item.phone === store.state.userInfo.account + ? item.phone === store.state.userInfo.userId ? "我" - : detail.showNickname === 2 ? maskUserName(item.userName) : item.userName - : item.createUserVO ? item.createUserVO.name : item.advisorBasic?.showName + : detail.showNickname === 2 + ? maskUserName(item.userName) + : item.userName + : item.createUserVO + ? item.createUserVO.name + : item.advisorBasic?.showName }} 讲师 助教 @@ -105,20 +121,35 @@
    回复 + > {{ item.content }}
    - {{ item.replyBasic.userId === store.state.userInfo.account - ? "我" : detail.showNickname === 2 ? maskUserName(item.replyBasic.userName) : item.replyBasic.userName }}:{{ - item.replyBasic.content - }} + {{ + item.replyBasic.userId === store.state.userInfo.userId + ? "我" + : detail.showNickname === 2 + ? maskUserName(item.replyBasic.userName) + : item.replyBasic.userName + }}:{{ item.replyBasic.content }}
    -
    {{ item.advisorBasic?.name }}({{item.advisorBasic?.license}})
    +
    + {{ item.advisorBasic?.name + }}({{ item.advisorBasic?.license }}) +

    -
    @@ -131,7 +162,12 @@ @click="imagePreview(item.content.split('upImg-')[1])" :src="item.content.split('upImg-')[1]" /> -
    {{ detail.advisorBasic.name }}({{detail.advisorBasic.license}})
    +
    + {{ detail.advisorBasic.name + }}({{ detail.advisorBasic.license }}) +
    @@ -147,9 +183,11 @@

    关注了老师

    @@ -157,7 +195,7 @@ class="attention" @click="subAdvisor" v-if=" - item.phone !== store.state.userInfo.account && + item.phone !== store.state.userInfo.userId && detail.isSubAdvisor !== 1 " > @@ -172,7 +210,13 @@

    - {{ item.content }} + {{ item.content }}

    @@ -190,7 +234,9 @@
  • -
    您有{{newMsgNum}}条新的消息
    +
    + 您有{{ newMsgNum }}条新的消息 +