check.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <headerBar
  3. title="拍摄物体镜头矫正"
  4. :menu="menu"
  5. showUser
  6. />
  7. <div class="check-wrap flex">
  8. <div class="check-page flex-col">
  9. <div class="main-container flex-col">
  10. <div class="content-wrapper flex-row justify-between">
  11. <div class="left-panel flex-col justify-between">
  12. <div class="tips-container flex-row" v-if="show">
  13. <img class="tips-icon" referrerpolicy="no-referrer" src="@/assets/images/Photography/tips-icon.png" />
  14. <span class="tips-tex">请在圆盘上摆上鞋子(注意左右脚),要求鞋外侧朝向拍照机,鞋子中轴线和红外线对齐</span>
  15. <img class="close-icon cu-p" referrerpolicy="no-referrer" src="@/assets/images/Photography/close-icon.png" @click="show = false"/>
  16. </div>
  17. <div class="camera-preview flex col center ">
  18. <span v-if="step === 1" class="fs-14">
  19. <img v-if="previewKey" class="camera-img" :src="preview+'?key='+previewKey" />
  20. </span>
  21. <template v-if="step === 2" >
  22. <img class="camera-img" :src="imageUrl+'?key='+imageUrlkey" />
  23. <span class="camera-description">这是一张用于检查镜头是否合适的测试图</span>
  24. </template>
  25. </div>
  26. </div>
  27. <div class="example-image flex-col"><span class="example-text">示范图片</span></div>
  28. </div>
  29. <div v-if="step === 1" class="action-button flex cente">
  30. <div @click="takePictures" class="check-button button--primary1 flex-col"><span class="button-text" v-loading="loading">拍照检查</span>
  31. </div>
  32. </div>
  33. <div v-else class="action-button flex center">
  34. <div @click="checkConfirm(false)" class="check-button button--white flex-col">
  35. <span class="button-text cu-p">重新拍照检查</span>
  36. </div>
  37. <router-link class="mar-left-20 " :to="{
  38. name: 'PhotographyShot'
  39. }">
  40. <div class="check-button button--primary1 flex-col">
  41. <span class="button-text cu-p">确认无误,下一步</span>
  42. </div>
  43. </router-link>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. <hardware-check
  49. isInitCheck
  50. @confirm="checkConfirm(true)"
  51. />
  52. </template>
  53. <script setup lang="ts">
  54. import { watchEffect,ref, reactive } from 'vue'
  55. import client from "@/stores/modules/client";
  56. import icpList from '@/utils/ipc'
  57. import useUserInfo from "@/stores/modules/user";
  58. import headerBar from '@/components/header-bar/index.vue'
  59. const clientStore = client();
  60. const menu = reactive([])
  61. const show = ref(true)
  62. const useUserInfoStore = useUserInfo()
  63. import HardwareCheck from '@/components/check/index.vue'
  64. function onCheckComplete(){
  65. }
  66. import { ref } from 'vue'
  67. import socket from "../../stores/modules/socket";
  68. import { digiCamControlWEB } from '@/utils/appconfig'
  69. const imageUrl = ref(digiCamControlWEB+'preview.jpg')
  70. const imageUrlkey = ref(0)
  71. const previewKey = ref(0)
  72. const preview = ref(digiCamControlWEB+'liveview.jpg')
  73. const step = ref(1)
  74. function checkConfirm(init){
  75. step.value =1
  76. if(menu.length === 0){
  77. menu.push({
  78. type:'setting'
  79. })
  80. }
  81. if(!init) previewKey.value++;
  82. showVideo()
  83. }
  84. let interval:any = null
  85. function showVideo(){
  86. clientStore.ipc.removeAllListeners(icpList.camera.PreviewShow);
  87. clientStore.ipc.send(icpList.camera.PreviewShow);
  88. clientStore.ipc.on(icpList.camera.PreviewShow, async (event, result) => {
  89. setTimeout(()=>{
  90. interval = setInterval(()=>{
  91. previewKey.value++;
  92. },200)
  93. },2000)
  94. })
  95. }
  96. function hideVideo(){
  97. clientStore.ipc.removeAllListeners(icpList.camera.PreviewHide);
  98. clientStore.ipc.send(icpList.camera.PreviewHide);
  99. clientStore.ipc.on(icpList.camera.PreviewHide, async (event, result) => {
  100. if(interval) clearInterval(interval)
  101. })
  102. }
  103. const loading = ref(false)
  104. function takePictures() {
  105. if (clientStore.isClient) {
  106. clientStore.ipc.removeAllListeners(icpList.camera.takePictures);
  107. clientStore.ipc.send(icpList.camera.takePictures);
  108. clientStore.ipc.on(icpList.camera.takePictures, async (event, result) => {
  109. if(interval) clearInterval(interval)
  110. loading.value = true;
  111. imageUrlkey.value++;
  112. setTimeout(()=>{
  113. hideVideo()
  114. step.value = 2
  115. imageUrlkey.value++;
  116. loading.value = false;
  117. },8000)
  118. })
  119. }
  120. }
  121. </script>
  122. <style scoped lang="scss">
  123. .check-wrap {
  124. background-color: rgba(234, 236, 237, 1);
  125. width: 100%;
  126. min-height: calc(100vh - 30px);
  127. display: flex;
  128. }
  129. .check-page {
  130. position: relative;
  131. width: 1200px;
  132. height: 768px;
  133. overflow: hidden;
  134. .main-container {
  135. width: 1200px;
  136. height: 739px;
  137. margin-bottom: 1px;
  138. .content-wrapper {
  139. width: 896px;
  140. height: 644px;
  141. margin: 10px 0 0 284px;
  142. .left-panel {
  143. width: 633px;
  144. height: 644px;
  145. .tips-container {
  146. background-color: rgba(255, 241, 222, 0.8);
  147. border-radius: 4px;
  148. width: 633px;
  149. height: 40px;
  150. border: 1px solid rgba(255, 228, 190, 1);
  151. justify-content: flex-center;
  152. .tips-icon {
  153. width: 16px;
  154. height: 16px;
  155. margin: 12px 0 0 16px;
  156. }
  157. .tips-tex {
  158. width: 549px;
  159. height: 22px;
  160. overflow-wrap: break-word;
  161. color: rgba(0, 0, 0, 0.85);
  162. font-size: 14px;
  163. font-weight: NaN;
  164. text-align: left;
  165. white-space: nowrap;
  166. line-height: 22px;
  167. margin: 9px 0 0 7px;
  168. }
  169. .close-icon {
  170. width: 12px;
  171. height: 12px;
  172. margin: 14px 16px 0 17px;
  173. }
  174. }
  175. .camera-preview {
  176. box-shadow: 0px 2px 10px 0px rgba(0, 32, 78, 0.1);
  177. background-color: rgba(255, 255, 255, 1);
  178. height: 600px;
  179. width: 600px;
  180. margin: 4px 0 0 16px;
  181. position: relative;
  182. .camera-description {
  183. position: absolute;
  184. bottom: 20px;
  185. width: 60%;
  186. padding: 8px 20px;
  187. background: rgba($color: #ffffff, $alpha: .2);
  188. border-radius: 20px;
  189. font-size: 14px;
  190. }
  191. .camera-img {
  192. width: 100%;
  193. }
  194. }
  195. }
  196. .example-image {
  197. background-color: rgba(216, 216, 216, 1);
  198. height: 200px;
  199. margin-top: 10px;
  200. width: 200px;
  201. .example-text {
  202. width: 56px;
  203. height: 20px;
  204. overflow-wrap: break-word;
  205. color: rgba(71, 71, 71, 1);
  206. font-size: 14px;
  207. font-weight: NaN;
  208. text-align: left;
  209. white-space: nowrap;
  210. line-height: 20px;
  211. margin: 90px 0 0 72px;
  212. }
  213. }
  214. }
  215. .action-button {
  216. width: 100%;
  217. text-align: center;
  218. margin-top: 28px;
  219. .check-button {
  220. .button-text {
  221. width: 180px;
  222. overflow-wrap: break-word;
  223. font-size: 16px;
  224. text-align: center;
  225. white-space: nowrap;
  226. height: 40px;
  227. line-height: 40px;
  228. }
  229. }
  230. }
  231. }
  232. }
  233. </style>