Browse Source

自助机登录

lighter 6 months ago
parent
commit
1cf2dc421b
4 changed files with 104 additions and 1 deletions
  1. 1 1
      src/App.vue
  2. 9 0
      src/api/isolations/self-machine.js
  3. 8 0
      src/router/index.js
  4. 86 0
      src/views/isolations/SelfMachineLogin.vue

+ 1 - 1
src/App.vue

@@ -12,7 +12,7 @@
 <script setup>
 import { computed } from 'vue'
 import store from './store'
-import Cookies from "js-cookie";
+import Cookies from 'js-cookie';
 const loading = computed(() => {
   return store.state.loading
 })

+ 9 - 0
src/api/isolations/self-machine.js

@@ -0,0 +1,9 @@
+import request from "@/utils/request";
+
+export function selfMachineLogin(id) {
+  return request({
+    url: '/selfMachine/login/login',
+    method: 'get',
+    params: { id },
+  })
+}

+ 8 - 0
src/router/index.js

@@ -508,6 +508,14 @@ export const constantRoutes = [
       title: '慢病患者登记表',
     },
   },
+  {
+    path: '/selfMachineLogin/:id',
+    name: 'selfMachineLogin',
+    component: () => import('../views/isolations/SelfMachineLogin.vue'),
+    meta: {
+      title: '自助机登录',
+    }
+  },
   {
     path: '/cashier',
     name: 'cashier',

+ 86 - 0
src/views/isolations/SelfMachineLogin.vue

@@ -0,0 +1,86 @@
+<template>
+  <div>
+    {{errMsg}}
+  </div>
+  <div v-show="showSuccess" class="login-success">
+    <div class="main-box">
+      <div class="icon-wrapper">
+        <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" class="icon-success">
+          <path fill="currentColor" d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336L456.192 600.384z"></path>
+        </svg>
+        <div class="result_title">
+          <p>扫码成功</p>
+          <van-button
+              type="danger"
+              plain
+              size="small"
+              block
+              @click="closeWindow"
+          >
+            关闭
+          </van-button>
+        </div>
+      </div>
+    </div>
+  </div>
+
+</template>
+
+<script setup>
+import router from "@/router";
+import {onMounted, ref} from "vue";
+import {selfMachineLogin} from "@/api/isolations/self-machine";
+
+const id = router.currentRoute.value.params.id
+const errMsg = ref('')
+const showSuccess = ref(false)
+
+function closeWindow() {
+  WeixinJSBridge.call('closeWindow')
+}
+
+onMounted(() => {
+  selfMachineLogin(id).then(() => {
+    showSuccess.value = true
+  }).catch((e) => {
+    errMsg.value = e;
+  })
+})
+
+</script>
+
+<style lang="scss">
+.login-success {
+  height: 100vh;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  .main-box {
+    margin-top: -160px;
+  }
+  .nav-bar-text {
+    color: #1989fa;
+    margin-left: 4px;
+  }
+  .icon-wrapper {
+    width: 100%;
+    text-align: center;
+  }
+  .icon-success {
+    color: #67c23a;
+    width: 64px;
+    height: 64px;
+  }
+  .result_title {
+    margin-top: 8px;
+    width: 128px;
+    > p {
+      margin: 0 0 32px 0;
+      font-size: 14px;
+      font-weight: bold;
+      color: #303133;
+      line-height: 1.3;
+    }
+  }
+}
+</style>