Compare commits

..

No commits in common. "6201973ca43f4f9eab9e9bf82f432c5110278138" and "1e6102b49aa525bc6d8659bdc4b5611d20c7b6f9" have entirely different histories.

19 changed files with 218 additions and 353 deletions

View File

@ -30,7 +30,7 @@ const forbidLogin = computed(() => {
if (terminalType === "App") {
window.upNativeComm.addEventListener("UPUser", (opt) => {
if (opt.action == "userChange" && store.state.userInfo.userId) {
if (opt.action == "userChange" && store.state.userInfo.account) {
console.log("userChange-->", opt);
// app
userLogin();

View File

@ -14,7 +14,7 @@ export default function useVideoPlay(
let playCtx = ref();
let showPlayBtn = ref(false);
let sessionId = localStorage.getItem(
`sessionId-${store.state.userInfo.userId}-${detail.id}`
`sessionId-${store.state.userInfo.account}-${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.userId}-${detail.id}-videoPlayTime`,
`${store.state.userInfo.account}-${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.userId,
userId: store.state.userInfo.account,
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.userId,
userId: store.state.userInfo.account,
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.userId,
userId: store.state.userInfo.account,
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.userId,
userId: store.state.userInfo.account,
reportType: 1,
GroupId: detail.id,
sessionId,
@ -182,7 +182,7 @@ export default function useVideoPlay(
});
playCtx.value.on("timeupdate", () => {
localStorage.setItem(
`${store.state.userInfo.userId}-${detail.id}-videoPlayTime`,
`${store.state.userInfo.account}-${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.userId,
userId: store.state.userInfo.account,
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.userId,
userId: store.state.userInfo.account,
reportType: 1,
GroupId: detail.id,
sessionId,

View File

@ -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.userId}-${id}`)
localStorage.getItem(`sessionId-${store.state.userInfo.account}-${id}`)
) {
sessionId = localStorage.getItem(
`sessionId-${store.state.userInfo.userId}-${id}`
`sessionId-${store.state.userInfo.account}-${id}`
);
} else {
sessionId = Math.random().toString(36).substring(2, 8);
localStorage.setItem(
`sessionId-${store.state.userInfo.userId}-${id}`,
`sessionId-${store.state.userInfo.account}-${id}`,
sessionId
);
}

View File

@ -45,11 +45,8 @@ 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)
) {
@ -77,7 +74,7 @@ export default function ({ detail, videoClass }) {
function processingData(data) {
if (data && data.type === 3) {
online.value = data.online;
if (store.state.userInfo.userId !== data.userId) {
if (store.state.userInfo.account !== data.userId) {
// 判断是否是本人进入直播间
// informMsgList.value.push(data);
store.commit("setInteractMsg", {
@ -238,10 +235,10 @@ export default function ({ detail, videoClass }) {
msgObj.isOpen = msgBody.data.isOpen;
msgObj.show =
(!msgObj.replyBasic && msgObj.isOpen !== 2) ||
store.state.userInfo.userId === msgObj.phone ||
store.state.userInfo.account === msgObj.phone ||
(msgObj.replyBasic &&
(msgObj.replyBasic.isOpen === 1 ||
store.state.userInfo.userId === msgObj.replyBasic.userId));
store.state.userInfo.account === msgObj.replyBasic.userId));
}
var replyMsgObj =
@ -252,10 +249,11 @@ export default function ({ detail, videoClass }) {
replyMsgObj.replyBasic.isOpen = msgBody.data.isOpen;
replyMsgObj.show =
(!replyMsgObj.replyBasic && replyMsgObj.isOpen !== 2) ||
store.state.userInfo.userId === replyMsgObj.phone ||
store.state.userInfo.account === replyMsgObj.phone ||
(replyMsgObj.replyBasic &&
(replyMsgObj.replyBasic.isOpen === 1 ||
store.state.userInfo.userId === replyMsgObj.replyBasic.userId));
store.state.userInfo.account ===
replyMsgObj.replyBasic.userId));
}
break;
case 11:
@ -264,7 +262,7 @@ export default function ({ detail, videoClass }) {
!questionnaireTipRef.value.showPopup &&
!questionnaireTipRef.value.questionnairePopupRef.showPopup &&
!msgBody.data.questionVO.userIdList.includes(
store.state.userInfo.userId
store.state.userInfo.account
)
) {
questionId.value = msgBody.data.questionVO?.id;
@ -288,9 +286,7 @@ 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;
@ -305,7 +301,7 @@ export default function ({ detail, videoClass }) {
case 1:
// 文本详细
ret = await liveMsgSend({
from: store.state.userInfo.userId,
from: store.state.userInfo.account,
groupId: detail.id,
text,
type,

View File

@ -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.userId === item.phone ||
state.userInfo.account === item.phone ||
(item.replyBasic &&
(item.replyBasic.isOpen === 1 ||
state.userInfo.userId === item.replyBasic.userId));
state.userInfo.account === item.replyBasic.userId));
if (payload.type === 1) {
// 新消息
// 公开的或者是本人发的文本消息
if (
((item.userId && item.isOpen === 1) ||
item.phone === state.userInfo.userId) &&
item.phone === state.userInfo.account) &&
item.type === 1
) {
state.interactMsgObj.newTreeMsg.push(item);

View File

@ -19,7 +19,7 @@
v-for="item in msgList"
:class="[
`li${item.id}`,
item.userId === store.state.userInfo.userId ? 'row-reverse' : '',
item.userId === store.state.userInfo.account ? 'row-reverse' : '',
]"
:key="item.id"
>
@ -27,7 +27,7 @@
v-if="
item.status === 2 ||
(item.userType === 2 &&
item.userId === store.state.userInfo.userId)
item.userId === store.state.userInfo.account)
"
>
<div class="chat-time" v-if="item.chatTime">
@ -36,7 +36,7 @@
<div
:class="[
'flex',
item.userId === store.state.userInfo.userId
item.userId === store.state.userInfo.account
? 'row-reverse'
: '',
]"
@ -62,7 +62,7 @@
<h3>
{{
item.userType === 2
? item.userId === store.state.userInfo.userId
? item.userId === store.state.userInfo.account
? "我"
: detail.showNickName === 2
? maskUserName(item.userName)
@ -81,7 +81,7 @@
><label
>{{
item.replyMessage?.userId ===
store.state.userInfo.userId
store.state.userInfo.account
? "我"
: detail.showNickName === 2
? maskUserName(item.replyMessage?.userName)
@ -102,7 +102,7 @@
<div class="reply" style="color: rgba(154, 164, 182, 1)">
{{
item.replyMessage?.userId ===
store.state.userInfo.userId
store.state.userInfo.account
? "我"
: detail.showNickName === 2
? maskUserName(item.replyMessage?.userName)
@ -181,10 +181,6 @@ const props = defineProps({
type: Object,
default: () => {},
},
stompClient: {
type: Object,
default: null,
},
});
const defaultAvatar = {
@ -241,7 +237,6 @@ const {
className: `.interact-scroll${props.type}`,
id: route.query.id,
type: props.type,
stompClient: props.stompClient,
});
const maskUserName = (value) => {

View File

@ -0,0 +1,62 @@
import { readMessage } from "@/api/circle";
// type 1 公共互动 2私聊
function getStorageTeacherMsg({
productId,
productType = 41,
type = 1,
userId,
}) {
const getMsgIds = localStorage.getItem(
`read-msg-${productType}-${productId}-${userId}-${type}`
);
if (getMsgIds) {
return JSON.parse(getMsgIds);
} else {
return [];
}
}
// 老师发的言,并且已经上报的缓存起来
export function setStorageTeacherMsg({
productId,
productType = 41,
userId,
type = 1, // type 1 公共互动 2私聊
msg, // 单条消息
msgArr, // 多条消息
}) {
const storageMsgIds = getStorageTeacherMsg({
productId,
productType,
type,
userId,
});
let messageIds = [];
// userType用户类型1投顾2用户3助教4运营人员
if (msg) {
if (!storageMsgIds.includes(msg.id) && msg.userType !== 2) {
messageIds = [msg.id];
}
} else if (msgArr && msgArr.length) {
msgArr.forEach((msg) => {
if (msg.userType !== 2 && !storageMsgIds.includes(msg.id)) {
messageIds.push(msg.id);
}
});
} else {
return;
}
if (messageIds.length) {
setTimeout(async () => {
let ret = await readMessage({ messageIds }).catch(() => {});
if (ret && ret.code === 0) {
localStorage.setItem(
`read-msg-${productType}-${productId}-${userId}-${type}`,
JSON.stringify(messageIds.concat(storageMsgIds))
);
}
}, Math.random() * 3);
}
}

View File

@ -4,13 +4,13 @@ import BScroll from "@better-scroll/core";
import PullDown from "@better-scroll/pull-down";
import MouseWheel from "@better-scroll/mouse-wheel";
import useDisableScroll from "@/hooks/useDisableScroll";
import useReadMessage from "./useReadMessage";
import { setStorageTeacherMsg } from "./storage";
import store from "@/store/index";
BScroll.use(PullDown);
BScroll.use(MouseWheel);
export default function useChatData({ id, className, type, stompClient }) {
export default function useChatData({ id, className, type }) {
const { addScrollEvent } = useDisableScroll();
const hasNext = ref(true);
let bs = ref();
@ -20,8 +20,6 @@ export default function useChatData({ id, className, type, stompClient }) {
const msgIdsObj = ref({});
const loading = ref(false);
const { setStorageTeacherMsg } = useReadMessage();
const getLiveHisMsg = async () => {
loading.value = true;
if (isPullingDown.value) return;
@ -46,10 +44,9 @@ export default function useChatData({ id, className, type, stompClient }) {
}
setStorageTeacherMsg({
productId: id,
userId: store.state.userInfo.userId,
userId: store.state.userInfo.account,
msgArr: list,
type: type === 5 ? 2 : 1,
stompClient,
});
}
isPullingDown.value = false;
@ -80,7 +77,7 @@ export default function useChatData({ id, className, type, stompClient }) {
});
setStorageTeacherMsg({
productId: id,
userId: store.state.userInfo.userId,
userId: store.state.userInfo.account,
msg,
type: type === 5 ? 2 : 1,
});

View File

@ -1,104 +0,0 @@
// import { readMessage } from "@/api/circle";
export default function useReadMessage() {
// type 1 公共互动 2私聊
const getStorageTeacherMsg = ({
productId,
productType = 41,
type = 1,
userId,
}) => {
const getMsgIds = localStorage.getItem(
`read-msg-${productType}-${productId}-${userId}-${type}`
);
if (getMsgIds) {
return JSON.parse(getMsgIds);
} else {
return [];
}
};
// 老师发的言,并且已经上报的缓存起来
let uploadReadMsgIds = []; // 存储需要上传的ids
let timeout = null;
const uploadReadMsg = ({
productId,
productType,
userId,
type, // type 1 公共互动 2私聊
stompClient,
messageIds,
storageMsgIds,
}) => {
console.log("stompClient", stompClient);
uploadReadMsgIds = Array.from(new Set(uploadReadMsgIds.concat(messageIds)));
clearTimeout(timeout);
timeout = setTimeout(async () => {
stompClient &&
stompClient.publish({
destination: `/chat/group/readMessage`,
headers: {
userId: userId,
messageIds: uploadReadMsgIds,
},
});
localStorage.setItem(
`read-msg-${productType}-${productId}-${userId}-${type}`,
JSON.stringify(uploadReadMsgIds.concat(storageMsgIds).sort())
);
uploadReadMsgIds = [];
}, 5000);
};
const setStorageTeacherMsg = ({
productId,
productType = 41,
userId,
type = 1, // type 1 公共互动 2私聊
msg, // 单条消息
msgArr, // 多条消息
stompClient,
}) => {
const storageMsgIds = getStorageTeacherMsg({
productId,
productType,
type,
userId,
});
let messageIds = [];
// userType用户类型1投顾2用户3助教4运营人员
if (msg) {
if (!storageMsgIds.includes(msg.id) && msg.userType !== 2) {
messageIds = [msg.id];
}
} else if (msgArr && msgArr.length) {
msgArr.forEach((msg) => {
if (msg.userType !== 2 && !storageMsgIds.includes(msg.id)) {
messageIds.push(msg.id);
}
});
} else {
return;
}
if (messageIds.length) {
uploadReadMsg({
productId,
productType,
userId,
type, // type 1 公共互动 2私聊
msg, // 单条消息
msgArr, // 多条消息
stompClient,
messageIds,
storageMsgIds,
});
}
};
return {
setStorageTeacherMsg,
};
}

View File

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

View File

@ -19,7 +19,6 @@
:bsRefresh="active === 0"
:detail="detail"
:newMsg="newMsg"
:stompClient="stompClient"
/>
</van-tab>
<van-tab title="老师" :name="1">
@ -28,7 +27,6 @@
:bsRefresh="active === 1"
:detail="detail"
:newMsg="newMsg"
:stompClient="stompClient"
/>
</van-tab>
<van-tab title="私聊" :name="2">
@ -37,7 +35,6 @@
:bsRefresh="active === 2"
:detail="detail"
:newMsg="privateNewMsg"
:stompClient="stompClient"
/>
</van-tab>
<van-tab title="精选" :name="3">
@ -46,7 +43,6 @@
:bsRefresh="active === 3"
:detail="detail"
:newMsg="newMsg"
:stompClient="stompClient"
/>
</van-tab>
</van-tabs>
@ -99,7 +95,7 @@ const queryCircleDetail = async () => {
const ret = await getCircleDetail({ id: route.query.id });
if (ret && ret.code === 0) {
detail.value = ret.data;
const key = `circleNotice-${detail.value.id}-${store.state.userInfo.userId}`;
const key = `circleNotice-${detail.value.id}-${store.state.userInfo.account}`;
const storageCircleNotice = localStorage.getItem(key);
if (!storageCircleNotice || storageCircleNotice !== detail.value.notice) {
showNotice.value = true;
@ -142,11 +138,7 @@ const chatMessage = (msg) => {
detail.value.showMemberCount = data;
}
};
const { stompClient } = useWebSocket({
id: route.query.id,
privateMessage,
chatMessage,
});
useWebSocket({ id: route.query.id, privateMessage, chatMessage });
const sendMsg = async () => {
let ret = await sendMessage({

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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