mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-03 13:44:47 +08:00
feat: 支持多标签页打开已经登录的系统后无需再登录并添加7天内免登录功能 (#747)
* feat: 支持多标签页打开已经登录的系统后无需再登录 * feat: 添加`7`天内免登录功能
This commit is contained in:
@@ -37,6 +37,7 @@ import globalization from "@/assets/svg/globalization.svg?component";
|
||||
import Lock from "@iconify-icons/ri/lock-fill";
|
||||
import Check from "@iconify-icons/ep/check";
|
||||
import User from "@iconify-icons/ri/user-3-fill";
|
||||
import Info from "@iconify-icons/ri/information-line";
|
||||
|
||||
defineOptions({
|
||||
name: "Login"
|
||||
@@ -107,6 +108,9 @@ onBeforeUnmount(() => {
|
||||
watch(imgCode, value => {
|
||||
useUserStoreHook().SET_VERIFYCODE(value);
|
||||
});
|
||||
watch(checked, bool => {
|
||||
useUserStoreHook().SET_ISREMEMBERED(bool);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -225,7 +229,16 @@ watch(imgCode, value => {
|
||||
<el-form-item>
|
||||
<div class="w-full h-[20px] flex justify-between items-center">
|
||||
<el-checkbox v-model="checked">
|
||||
{{ t("login.remember") }}
|
||||
<span class="flex">
|
||||
{{ t("login.remember") }}
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
placement="top"
|
||||
:content="t('login.rememberInfo')"
|
||||
>
|
||||
<IconifyIconOffline :icon="Info" class="ml-1" />
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</el-checkbox>
|
||||
<el-button
|
||||
link
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { initRouter } from "@/router/utils";
|
||||
import { storageSession } from "@pureadmin/utils";
|
||||
import { storageLocal } from "@pureadmin/utils";
|
||||
import { type CSSProperties, ref, computed } from "vue";
|
||||
import { useUserStoreHook } from "@/store/modules/user";
|
||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||
@@ -34,7 +34,7 @@ function onChange() {
|
||||
.loginByUsername({ username: username.value, password: "admin123" })
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
storageSession().removeItem("async-routes");
|
||||
storageLocal().removeItem("async-routes");
|
||||
usePermissionStoreHook().clearAllCachePage();
|
||||
initRouter();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user