123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <template>
- <el-popover placement="bottom" :width="220" trigger="hover">
- <template #reference>
- <div class="header-icon-bar">
- <HcIcon name="help" class="header-icon"/>
- </div>
- </template>
- <div class="header-pover-menu-list">
- <div class="list-item">
- <span class="text">开启功能气泡提示</span>
- <el-switch v-model="bubbleVal" @change="bubbleUpdate"/>
- </div>
- <div class="list-item">
- <span class="text">查看系统操作文档</span>
- <img class="icon" :src="getAssetsHomeFile('word.png')" alt=""/>
- <img class="icon1" :src="getAssetsHomeFile('word1.png')" alt=""/>
- </div>
- <div class="list-item" @click="videoPreviewModal = true" v-if="videoUrl">
- <span class="text">当前页面功能讲解</span>
- <img class="icon" :src="getAssetsHomeFile('video.png')" alt=""/>
- <img class="icon1" :src="getAssetsHomeFile('video1.png')" alt=""/>
- </div>
- <div class="list-item" @click="toOrderService">
- <span class="text">工单服务\需求反馈</span>
- <img class="icon" :src="getAssetsHomeFile('short.png')" alt="" @click.stop="screenShortClick"/>
- <img class="icon1" :src="getAssetsHomeFile('short1.png')" alt="" @click.stop="screenShortClick"/>
- </div>
- </div>
- </el-popover>
- <!--n-modal v-model:show="videoPreviewModal" title="当前页面功能讲解" preset="card" class="w-990">
- <video class="preview-video" :src="videoUrl" controls="controls" autoplay="autoplay">
- 您的浏览器不支持 video
- </video>
- </n-modal-->
- </template>
- <script setup>
- import {ref,watch,nextTick} from "vue";
- import {useRoute} from 'vue-router'
- import router from '~src/router/index';
- import {useAppStore} from "~src/store/index";
- import ScreenShot from "js-web-screen-shot";
- //初始变量
- const useRoutes = useRoute()
- const useAppState = useAppStore()
- const bubbleVal = ref(useAppState.getBubble);
- const videoPreviewModal = ref(false)
- const videoUrl = ref(useRoutes.meta['videoUrl'] || '')
- const webRtcVal = ref(false)
- const fullScreenVal = ref(true)
- //监听
- watch(() => [
- useAppState.getBubble,
- useRoutes?.meta?.videoUrl,
- useAppState.getShotWebRtc,
- useAppState.getFullScreen,
- ], ([Bubble,url,webRtc,fullScreen]) => {
- bubbleVal.value = Bubble
- videoUrl.value = url || ''
- setScreenShotData(webRtc,fullScreen)
- })
- //渲染完成
- nextTick(() => {
- const webRtc = useAppState.getShotWebRtc
- const fullScreen = useAppState.getFullScreen
- setScreenShotData(webRtc,fullScreen)
- })
- //处理屏幕截图的配置
- const setScreenShotData = (webRtc,fullScreen) => {
- webRtcVal.value = parseInt(webRtc) === 1
- fullScreenVal.value = parseInt(fullScreen) === 1
- }
- //开关值改变
- const bubbleUpdate = (val) => {
- bubbleVal.value = val;
- useAppState.setBubble(val);
- }
- //工单服务\需求反馈
- const screenShortClick = () => {
- setTimeout(() => {
- new ScreenShot({
- enableWebRtc: webRtcVal.value, //截图方式
- clickCutFullScreen: fullScreenVal.value, //全屏
- loadCrossImg: true, //跨域
- level: 99999,
- completeCallback: getScreenShotImg
- });
- }, 500)
- }
- //获取裁剪区域图片信息
- const getScreenShotImg = (base64) => {
- window.sessionStorage.setItem('screenShort-base64', base64);
- //跳转到工单服务\需求反馈
- const useRoutePath = useRoutes.path
- useAppState.setScreenShort(true)
- if (useRoutePath !== "/other/order-service") {
- router.push({name: 'order-service'});
- }
- }
- //工单服务\需求反馈
- const toOrderService = () => {
- router.push({name: 'order-service'});
- }
- // 获取assets静态资源
- const getAssetsHomeFile = (url) => {
- const path = `../../assets/images/${url}`;
- const modules = import.meta.globEager("../../assets/images/*");
- return modules[path].default;
- }
- </script>
- <style lang="scss" scoped>
- .header-icon-bar {
- position: relative;
- height: 40px;
- width: 40px;
- border-radius: 100px;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 26px;
- cursor: pointer;
- margin-right: 30px;
- border: 1px solid #00000000;
- background: #f1f5f8;
- color: #202532;
- box-shadow: 4px 4px 8px 0 rgba(54,92,167,0.15), -4px -4px 8px 0px #ffffff;
- }
- .hc-layout-box .hc-container-view.home .hc-header-view .hc-header-content .header-icon-bar {
- border: 1px solid white;
- color: inherit;
- box-shadow: initial;
- background: initial;
- }
- .header-pover-menu-list {
- position: relative;
- margin: -5px -12px;
- .list-item {
- position: relative;
- padding: 10px 24px;
- cursor: pointer;
- display: flex;
- align-items: center;
- transition: background-color 0.2s;
- .text {
- flex: auto;
- }
- .icon,.icon1 {
- width: 24px;
- height: 24px;
- }
- .icon1 {
- display: none;
- }
- &:hover {
- color: #ffffff;
- background-color: var(--el-color-primary);
- .icon {
- display: none;
- }
- .icon1 {
- display: block;
- }
- }
- }
- }
- .preview-video {
- width: 100%;
- }
- </style>
|