check.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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">拍照检查</span>
  30. </div>
  31. </div>
  32. <div v-else class="action-button flex center">
  33. <div @click="checkConfirm" 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"
  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(){
  73. step.value =1
  74. menu.push({
  75. type:'setting'
  76. })
  77. showVideo()
  78. }
  79. let interval:any = null
  80. function showVideo(){
  81. clientStore.ipc.removeAllListeners(icpList.camera.PreviewShow);
  82. clientStore.ipc.send(icpList.camera.PreviewShow);
  83. clientStore.ipc.on(icpList.camera.PreviewShow, async (event, result) => {
  84. setTimeout(()=>{
  85. interval = setInterval(()=>{
  86. previewKey.value++;
  87. },200)
  88. },2000)
  89. })
  90. }
  91. function hideVideo(){
  92. clientStore.ipc.removeAllListeners(icpList.camera.PreviewHide);
  93. clientStore.ipc.send(icpList.camera.PreviewHide);
  94. clientStore.ipc.on(icpList.camera.PreviewHide, async (event, result) => {
  95. if(interval) clearInterval(interval)
  96. })
  97. }
  98. function takePictures() {
  99. if (clientStore.isClient) {
  100. clientStore.ipc.removeAllListeners(icpList.camera.takePictures);
  101. clientStore.ipc.send(icpList.camera.takePictures);
  102. clientStore.ipc.on(icpList.camera.takePictures, async (event, result) => {
  103. setTimeout(()=>{
  104. hideVideo()
  105. step.value = 2
  106. imageUrlkey.value++;
  107. },5000)
  108. })
  109. }
  110. }
  111. </script>
  112. <style scoped lang="scss">
  113. .check-wrap {
  114. background-color: rgba(234, 236, 237, 1);
  115. width: 100%;
  116. min-height: 100vh;
  117. display: flex;
  118. }
  119. .check-page {
  120. position: relative;
  121. width: 1200px;
  122. height: 768px;
  123. overflow: hidden;
  124. .main-container {
  125. width: 1200px;
  126. height: 739px;
  127. margin-bottom: 1px;
  128. .content-wrapper {
  129. width: 896px;
  130. height: 644px;
  131. margin: 10px 0 0 284px;
  132. .left-panel {
  133. width: 633px;
  134. height: 644px;
  135. .tips-container {
  136. background-color: rgba(255, 241, 222, 0.8);
  137. border-radius: 4px;
  138. width: 633px;
  139. height: 40px;
  140. border: 1px solid rgba(255, 228, 190, 1);
  141. justify-content: flex-center;
  142. .tips-icon {
  143. width: 16px;
  144. height: 16px;
  145. margin: 12px 0 0 16px;
  146. }
  147. .tips-tex {
  148. width: 549px;
  149. height: 22px;
  150. overflow-wrap: break-word;
  151. color: rgba(0, 0, 0, 0.85);
  152. font-size: 14px;
  153. font-weight: NaN;
  154. text-align: left;
  155. white-space: nowrap;
  156. line-height: 22px;
  157. margin: 9px 0 0 7px;
  158. }
  159. .close-icon {
  160. width: 12px;
  161. height: 12px;
  162. margin: 14px 16px 0 17px;
  163. }
  164. }
  165. .camera-preview {
  166. box-shadow: 0px 2px 10px 0px rgba(0, 32, 78, 0.1);
  167. background-color: rgba(255, 255, 255, 1);
  168. height: 600px;
  169. width: 600px;
  170. margin: 4px 0 0 16px;
  171. position: relative;
  172. .camera-description {
  173. position: absolute;
  174. bottom: 20px;
  175. width: 60%;
  176. padding: 8px 20px;
  177. background: rgba($color: #ffffff, $alpha: .2);
  178. border-radius: 20px;
  179. font-size: 14px;
  180. }
  181. .camera-img {
  182. width: 100%;
  183. }
  184. }
  185. }
  186. .example-image {
  187. background-color: rgba(216, 216, 216, 1);
  188. height: 200px;
  189. margin-top: 10px;
  190. width: 200px;
  191. .example-text {
  192. width: 56px;
  193. height: 20px;
  194. overflow-wrap: break-word;
  195. color: rgba(71, 71, 71, 1);
  196. font-size: 14px;
  197. font-weight: NaN;
  198. text-align: left;
  199. white-space: nowrap;
  200. line-height: 20px;
  201. margin: 90px 0 0 72px;
  202. }
  203. }
  204. }
  205. .action-button {
  206. width: 100%;
  207. text-align: center;
  208. margin-top: 28px;
  209. .check-button {
  210. .button-text {
  211. width: 180px;
  212. overflow-wrap: break-word;
  213. font-size: 16px;
  214. text-align: center;
  215. white-space: nowrap;
  216. height: 40px;
  217. line-height: 40px;
  218. }
  219. }
  220. }
  221. }
  222. }
  223. </style>