91 lines
2.0 KiB
Vue
91 lines
2.0 KiB
Vue
<template>
|
|
<view class="spjk-box">
|
|
<view class="select-bar">
|
|
<uni-data-select
|
|
v-model="value"
|
|
:localdata="list"
|
|
@change="change"
|
|
:clear="false"
|
|
>
|
|
</uni-data-select>
|
|
</view>
|
|
<view class="video-box">
|
|
<!-- <video :src="videoObject.src" controls is-live="true"></video> -->
|
|
|
|
<!-- <HFivePlayer :wsUrl="videoObject" :size="1" :playerID="'111'"/> -->
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
// import HFivePlayer from "../../../components/VideoPlay/videoPlay.vue"
|
|
export default {
|
|
props:{
|
|
stcd:String,
|
|
source:String,
|
|
default:''
|
|
},
|
|
// components:{
|
|
// HFivePlayer
|
|
// },
|
|
data() {
|
|
return {
|
|
value: "",
|
|
list:[],
|
|
videoObject:{},
|
|
}
|
|
},
|
|
methods: {
|
|
async getList(){
|
|
try{
|
|
const {data} = await uni.$http.get(
|
|
`/gunshiApp/xfflood/stbprp/cctv/listByStcd/${this.stcd}`)
|
|
if(data.code == 200){
|
|
let newData = data.data.map(item => ({...item,value:item.camId,text:item.name}))
|
|
this.list = [...newData];
|
|
this.value = newData[0].value
|
|
this.getVideoSrc(newData[0].camId)
|
|
}
|
|
}catch(e){
|
|
uni.$showMsg()
|
|
}
|
|
},
|
|
async getVideoSrc(id){
|
|
try{
|
|
const {data} = await uni.$http.get(
|
|
`/gunshiApp/xfflood/xfCctvB/preview/${id}`)
|
|
if(data.code == 200){
|
|
console.log(data.data);
|
|
this.videoObject = {src:data.data}
|
|
}
|
|
}catch(e){
|
|
uni.$showMsg()
|
|
}
|
|
},
|
|
playStatus(val){
|
|
if(val.type === 'success'){
|
|
console.log('播放成功');
|
|
}else{
|
|
console.log('播放失败')
|
|
console.log(val.msg)
|
|
}
|
|
},
|
|
change(e) {
|
|
console.log("e:", e);
|
|
this.getVideoSrc(e)
|
|
},
|
|
},
|
|
mounted() {
|
|
this.getList()
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.spjk-box{
|
|
.select-bar{
|
|
margin: 10px 15px;
|
|
}
|
|
}
|
|
</style>
|