|
@@ -0,0 +1,75 @@
|
|
|
+<script setup lang="ts">
|
|
|
+import {onMounted, ref} from "vue";
|
|
|
+import {ElIcon} from "element-plus";
|
|
|
+import {Loading} from "@element-plus/icons-vue";
|
|
|
+import {userInfoStore} from "@/utils/store-public";
|
|
|
+import store from '@/store'
|
|
|
+import {loginApi} from '@/api/login'
|
|
|
+
|
|
|
+const props = defineProps<{
|
|
|
+ success: () => void,
|
|
|
+ error: () => void
|
|
|
+}>()
|
|
|
+
|
|
|
+const reLogin = () => {
|
|
|
+ let params = {
|
|
|
+ codeRs: userInfoStore.value.codeRs,
|
|
|
+ password: userInfoStore.value.password
|
|
|
+ }
|
|
|
+
|
|
|
+ loginApi(params).then((res) => {
|
|
|
+ store.commit('user/tokenChange', res.token)
|
|
|
+ store.commit('user/sidChange', res.sid)
|
|
|
+ store.commit('user/infoChange', res)
|
|
|
+ props.success()
|
|
|
+ }).catch(() => {
|
|
|
+ props.error()
|
|
|
+ })
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ reLogin()
|
|
|
+})
|
|
|
+
|
|
|
+</script>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <div class="re-login_box">
|
|
|
+ <div class="re-login_header">
|
|
|
+ <h3>
|
|
|
+ 令牌过期,正在重新登录。
|
|
|
+ </h3>
|
|
|
+ </div>
|
|
|
+ <div class="re-login_loading">
|
|
|
+ <el-icon class="is-loading" :size="100">
|
|
|
+ <Loading/>
|
|
|
+ </el-icon>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+$re-login-width: 500px;
|
|
|
+
|
|
|
+.re-login_box {
|
|
|
+ position: fixed;
|
|
|
+ width: $re-login-width;
|
|
|
+ height: 20%;
|
|
|
+ border-radius: 5px;
|
|
|
+ top: 20%;
|
|
|
+ left: calc(50% - $re-login-width / 2);
|
|
|
+ box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.5);
|
|
|
+
|
|
|
+ .re-login_header {
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .re-login_loading {
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+</style>
|