App.vue 2.76 KB
<template>
    <div class="fullPage touchmove">
        <livePlayer :params="paramObj"></livePlayer>
        <div class="tour-btns" v-if="paramObj.type=='titem'">
            <van-button @click="navBackTour" type="primary">返回上一页</van-button>
            <van-button @click="pictureBtn" type="primary">确认并截图</van-button>
        </div>
        <div class="tour-btns" v-else-if="paramObj.type=='view'">
            <van-button block @click="navBack" type="primary">查看其他监控点</van-button>
        </div>
        <div class="tour-btns" v-else>
            <van-button @click="navBack" type="primary">查看其他监控点</van-button>
            <van-button @click="pictureBtn" type="primary">开始巡检</van-button>
        </div>
    </div>
</template>
<script setup>
import { reactive, ref, onMounted, getCurrentInstance } from 'vue';
import { Toast } from 'vant';
import livePlayer from '@/components/livePlayer.vue';
//import vconsole from 'vconsole';
if (process.env.NODE_ENV !== 'production') {
    //new vconsole();
}
/*获取 Url 参数 S*/
import parse from 'url-param-parser';
const paramObj = parse(window.location.href).search || {}
/********************************/
document.title = decodeURIComponent(paramObj.name);
localStorage.setItem('atoken', paramObj.atoken);
localStorage.setItem('lang', 'zh_CN');
/*获取 Url 参数 E*/
import tourApi from '@/api';
//var data = reactive(v);
const navBack = () => {
    wx.miniProgram.redirectTo({
        url: `/pages/tour/gate/index?type=${paramObj.type}`
    });
};
const navBackTour = ()=>{
    wx.miniProgram.navigateBack();
}
const pictureBtn = () => {
    Toast.loading({
       duration: 0, 
       message: '视频截图中···',
       forbidClick: true,
    }); 
    tourApi.getCapture({id:paramObj.channelid}).then(res=>{
        if(res.status!=200){
          return Toast.fail(res.data.msg);
        }
        let picUrl = res.data.data;
        Toast.clear();
        if(paramObj.type!='titem'){
            wx.miniProgram.redirectTo({
             url: `/pages/tour/index/index?action=capture&picUrl=${picUrl}&id=${paramObj.id}&channelid=${paramObj.channelid}&mallId=${paramObj.mallId}&title=${paramObj.name}`
            }); 
        }else{
          /***********巡店详情截图****************/
            wx.miniProgram.navigateTo({
              url: `/pages/tour/titem/index?action=capture&picUrl=${picUrl}&id=${paramObj.tid}`
            });
        }
          
    })
};
onMounted(() => {

})
</script>
<style scoped lang="less">
.tour-btns{
    display: flex;
    justify-content: space-between;
    padding:20px 2vw 0;
    --van-button-border-radius:12px;
    :deep(.van-button){
        margin-bottom: 20px;
        width:47vw;
        &.van-button--block{
           width:100%;
        } 
    }
}
</style>