video.vue
3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<template>
<div>
<headerComp :leftImgSrc="leftImg" :title="titleStr" :rightImgSrc="rightImg" @leftClick="backFun" @rightClick="conditionFun"></headerComp>
<iframe id="iframeId" :src="ifSrc" frameborder="0" width="100%" height="236" scrolling="yes"></iframe>
<uni-collapse @change="change">
<uni-collapse-item :title="item.org_name" open="true" v-for="item in deviceList">
<view style="padding: 30upx;padding-left: 60upx;" @tap="tapChannel(channelItem)" :class="[channelItem.chan_id==isActiveChannel?'focusClass':'',channelItem.status==0?'disableClass':'']" v-for="channelItem in item.channels"> {{channelItem.chan_name}} </view>
</uni-collapse-item>
</uni-collapse>
</div>
</template>
<script>
import headerComp from '../../../components/header'
import backArrow from '../../../static/header/backArrow.png'
import other from '../../../static/header/other.png'
import circlebar from '../../../components/circleBarChart'
import linechart from '../../../components/lineChart'
import uniCollapse from "../../../components/collapse/uni-collapse/uni-collapse.vue"
import uniCollapseItem from "../../../components/collapse/uni-collapse-item/uni-collapse-item.vue"
export default{
data(){
return{
titleStr:'视频巡店',
leftImg:backArrow,
rightImg:other,
atoken:'',
ifSrc:'',
isActiveChannel:'1000000001001',
accountId:[],
deviceList:[]
}
},
onLoad: function (option) {
this.ifSrc=window.location.protocol+'//'+window.location.host+'/appweb/static/video.html'
uni.getStorage({
key:'accountList',
success:(res)=>{
if(res.data){
var list=JSON.parse(res.data);
list.forEach((item,index)=>{
if(index==0){
this.accountId.push(item.id)
}
})
uni.getStorage({
key:'selectAccountIdArr',
success:(res)=> {
this.accountId=JSON.parse(res.data);
},
complete: (res) => {
}
})
}
}
})
uni.getStorage({
key:'atoken',
success:(res)=>{
this.atoken=res.data;
}
})
this.getDeviceList();
},
onReady:function(){
},
computed: {
i18n() {
return this.$t("index")
}
},
components:{
headerComp,uniCollapse,uniCollapseItem
},
methods: {
change(){
console.log('change')
},
tapChannel(item){
if(item.status==1){
this.isActiveChannel=item.chan_id;
localStorage.setItem('channelId',item.chan_id);
document.getElementById('iframeId').contentWindow.location.reload(true);
}
},
backFun(){
uni.reLaunch({
url:"../profile",
})
},
conditionFun(){
uni.navigateTo({
url:'../../list/oneMallList?url=../profile/video/video'
})
},
getDeviceList(){
//window.url+
//this.accountId[0]
uni.request({
url:window.url+'/deviceMappings/shilian/devices',
data:{
mallId:this.accountId[0],
_t:Date.parse(new Date())/1000
},
header: {
'app-code':'mobile',
'Authorization': this.atoken //自定义请求头信息
},
method:'GET',
success:(res) =>{
this.deviceList=res.data.data;
if(this.deviceList.length>0&&this.deviceList[0].channels.length>0){
this.isActiveChannel=this.deviceList[0].channels[0].chan_id;
localStorage.setItem('channelId',this.isActiveChannel);
document.getElementById('iframeId').contentWindow.location.reload(true);
}
}
})
}
},
}
</script>
<style>
.focusClass{
color: #0069FF;
}
.disableClass{
opacity: 0.3;
}
</style>