HelpInfoBar.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <el-popover placement="bottom" :width="220" trigger="hover">
  3. <template #reference>
  4. <div class="header-icon-bar">
  5. <HcIcon name="help" class="header-icon"/>
  6. </div>
  7. </template>
  8. <div class="header-pover-menu-list">
  9. <div class="list-item">
  10. <span class="text">开启功能气泡提示</span>
  11. <el-switch v-model="bubbleVal" @change="bubbleUpdate"/>
  12. </div>
  13. <div class="list-item">
  14. <span class="text">查看系统操作文档</span>
  15. <img class="icon" :src="getAssetsHomeFile('word.png')" alt=""/>
  16. <img class="icon1" :src="getAssetsHomeFile('word1.png')" alt=""/>
  17. </div>
  18. <div class="list-item" @click="videoPreviewModal = true" v-if="videoUrl">
  19. <span class="text">当前页面功能讲解</span>
  20. <img class="icon" :src="getAssetsHomeFile('video.png')" alt=""/>
  21. <img class="icon1" :src="getAssetsHomeFile('video1.png')" alt=""/>
  22. </div>
  23. <div class="list-item" @click="toOrderService">
  24. <span class="text">工单服务\需求反馈</span>
  25. <img class="icon" :src="getAssetsHomeFile('short.png')" alt="" @click.stop="screenShortClick"/>
  26. <img class="icon1" :src="getAssetsHomeFile('short1.png')" alt="" @click.stop="screenShortClick"/>
  27. </div>
  28. </div>
  29. </el-popover>
  30. <!--n-modal v-model:show="videoPreviewModal" title="当前页面功能讲解" preset="card" class="w-990">
  31. <video class="preview-video" :src="videoUrl" controls="controls" autoplay="autoplay">
  32. 您的浏览器不支持 video
  33. </video>
  34. </n-modal-->
  35. </template>
  36. <script setup>
  37. import {ref,watch,nextTick} from "vue";
  38. import {useRoute} from 'vue-router'
  39. import router from '~src/router/index';
  40. import {useAppStore} from "~src/store/index";
  41. import ScreenShot from "js-web-screen-shot";
  42. //初始变量
  43. const useRoutes = useRoute()
  44. const useAppState = useAppStore()
  45. const bubbleVal = ref(useAppState.getBubble);
  46. const videoPreviewModal = ref(false)
  47. const videoUrl = ref(useRoutes.meta['videoUrl'] || '')
  48. const webRtcVal = ref(false)
  49. const fullScreenVal = ref(true)
  50. //监听
  51. watch(() => [
  52. useAppState.getBubble,
  53. useRoutes?.meta?.videoUrl,
  54. useAppState.getShotWebRtc,
  55. useAppState.getFullScreen,
  56. ], ([Bubble,url,webRtc,fullScreen]) => {
  57. bubbleVal.value = Bubble
  58. videoUrl.value = url || ''
  59. setScreenShotData(webRtc,fullScreen)
  60. })
  61. //渲染完成
  62. nextTick(() => {
  63. const webRtc = useAppState.getShotWebRtc
  64. const fullScreen = useAppState.getFullScreen
  65. setScreenShotData(webRtc,fullScreen)
  66. })
  67. //处理屏幕截图的配置
  68. const setScreenShotData = (webRtc,fullScreen) => {
  69. webRtcVal.value = parseInt(webRtc) === 1
  70. fullScreenVal.value = parseInt(fullScreen) === 1
  71. }
  72. //开关值改变
  73. const bubbleUpdate = (val) => {
  74. bubbleVal.value = val;
  75. useAppState.setBubble(val);
  76. }
  77. //工单服务\需求反馈
  78. const screenShortClick = () => {
  79. setTimeout(() => {
  80. new ScreenShot({
  81. enableWebRtc: webRtcVal.value, //截图方式
  82. clickCutFullScreen: fullScreenVal.value, //全屏
  83. loadCrossImg: true, //跨域
  84. level: 99999,
  85. completeCallback: getScreenShotImg
  86. });
  87. }, 500)
  88. }
  89. //获取裁剪区域图片信息
  90. const getScreenShotImg = (base64) => {
  91. window.sessionStorage.setItem('screenShort-base64', base64);
  92. //跳转到工单服务\需求反馈
  93. const useRoutePath = useRoutes.path
  94. useAppState.setScreenShort(true)
  95. if (useRoutePath !== "/other/order-service") {
  96. router.push({name: 'order-service'});
  97. }
  98. }
  99. //工单服务\需求反馈
  100. const toOrderService = () => {
  101. router.push({name: 'order-service'});
  102. }
  103. // 获取assets静态资源
  104. const getAssetsHomeFile = (url) => {
  105. const path = `../../assets/images/${url}`;
  106. const modules = import.meta.globEager("../../assets/images/*");
  107. return modules[path].default;
  108. }
  109. </script>
  110. <style lang="scss" scoped>
  111. .header-icon-bar {
  112. position: relative;
  113. height: 40px;
  114. width: 40px;
  115. border-radius: 100px;
  116. display: flex;
  117. justify-content: center;
  118. align-items: center;
  119. font-size: 26px;
  120. cursor: pointer;
  121. margin-right: 30px;
  122. border: 1px solid #00000000;
  123. background: #f1f5f8;
  124. color: #202532;
  125. box-shadow: 4px 4px 8px 0 rgba(54,92,167,0.15), -4px -4px 8px 0px #ffffff;
  126. }
  127. .hc-layout-box .hc-container-view.home .hc-header-view .hc-header-content .header-icon-bar {
  128. border: 1px solid white;
  129. color: inherit;
  130. box-shadow: initial;
  131. background: initial;
  132. }
  133. .header-pover-menu-list {
  134. position: relative;
  135. margin: -5px -12px;
  136. .list-item {
  137. position: relative;
  138. padding: 10px 24px;
  139. cursor: pointer;
  140. display: flex;
  141. align-items: center;
  142. transition: background-color 0.2s;
  143. .text {
  144. flex: auto;
  145. }
  146. .icon,.icon1 {
  147. width: 24px;
  148. height: 24px;
  149. }
  150. .icon1 {
  151. display: none;
  152. }
  153. &:hover {
  154. color: #ffffff;
  155. background-color: var(--el-color-primary);
  156. .icon {
  157. display: none;
  158. }
  159. .icon1 {
  160. display: block;
  161. }
  162. }
  163. }
  164. }
  165. .preview-video {
  166. width: 100%;
  167. }
  168. </style>