Browse Source

日常开发

林旭祥 6 months ago
parent
commit
d122833271
2 changed files with 30 additions and 6 deletions
  1. 17 0
      src/views/gesture/index.vue
  2. 13 6
      src/views/login/mobile.vue

+ 17 - 0
src/views/gesture/index.vue

@@ -206,6 +206,22 @@ const getTips = () => {
   }, myTime)
   }, myTime)
 };
 };
 
 
+//获取个人信息
+const getUserInfo = () => {
+  let userInfo = localStorage.getItem("userInfo") || '';
+  if(userInfo){
+    return false;
+  }
+  let params = {};
+  proxy?.$http.common.getUserInfo(params).then((res: any) => {
+    //保存信息
+    if (res.data.length) {
+      let info = JSON.stringify(res.data[0]);
+      localStorage.setItem("userInfo", info);
+    }
+  });
+};
+
 onBeforeMount(() => {
 onBeforeMount(() => {
   //加载设备WS
   //加载设备WS
   handWs((e: any) => {
   handWs((e: any) => {
@@ -259,6 +275,7 @@ onBeforeMount(() => {
 })
 })
 onMounted(() => {
 onMounted(() => {
   getInitExam();
   getInitExam();
+  getUserInfo();
 })
 })
 onBeforeUnmount(() => {
 onBeforeUnmount(() => {
   listenWs.value = false;
   listenWs.value = false;

+ 13 - 6
src/views/login/mobile.vue

@@ -18,11 +18,13 @@
           <div @click="getLogin" class="login-btn">登 录</div>
           <div @click="getLogin" class="login-btn">登 录</div>
         </div>
         </div>
       </div>
       </div>
-      <div v-else style=" width: 100%; color: #ffffff; font-size:20px; text-align: center; ">
-        <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 v-else class="login-content-center">
+        <div class="login-input-box">
+          <div style="margin-bottom: 15px;">模拟发送手势:</div>
+          <div class="login-item"><div @click="getCmdtest(1)"  class="login-btn" style="width:100%;">1、左滑动(切换项目)</div></div>
+          <div class="login-item"><div @click="getCmdtest(2)"  class="login-btn" style="width:100%;">2、举左手(确认)</div></div>
+          <div class="login-item" style="margin-bottom: 0;"><div @click="getCmdtest(3)"  class="login-btn" style="width:100%;">3、双手胸前交叉(退出)</div></div>
+        </div>
       </div>
       </div>
     </div>
     </div>
   </div>
   </div>
@@ -68,7 +70,12 @@ const getLogin = () => {
   proxy?.$http.common.qrlogin(params).then((res: any) => {
   proxy?.$http.common.qrlogin(params).then((res: any) => {
     if (res.access_token) {
     if (res.access_token) {
       show.value = true
       show.value = true
-      getDeviceInfo()
+      //保存token
+      let token = 'JWT ' + res.access_token;
+      localStorage.setItem("token", token);
+      setTimeout(()=>{
+        getDeviceInfo()
+      },500)
     }
     }
   }).catch(() => {
   }).catch(() => {
   }).finally(() => proxy?.$modal?.closeLoading());
   }).finally(() => proxy?.$modal?.closeLoading());