shopTour.vue 3.33 KB
<template>
    <div class="tour-btns1">
        <div class="box">
            <span @click="navBack">{{decodeURIComponent(paramObj.name)}}<van-icon class="icon" name="play" /></span>
        </div>
        <div class="box box1">
            <span v-if="bookmark" @click="delCollectGate">
                <van-icon class="iconMargin" color="#F7B500" name="star" />收藏
            </span>
            <span v-else @click="collectGate">
                <van-icon class="iconMargin" name="star-o" />收藏
            </span>
            <span @click="pictureBtn">
                <van-icon class="iconMargin" name="photograph" />开始巡检
            </span>
        </div>
    </div>
</template>

<script setup>
    import { reactive, ref, onMounted, getCurrentInstance } from 'vue';
    import { Toast } from 'vant';
    import tourApi from '@/api';
    const navBack = () => {
        wx.miniProgram.redirectTo({
            url: `/pages/tour/gate/index?type=${paramObj.type}&atoken=${paramObj.atoken}&userId=${paramObj.userId}&id=${paramObj.id}&channelid=${paramObj.channelid}&platform=${paramObj.platform}&mallId=${paramObj.mallId}&name=${paramObj.name}`
        });
    };
    const bookmark = ref(paramObj.bookmark)
    const collectGate= ()=>{
        tourApi.setBookmark({
            userId:paramObj.userId,
            patrolGateIds:[paramObj.id]
        }).then(res=>{
            if(res.data.code==200){
                bookmark.value = true;
              return Toast.success('收藏成功');
            }
        })
    }
    const delCollectGate= ()=>{
        tourApi.delBookmark({
            userId:paramObj.userId,
            patrolGateIds:[paramObj.id]
        }).then(res=>{
            if(res.data.code==200){
                bookmark.value = false;
              return Toast.success('取消收藏成功');
            }
        })
    }
    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}&atoken=${paramObj.atoken}&userId=${paramObj.userId}`
        //         }); 
        //     }else{
        //       /***********巡店详情截图****************/
        //         wx.miniProgram.navigateTo({
        //           url: `/pages/tour/titemDetail/index?action=capture&picUrl=${picUrl}&id=${paramObj.tid}`
        //         });
        //     }
              
        // })
    };
</script>

<style scoped lang="less">
    .tour-btns1{
        display: flex;
        background: #E6EDFF;
        height: 15vw;
        line-height: 15vw;
        padding: 0 20px;
        .box{
            display: inline-block;
            flex: 1;
        }
        .box1{
            text-align: right;
            span{
                margin-left: 20px;
            }
        }
        .icon{
            transform: rotate(90deg);
        }
    }
</style>