林旭祥 7 månader sedan
förälder
incheckning
c81daf4457

+ 1 - 1
src/assets/styles/index.scss

@@ -77,7 +77,7 @@ ul li {
     font-size: 1.5rem;
   }
   .el-message-box__input {
-    width: 60%;
+    width: 72%;
 
     .el-input {
       height: 5.5vh;

+ 25 - 14
src/components/OptionWindow/index.vue

@@ -159,10 +159,10 @@ const data = reactive<any>({
 const { optionForm, optionWindow, project, musicList, classList, chooseArea, chooseAllState, loading } = toRefs(data);
 
 //打开
-const open = (data: any) => {
+const open = async (data: any) => {
   console.log("data", data);
-  getClass();
-  getMusic();
+  await getClass();
+  await getMusic();
   project.value = data;
   chooseArea.value = [];
   optionWindow.value.show = true;
@@ -187,12 +187,12 @@ const areaList = computed(() => {
 });
 
 //获取音乐
-const getMusic = () => {
+const getMusic = async () => {
   const list: any = useAppStore().getMusic();
   if (list.length) {
     musicList.value = list;
   } else {
-    proxy?.$http.train.musicList().then((res: any) => {
+    await proxy?.$http.train.musicList().then((res: any) => {
       if (res.data.length > 0) {
         let myList: any = res.data;
         musicList.value = myList;
@@ -204,7 +204,7 @@ const getMusic = () => {
 };
 
 //获取班级列表
-const getClass = () => {
+const getClass = async () => {
   const list: any = useAppStore().getClass();
   if (list.length) {
     classList.value = list;
@@ -213,7 +213,7 @@ const getClass = () => {
       page: 1,
       per_page: 9999,
     };
-    proxy?.$http.common.classList(params).then((res: any) => {
+    await proxy?.$http.common.classList(params).then((res: any) => {
       if (res.data.length > 0) {
         let myList: any = res.data;
         classList.value = myList;
@@ -265,7 +265,8 @@ const getAllArea = (data: any) => {
 };
 
 //确定
-const confirm = (data: any) => {
+const confirm = () => {
+  console.log("project.value", project.value)
   optionForm.value.project = project.value.key;
   optionForm.value.classes = classList.value.map((item: any) => { return item.id; }).join();
   optionForm.value.area = chooseArea.value.join();
@@ -281,11 +282,11 @@ const confirm = (data: any) => {
     ElMessage({ message: message, type: 'error', duration: 3 * 1000 });
     return false;
   }
-  if (optionForm.value.standard == null) {
-    let message = "请选择评分标准";
-    ElMessage({ message: message, type: 'error', duration: 3 * 1000 });
-    return false;
-  }
+  // if (optionForm.value.standard == null) {
+  //   let message = "请选择评分标准";
+  //   ElMessage({ message: message, type: 'error', duration: 3 * 1000 });
+  //   return false;
+  // }
   loading.value = true;
   if (chooseArea.value.length > 1) {
     //多区域
@@ -300,6 +301,15 @@ const confirm = (data: any) => {
   }
 };
 
+//手势赋值跳转
+const getGesture = async (myProject, data) => {
+  await getClass();
+  project.value = myProject;
+  chooseArea.value = data.area.split(",");
+  optionForm.value = data;
+  confirm();
+}
+
 onMounted(() => {
 })
 
@@ -311,7 +321,8 @@ onBeforeUnmount(() => {
 defineExpose({
   open,
   close,
-  optionWindow
+  optionWindow,
+  getGesture
 })
 </script>
 <style lang="scss" scoped>

+ 3 - 1
src/plugins/modal.ts

@@ -64,10 +64,12 @@ export default {
     });
   },
   // 提交内容
-  prompt(content: any) {
+  prompt(content: any, inputType?: any) {
     return ElMessageBox.prompt(content, '系统提示', {
       confirmButtonText: '确 定',
       cancelButtonText: '取 消',
+      inputType: inputType ? inputType : 'text',
+      inputPlaceholder: '请输入',
       type: 'warning',
       center: true,
       customClass: 'messageBoxClass',

+ 34 - 8
src/views/gesture/index.vue

@@ -17,9 +17,9 @@
     <OptionWindow ref="optionWindowRef" :projectList="projectList" />
 
     <div style=" width: 100%; color: #ffffff; font-size:1.5rem; text-align: center; position:fixed; bottom: 10px; ">
-      模拟发送手势:
-      <div @click="getCmdtest(1)">1、左滑动</div>
-      <div @click="getCmdtest(2)">2、举左手</div>
+      <div style="margin-bottom: 10px;">模拟发送手势:</div>
+      <div @click="getCmdtest(1)" style="margin-bottom: 10px;">1、左滑动</div>
+      <div @click="getCmdtest(2)" style="margin-bottom: 10px;">2、举左手</div>
       <div @click="getCmdtest(3)">3、双手胸前交叉</div>
     </div>
   </div>
@@ -106,18 +106,44 @@ const slideNext = () => {
   mySwiper.value.slideNext();
 };
 
+/**
+ * 确定并进入
+*/
+const confirm = () => {
+  let project = projectList.value[mySwiper.value.realIndex];
+  console.log("project", project)
+  let obj = device_info.value.project_list.find((item) => {
+    return item.exam_name == project.key;
+  })
+  if (obj == undefined) {
+    proxy?.$modal.msgError("该项目没有配置参数");
+    return false;
+  }
+  let data = {
+    gesture: obj.gesture ? true : false,
+    demo: obj.demo,
+    area: obj.area_test_id,
+    ctrl: obj.area_ctrl_id,
+    time: obj.test_time,
+    music: obj.music_info.url,
+    handcontroller: device_info.value.handcontroller_id,
+  }
+  console.log("111", project)
+  optionWindowRef.value.getGesture(JSON.parse(JSON.stringify(project)), data);
+};
+
 /**
  * 手势
 */
 const getHandWs = () => {
   //加载手势WS
   handWs((e: any) => {
-
     //发送设备
     if (e?.wksid) {
       console.log("e.wksid", e.wksid)
-      if (device_info.value.handcontroller_id) {
-        startHand(device_info.value.handcontroller_id)
+      let handcontroller_id = device_info.value.handcontroller_id;
+      if (handcontroller_id) {
+        startHand(handcontroller_id)
       } else {
         proxy?.$modal.msgError("请配置手势ID");
       }
@@ -128,7 +154,7 @@ const getHandWs = () => {
     }
     //举左手
     if (e?.data?.result == "left_hand") {
-
+      confirm();
     }
     //退出
     if (e?.data?.result == "exit") {
@@ -153,7 +179,7 @@ const getCmdtest = (data: any) => {
  * 退出
 */
 const getLogout = () => {
-  proxy?.$modal.prompt("请输入密码").then((e: any) => {
+  proxy?.$modal.prompt('请输入密码', 'password').then((e: any) => {
     // console.log("e", e)
     if (e.action == 'confirm' && e.value) {
       let params = {

+ 1 - 1
src/views/home/index.vue

@@ -39,7 +39,7 @@ const getJump = (url: string, name: string) => {
     return false;
   }
   if (url == '/set') {
-    proxy?.$modal.prompt("请输入密码").then((e: any) => {
+    proxy?.$modal.prompt('请输入密码', 'password').then((e: any) => {
       // console.log("e", e)
       if (e.action == 'confirm' && e.value) {
         let params = {

+ 17 - 2
src/views/train/multiple.vue

@@ -67,7 +67,7 @@
 <script setup name="Multiple" lang="ts">
 import { initSpeech, speckText, playMusic, controlMusic, speckCancel, chineseNumber } from '@/utils/speech'
 import { initWs, examEnds, openOneTest, startFace, stopFace, faceConfirmOnly, startOneTest, finishOneTest, closeOneTest, suspendFaceRecognitionChannels, resumeFaceRecognitionChannels } from '@/utils/ws'
-import { handWs } from '@/utils/handWs'
+import { handWs, startHand, closeHand } from '@/utils/handWs'
 const { proxy } = getCurrentInstance() as any;
 const router = useRouter();
 const route = useRoute();
@@ -203,7 +203,12 @@ const getExit = () => {
   examEnds();//通知工作站关闭
   speckCancel()//停止播报;
   window.onbeforeunload = null;//移除事件处理器
-  router.push({ path: '/' });//跳转
+  let handcontroller_id = parameter.value.handcontroller;
+  if (handcontroller_id) {
+    router.push({ path: '/gesture' });//跳转
+  } else {
+    router.push({ path: '/' });//跳转
+  }
 };
 
 /**
@@ -477,6 +482,16 @@ const getAddTestList = (num: number) => {
 */
 const initHand = () => {
   handWs((e: any) => {
+    //发送设备
+    if (e?.wksid) {
+      console.log("e.wksid", e.wksid)
+      let handcontroller_id = parameter.value.handcontroller;
+      if (handcontroller_id) {
+        startHand(handcontroller_id)
+      } else {
+        proxy?.$modal.msgError("请配置手势ID");
+      }
+    }
     //左滑动
     if (e?.data?.result == "next_item") {
     }

+ 18 - 3
src/views/train/test.vue

@@ -21,7 +21,7 @@
               :leave-active-class="proxy?.animate.dialog.leave">
               <div class="time" v-show="needStart && [42].includes(examState)">{{
                 time.countdownNum
-              }}</div>
+                }}</div>
             </Transition>
             <div class="tips" v-if="examState == 41">
               <img v-if="parameter.gesture" src="@/assets/images/test/ready1.png" />
@@ -115,7 +115,7 @@
 <script setup name="TrainTest" lang="ts">
 import { initSpeech, speckText, playMusic, controlMusic, speckCancel, chineseNumber } from '@/utils/speech'
 import { initWs, examEnds, openOneTest, startFace, stopFace, faceConfirmOnly, startOneTest, finishOneTest, closeOneTest, suspendFaceRecognitionChannels, resumeFaceRecognitionChannels } from '@/utils/ws'
-import { handWs } from '@/utils/handWs'
+import { handWs, startHand, closeHand } from '@/utils/handWs'
 import dayjs from 'dayjs'
 import dataDictionary from "@/utils/dataDictionary"
 const { proxy } = getCurrentInstance() as any;
@@ -400,7 +400,12 @@ const getExit = () => {
   examEnds();//通知工作站关闭
   speckCancel()//停止播报;
   window.onbeforeunload = null;//移除事件处理器
-  router.push({ path: '/' });//跳转
+  let handcontroller_id = parameter.value.handcontroller;
+  if (handcontroller_id) {
+    router.push({ path: '/gesture' });//跳转
+  } else {
+    router.push({ path: '/' });//跳转
+  }
 };
 
 /**
@@ -688,6 +693,16 @@ const getReady = () => {
 */
 const initHand = () => {
   handWs((e: any) => {
+    //发送设备
+    if (e?.wksid) {
+      console.log("e.wksid", e.wksid)
+      let handcontroller_id = parameter.value.handcontroller;
+      if (handcontroller_id) {
+        startHand(handcontroller_id)
+      } else {
+        proxy?.$modal.msgError("请配置手势ID");
+      }
+    }
     //左滑动
     if (e?.data?.result == "next_item") {
     }