63 lines
1.7 KiB
Vue
63 lines
1.7 KiB
Vue
|
|
<template>
|
||
|
|
<el-container class="w-h-full justify-center items-center bg-sky-200">
|
||
|
|
<el-main>
|
||
|
|
<Login v-show="pageMark == 'login'" @changePage="changePage" />
|
||
|
|
<Registered v-show="pageMark == 'registered'" @changePage="changePage" />
|
||
|
|
<ResetPassword v-show="pageMark == 'resetPassword'" @changePage="changePage" />
|
||
|
|
</el-main>
|
||
|
|
</el-container>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script setup>
|
||
|
|
import { ref, watch, onMounted } from "vue";
|
||
|
|
|
||
|
|
import $http from "../api/index";
|
||
|
|
import $url from "../api/url";
|
||
|
|
|
||
|
|
import Login from "../components/initialService/login.vue";
|
||
|
|
import Registered from "../components/initialService/registered.vue";
|
||
|
|
import ResetPassword from "../components/initialService/resetPassword.vue";
|
||
|
|
|
||
|
|
const pageMark = ref("login");
|
||
|
|
|
||
|
|
const changePage = (value) => {
|
||
|
|
pageMark.value = value;
|
||
|
|
};
|
||
|
|
|
||
|
|
watch(pageMark, (value) => {});
|
||
|
|
|
||
|
|
onMounted(() => {
|
||
|
|
if (
|
||
|
|
localStorage.data &&
|
||
|
|
localStorage.data !== "" &&
|
||
|
|
localStorage.data !== null &&
|
||
|
|
localStorage.data !== undefined &&
|
||
|
|
localStorage.data !== NaN
|
||
|
|
) {
|
||
|
|
let client_id = "exam";
|
||
|
|
const data = {
|
||
|
|
data: localStorage.data,
|
||
|
|
client_id,
|
||
|
|
};
|
||
|
|
$http.post($url.loginStatus, data).then((res) => {
|
||
|
|
if (res.data.code === 200) {
|
||
|
|
localStorage.setItem("data", res.data.data);
|
||
|
|
if (
|
||
|
|
localStorage.data &&
|
||
|
|
localStorage.data !== "" &&
|
||
|
|
localStorage.data !== null &&
|
||
|
|
localStorage.data !== undefined &&
|
||
|
|
localStorage.data !== NaN
|
||
|
|
) {
|
||
|
|
window.location.href = window.location.href.replace("/initialService", "/main");
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
localStorage.clear();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style scoped></style>
|