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>
<div class="action-item"> <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-if="isDiy==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-else="isDiy==1">取消收藏</div>
</div> </div>
</div> </div>
@@ -98,38 +98,36 @@
let videoRef = ref() let videoRef = ref()
let webRtcServer = null let webRtcServer = null
let hlsRef = null let hlsRef = null
let colletCond = ref(props.isCollect)
let isDayCurr = ref(props.isDiy)
watch( watch(
() => props.isCollect, () =>modelValue.value,
(val) => { (val) => {
if (val) { // colletCond.value = props.isCollect
// colletCond.value = val // isDayCurr.value = props.isDiy
// setTimeout(() => { console.log(props.isDiy,'val[0].value')
// init()
// }, 1000)
}else{
// colletCond.value = 0
}
}, },
{ {
immediate: true immediate: true
} }
) )
let colletCond = ref(props.isCollect) const emit = defineEmits(['isDiyChange']);
let isDayCurr = ref(props.isDiy)
// 收藏 // 收藏
const handleCollectAdd = async (id, status, index) => { const handleCollectAdd = async (id, status, index) => {
await getColletDiyApi({ await getColletDiyApi({
cameraIndexCode:id, cameraIndexCode:props.cameraIndexCode,
isDiy: isDayCurr.value == 0 ? 1 : 0 isDiy: props.isDiy == 0 ? 1 : 0
}) })
if(isDayCurr.value==1){
if(props.isDiy==1){
isDayCurr.value=0 isDayCurr.value=0
// modelValue.value = false // modelValue.value = false
}else{ }else{
isDayCurr.value=1 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, cameraIndexCode:props.cameraIndexCode,
isCollect: colletCond.value == 0 ? 1 : 0 isCollect: colletCond.value == 0 ? 1 : 0
}) })
if (colletCond.value == 0) { if (colletCond.value == 0) {
colletCond.value = 1 colletCond.value = 1
} else { } else {

View File

@@ -14,7 +14,7 @@
width:(100/grad)+'%' 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 <div
v-if="element.isDiy == 1" v-if="element.isDiy == 1"
class="video-item__follow" class="video-item__follow"
@@ -70,7 +70,7 @@
<el-pagination background layout="prev, pager, next" :total="1000" /> <el-pagination background layout="prev, pager, next" :total="1000" />
</div> --> </div> -->
</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> </template>
<script setup> <script setup>
@@ -127,6 +127,18 @@
getRegionsList() 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)=>{ const onStart = (res)=>{
} }
@@ -138,7 +150,7 @@
cameraIndexCodes:videoList.value[itemIndex].videos.map((item) => item.cameraIndexCode) cameraIndexCodes:videoList.value[itemIndex].videos.map((item) => item.cameraIndexCode)
}).then((ress)=>{ }).then((ress)=>{
videoList.value[itemIndex] = newList // getVideCollectCateList()
}) })
} }
@@ -207,7 +219,9 @@
let isCollect = ref(0) let isCollect = ref(0)
let isDiy = ref(0) let isDiy = ref(0)
let videoSrc = ref('') let videoSrc = ref('')
const handleCamera = async (itemCode,resource) => { let diyIndex = ref(null)
const handleCamera = async (itemCode,resource,index) => {
diyIndex.value = index
show.value = true show.value = true
let res = await getPreviewUrlApi({ let res = await getPreviewUrlApi({
type: 'hls', type: 'hls',