|
@@ -1,181 +1,111 @@
|
|
|
<template>
|
|
|
- <div class="tw-h-screen tw-flex">
|
|
|
- <div class="tw-bg-white">
|
|
|
- <div class="tw-py-2 tw-flex tw-justify-center">
|
|
|
- <img class="qm-logo-img" />
|
|
|
+ <div class="home">
|
|
|
+ <div class="home-header">
|
|
|
+ <div class="home-menu">
|
|
|
+ <div class="home-title">
|
|
|
+ <h1>研究生成绩分析</h1>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ v-for="menu in menus"
|
|
|
+ :key="menu.url"
|
|
|
+ :class="['home-menu-item', { 'is-active': curMenu == menu.url }]"
|
|
|
+ @click="toMenu(menu)"
|
|
|
+ >
|
|
|
+ <svg-icon :name="menu.icon"></svg-icon>
|
|
|
+ <span>{{ menu.name }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="home-action">
|
|
|
+ <div class="home-action-item">
|
|
|
+ <svg-icon name="user" color="#BFBFBF"></svg-icon>
|
|
|
+ <span>{{ store.userInfo.displayName }}</span>
|
|
|
+ </div>
|
|
|
+ <a-button type="text" @click="toModifyPwd">
|
|
|
+ <template #icon>
|
|
|
+ <svg-icon name="password"></svg-icon>
|
|
|
+ </template>
|
|
|
+ </a-button>
|
|
|
+ <a-button type="text" @click="doLogout">
|
|
|
+ <template #icon>
|
|
|
+ <svg-icon name="logout"></svg-icon>
|
|
|
+ </template>
|
|
|
+ </a-button>
|
|
|
</div>
|
|
|
- <a-menu style="width: 240px" mode="inline" :openKeys="['sub1', 'sub2']">
|
|
|
- <a-sub-menu key="sub1">
|
|
|
- <template #icon> <span class="basic-icon"></span> </template>
|
|
|
- <template #title>基础管理</template>
|
|
|
- <a-menu-item v-if="store.isSuperAdmin" key="11">
|
|
|
- <router-link activeClass="active-route" to="/basic/rootOrg">
|
|
|
- 学校管理
|
|
|
- </router-link>
|
|
|
- </a-menu-item>
|
|
|
- <a-menu-item v-if="store.isSuperAdmin" key="16">
|
|
|
- <router-link activeClass="active-route" to="/basic/auth">
|
|
|
- 授权管理
|
|
|
- </router-link>
|
|
|
- </a-menu-item>
|
|
|
- <!-- <a-menu-item v-if="store.isSuperAdmin" key="12">
|
|
|
- <router-link activeClass="active-route" to="/basic/subOrg">
|
|
|
- 机构管理
|
|
|
- </router-link>
|
|
|
- </a-menu-item> -->
|
|
|
- <!-- <a-menu-item v-if="store.isSuperAdmin" key="13">
|
|
|
- <router-link activeClass="active-route" to="/basic/role">
|
|
|
- 角色管理
|
|
|
- </router-link>
|
|
|
- </a-menu-item> -->
|
|
|
- <a-menu-item v-if="!store.isCourseAdmin" key="14">
|
|
|
- <router-link activeClass="active-route" to="/basic/user">
|
|
|
- 用户管理
|
|
|
- </router-link>
|
|
|
- </a-menu-item>
|
|
|
- <a-menu-item v-if="!store.isSuperAdmin" key="15">
|
|
|
- <router-link activeClass="active-route" to="/basic/course">
|
|
|
- 科目管理
|
|
|
- </router-link>
|
|
|
- </a-menu-item>
|
|
|
- </a-sub-menu>
|
|
|
- <a-sub-menu v-if="!store.isSuperAdmin" key="sub2">
|
|
|
- <template #icon> <span class="project-icon"></span> </template>
|
|
|
- <template #title>项目管理</template>
|
|
|
- <a-menu-item key="21">
|
|
|
- <router-link
|
|
|
- activeClass="active-route"
|
|
|
- to="/project/projectManagement"
|
|
|
- >
|
|
|
- 项目列表
|
|
|
- </router-link>
|
|
|
- </a-menu-item>
|
|
|
- <a-menu-item key="22">
|
|
|
- <router-link
|
|
|
- activeClass="active-route"
|
|
|
- to="/project/projectCompareManagement"
|
|
|
- >
|
|
|
- 关联分析
|
|
|
- </router-link>
|
|
|
- </a-menu-item>
|
|
|
- </a-sub-menu>
|
|
|
- </a-menu>
|
|
|
</div>
|
|
|
- <div
|
|
|
- class="tw-h-screen"
|
|
|
- style="width: calc(100% - 240px); overflow: scroll; min-width: 960px"
|
|
|
- >
|
|
|
- <div
|
|
|
- class="tw-bg-white tw-flex tw-justify-between tw-items-center"
|
|
|
- style="border-left: 1px solid var(--app-main-bg-color); height: 56px"
|
|
|
- >
|
|
|
- <div>
|
|
|
- <span class="current-location-icon"></span>
|
|
|
- <span style="color: var(--app-secondary-text-color)">
|
|
|
- 当前所在位置:<span class="location-teleport">{{
|
|
|
- store.currentLocation
|
|
|
- }}</span></span
|
|
|
+ <div class="home-body">
|
|
|
+ <div v-if="store.currentLocation" class="home-breadcrumb">
|
|
|
+ <span class="breadcrumb-tips">
|
|
|
+ <HomeOutlined />
|
|
|
+ <span style="margin-left: 7px"
|
|
|
+ >当前所在位置:{{ store.currentLocation }}</span
|
|
|
>
|
|
|
- </div>
|
|
|
- <div class="tw-flex tw-items-center tw-cursor-pointer tw-gap-2 tw-mr-2">
|
|
|
- <div class="tw-cursor-pointer" @click="visible = true">
|
|
|
- {{ store.userInfo.displayName }}
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="logout-icon" @click="doLogout"></div>
|
|
|
- </div>
|
|
|
+ </span>
|
|
|
</div>
|
|
|
- <router-view class="tw-m-8"></router-view>
|
|
|
+ <router-view></router-view>
|
|
|
</div>
|
|
|
|
|
|
- <a-modal
|
|
|
- v-model:visible="visible"
|
|
|
- title="修改密码"
|
|
|
- okText="确定"
|
|
|
- cancelText="取消"
|
|
|
- @ok="handleOk"
|
|
|
- >
|
|
|
- <a-form :labelCol="{ span: 6 }">
|
|
|
- <a-form-item label="新密码">
|
|
|
- <a-input-password v-model:value="newPassword"></a-input-password>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item label="重复输入新密码">
|
|
|
- <a-input-password v-model:value="newPasswordCopy"></a-input-password>
|
|
|
- </a-form-item>
|
|
|
- </a-form>
|
|
|
- </a-modal>
|
|
|
+ <!-- ModifyPwd -->
|
|
|
+ <ModifyPwd ref="modifyPwdRef" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
+import { HomeOutlined } from "@ant-design/icons-vue";
|
|
|
import { logout } from "@/api/loginPage";
|
|
|
-import { changePassword } from "@/api/userManagementPage";
|
|
|
import { routeLogout } from "@/router";
|
|
|
import { useMainStore } from "@/store";
|
|
|
import { message } from "ant-design-vue";
|
|
|
+import useAuth from "@/hooks/auth";
|
|
|
+import { menuRelative } from "@/constants/menu";
|
|
|
+import type { MenuItem } from "@/constants/menu";
|
|
|
+import { useRoute, useRouter } from "vue-router";
|
|
|
+import { ref, watch } from "vue";
|
|
|
+import ModifyPwd from "../features/userManagement/ModifyPwd.vue";
|
|
|
|
|
|
+const route = useRoute();
|
|
|
+const router = useRouter();
|
|
|
const store = useMainStore();
|
|
|
|
|
|
-async function doLogout() {
|
|
|
- await logout().then(() =>
|
|
|
- routeLogout({ cause: "主动退出", redirectTo: "/" })
|
|
|
- );
|
|
|
-}
|
|
|
+const { menus } = useAuth(store.userInfo.role);
|
|
|
+let curMenu = ref();
|
|
|
+type MenuKey = keyof typeof menuRelative;
|
|
|
|
|
|
-let visible = $ref(false);
|
|
|
-let newPassword = $ref("");
|
|
|
-let newPasswordCopy = $ref("");
|
|
|
+watch(
|
|
|
+ () => route.name,
|
|
|
+ (val) => {
|
|
|
+ console.log(val);
|
|
|
|
|
|
-async function handleOk() {
|
|
|
- if (newPassword.length < 6) {
|
|
|
- void message.error({ content: "密码长度必须至少大于6位" });
|
|
|
- return;
|
|
|
+ if (!val) return;
|
|
|
+ const routeName = val.toString();
|
|
|
+ const keys: MenuKey[] = Object.keys(menuRelative) as MenuKey[];
|
|
|
+ const rname = keys.find((k) => menuRelative[k].includes(routeName));
|
|
|
+ curMenu.value = rname ?? routeName;
|
|
|
+ },
|
|
|
+ {
|
|
|
+ immediate: true,
|
|
|
}
|
|
|
- if (newPassword !== newPasswordCopy) {
|
|
|
- void message.error({ content: "两次输入的密码不一致" });
|
|
|
- return;
|
|
|
- }
|
|
|
- await changePassword(newPassword);
|
|
|
- void message.success("密码修改成功");
|
|
|
- visible = false;
|
|
|
-}
|
|
|
-</script>
|
|
|
+);
|
|
|
|
|
|
-<style scoped>
|
|
|
-.active-route {
|
|
|
- color: #4d66fd;
|
|
|
-}
|
|
|
+function toMenu(menu: MenuItem) {
|
|
|
+ console.log(menu, curMenu.value, route.name);
|
|
|
|
|
|
-.qm-logo-img {
|
|
|
- content: url(@/assets/qm-logo.png);
|
|
|
- height: 80px;
|
|
|
-}
|
|
|
+ curMenu.value = menu.url;
|
|
|
|
|
|
-.basic-icon {
|
|
|
- background-image: url(./images/基础管理.png);
|
|
|
- margin-right: -2px;
|
|
|
- width: 16px;
|
|
|
- height: 16px;
|
|
|
-}
|
|
|
+ if (route.name === menu.url) return;
|
|
|
|
|
|
-.project-icon {
|
|
|
- background-image: url(./images/项目管理.png);
|
|
|
- margin-right: -2px;
|
|
|
- width: 16px;
|
|
|
- height: 16px;
|
|
|
+ router.push({
|
|
|
+ name: menu.url,
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
-.current-location-icon {
|
|
|
- background-image: url(./images/当前位置.png);
|
|
|
- margin-left: 20px;
|
|
|
- display: inline-block;
|
|
|
- width: 10px;
|
|
|
- height: 10px;
|
|
|
+const modifyPwdRef = ref();
|
|
|
+function toModifyPwd() {
|
|
|
+ modifyPwdRef.value?.open();
|
|
|
}
|
|
|
|
|
|
-.logout-icon {
|
|
|
- background-image: url(./images/退出.png);
|
|
|
- width: 32px;
|
|
|
- height: 32px;
|
|
|
+async function doLogout() {
|
|
|
+ await logout().then(() =>
|
|
|
+ routeLogout({ cause: "主动退出", redirectTo: "/" })
|
|
|
+ );
|
|
|
}
|
|
|
-</style>
|
|
|
+</script>
|