fix: 登录对接

This commit is contained in:
kaizheng(郑凯) 2025-02-15 17:49:35 +08:00
parent 512678dde3
commit 6201973ca4
17 changed files with 227 additions and 153 deletions

View File

@ -30,7 +30,7 @@ const forbidLogin = computed(() => {
if (terminalType === "App") { if (terminalType === "App") {
window.upNativeComm.addEventListener("UPUser", (opt) => { 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); console.log("userChange-->", opt);
// app // app
userLogin(); userLogin();

View File

@ -14,7 +14,7 @@ export default function useVideoPlay(
let playCtx = ref(); let playCtx = ref();
let showPlayBtn = ref(false); let showPlayBtn = ref(false);
let sessionId = localStorage.getItem( let sessionId = localStorage.getItem(
`sessionId-${store.state.userInfo.account}-${detail.id}` `sessionId-${store.state.userInfo.userId}-${detail.id}`
); );
console.log("sessionId", sessionId); console.log("sessionId", sessionId);
const playVideo = async (videoEl) => { const playVideo = async (videoEl) => {
@ -78,7 +78,7 @@ export default function useVideoPlay(
setPlayCtx({ playCtx: playCtx.value }); setPlayCtx({ playCtx: playCtx.value });
playCtx.value.on("loadedmetadata", () => { playCtx.value.on("loadedmetadata", () => {
const currentTime = localStorage.getItem( const currentTime = localStorage.getItem(
`${store.state.userInfo.account}-${detail.id}-videoPlayTime`, `${store.state.userInfo.userId}-${detail.id}-videoPlayTime`,
playCtx.value.currentTime() playCtx.value.currentTime()
); );
if (playCtx.value && currentTime) { if (playCtx.value && currentTime) {
@ -94,7 +94,7 @@ export default function useVideoPlay(
// 做一些处理 // 做一些处理
console.log("play", { console.log("play", {
reportVideoTopic: `/app/chat/report/video/${detail.id}`, reportVideoTopic: `/app/chat/report/video/${detail.id}`,
userId: store.state.userInfo.account, userId: store.state.userInfo.userId,
reportType: 2, reportType: 2,
GroupId: detail.id, GroupId: detail.id,
}); });
@ -104,7 +104,7 @@ export default function useVideoPlay(
stompClient.value.publish({ stompClient.value.publish({
destination: `/app/chat/report/video/${detail.id}`, destination: `/app/chat/report/video/${detail.id}`,
headers: { headers: {
userId: store.state.userInfo.account, userId: store.state.userInfo.userId,
reportType: 2, reportType: 2,
GroupId: detail.id, GroupId: detail.id,
sessionId, sessionId,
@ -117,7 +117,7 @@ export default function useVideoPlay(
// 做一些处理 // 做一些处理
console.log("pause", { console.log("pause", {
reportVideoTopic: `/app/chat/report/video/${detail.id}`, reportVideoTopic: `/app/chat/report/video/${detail.id}`,
userId: store.state.userInfo.account, userId: store.state.userInfo.userId,
reportType: 1, reportType: 1,
GroupId: detail.id, GroupId: detail.id,
}); });
@ -127,7 +127,7 @@ export default function useVideoPlay(
stompClient.value.publish({ stompClient.value.publish({
destination: `/app/chat/report/video/${detail.id}`, destination: `/app/chat/report/video/${detail.id}`,
headers: { headers: {
userId: store.state.userInfo.account, userId: store.state.userInfo.userId,
reportType: 1, reportType: 1,
GroupId: detail.id, GroupId: detail.id,
sessionId, sessionId,
@ -182,7 +182,7 @@ export default function useVideoPlay(
}); });
playCtx.value.on("timeupdate", () => { playCtx.value.on("timeupdate", () => {
localStorage.setItem( localStorage.setItem(
`${store.state.userInfo.account}-${detail.id}-videoPlayTime`, `${store.state.userInfo.userId}-${detail.id}-videoPlayTime`,
playCtx.value.currentTime() playCtx.value.currentTime()
); );
}); });
@ -229,7 +229,7 @@ export default function useVideoPlay(
stompClient.value.publish({ stompClient.value.publish({
destination: `/app/chat/report/video/${detail.id}`, destination: `/app/chat/report/video/${detail.id}`,
headers: { headers: {
userId: store.state.userInfo.account, userId: store.state.userInfo.userId,
reportType: 2, reportType: 2,
GroupId: detail.id, GroupId: detail.id,
sessionId, sessionId,
@ -247,7 +247,7 @@ export default function useVideoPlay(
stompClient.value.publish({ stompClient.value.publish({
destination: `/app/chat/report/video/${detail.id}`, destination: `/app/chat/report/video/${detail.id}`,
headers: { headers: {
userId: store.state.userInfo.account, userId: store.state.userInfo.userId,
reportType: 1, reportType: 1,
GroupId: detail.id, GroupId: detail.id,
sessionId, sessionId,

View File

@ -29,15 +29,15 @@ export default function ({ id, subMessage, chatMessage, saleUserId }) {
console.log("connect建立连接"); console.log("connect建立连接");
const frontToken = store.state.token; const frontToken = store.state.token;
if ( if (
localStorage.getItem(`sessionId-${store.state.userInfo.account}-${id}`) localStorage.getItem(`sessionId-${store.state.userInfo.userId}-${id}`)
) { ) {
sessionId = localStorage.getItem( sessionId = localStorage.getItem(
`sessionId-${store.state.userInfo.account}-${id}` `sessionId-${store.state.userInfo.userId}-${id}`
); );
} else { } else {
sessionId = Math.random().toString(36).substring(2, 8); sessionId = Math.random().toString(36).substring(2, 8);
localStorage.setItem( localStorage.setItem(
`sessionId-${store.state.userInfo.account}-${id}`, `sessionId-${store.state.userInfo.userId}-${id}`,
sessionId sessionId
); );
} }

View File

@ -45,8 +45,11 @@ export default function ({ detail, videoClass }) {
onMounted(async () => { onMounted(async () => {
if ( if (
[$liveStatusObj.InLive, $liveStatusObj.PausePlay].includes(liveStatus.value) || [$liveStatusObj.InLive, $liveStatusObj.PausePlay].includes(
((liveStatus.value === $liveStatusObj.FinishPlay || detail.playType === 2)&& liveStatus.value
) ||
((liveStatus.value === $liveStatusObj.FinishPlay ||
detail.playType === 2) &&
detail.libraryList && detail.libraryList &&
detail.libraryList.length) detail.libraryList.length)
) { ) {
@ -74,7 +77,7 @@ export default function ({ detail, videoClass }) {
function processingData(data) { function processingData(data) {
if (data && data.type === 3) { if (data && data.type === 3) {
online.value = data.online; online.value = data.online;
if (store.state.userInfo.account !== data.userId) { if (store.state.userInfo.userId !== data.userId) {
// 判断是否是本人进入直播间 // 判断是否是本人进入直播间
// informMsgList.value.push(data); // informMsgList.value.push(data);
store.commit("setInteractMsg", { store.commit("setInteractMsg", {
@ -235,10 +238,10 @@ export default function ({ detail, videoClass }) {
msgObj.isOpen = msgBody.data.isOpen; msgObj.isOpen = msgBody.data.isOpen;
msgObj.show = msgObj.show =
(!msgObj.replyBasic && msgObj.isOpen !== 2) || (!msgObj.replyBasic && msgObj.isOpen !== 2) ||
store.state.userInfo.account === msgObj.phone || store.state.userInfo.userId === msgObj.phone ||
(msgObj.replyBasic && (msgObj.replyBasic &&
(msgObj.replyBasic.isOpen === 1 || (msgObj.replyBasic.isOpen === 1 ||
store.state.userInfo.account === msgObj.replyBasic.userId)); store.state.userInfo.userId === msgObj.replyBasic.userId));
} }
var replyMsgObj = var replyMsgObj =
@ -249,11 +252,10 @@ export default function ({ detail, videoClass }) {
replyMsgObj.replyBasic.isOpen = msgBody.data.isOpen; replyMsgObj.replyBasic.isOpen = msgBody.data.isOpen;
replyMsgObj.show = replyMsgObj.show =
(!replyMsgObj.replyBasic && replyMsgObj.isOpen !== 2) || (!replyMsgObj.replyBasic && replyMsgObj.isOpen !== 2) ||
store.state.userInfo.account === replyMsgObj.phone || store.state.userInfo.userId === replyMsgObj.phone ||
(replyMsgObj.replyBasic && (replyMsgObj.replyBasic &&
(replyMsgObj.replyBasic.isOpen === 1 || (replyMsgObj.replyBasic.isOpen === 1 ||
store.state.userInfo.account === store.state.userInfo.userId === replyMsgObj.replyBasic.userId));
replyMsgObj.replyBasic.userId));
} }
break; break;
case 11: case 11:
@ -262,7 +264,7 @@ export default function ({ detail, videoClass }) {
!questionnaireTipRef.value.showPopup && !questionnaireTipRef.value.showPopup &&
!questionnaireTipRef.value.questionnairePopupRef.showPopup && !questionnaireTipRef.value.questionnairePopupRef.showPopup &&
!msgBody.data.questionVO.userIdList.includes( !msgBody.data.questionVO.userIdList.includes(
store.state.userInfo.account store.state.userInfo.userId
) )
) { ) {
questionId.value = msgBody.data.questionVO?.id; questionId.value = msgBody.data.questionVO?.id;
@ -286,7 +288,9 @@ export default function ({ detail, videoClass }) {
break; break;
case 16: case 16:
// 隐藏用户昵称 // 隐藏用户昵称
emitter.emit("updateVideoDetail", { showNickname: msgBody.data.openQW }); emitter.emit("updateVideoDetail", {
showNickname: msgBody.data.openQW,
});
break; break;
default: default:
break; break;
@ -301,7 +305,7 @@ export default function ({ detail, videoClass }) {
case 1: case 1:
// 文本详细 // 文本详细
ret = await liveMsgSend({ ret = await liveMsgSend({
from: store.state.userInfo.account, from: store.state.userInfo.userId,
groupId: detail.id, groupId: detail.id,
text, text,
type, type,

View File

@ -86,16 +86,16 @@ export default createStore({
let chatTime = dayjs(item.createTime).format("MM-DD HH:mm"); let chatTime = dayjs(item.createTime).format("MM-DD HH:mm");
item.show = item.show =
(!item.replyBasic && item.isOpen !== 2) || (!item.replyBasic && item.isOpen !== 2) ||
state.userInfo.account === item.phone || state.userInfo.userId === item.phone ||
(item.replyBasic && (item.replyBasic &&
(item.replyBasic.isOpen === 1 || (item.replyBasic.isOpen === 1 ||
state.userInfo.account === item.replyBasic.userId)); state.userInfo.userId === item.replyBasic.userId));
if (payload.type === 1) { if (payload.type === 1) {
// 新消息 // 新消息
// 公开的或者是本人发的文本消息 // 公开的或者是本人发的文本消息
if ( if (
((item.userId && item.isOpen === 1) || ((item.userId && item.isOpen === 1) ||
item.phone === state.userInfo.account) && item.phone === state.userInfo.userId) &&
item.type === 1 item.type === 1
) { ) {
state.interactMsgObj.newTreeMsg.push(item); state.interactMsgObj.newTreeMsg.push(item);

View File

@ -19,7 +19,7 @@
v-for="item in msgList" v-for="item in msgList"
:class="[ :class="[
`li${item.id}`, `li${item.id}`,
item.userId === store.state.userInfo.account ? 'row-reverse' : '', item.userId === store.state.userInfo.userId ? 'row-reverse' : '',
]" ]"
:key="item.id" :key="item.id"
> >
@ -27,7 +27,7 @@
v-if=" v-if="
item.status === 2 || item.status === 2 ||
(item.userType === 2 && (item.userType === 2 &&
item.userId === store.state.userInfo.account) item.userId === store.state.userInfo.userId)
" "
> >
<div class="chat-time" v-if="item.chatTime"> <div class="chat-time" v-if="item.chatTime">
@ -36,7 +36,7 @@
<div <div
:class="[ :class="[
'flex', 'flex',
item.userId === store.state.userInfo.account item.userId === store.state.userInfo.userId
? 'row-reverse' ? 'row-reverse'
: '', : '',
]" ]"
@ -62,7 +62,7 @@
<h3> <h3>
{{ {{
item.userType === 2 item.userType === 2
? item.userId === store.state.userInfo.account ? item.userId === store.state.userInfo.userId
? "我" ? "我"
: detail.showNickName === 2 : detail.showNickName === 2
? maskUserName(item.userName) ? maskUserName(item.userName)
@ -81,7 +81,7 @@
><label ><label
>{{ >{{
item.replyMessage?.userId === item.replyMessage?.userId ===
store.state.userInfo.account store.state.userInfo.userId
? "我" ? "我"
: detail.showNickName === 2 : detail.showNickName === 2
? maskUserName(item.replyMessage?.userName) ? maskUserName(item.replyMessage?.userName)
@ -102,7 +102,7 @@
<div class="reply" style="color: rgba(154, 164, 182, 1)"> <div class="reply" style="color: rgba(154, 164, 182, 1)">
{{ {{
item.replyMessage?.userId === item.replyMessage?.userId ===
store.state.userInfo.account store.state.userInfo.userId
? "我" ? "我"
: detail.showNickName === 2 : detail.showNickName === 2
? maskUserName(item.replyMessage?.userName) ? maskUserName(item.replyMessage?.userName)

View File

@ -46,7 +46,7 @@ export default function useChatData({ id, className, type, stompClient }) {
} }
setStorageTeacherMsg({ setStorageTeacherMsg({
productId: id, productId: id,
userId: store.state.userInfo.account, userId: store.state.userInfo.userId,
msgArr: list, msgArr: list,
type: type === 5 ? 2 : 1, type: type === 5 ? 2 : 1,
stompClient, stompClient,
@ -80,7 +80,7 @@ export default function useChatData({ id, className, type, stompClient }) {
}); });
setStorageTeacherMsg({ setStorageTeacherMsg({
productId: id, productId: id,
userId: store.state.userInfo.account, userId: store.state.userInfo.userId,
msg, msg,
type: type === 5 ? 2 : 1, type: type === 5 ? 2 : 1,
}); });

View File

@ -23,15 +23,15 @@ export default function ({ id, privateMessage, chatMessage }) {
console.log("connect建立连接"); console.log("connect建立连接");
const frontToken = store.state.token; const frontToken = store.state.token;
if ( if (
localStorage.getItem(`sessionId-${store.state.userInfo.account}-${id}`) localStorage.getItem(`sessionId-${store.state.userInfo.userId}-${id}`)
) { ) {
sessionId = localStorage.getItem( sessionId = localStorage.getItem(
`sessionId-${store.state.userInfo.account}-${id}` `sessionId-${store.state.userInfo.userId}-${id}`
); );
} else { } else {
sessionId = Math.random().toString(36).substring(2, 8); sessionId = Math.random().toString(36).substring(2, 8);
localStorage.setItem( localStorage.setItem(
`sessionId-${store.state.userInfo.account}-${id}`, `sessionId-${store.state.userInfo.userId}-${id}`,
sessionId sessionId
); );
} }
@ -77,7 +77,7 @@ export default function ({ id, privateMessage, chatMessage }) {
// APP端私聊消息 // APP端私聊消息
privateMessage && privateMessage &&
(await stompClient.value.subscribe( (await stompClient.value.subscribe(
`/app/private/topic/${id}/${store.state.userInfo.account}`, `/app/private/topic/${id}/${store.state.userInfo.userId}`,
privateMessage privateMessage
)); ));
}; };

View File

@ -99,7 +99,7 @@ const queryCircleDetail = async () => {
const ret = await getCircleDetail({ id: route.query.id }); const ret = await getCircleDetail({ id: route.query.id });
if (ret && ret.code === 0) { if (ret && ret.code === 0) {
detail.value = ret.data; detail.value = ret.data;
const key = `circleNotice-${detail.value.id}-${store.state.userInfo.account}`; const key = `circleNotice-${detail.value.id}-${store.state.userInfo.userId}`;
const storageCircleNotice = localStorage.getItem(key); const storageCircleNotice = localStorage.getItem(key);
if (!storageCircleNotice || storageCircleNotice !== detail.value.notice) { if (!storageCircleNotice || storageCircleNotice !== detail.value.notice) {
showNotice.value = true; showNotice.value = true;

View File

@ -5,7 +5,11 @@
<div class="form"> <div class="form">
<div class="input-group"> <div class="input-group">
<label>账户</label> <label>账户</label>
<input placeholder="请输入账号" v-model="fromData.userId" /> <input placeholder="请输入账号" v-model.trim="fromData.userName" />
</div>
<div class="input-group">
<label>密码</label>
<input placeholder="请输入密码" v-model.trim="fromData.password" />
</div> </div>
<!-- <div class="input-group"> <!-- <div class="input-group">
<label>验证码</label> <label>验证码</label>
@ -13,7 +17,7 @@
<span v-if="!showTime" @click="getCode">点击获取</span> <span v-if="!showTime" @click="getCode">点击获取</span>
<i v-else>{{ time }}S后重试</i> <i v-else>{{ time }}S后重试</i>
</div> --> </div> -->
<button @click="login">登录</button> <button @click="login" :disabled="disabled">登录</button>
</div> </div>
</div> </div>
</template> </template>
@ -24,7 +28,7 @@ import { useRoute, useRouter } from "vue-router";
import Nav from "@/components/NavBar.vue"; import Nav from "@/components/NavBar.vue";
// import { queryLogin } from "@/api/index"; // import { queryLogin } from "@/api/index";
import { useStore } from "vuex"; import { useStore } from "vuex";
// import { showToast } from "vant"; import { showToast } from "vant";
import { getUserInfo } from "@/api/index"; import { getUserInfo } from "@/api/index";
const store = useStore(); const store = useStore();
@ -34,11 +38,12 @@ const router = useRouter();
const disabled = ref(true); const disabled = ref(true);
// const showTime = ref(false); // const showTime = ref(false);
const fromData = reactive({ const fromData = reactive({
userId: "", userName: "",
password: "",
clientType: 1, clientType: 1,
}); });
watch(fromData, (val) => { watch(fromData, (val) => {
if (val.account && val.code) { if (val.userName && val.password) {
disabled.value = false; disabled.value = false;
} else { } else {
disabled.value = true; disabled.value = true;
@ -47,9 +52,11 @@ watch(fromData, (val) => {
// const reg = /^1[34578]\d{9}$/; // const reg = /^1[34578]\d{9}$/;
const login = async () => { const login = async () => {
// if (!reg.test(fromData.account)) { if (!fromData.userName) {
// return showToast(""); return showToast("请输入账号!");
// } } else if (!fromData.password) {
return showToast("请输入密码!");
}
let ret = await getUserInfo({ ...fromData }); let ret = await getUserInfo({ ...fromData });
if (ret.code === 0) { if (ret.code === 0) {
store.commit("setToken", ret.data.upToken); store.commit("setToken", ret.data.upToken);

View File

@ -99,7 +99,7 @@ const getSerialDetailFn = async () => {
window.shareApi.initWxH5({ window.shareApi.initWxH5({
env: window.config.shareEnv, env: window.config.shareEnv,
shareusername: store.state.userInfo.account, shareusername: store.state.userInfo.userId,
title: serial.value.name, title: serial.value.name,
summary: serial.value.remark, summary: serial.value.remark,
linkurl: location.href, linkurl: location.href,

View File

@ -37,7 +37,7 @@
<h3> <h3>
{{ {{
!item.replyUserId !item.replyUserId
? item.userName === store.state.userInfo.account ? item.userName === store.state.userInfo.userId
? "我" ? "我"
: item.userName : item.userName
: item.replyUserName : item.replyUserName

View File

@ -159,7 +159,7 @@ const { playVideo } = useShortVideoPlay();
// //
const codeVerify = localStorage.getItem( const codeVerify = localStorage.getItem(
`${store.state.userInfo.account}-shotVideoPlay-${route.query.id}-code` `${store.state.userInfo.userId}-shotVideoPlay-${route.query.id}-code`
); );
const showCodeDialog = computed(() => { const showCodeDialog = computed(() => {
@ -253,7 +253,7 @@ const getLiveLimit = async () => {
if (ret.data.result) { if (ret.data.result) {
// //
localStorage.setItem( localStorage.setItem(
`${store.state.userInfo.account}-shotVideoPlay-${route.query.id}-code`, `${store.state.userInfo.userId}-shotVideoPlay-${route.query.id}-code`,
true true
); );
isPlay.value = true; isPlay.value = true;

View File

@ -15,10 +15,10 @@
v-for="(item, index) in msgList.filter( v-for="(item, index) in msgList.filter(
(item) => (item) =>
(!item.replyBasic && item.isOpen !== 2) || (!item.replyBasic && item.isOpen !== 2) ||
store.state.userInfo.account === item.phone || store.state.userInfo.userId === item.phone ||
(item.replyBasic && (item.replyBasic &&
(item.replyBasic.isOpen === 1 || (item.replyBasic.isOpen === 1 ||
store.state.userInfo.account === item.replyBasic.userId)) store.state.userInfo.userId === item.replyBasic.userId))
)" )"
:class="[`li${index}`]" :class="[`li${index}`]"
:key="index" :key="index"
@ -41,7 +41,7 @@
<label <label
>{{ >{{
item.userId item.userId
? item.phone === store.state.userInfo.account ? item.phone === store.state.userInfo.userId
? "我" ? "我"
: item.userName : item.userName
: "直播老师" : "直播老师"
@ -71,7 +71,7 @@
<p> <p>
<label <label
>{{ >{{
item.phone === store.state.userInfo.account item.phone === store.state.userInfo.userId
? "我" ? "我"
: item.userName : item.userName
}}</label }}</label
@ -81,7 +81,7 @@
class="attention" class="attention"
@click="subAdvisor" @click="subAdvisor"
v-if=" v-if="
item.phone !== store.state.userInfo.account && item.phone !== store.state.userInfo.userId &&
detail.isSubAdvisor !== 1 detail.isSubAdvisor !== 1
" "
> >
@ -92,7 +92,7 @@
<p> <p>
<label <label
>{{ >{{
item.phone === store.state.userInfo.account item.phone === store.state.userInfo.userId
? "我" ? "我"
: item.userName : item.userName
}}</label }}</label
@ -101,7 +101,7 @@
<button <button
class="share" class="share"
@click="sendMsg(5)" @click="sendMsg(5)"
v-if="item.phone !== store.state.userInfo.account" v-if="item.phone !== store.state.userInfo.userId"
> >
我也要分享 我也要分享
</button> </button>

View File

@ -34,15 +34,20 @@
2直播界面显示讲师发布的内容听众发言可以在讨论区或以弹幕的形式查看 2直播界面显示讲师发布的内容听众发言可以在讨论区或以弹幕的形式查看
</p> </p>
</div> </div>
<div class="license">{{ detail.advisorBasic.name }}<i v-if="detail.advisorBasic.license">{{detail.advisorBasic.license}}</i></div> <div class="license">
{{ detail.advisorBasic.name
}}<i v-if="detail.advisorBasic.license"
>{{ detail.advisorBasic.license }}</i
>
</div>
</div> </div>
</div> </div>
</li> </li>
<li <li
v-for="(item) in informMsgList" v-for="item in informMsgList"
:class="[ :class="[
`li${item.id}`, `li${item.id}`,
item.phone === store.state.userInfo.account ? 'row-reverse' : '', item.phone === store.state.userInfo.userId ? 'row-reverse' : '',
]" ]"
:key="item.id" :key="item.id"
> >
@ -50,17 +55,24 @@
<!-- <div v-if="item.type === 3" class="warn"> <!-- <div v-if="item.type === 3" class="warn">
{{ item.userName }}进入直播间 {{ item.userName }}进入直播间
</div> --> </div> -->
<div class="chat-time" v-if="(isTg && item.tgChatTime) || (!isTg && item.chatTime)">{{ isTg ? item.tgChatTime : item.chatTime }}</div> <div
class="chat-time"
v-if="(isTg && item.tgChatTime) || (!isTg && item.chatTime)"
>
{{ isTg ? item.tgChatTime : item.chatTime }}
</div>
<div v-if="item.type === 5" class="warn"> <div v-if="item.type === 5" class="warn">
{{ {{
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
}}分享了直播间 }}分享了直播间
<button <button
class="share" class="share"
@click="sendMsg(5)" @click="sendMsg(5)"
v-if="item.phone !== store.state.userInfo.account" v-if="item.phone !== store.state.userInfo.userId"
> >
我也要分享 我也要分享
</button> </button>
@ -69,7 +81,7 @@
v-else v-else
:class="[ :class="[
'flex', 'flex',
item.phone === store.state.userInfo.account ? 'row-reverse' : '', item.phone === store.state.userInfo.userId ? 'row-reverse' : '',
]" ]"
> >
<div class="photo"> <div class="photo">
@ -91,10 +103,14 @@
<h3> <h3>
{{ {{
item.userId item.userId
? item.phone === store.state.userInfo.account ? item.phone === store.state.userInfo.userId
? "我" ? "我"
: detail.showNickname === 2 ? maskUserName(item.userName) : item.userName : detail.showNickname === 2
: item.createUserVO ? item.createUserVO.name : item.advisorBasic?.showName ? maskUserName(item.userName)
: item.userName
: item.createUserVO
? item.createUserVO.name
: item.advisorBasic?.showName
}} }}
<span v-if="item.advisorId">讲师</span> <span v-if="item.advisorId">讲师</span>
<span v-else-if="item.createUserVO">助教</span> <span v-else-if="item.createUserVO">助教</span>
@ -105,20 +121,35 @@
<div class="reply-content"> <div class="reply-content">
<div class="reply"> <div class="reply">
<span style="color: rgba(154, 164, 182, 1)">回复</span <span style="color: rgba(154, 164, 182, 1)">回复</span
><label>{{ item.replyBasic.userId === store.state.userInfo.account ><label
? "我" : detail.showNickname === 2 ? maskUserName(item.replyBasic.userName) : item.replyBasic.userName }}</label> >{{
item.replyBasic.userId ===
store.state.userInfo.userId
? "我"
: detail.showNickname === 2
? maskUserName(item.replyBasic.userName)
: item.replyBasic.userName
}}</label
>
{{ item.content }} {{ item.content }}
</div> </div>
<div class="reply" style="color: rgba(154, 164, 182, 1)"> <div class="reply" style="color: rgba(154, 164, 182, 1)">
{{ item.replyBasic.userId === store.state.userInfo.account {{
? "我" : detail.showNickname === 2 ? maskUserName(item.replyBasic.userName) : item.replyBasic.userName }}{{ item.replyBasic.userId === store.state.userInfo.userId
item.replyBasic.content ? "我"
}} : detail.showNickname === 2
? maskUserName(item.replyBasic.userName)
: item.replyBasic.userName
}}{{ item.replyBasic.content }}
</div> </div>
</div> </div>
<div class="license">{{ item.advisorBasic?.name }}<i v-if="detail.advisorBasic.license">{{item.advisorBasic?.license}}</i></div> <div class="license">
{{ item.advisorBasic?.name
}}<i v-if="detail.advisorBasic.license"
>{{ item.advisorBasic?.license }}</i
>
</div>
</div> </div>
</div> </div>
<div v-else-if="item.type === 1 && !item.replyBasic"> <div v-else-if="item.type === 1 && !item.replyBasic">
<div> <div>
@ -131,7 +162,12 @@
@click="imagePreview(item.content.split('upImg-')[1])" @click="imagePreview(item.content.split('upImg-')[1])"
:src="item.content.split('upImg-')[1]" :src="item.content.split('upImg-')[1]"
/> />
<div v-if="item.advisorId" class="license">{{ detail.advisorBasic.name }}<i v-if="detail.advisorBasic.license">{{detail.advisorBasic.license}}</i></div> <div v-if="item.advisorId" class="license">
{{ detail.advisorBasic.name
}}<i v-if="detail.advisorBasic.license"
>{{ detail.advisorBasic.license }}</i
>
</div>
</div> </div>
</div> </div>
<div v-else-if="item.type === 2" class="product-item"> <div v-else-if="item.type === 2" class="product-item">
@ -147,9 +183,11 @@
<p> <p>
<label <label
>{{ >{{
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
}}</label }}</label
>关注了老师 >关注了老师
</p> </p>
@ -157,7 +195,7 @@
class="attention" class="attention"
@click="subAdvisor" @click="subAdvisor"
v-if=" v-if="
item.phone !== store.state.userInfo.account && item.phone !== store.state.userInfo.userId &&
detail.isSubAdvisor !== 1 detail.isSubAdvisor !== 1
" "
> >
@ -172,7 +210,13 @@
</div> </div>
<div v-else-if="item.type === 8" style="color: #f46946"> <div v-else-if="item.type === 8" style="color: #f46946">
<p> <p>
<label>{{ detail.showNickname === 2 ? maskUserName(item.userName) : item.userName }}</label>{{ item.content }} <label
>{{
detail.showNickname === 2
? maskUserName(item.userName)
: item.userName
}}</label
>{{ item.content }}
</p> </p>
</div> </div>
<div v-else-if="item.type === 11" class="question-item"> <div v-else-if="item.type === 11" class="question-item">
@ -190,7 +234,9 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="new-msg-tip" @click="lookNewMsg" v-if="newMsgNum">您有{{newMsgNum}}条新的消息</div> <div class="new-msg-tip" @click="lookNewMsg" v-if="newMsgNum">
您有{{ newMsgNum }}条新的消息
</div>
<!-- <div class="product-float" v-if="productFloatShow"> <!-- <div class="product-float" v-if="productFloatShow">
<ProductItem <ProductItem
:item="informMsgList[informMsgList.length - 1].productBasic" :item="informMsgList[informMsgList.length - 1].productBasic"
@ -208,7 +254,17 @@
</template> </template>
<script setup> <script setup>
import { ref, defineProps, onBeforeUnmount, defineExpose, watch, nextTick, onMounted, computed, defineEmits } from "vue"; import {
ref,
defineProps,
onBeforeUnmount,
defineExpose,
watch,
nextTick,
onMounted,
computed,
defineEmits,
} from "vue";
import { useStore } from "vuex"; import { useStore } from "vuex";
import { showToast, showImagePreview } from "vant"; import { showToast, showImagePreview } from "vant";
import { import {
@ -259,24 +315,33 @@ const { msgListRef, bs } = useChatData(
}) })
); );
const hasNext = computed(()=>{ const hasNext = computed(() => {
return props.isTg ? store.state.interactMsgObj.tgHasHisMsg : store.state.interactMsgObj.hasHisMsg return props.isTg
}) ? store.state.interactMsgObj.tgHasHisMsg
: store.state.interactMsgObj.hasHisMsg;
});
watch(hasNext,(value)=>{ watch(hasNext, (value) => {
if(value) bs.value && bs.value.openPullDown(); if (value) bs.value && bs.value.openPullDown();
}) });
watch(()=>props.informMsgList, ()=>{ watch(
nextTick(()=>{ () => props.informMsgList,
bs.value && bs.value.refresh(); () => {
if((props.isTg && store.state.interactMsgObj.isTgScrollToBottom) || (!props.isTg && store.state.interactMsgObj.isScrollToBottom ) ) { nextTick(() => {
nextTick(()=>{ bs.value && bs.value.refresh();
bs.value && bs.value.scrollTo(0, bs.value.maxScrollY, 0); if (
}) (props.isTg && store.state.interactMsgObj.isTgScrollToBottom) ||
} (!props.isTg && store.state.interactMsgObj.isScrollToBottom)
}) ) {
},{deep: true}) nextTick(() => {
bs.value && bs.value.scrollTo(0, bs.value.maxScrollY, 0);
});
}
});
},
{ deep: true }
);
let intervalTime = null; let intervalTime = null;
@ -349,8 +414,8 @@ const goAnswer = async (item) => {
}; };
const emit = defineEmits(["optShare"]); const emit = defineEmits(["optShare"]);
const sendMsg = (type, params) => { const sendMsg = (type, params) => {
if(type === 5) { if (type === 5) {
emit('optShare') emit("optShare");
} }
emitter.emit("emSendMsg", { emitter.emit("emSendMsg", {
type, type,
@ -370,41 +435,40 @@ const imagePreview = (url) => {
}); });
}; };
const newMsgNum = computed(() => {
return props.isTg
? store.state.interactMsgObj.temTgInteractShowNum
: store.state.interactMsgObj.temUserInteractShowNum;
});
const newMsgNum = computed(()=>{ onMounted(() => {
return props.isTg ? store.state.interactMsgObj.temTgInteractShowNum : store.state.interactMsgObj.temUserInteractShowNum bs.value.on("scrollEnd", () => {
}) let isBottom = bs.value.maxScrollY + 20 >= bs.value.y;
store.commit("setIsScrollToBottom", {
onMounted(()=>{
bs.value.on("scrollEnd", ()=>{
let isBottom = bs.value.maxScrollY+20 >= bs.value.y
store.commit('setIsScrollToBottom', {
isTg: props.isTg, isTg: props.isTg,
data: isBottom data: isBottom,
}) });
if(isBottom)resetData() if (isBottom) resetData();
}); });
}) });
const lookNewMsg = () => { const lookNewMsg = () => {
resetData() resetData();
} };
const resetData = () => { const resetData = () => {
store.commit('interactMsgMerge',{isTg: props.isTg}) store.commit("interactMsgMerge", { isTg: props.isTg });
nextTick(()=>{ nextTick(() => {
bs.value && bs.value.refresh() bs.value && bs.value.refresh();
nextTick(()=>{ nextTick(() => {
bs.value && bs.value.scrollTo(0, bs.value.maxScrollY, 0); bs.value && bs.value.scrollTo(0, bs.value.maxScrollY, 0);
}) });
}) });
} };
const maskUserName = (value)=> { const maskUserName = (value) => {
return value.charAt(0) + '**'; return value.charAt(0) + "**";
} };
defineExpose({ defineExpose({
bs, bs,
@ -417,7 +481,7 @@ defineExpose({
text-align: left; text-align: left;
height: 100%; height: 100%;
box-sizing: border-box; box-sizing: border-box;
.p20{ .p20 {
padding: 20px; padding: 20px;
} }
li { li {
@ -481,7 +545,7 @@ defineExpose({
} }
} }
} }
li:last-child{ li:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
.row-reverse { .row-reverse {
@ -547,8 +611,8 @@ defineExpose({
text-align: justify; text-align: justify;
line-height: 30px; line-height: 30px;
} }
.license{ .license {
padding:0; padding: 0;
color: #c6c7c9; color: #c6c7c9;
line-height: 24px; line-height: 24px;
font-size: 24px; font-size: 24px;
@ -689,13 +753,13 @@ defineExpose({
} }
} }
} }
.new-msg-tip{ .new-msg-tip {
position: absolute; position: absolute;
left: 0; left: 0;
bottom: 0px; bottom: 0px;
color: #2e78fa; color: #2e78fa;
background: #fff; background: #fff;
border: 1px solid rgba(204,204,204,0.2); border: 1px solid rgba(204, 204, 204, 0.2);
font-size: 24px; font-size: 24px;
padding: 8px 12px; padding: 8px 12px;
border-radius: 20px; border-radius: 20px;

View File

@ -16,7 +16,7 @@
<NoLookTip v-if="[5, 6].includes(videoDetail.status)" text="该视频已下架" /> <NoLookTip v-if="[5, 6].includes(videoDetail.status)" text="该视频已下架" />
<NoLookTip <NoLookTip
v-else-if="noAuth" v-else-if="noAuth"
:text="`${store.state.userInfo.account}账号暂无服务权限,请联系小助理开通`" :text="`${store.state.userInfo.userId}账号暂无服务权限,请联系小助理开通`"
/> />
<van-dialog <van-dialog
v-model:show="showCodeDialog" v-model:show="showCodeDialog"
@ -50,7 +50,7 @@ const store = useStore();
const router = useRouter(); const router = useRouter();
// //
const codeVerify = localStorage.getItem( const codeVerify = localStorage.getItem(
`${store.state.userInfo.account}-${route.query.id}-code` `${store.state.userInfo.userId}-${route.query.id}-code`
); );
const showCodeDialog = computed(() => { const showCodeDialog = computed(() => {
@ -137,7 +137,7 @@ const getVideoDetail = async () => {
videoDetail.value = ret.data; videoDetail.value = ret.data;
window.shareApi.initWxH5({ window.shareApi.initWxH5({
env: window.config.shareEnv, env: window.config.shareEnv,
shareusername: store.state.userInfo.account, shareusername: store.state.userInfo.userId,
title: videoDetail.value.title, title: videoDetail.value.title,
summary: videoDetail.value.viewPoint, summary: videoDetail.value.viewPoint,
linkurl: location.href, linkurl: location.href,
@ -171,9 +171,9 @@ const getVideoDetail = async () => {
// deptId: "", // deptId: "",
// riskLevel: videoDetail.value.riskLevel, // riskLevel: videoDetail.value.riskLevel,
// saleUserId: route.query.saleUserId ? route.query.saleUserId : "", // saleUserId: route.query.saleUserId ? route.query.saleUserId : "",
// userId: store.state.userInfo.account, // userId: store.state.userInfo.userId,
// userName: store.state.userInfo.userName, // userName: store.state.userInfo.userName,
// zjzh: store.state.userInfo.account, // zjzh: store.state.userInfo.userId,
// imgUrl: store.state.userInfo.imgUrl, // imgUrl: store.state.userInfo.imgUrl,
// videoId: videoDetail.value.id, // videoId: videoDetail.value.id,
// }); // });
@ -192,7 +192,7 @@ const getLiveLimit = async () => {
// //
if (ret.data.limitType === 3) { if (ret.data.limitType === 3) {
localStorage.setItem( localStorage.setItem(
`${store.state.userInfo.account}-${route.query.id}-code`, `${store.state.userInfo.userId}-${route.query.id}-code`,
true true
); );
} }

View File

@ -1,7 +1,5 @@
<template> <template>
<div @click="clear"> <div @click="clear">定时器暂停</div>
定时器暂停
</div>
</template> </template>
<script setup> <script setup>
@ -12,11 +10,14 @@ const store = useStore();
let msgIndex = 0; let msgIndex = 0;
let time; let time;
if(store.state.userInfo.account === window.config.testReactionUserId && window.config.testReactionId) { if (
console.log(time) store.state.userInfo.userId === window.config.testReactionUserId &&
window.config.testReactionId
) {
console.log(time);
time = setInterval(() => { time = setInterval(() => {
msgIndex++; msgIndex++;
if(msgIndex === 10000) clearInterval(time) if (msgIndex === 10000) clearInterval(time);
liveMsgSend({ liveMsgSend({
from: window.config.testReactionUserId, from: window.config.testReactionUserId,
groupId: window.config.testReactionId, groupId: window.config.testReactionId,
@ -28,10 +29,8 @@ if(store.state.userInfo.account === window.config.testReactionUserId && window.c
}, 20); }, 20);
} }
const clear = () =>{ const clear = () => {
clearInterval(time) clearInterval(time);
} };
</script> </script>
<style scoped lang='scss'> <style scoped lang="scss"></style>
</style>