bug 修改

This commit is contained in:
duanliang
2025-05-30 22:05:42 +08:00
parent ba9baaaa15
commit 2134b44689
2 changed files with 35 additions and 22 deletions

View File

@@ -49,8 +49,8 @@
</div>
<div class="action-item">
<div class="video-follow" @click="handleCollectAdd(cameraIndexCode, isDiy, index)" v-if="isDayCurr==0">收藏</div>
<div class="video-follow" @click="handleCollectAdd(cameraIndexCode, isDiy, index)" v-else="isDayCurr==1">取消收藏</div>
<div class="video-follow" @click="handleCollectAdd(cameraIndexCode, isDiy, index)" v-if="isDiy==0">收藏</div>
<div class="video-follow" @click="handleCollectAdd(cameraIndexCode, isDiy, index)" v-else="isDiy==1">取消收藏</div>
</div>
</div>
@@ -98,38 +98,36 @@
let videoRef = ref()
let webRtcServer = null
let hlsRef = null
let colletCond = ref(props.isCollect)
let isDayCurr = ref(props.isDiy)
watch(
() => props.isCollect,
() =>modelValue.value,
(val) => {
if (val) {
// colletCond.value = val
// setTimeout(() => {
// init()
// }, 1000)
}else{
// colletCond.value = 0
}
// colletCond.value = props.isCollect
// isDayCurr.value = props.isDiy
console.log(props.isDiy,'val[0].value')
},
{
immediate: true
}
)
let colletCond = ref(props.isCollect)
let isDayCurr = ref(props.isDiy)
const emit = defineEmits(['isDiyChange']);
// 收藏
const handleCollectAdd = async (id, status, index) => {
await getColletDiyApi({
cameraIndexCode:id,
isDiy: isDayCurr.value == 0 ? 1 : 0
cameraIndexCode:props.cameraIndexCode,
isDiy: props.isDiy == 0 ? 1 : 0
})
if(isDayCurr.value==1){
if(props.isDiy==1){
isDayCurr.value=0
// modelValue.value = false
}else{
isDayCurr.value=1
}
pubSub.publish('videoIsDiy',{isDiy:isDayCurr.value,cameraIndexCode:props.cameraIndexCode} )
emit('isDiyChange', isDayCurr.value);
pubSub.publish('videoIsDiy',{isDiy:props.isDiy,cameraIndexCode:props.cameraIndexCode} )
}
// 关注
@@ -138,6 +136,7 @@
cameraIndexCode:props.cameraIndexCode,
isCollect: colletCond.value == 0 ? 1 : 0
})
if (colletCond.value == 0) {
colletCond.value = 1
} else {

View File

@@ -14,7 +14,7 @@
width:(100/grad)+'%'
}">
<div class="video-item__inner" @click="handleCamera(element.cameraIndexCode,element)">
<div class="video-item__inner" @click="handleCamera(element.cameraIndexCode,element,index)">
<div
v-if="element.isDiy == 1"
class="video-item__follow"
@@ -70,7 +70,7 @@
<el-pagination background layout="prev, pager, next" :total="1000" />
</div> -->
</div>
<VideoDialog v-model="show" :cameraIndexCode="cameraIndexCode" :isDiy="isDiy" :isCollect="isCollect" :src="videoSrc" />
<VideoDialog v-model="show" :cameraIndexCode="cameraIndexCode" @isDiyChange="isDiyChange" :isDiy="isDiy" :isCollect="isCollect" :src="videoSrc" />
</template>
<script setup>
@@ -127,6 +127,18 @@
getRegionsList()
})
}
//弹窗收藏监听
const isDiyChange = (val)=>{
console.log(val,11222)
isDiy.value = val
videoList.value[diyIndex.value].videos.forEach(async (it, i) => {
if(it.cameraIndexCode == cameraIndexCode.value){
it.isDiy = val
}
})
}
const onStart = (res)=>{
}
@@ -138,7 +150,7 @@
cameraIndexCodes:videoList.value[itemIndex].videos.map((item) => item.cameraIndexCode)
}).then((ress)=>{
videoList.value[itemIndex] = newList
// getVideCollectCateList()
})
}
@@ -207,7 +219,9 @@
let isCollect = ref(0)
let isDiy = ref(0)
let videoSrc = ref('')
const handleCamera = async (itemCode,resource) => {
let diyIndex = ref(null)
const handleCamera = async (itemCode,resource,index) => {
diyIndex.value = index
show.value = true
let res = await getPreviewUrlApi({
type: 'hls',