fix: bug修复

This commit is contained in:
kaizheng(郑凯) 2025-02-27 13:45:38 +08:00
parent 149fac2021
commit 041773b1c1
3 changed files with 153 additions and 164 deletions

View File

@ -49,7 +49,7 @@
> >
<LivePlayList v-if="active === 3" :id="route.query.id" /> <LivePlayList v-if="active === 3" :id="route.query.id" />
<ShotVideoList v-else-if="active === 35" :id="route.query.id" /> <ShotVideoList v-else-if="active === 35" :id="route.query.id" />
<CircleList v-else-if="active === 1" :id="route.query.id" /> <CircleList v-else-if="active === 41" :id="route.query.id" />
<Empty text="暂无内容" v-else /> <Empty text="暂无内容" v-else />
</van-tab> </van-tab>
</van-tabs> </van-tabs>
@ -92,12 +92,6 @@ const getTgTab = async () => {
let ret = await queryTgTab({ id: route.query.id }) let ret = await queryTgTab({ id: route.query.id })
if (ret.code === 0) { if (ret.code === 0) {
tabList.value = ret.data tabList.value = ret.data
tabList.value.push({
productType: 1,
showName: "圈子",
sort: 3,
status: 1,
})
} }
} }

View File

@ -11,10 +11,10 @@
</template> </template>
<script setup> <script setup>
import { defineProps } from "vue"; import { defineProps } from "vue"
import { useRoute } from "vue-router"; import { useRoute } from "vue-router"
import { queryCartRead } from "@/api/video"; import { queryCartRead } from "@/api/video"
import { useStore } from "vuex"; import { useStore } from "vuex"
const props = defineProps({ const props = defineProps({
item: { item: {
required: true, required: true,
@ -41,9 +41,9 @@ const props = defineProps({
type: Number, type: Number,
default: 3, default: 3,
}, },
}); })
const route = useRoute(); const route = useRoute()
const store = useStore(); const store = useStore()
const toDetail = async () => { const toDetail = async () => {
if (props.isShopCar) { if (props.isShopCar) {
await queryCartRead({ await queryCartRead({
@ -51,7 +51,7 @@ const toDetail = async () => {
productType: props.item.productType, productType: props.item.productType,
videoId: route.query.id, videoId: route.query.id,
saleUserId: route.query.saleUserId, saleUserId: route.query.saleUserId,
}); })
} }
if (props.item.productType === 21) { if (props.item.productType === 21) {
// let bvideo = `${ // let bvideo = `${
@ -65,7 +65,7 @@ const toDetail = async () => {
token: store.state.userInfo.token, token: store.state.userInfo.token,
refreshToken: store.state.userInfo.refreshToken, refreshToken: store.state.userInfo.refreshToken,
activityId: props.item.url, activityId: props.item.url,
}); })
} else { } else {
if (props.liveProductId) { if (props.liveProductId) {
location.href = `${location.origin}/tgh5/viewpackageDetail/${ location.href = `${location.origin}/tgh5/viewpackageDetail/${
@ -74,12 +74,12 @@ const toDetail = async () => {
props.liveCategoryId props.liveCategoryId
}&liveMarketId=${ }&liveMarketId=${
route.query.saleUserId ? route.query.saleUserId : "" route.query.saleUserId ? route.query.saleUserId : ""
}&liveTgId=${props.tgId}`; }&liveTgId=${props.tgId}`
} else { } else {
location.href = `${location.origin}/tgh5/viewpackageDetail/${props.item.id}`; location.href = `${location.origin}/tgh5/viewpackageDetail/${props.item.id}`
} }
} }
}; }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@media screen and (min-width: 480px) { @media screen and (min-width: 480px) {

View File

@ -136,27 +136,27 @@ import {
reactive, reactive,
computed, computed,
defineExpose, defineExpose,
} from "vue"; } from "vue"
import { useRoute } from "vue-router"; import { useRoute } from "vue-router"
import { showToast } from "vant"; import { showToast } from "vant"
import Share from "@/components/Share"; import Share from "@/components/Share"
// import { likeVideo, queryLiveCoupon } from "@/api/video"; // import { likeVideo, queryLiveCoupon } from "@/api/video";
import { likeVideo } from "@/api/video"; import { likeVideo } from "@/api/video"
import emitter from "@/utils/emitter"; import emitter from "@/utils/emitter"
import useGetLiveStatusObj from "@/hooks/useGetLiveStatusObj"; import useGetLiveStatusObj from "@/hooks/useGetLiveStatusObj"
import QuestionnairePopup from "../components/QuestionnairePopup.vue"; import QuestionnairePopup from "../components/QuestionnairePopup.vue"
import { useStore } from "vuex"; import { useStore } from "vuex"
import ChatFrame from "./ChatFrame.vue"; import ChatFrame from "./ChatFrame.vue"
import Interact from "./Interact.vue"; import Interact from "./Interact.vue"
import { terminalType } from "@/utils/index"; import { terminalType } from "@/utils/index"
import { getSystem } from "@/utils/index"; import { getSystem } from "@/utils/index"
// import TgChatFrame from "./TgChatFrame.vue"; // import TgChatFrame from "./TgChatFrame.vue";
// import MainInteract from "./MainInteract.vue"; // import MainInteract from "./MainInteract.vue";
import { queryCartRead } from "@/api/video"; import { queryCartRead } from "@/api/video"
const $liveStatusObj = useGetLiveStatusObj(); const $liveStatusObj = useGetLiveStatusObj()
const store = useStore(); const store = useStore()
const system = getSystem(); const system = getSystem()
const props = defineProps({ const props = defineProps({
detail: { detail: {
@ -184,105 +184,102 @@ const props = defineProps({
type: Object, type: Object,
default: () => ({}), default: () => ({}),
}, },
}); })
const msgTipIcon = { const msgTipIcon = {
1: require("@/assets/images/open-msg-tip.png"), 1: require("@/assets/images/open-msg-tip.png"),
2: require("@/assets/images/close-msg-tip.png"), 2: require("@/assets/images/close-msg-tip.png"),
}; }
const showRecommend = ref(false); // const showRecommend = ref(false) //
const route = useRoute(); const route = useRoute()
watch( watch(
() => props.activityObj, () => props.activityObj,
() => { () => {
if (props.activityObj && Object.keys(props.activityObj).length) { if (props.activityObj && Object.keys(props.activityObj).length) {
showRecommend.value = true; showRecommend.value = true
} }
} }
); )
const newMsgTree = computed(() => { const newMsgTree = computed(() => {
return store.state.interactMsgObj.newTreeMsg.slice(-3); return store.state.interactMsgObj.newTreeMsg.slice(-3)
}); })
const showCarPush = ref(false); // const showCarPush = ref(false) //
watch( watch(
() => props.carPushObj, () => props.carPushObj,
() => { () => {
if (props.carPushObj && Object.keys(props.carPushObj).length) { if (props.carPushObj && Object.keys(props.carPushObj).length) {
showCarPush.value = true; showCarPush.value = true
} else { } else {
showCarPush.value = false; showCarPush.value = false
} }
} }
); )
onBeforeUnmount(() => { onBeforeUnmount(() => {
emitter.off("getCouponDetail"); emitter.off("getCouponDetail")
emitter.off("informUserInRoom"); emitter.off("informUserInRoom")
}); })
async function toActivityPage(type) { async function toActivityPage(type) {
if (type === 1) { if (type === 1) {
location.href = props.activityObj.url; location.href = props.activityObj.url
} else { } else {
await queryCartRead({ await queryCartRead({
productId: props.carPushObj.productId, productId: props.carPushObj.productId,
productType: props.carPushObj.productType, productType: props.carPushObj.productType,
videoId: route.query.id, videoId: route.query.id,
saleUserId: route.query.saleUserId, saleUserId: route.query.saleUserId,
}); })
// type // :3 , : 35 , : 32, : 33 location.href = window.config.getCarProductLink({
let bvideo = `${ token: store.state.userInfo.token,
props.carPushObj.url.indexOf("?") === -1 ? "?" : "&" refreshToken: store.state.userInfo.refreshToken,
}bvideo=videoId_${route.query.id},type_3`; activityId: props.carPushObj.url,
if (route.query.saleUserId) { })
bvideo = `${bvideo},saleUserId_${route.query.saleUserId}`;
}
location.href = `${props.carPushObj.url}${bvideo}`;
} }
} }
const text = ref(); const text = ref()
const shareRef = ref(); const shareRef = ref()
const sendTextLoading = ref(false); const sendTextLoading = ref(false)
const emit = defineEmits(["sendMsg", "closeActivity", "closeCarPush"]); const emit = defineEmits(["sendMsg", "closeActivity", "closeCarPush"])
const showGuide = ref(false); const showGuide = ref(false)
const sendMsg = (type, params = {}) => { const sendMsg = (type, params = {}) => {
if (![1, 4].includes(type)) { if (![1, 4].includes(type)) {
// //
emit("sendMsg", type, params); emit("sendMsg", type, params)
} }
switch (type) { switch (type) {
case 1: case 1:
if (text.value) { if (text.value) {
sendTextLoading.value = true; sendTextLoading.value = true
emit("sendMsg", type, { emit("sendMsg", type, {
...params, ...params,
callBack: () => { callBack: () => {
sendTextLoading.value = false; sendTextLoading.value = false
text.value = ""; text.value = ""
}, },
errorBack: () => { errorBack: () => {
sendTextLoading.value = false; sendTextLoading.value = false
}, },
}); })
} else { } else {
showToast("请输入互动内容!"); showToast("请输入互动内容!")
} }
break; break
case 4: case 4:
dblclickLive(); dblclickLive()
break; break
case 5: case 5:
optShare(); optShare()
break; break
default: default:
break; break
} }
}; }
const optShare = () => { const optShare = () => {
// //
@ -290,108 +287,106 @@ const optShare = () => {
typeof WeixinJSBridge === "object" && typeof WeixinJSBridge === "object" &&
typeof window.WeixinJSBridge.invoke === "function" typeof window.WeixinJSBridge.invoke === "function"
) { ) {
showGuide.value = true; showGuide.value = true
} else { } else {
shareRef.value.showPopup = true; shareRef.value.showPopup = true
} }
}; }
const ChatFrameRef = ref(); const ChatFrameRef = ref()
function inputMsg() { function inputMsg() {
let bs = ChatFrameRef.value.bs; let bs = ChatFrameRef.value.bs
bs && bs.stop(); bs && bs.stop()
bs && bs.scrollTo(0, bs.maxScrollY, 0); bs && bs.scrollTo(0, bs.maxScrollY, 0)
} }
function bsRefresh() { function bsRefresh() {
ChatFrameRef.value && ChatFrameRef.value && ChatFrameRef.value.bs && ChatFrameRef.value.bs.refresh()
ChatFrameRef.value.bs &&
ChatFrameRef.value.bs.refresh();
} }
// //
const closeActivity = () => { const closeActivity = () => {
showRecommend.value = false; showRecommend.value = false
emit("closeActivity"); emit("closeActivity")
}; }
// //
const closeCarPush = () => { const closeCarPush = () => {
showCarPush.value = false; showCarPush.value = false
emit("closeCarPush"); emit("closeCarPush")
}; }
let liveIndex = 0; let liveIndex = 0
const liveIcon = [ const liveIcon = [
require("@/assets/images/liveIcon/icon1.png"), require("@/assets/images/liveIcon/icon1.png"),
require("@/assets/images/liveIcon/icon2.png"), require("@/assets/images/liveIcon/icon2.png"),
require("@/assets/images/liveIcon/icon3.png"), require("@/assets/images/liveIcon/icon3.png"),
require("@/assets/images/liveIcon/icon4.png"), require("@/assets/images/liveIcon/icon4.png"),
]; ]
const favorUserCountObj = reactive({ const favorUserCountObj = reactive({
favorUserCount: props.detail.favorUserCount, favorUserCount: props.detail.favorUserCount,
isFavor: props.detail.isFavor, isFavor: props.detail.isFavor,
}); })
const sendLikeVideo = async (liveNum) => { const sendLikeVideo = async (liveNum) => {
const ret = await likeVideo({ const ret = await likeVideo({
id: props.detail.id, id: props.detail.id,
option: 1, option: 1,
num: liveNum, num: liveNum,
}); })
if (ret.code === 0) { if (ret.code === 0) {
favorUserCountObj.isFavor = 1; favorUserCountObj.isFavor = 1
favorUserCountObj.favorUserCount = ret.data.count; favorUserCountObj.favorUserCount = ret.data.count
emitter.emit("updateVideoDetail", favorUserCountObj); emitter.emit("updateVideoDetail", favorUserCountObj)
} }
}; }
let sendLiveTime = null; let sendLiveTime = null
const dblclickLive = () => { const dblclickLive = () => {
const img = document.createElement("img"); const img = document.createElement("img")
img.setAttribute("src", liveIcon[liveIndex % 4]); img.setAttribute("src", liveIcon[liveIndex % 4])
img.setAttribute("class", "live-icon"); img.setAttribute("class", "live-icon")
document.querySelector(".star").appendChild(img); document.querySelector(".star").appendChild(img)
liveIndex++; liveIndex++
((img) => { ;((img) => {
setTimeout(() => { setTimeout(() => {
let star = document.querySelector(".star"); let star = document.querySelector(".star")
star && star.removeChild(img); star && star.removeChild(img)
}, 2000); }, 2000)
})(img); })(img)
clearTimeout(sendLiveTime); clearTimeout(sendLiveTime)
sendLiveTime = setTimeout(() => { sendLiveTime = setTimeout(() => {
sendLikeVideo(liveIndex); sendLikeVideo(liveIndex)
liveIndex = 0; liveIndex = 0
}, 1000); }, 1000)
};
function bigNumberTransform(value) {
let param = {};
let k = 10000,
sizes = ["", "万", "亿", "万亿"],
i;
if (value < k) {
param.value = value;
param.unit = "";
} else {
i = Math.floor(Math.log(value) / Math.log(k));
param.value = parseInt(value / Math.pow(k, i));
param.unit = `${sizes[i]}+`;
}
let number = param.value + param.unit;
return number;
} }
const couponDetail = ref(); function bigNumberTransform(value) {
let param = {}
let k = 10000,
sizes = ["", "万", "亿", "万亿"],
i
if (value < k) {
param.value = value
param.unit = ""
} else {
i = Math.floor(Math.log(value) / Math.log(k))
param.value = parseInt(value / Math.pow(k, i))
param.unit = `${sizes[i]}+`
}
let number = param.value + param.unit
return number
}
const couponDetail = ref()
// //
emitter.on("getCouponDetail", (value) => { emitter.on("getCouponDetail", (value) => {
couponDetail.value = value; couponDetail.value = value
}); })
const showDiscountCoupon = () => { const showDiscountCoupon = () => {
emitter.emit("showDiscountCoupon", couponDetail.value); emitter.emit("showDiscountCoupon", couponDetail.value)
}; }
// const getLiveCoupon = async () => { // const getLiveCoupon = async () => {
// let ret = await queryLiveCoupon({ // let ret = await queryLiveCoupon({
@ -407,45 +402,45 @@ const showDiscountCoupon = () => {
// //
// getLiveCoupon(); // getLiveCoupon();
let tipLook = false; let tipLook = false
const userInTip = (name) => { const userInTip = (name) => {
try { try {
const span = document.createElement("span"); const span = document.createElement("span")
span.innerHTML = `${name} 来了`; span.innerHTML = `${name} 来了`
span.setAttribute("class", "user-in-tip"); span.setAttribute("class", "user-in-tip")
document.querySelector(".msg-content").appendChild(span); document.querySelector(".msg-content").appendChild(span)
((span) => { ;((span) => {
setTimeout(() => { setTimeout(() => {
let star = document.querySelector(".msg-content"); let star = document.querySelector(".msg-content")
star && star.removeChild(span); star && star.removeChild(span)
tipLook = false; tipLook = false
}, 3000); }, 3000)
})(span); })(span)
} catch (error) { } catch (error) {
tipLook = false; tipLook = false
} }
}; }
const InteractRef = ref(); const InteractRef = ref()
const showInteractAction = () => { const showInteractAction = () => {
InteractRef.value.show = true; InteractRef.value.show = true
}; }
const msgTipIndex = ref(1); const msgTipIndex = ref(1)
const changeMsgTip = () => { const changeMsgTip = () => {
msgTipIndex.value = msgTipIndex.value === 1 ? 2 : 1; msgTipIndex.value = msgTipIndex.value === 1 ? 2 : 1
}; }
emitter.on("informUserInRoom", (name) => { emitter.on("informUserInRoom", (name) => {
if (!tipLook) { if (!tipLook) {
tipLook = true; tipLook = true
userInTip(name); userInTip(name)
} }
}); })
defineExpose({ defineExpose({
bsRefresh, bsRefresh,
}); })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
::v-deep .user-in-tip { ::v-deep .user-in-tip {