This commit is contained in:
weipengfei 2023-10-18 18:47:46 +08:00
parent 04c4c9aa7c
commit e06cb77c1c
2 changed files with 25 additions and 12 deletions

View File

@ -4,12 +4,22 @@ import { ref } from "vue"
import axios from "axios"
const showIframe = ref(false)
const iframeSRC = ref("")
// const iframeSRC = ref("")
if(!localStorage.getItem('order4')){
console.error('请到缓存设置指令: order1~4; ', '场景指令: scene--URI, 视频指令: mp4--URI', '例如: order1 secen--http://shop.lihai.cn/#/admin');
}
const orderList = ref([]);
const loadOrderList = ()=>{
axios.get('https://chat.lihaink.cn/index/demo1').then((res)=>{
orderList.value = res.data.data;
console.log(orderList);
})
}
loadOrderList()
const changeImg = (e: number)=>{
// switch(e){
// case 1: iframeSRC.value = "https://goview.lihaink.cn/#/chart/preview/62";break;
@ -18,12 +28,12 @@ const changeImg = (e: number)=>{
// case 4: iframeSRC.value = "https://goview.lihaink.cn/#/chart/preview/74";break;
// }
// showIframe.value = true;
switch(e){
case 1: nowOrder.value = localStorage.getItem('order1');break;
case 2: nowOrder.value = localStorage.getItem('order2');break;
case 3: nowOrder.value = localStorage.getItem('order3');;break;
case 4: nowOrder.value = localStorage.getItem('order4');;break;
}
// switch(e){
// case 1: nowOrder.value = localStorage.getItem('order1');break;
// case 2: nowOrder.value = localStorage.getItem('order2');break;
// case 3: nowOrder.value = localStorage.getItem('order3');;break;
// case 4: nowOrder.value = localStorage.getItem('order4');;break;
// }
submitOrder(e)
}
@ -31,7 +41,8 @@ const nowOrder = ref<string|null>("")
const url = ref("")
const submitOrder = (e: number)=>{
if(!nowOrder.value) return console.log('请到缓存设置指令: order'+e, '场景指令: scene--URI, 视频指令: mp4--URI');
// if(!nowOrder.value) return console.log(': order'+e, ': scene--URI, : mp4--URI');
nowOrder.value = `${orderList.value[e].type==1?'scene':'mp4'}--${orderList.value[e].uri}`;
if(url.value==`https://chat.lihaink.cn/index/push?name=${nowOrder.value}`) return console.log('当前指令已经发送过,请切换其他指令');
url.value = `https://chat.lihaink.cn/index/push?name=${nowOrder.value}`
axios.get(`https://chat.lihaink.cn/index/push?name=${btoa(nowOrder.value)}`).then(()=>{
@ -56,19 +67,19 @@ const back = ()=>{
<div class="img-list w-full h-full">
<div id="img1" class="img-list-item" @click="changeImg(1)">
<water cid="img1"/>
<img src="https://worker-task.lihaink.cn/uploads/images/20231017/20231017173032d02895995.jpg"/>
<img :src="orderList[0]?.image"/>
</div>
<div id="img2" class="img-list-item" @click="changeImg(2)">
<water cid="img2"/>
<img src="https://worker-task.lihaink.cn/uploads/images/20231017/20231017173052de7b64557.jpg"/>
<img :src="orderList[1]?.image"/>
</div>
<div id="img3" class="img-list-item" @click="changeImg(3)">
<water cid="img3"/>
<img src="https://worker-task.lihaink.cn/uploads/images/20231017/20231017173108d32b37266.jpg"/>
<img :src="orderList[2]?.image"/>
</div>
<div id="img4" class="img-list-item" @click="changeImg(4)">
<water cid="img4"/>
<img src="https://worker-task.lihaink.cn/uploads/images/20231017/20231017173128418571732.jpg"/>
<img :src="orderList[3]?.image"/>
</div>
</div>
</div>

View File

@ -57,6 +57,8 @@ user_channel.on('message', (data: any) => {
console.log(error);
}
})
</script>