From 55cbb1d7bb39ca69e9e9e159e32e898d0e1e6de4 Mon Sep 17 00:00:00 2001
From: icssoa <2570063477@qq.com>
Date: Wed, 1 Jun 2022 22:26:54 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=20useBaseStore=20=E4=B8=BA?=
=?UTF-8?q?=20useBase?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package.json | 2 +-
src/App.vue | 4 +-
src/cool/bootstrap.ts | 4 +-
src/cool/router/index.ts | 4 +-
src/cool/service/request.ts | 4 +-
src/modules/base/common/permission.ts | 4 +-
src/modules/base/common/resize.ts | 4 +-
src/modules/base/components/select/index.vue | 61 +++++++++++++++++
src/modules/base/index.ts | 8 ++-
.../error-page/components/error-page.vue | 4 +-
.../base/pages/layout/components/process.vue | 5 +-
.../pages/layout/components/route-nav.vue | 4 +-
.../base/pages/layout/components/slider.vue | 8 +--
.../base/pages/layout/components/topbar.vue | 4 +-
.../base/pages/layout/components/views.vue | 4 +-
src/modules/base/pages/layout/index.vue | 4 +-
src/modules/base/pages/login/index.vue | 4 +-
src/modules/base/store/index.ts | 2 +-
src/modules/base/store/user.ts | 2 +-
.../base/views/components/dept-tree.vue | 48 ++++++++++----
src/modules/base/views/info.vue | 4 +-
src/modules/base/views/user.vue | 65 ++++++-------------
src/modules/upload/components/index.vue | 4 +-
src/modules/upload/components/space.vue | 4 +-
.../upload/components/space/category.vue | 4 +-
vite.config.ts | 10 +--
26 files changed, 171 insertions(+), 104 deletions(-)
create mode 100644 src/modules/base/components/select/index.vue
diff --git a/package.json b/package.json
index 5bee8ff..9cf8c64 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "front-next",
- "version": "5.2.3",
+ "version": "5.2.4",
"scripts": {
"dev": "vite --host",
"build": "vite build",
diff --git a/src/App.vue b/src/App.vue
index d4a7cb7..bb395fb 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -20,9 +20,9 @@
diff --git a/src/cool/bootstrap.ts b/src/cool/bootstrap.ts
index 5168261..86d7529 100644
--- a/src/cool/bootstrap.ts
+++ b/src/cool/bootstrap.ts
@@ -2,7 +2,7 @@ import { createPinia } from "pinia";
import { App } from "vue";
import { useModule } from "./module";
import { router, viewer } from "./router";
-import { useBaseStore } from "/$/base";
+import { useBase } from "/$/base";
import mitt from "mitt";
import VueECharts from "vue-echarts";
import ElementPlus from "element-plus";
@@ -23,7 +23,7 @@ export async function bootstrap(Vue: App) {
Vue.component("v-chart", VueECharts);
// 基础
- const { app, user, menu } = useBaseStore();
+ const { app, user, menu } = useBase();
// 加载模块
useModule(Vue);
diff --git a/src/cool/router/index.ts b/src/cool/router/index.ts
index 102b998..97d0a21 100644
--- a/src/cool/router/index.ts
+++ b/src/cool/router/index.ts
@@ -8,7 +8,7 @@ import {
RouteRecordRaw
} from "vue-router";
import { storage, config } from "/@/cool";
-import { useBaseStore } from "/$/base";
+import { useBase } from "/$/base";
import { cloneDeep, isArray } from "lodash";
// 视图文件
@@ -50,7 +50,7 @@ const router = createRouter({
// 路由守卫
router.beforeEach((to: any, _: any, next: NavigationGuardNext) => {
- const { user, process } = useBaseStore();
+ const { user, process } = useBase();
if (user.token) {
if (to.path.includes("/login")) {
diff --git a/src/cool/service/request.ts b/src/cool/service/request.ts
index 35aa43b..efa5a81 100644
--- a/src/cool/service/request.ts
+++ b/src/cool/service/request.ts
@@ -4,7 +4,7 @@ import "nprogress/nprogress.css";
import { ElMessage } from "element-plus";
import { isDev, config } from "/@/cool";
import { storage } from "/@/cool/utils";
-import { useBaseStore } from "/$/base";
+import { useBase } from "/$/base";
import { router } from "../router";
axios.defaults.timeout = 30000;
@@ -26,7 +26,7 @@ axios.interceptors.request.eject(axios._req);
// @ts-ignore
axios._req = axios.interceptors.request.use(
(req: any) => {
- const { user } = useBaseStore();
+ const { user } = useBase();
if (req.url) {
// 请求进度条
diff --git a/src/modules/base/common/permission.ts b/src/modules/base/common/permission.ts
index 899c8cb..512b495 100644
--- a/src/modules/base/common/permission.ts
+++ b/src/modules/base/common/permission.ts
@@ -1,8 +1,8 @@
-import { useBaseStore } from "../store";
+import { useStore } from "../store";
import { isObject } from "lodash";
function parse(value: any) {
- const { menu } = useBaseStore();
+ const { menu } = useStore();
if (typeof value == "string") {
return value ? menu.perms.some((e: any) => e.includes(value.replace(/\s/g, ""))) : false;
diff --git a/src/modules/base/common/resize.ts b/src/modules/base/common/resize.ts
index fb865a3..fb1f12a 100644
--- a/src/modules/base/common/resize.ts
+++ b/src/modules/base/common/resize.ts
@@ -1,8 +1,8 @@
import { useEventListener } from "@vueuse/core";
-import { useBaseStore } from "../store";
+import { useStore } from "../store";
function resize() {
- const { app } = useBaseStore();
+ const { app } = useStore();
app.setBrowser();
app.isFold = app.browser.isMini;
}
diff --git a/src/modules/base/components/select/index.vue b/src/modules/base/components/select/index.vue
new file mode 100644
index 0000000..357ce40
--- /dev/null
+++ b/src/modules/base/components/select/index.vue
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
diff --git a/src/modules/base/index.ts b/src/modules/base/index.ts
index 91b0151..7c70b9a 100644
--- a/src/modules/base/index.ts
+++ b/src/modules/base/index.ts
@@ -1,4 +1,10 @@
+import { useStore } from "./store";
import "./static/css/index.scss";
-export * from "./store";
+export function useBase() {
+ return {
+ ...useStore()
+ };
+}
+
export * from "./common";
diff --git a/src/modules/base/pages/error-page/components/error-page.vue b/src/modules/base/pages/error-page/components/error-page.vue
index 2c1ccb8..176b7e0 100644
--- a/src/modules/base/pages/error-page/components/error-page.vue
+++ b/src/modules/base/pages/error-page/components/error-page.vue
@@ -35,7 +35,7 @@