check.vue 6.7 KB

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