check.vue 7.2 KB

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