diff --git a/cdTMP/src/api/request.js b/cdTMP/src/api/request.js
index 09f9156..2578ec2 100644
--- a/cdTMP/src/api/request.js
+++ b/cdTMP/src/api/request.js
@@ -65,8 +65,11 @@ function createService() {
err("登录状态已过期,需要重新登录")
// 清楚本地localStorage
tool.local.clear()
- // 移动到网站的根目录
- window.location.href = "/"
+ // 移动到网站的根目录-这里不需要因为导航守卫可以返回login页面
+ if (error.response.data.data.code === 40001) {
+ } else {
+ window.location.href = "/"
+ }
break
case 403:
err("没有权限访问该资源")
diff --git a/cdTMP/src/api/system/user.js b/cdTMP/src/api/system/user.js
index 123eb3f..b92c2fc 100644
--- a/cdTMP/src/api/system/user.js
+++ b/cdTMP/src/api/system/user.js
@@ -102,4 +102,15 @@ export default {
params
})
},
+ /**
+ * 加载LDAP的用户数据
+ * @returns
+ */
+ loadLDAPUsers(params = {}) {
+ return request({
+ url: "system/user/ldap",
+ method: "get",
+ params
+ })
+ }
}
diff --git a/cdTMP/src/api/system/workplace.js b/cdTMP/src/api/system/workplace.js
new file mode 100644
index 0000000..a21be01
--- /dev/null
+++ b/cdTMP/src/api/system/workplace.js
@@ -0,0 +1,14 @@
+import { request } from "@/api/request"
+export default {
+ /**
+ * 查询工作台的统计信息
+ * @returns 统计用户和项目情况
+ */
+ getStatistics(params = {}) {
+ return request({
+ url: `/system/workplace/statistics`,
+ method: "get",
+ params
+ })
+ }
+}
diff --git a/cdTMP/src/router/guard/userLoginInfo.js b/cdTMP/src/router/guard/userLoginInfo.js
index 767361a..9e8ddc6 100644
--- a/cdTMP/src/router/guard/userLoginInfo.js
+++ b/cdTMP/src/router/guard/userLoginInfo.js
@@ -2,39 +2,38 @@ import NProgress from "nprogress" // progress bar
import { useUserStore } from "@/store"
// userInfo守卫
export default function setupUserLoginInfoGuard(router) {
- router.beforeEach(async (to, from, next) => {
+ router.beforeEach(async (to, from) => {
NProgress.start()
const userStore = useUserStore()
if (userStore.isLogin()) {
if (userStore.role) {
- next()
+ return
} else {
try {
await userStore.info()
- next()
+ return
} catch (error) {
await userStore.logout()
- next({
+ return {
name: "login",
query: {
redirect: to.name,
...to.query
}
- })
+ }
}
}
} else {
if (to.name === "login") {
- next()
return
}
- next({
+ return {
name: "login",
query: {
redirect: to.name,
...to.query
}
- })
+ }
}
})
}
diff --git a/cdTMP/src/store/modules/user.js b/cdTMP/src/store/modules/user.js
index 4e1bce6..59b47fb 100644
--- a/cdTMP/src/store/modules/user.js
+++ b/cdTMP/src/store/modules/user.js
@@ -79,7 +79,6 @@ const useUserStore = defineStore("user", {
}
})
.catch((e) => {
- console.log(e)
return false
})
},
diff --git a/cdTMP/src/utils/request.js b/cdTMP/src/utils/request.js
index 5fe9090..f878411 100644
--- a/cdTMP/src/utils/request.js
+++ b/cdTMP/src/utils/request.js
@@ -62,7 +62,7 @@ function createService() {
case 401:
err("登录状态已过期,需要重新登录")
tool.local.clear()
- window.location.href = "/"
+ window.location.href = "/login"
break
case 403:
err("没有权限访问该资源")
diff --git a/cdTMP/src/views/dashboard/workplace/components/cpns/st-count.vue b/cdTMP/src/views/dashboard/workplace/components/cpns/st-count.vue
index 929c972..37de9d7 100644
--- a/cdTMP/src/views/dashboard/workplace/components/cpns/st-count.vue
+++ b/cdTMP/src/views/dashboard/workplace/components/cpns/st-count.vue
@@ -15,11 +15,7 @@