使用真登录功能前拉取报错,提交代码

This commit is contained in:
GYYM
2024-11-20 11:22:05 +08:00
parent 963c0f5713
commit fdc7639887
19 changed files with 192 additions and 86 deletions

View File

@@ -19,6 +19,9 @@
<el-dropdown-item @click="changeMode">
<el-icon><Edit /></el-icon>{{ $t("header.changeMode") }}
</el-dropdown-item>
<el-dropdown-item @click="openDialog('versionRegisterRef')">
<el-icon><SetUp /></el-icon>{{ $t("header.versionRegister") }}
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
@@ -29,6 +32,8 @@
<InfoDialog ref="infoRef"></InfoDialog>
<!-- passwordDialog -->
<PasswordDialog ref="passwordRef"></PasswordDialog>
<!-- versionRegisterDialog -->
<VersionDialog ref="versionRegisterRef"></VersionDialog>
</template>
<script setup lang="ts">
@@ -40,6 +45,7 @@ import { useUserStore } from "@/stores/modules/user";
import { ElMessageBox, ElMessage } from "element-plus";
import InfoDialog from "./InfoDialog.vue";
import PasswordDialog from "./PasswordDialog.vue";
import VersionDialog from "@/views/system/versionRegister/index.vue";
import { computed } from "vue";
import { Avatar } from "@element-plus/icons-vue";
import AssemblySize from "./components/AssemblySize.vue";
@@ -49,7 +55,9 @@ import ThemeSetting from "./components/ThemeSetting.vue";
import Message from "./components/Message.vue";
import Fullscreen from "./components/Fullscreen.vue";
import { useAuthStore } from "@/stores/modules/auth";
import {useDictStore} from "@/stores/modules/dict";
const userStore = useUserStore();
const dictStore = useDictStore();
const username = computed(() => userStore.userInfo.name);
const router = useRouter();
const authStore = useAuthStore();
@@ -64,6 +72,8 @@ const logout = () => {
await logoutApi();
// 2.清除 Token
userStore.setToken("");
userStore.setUserInfo({name: ""});
dictStore.setDictData([]);
// 3.重定向到登陆页
router.replace(LOGIN_URL);
ElMessage.success("退出登录成功!");
@@ -75,9 +85,12 @@ const logout = () => {
// 打开修改密码和个人信息弹窗
const infoRef = ref<InstanceType<typeof InfoDialog> | null>(null);
const passwordRef = ref<InstanceType<typeof PasswordDialog> | null>(null);
const versionRegisterRef = ref<InstanceType<typeof VersionDialog> | null>(null);
const openDialog = (ref: string) => {
if (ref == "infoRef") infoRef.value?.openDialog();
if (ref == "passwordRef") passwordRef.value?.openDialog();
if (ref == "versionRegisterRef") versionRegisterRef.value?.openDialog();
};
//模式切换
const changeMode = () => {