Procházet zdrojové kódy

登录页增加免登录功能

coderDJing před 11 měsíci
rodič
revize
152e4f67eb
1 změnil soubory, kde provedl 23 přidání a 2 odebrání
  1. 23 2
      src/pages/login/index.vue

+ 23 - 2
src/pages/login/index.vue

@@ -3,7 +3,27 @@ import Crypto from "../../utils/crypto";
 import { user } from '~/store/index'
 import { getAssetsImages } from "~/utils/getAssets"
 
+const loginLoading = ref(false)
 const router = useRouter()
+const route = useRoute();
+let zlb_token = route.query.zlb_token;
+if (zlb_token) {
+  request({
+    url: '/openapi/oauth/zlb/checkticket.php',
+    data: {
+      zlb_token: zlb_token
+    }
+  }).then((res) => {
+    if (res?.code === '1') {
+      user.value = res.data
+      router.replace('/main/course/qjkc')
+    } else {
+      loginLoading.value = false
+    }
+  }).catch(() => {
+    loginLoading.value = false
+  })
+}
 if (JSON.stringify(user.value) !== '{}') {
   router.replace('/main/course/qjkc')
 }
@@ -28,7 +48,7 @@ let hintText = $ref('')
 
 let readedClause = $ref(true)
 
-const loginLoading = ref(false)
+
 function handleLogin() {
   if (loginLoading.value) {
     return
@@ -95,7 +115,8 @@ function goFeedBack() {
   <div class="inputDiv paddingtop">
     <div class="inputHeight"><img :src="getAssetsImages('lock.png')" class="inputIcon" /></div>
     <div class="inputHeight paddingLeft">
-      <input v-model="fromData.user_password" placeholder="密码" :style="pswVisile ? '' : '-webkit-text-security:disc;'" />
+      <input v-model="fromData.user_password" placeholder="密码"
+        :style="pswVisile ? '' : '-webkit-text-security:disc;'" />
     </div>
     <div class="inputHeight paddingLefteye" @click="pswVisile = !pswVisile"><img
         :src="pswVisile ? getAssetsImages('eyeopen.png') : getAssetsImages('eyeclose.png')" class="eyeIcon" /></div>