From 6b4a9c345965d3106422b17461ec390bdfd4611c Mon Sep 17 00:00:00 2001 From: icssoa <615206459@qq.com> Date: Thu, 29 Sep 2022 11:17:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 5 +- src/cool/bootstrap/eps.ts | 41 +-- src/modules/base/components/avatar/index.vue | 110 -------- .../base/components/codemirror/index.vue | 95 ------- .../base/components/column-custom/index.vue | 136 ---------- src/modules/base/components/date/text.vue | 30 -- src/modules/base/components/editor/quill.vue | 256 ------------------ src/modules/base/components/editor/wang.vue | 146 ---------- src/modules/base/components/icon/svg.vue | 41 --- src/modules/base/components/image/index.vue | 109 -------- src/modules/base/components/link/index.vue | 79 ------ src/modules/base/components/select/index.vue | 65 ----- src/modules/base/components/switch/index.tsx | 86 ------ src/modules/base/components/view/group.vue | 150 ---------- src/modules/base/config.ts | 9 +- src/modules/base/layout/components/amenu.vue | 4 +- src/modules/base/layout/components/views.vue | 4 +- src/modules/base/store/app.ts | 6 +- src/modules/base/views/param.vue | 2 +- src/modules/chat/components/index.vue | 1 + src/modules/chat/components/message.vue | 2 +- src/modules/demo/components/form-crud.vue | 109 ++++++++ src/modules/demo/views/crud.vue | 160 +++-------- .../views/home/components/category-ratio.vue | 2 +- .../demo/views/home/components/hot-search.vue | 65 +++-- src/modules/theme/components/theme.vue | 40 +-- src/modules/theme/config.ts | 21 +- src/modules/theme/types/index.d.ts | 6 + src/modules/theme/utils/index.ts | 31 ++- yarn.lock | 82 +++++- 30 files changed, 358 insertions(+), 1535 deletions(-) delete mode 100644 src/modules/base/components/avatar/index.vue delete mode 100644 src/modules/base/components/codemirror/index.vue delete mode 100644 src/modules/base/components/column-custom/index.vue delete mode 100644 src/modules/base/components/date/text.vue delete mode 100644 src/modules/base/components/editor/quill.vue delete mode 100644 src/modules/base/components/editor/wang.vue delete mode 100644 src/modules/base/components/icon/svg.vue delete mode 100644 src/modules/base/components/image/index.vue delete mode 100644 src/modules/base/components/link/index.vue delete mode 100644 src/modules/base/components/select/index.vue delete mode 100644 src/modules/base/components/switch/index.tsx delete mode 100644 src/modules/base/components/view/group.vue create mode 100644 src/modules/demo/components/form-crud.vue create mode 100644 src/modules/theme/types/index.d.ts diff --git a/package.json b/package.json index d824086..f1fba6c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "front-next", - "version": "5.10.0", + "version": "5.11.0", "scripts": { "dev": "vite --host", "build": "vite build", @@ -11,7 +11,8 @@ "dependencies": { "@codemirror/lang-javascript": "^6.0.1", "@codemirror/theme-one-dark": "^6.0.0", - "@cool-vue/crud": "^5.6.1", + "@cool-vue/admin": "^5.0.1", + "@cool-vue/crud": "^5.6.4", "@element-plus/icons-vue": "^2.0.6", "@vueuse/core": "^9.1.0", "@wangeditor/editor": "^5.1.14", diff --git a/src/cool/bootstrap/eps.ts b/src/cool/bootstrap/eps.ts index aa4464c..9d677b9 100644 --- a/src/cool/bootstrap/eps.ts +++ b/src/cool/bootstrap/eps.ts @@ -183,27 +183,28 @@ export async function createEps() { createDts(list); } - // 开发环境下使用接口 /eps 的数据,生产环境使用 eps.json + // 使用 eps.json + try { + const eps = JSON.parse(__EPS__ || "[]").map(([prefix, api]: any[]) => { + return { + prefix, + api: api.map(([method, path, name]: string[]) => { + return { + method, + path, + name + }; + }) + }; + }); + + set(eps); + } catch (err) { + console.error("[Eps] 解析失败!", err); + } + + // 开发环境下使用接口 /eps 刷新数据 if (isDev) { await getEps(); - } else { - try { - const eps = JSON.parse(__EPS__ || "[]").map(([prefix, api]: any[]) => { - return { - prefix, - api: api.map(([method, path, name]: string[]) => { - return { - method, - path, - name - }; - }) - }; - }); - - set(eps); - } catch (err) { - console.error("[Eps] 解析失败!", err); - } } } diff --git a/src/modules/base/components/avatar/index.vue b/src/modules/base/components/avatar/index.vue deleted file mode 100644 index 40d71bd..0000000 --- a/src/modules/base/components/avatar/index.vue +++ /dev/null @@ -1,110 +0,0 @@ - - - - - diff --git a/src/modules/base/components/codemirror/index.vue b/src/modules/base/components/codemirror/index.vue deleted file mode 100644 index 3938331..0000000 --- a/src/modules/base/components/codemirror/index.vue +++ /dev/null @@ -1,95 +0,0 @@ - - - - - diff --git a/src/modules/base/components/column-custom/index.vue b/src/modules/base/components/column-custom/index.vue deleted file mode 100644 index 3036395..0000000 --- a/src/modules/base/components/column-custom/index.vue +++ /dev/null @@ -1,136 +0,0 @@ - - - - - diff --git a/src/modules/base/components/date/text.vue b/src/modules/base/components/date/text.vue deleted file mode 100644 index 550ca75..0000000 --- a/src/modules/base/components/date/text.vue +++ /dev/null @@ -1,30 +0,0 @@ - - - diff --git a/src/modules/base/components/editor/quill.vue b/src/modules/base/components/editor/quill.vue deleted file mode 100644 index c3a2f10..0000000 --- a/src/modules/base/components/editor/quill.vue +++ /dev/null @@ -1,256 +0,0 @@ - - - - - diff --git a/src/modules/base/components/editor/wang.vue b/src/modules/base/components/editor/wang.vue deleted file mode 100644 index 345e120..0000000 --- a/src/modules/base/components/editor/wang.vue +++ /dev/null @@ -1,146 +0,0 @@ - - - - - diff --git a/src/modules/base/components/icon/svg.vue b/src/modules/base/components/icon/svg.vue deleted file mode 100644 index 0d2e01b..0000000 --- a/src/modules/base/components/icon/svg.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - - - diff --git a/src/modules/base/components/image/index.vue b/src/modules/base/components/image/index.vue deleted file mode 100644 index 3e26368..0000000 --- a/src/modules/base/components/image/index.vue +++ /dev/null @@ -1,109 +0,0 @@ - - - - - diff --git a/src/modules/base/components/link/index.vue b/src/modules/base/components/link/index.vue deleted file mode 100644 index 4b65fe4..0000000 --- a/src/modules/base/components/link/index.vue +++ /dev/null @@ -1,79 +0,0 @@ - - - - - diff --git a/src/modules/base/components/select/index.vue b/src/modules/base/components/select/index.vue deleted file mode 100644 index 316adfd..0000000 --- a/src/modules/base/components/select/index.vue +++ /dev/null @@ -1,65 +0,0 @@ - - - diff --git a/src/modules/base/components/switch/index.tsx b/src/modules/base/components/switch/index.tsx deleted file mode 100644 index 0ca65e9..0000000 --- a/src/modules/base/components/switch/index.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import { useCrud } from "@cool-vue/crud"; -import { ElMessage } from "element-plus"; -import { defineComponent, ref, watch } from "vue"; -import { isBoolean } from "lodash-es"; - -export default defineComponent({ - name: "cl-switch", - - props: { - scope: null, - column: null, - modelValue: [Number, String, Boolean], - activeValue: { - type: [Number, String, Boolean], - default: true - }, - inactiveValue: { - type: [Number, String, Boolean], - default: false - } - }, - - emits: ["update:modelValue", "change"], - - setup(props, { emit }) { - // cl-crud - const Crud = useCrud(); - - // 状态 - const status = ref(); - - watch( - () => props.modelValue, - (val: any) => { - if (isBoolean(props.activeValue)) { - status.value = Boolean(val); - } else { - status.value = val; - } - }, - { - immediate: true - } - ); - - // 监听改变 - function onChange(val: boolean | string | number) { - if (props.column && props.scope) { - if (Crud.value?.service.update) { - Crud.value?.service - ?.update({ - ...props.scope, - [props.column.property]: val - }) - .then(() => { - ElMessage.success("更新成功"); - emit("update:modelValue", val); - emit("change", val); - }) - .catch((err) => { - ElMessage.error(err.message); - }); - } - } else { - emit("update:modelValue", val); - emit("change", val); - } - } - - return { - status, - onChange - }; - }, - - render(ctx: any) { - return ( - - ); - } -}); diff --git a/src/modules/base/components/view/group.vue b/src/modules/base/components/view/group.vue deleted file mode 100644 index 9891693..0000000 --- a/src/modules/base/components/view/group.vue +++ /dev/null @@ -1,150 +0,0 @@ - - - - - diff --git a/src/modules/base/config.ts b/src/modules/base/config.ts index 5ef27d1..fb28084 100644 --- a/src/modules/base/config.ts +++ b/src/modules/base/config.ts @@ -1,11 +1,13 @@ import { ModuleConfig, config } from "/@/cool"; import { useStore } from "./store"; +import { App } from "vue"; +import Admin from "@cool-vue/admin"; +import "@cool-vue/admin/dist/index.css"; import "./static/css/index.scss"; export default (): ModuleConfig => { return { order: 99, - components: Object.values(import.meta.glob("./components/**/*")), views: [ { path: "/my/info", @@ -56,7 +58,10 @@ export default (): ModuleConfig => { component: () => import("./pages/error-page/502.vue") } ], - install() { + install(app: App) { + // 基础库 + app.use(Admin); + // 设置标题 document.title = config.app.name; }, diff --git a/src/modules/base/layout/components/amenu.vue b/src/modules/base/layout/components/amenu.vue index a8416bb..85b86a5 100644 --- a/src/modules/base/layout/components/amenu.vue +++ b/src/modules/base/layout/components/amenu.vue @@ -23,10 +23,10 @@ const { router, route } = useCool(); const { menu } = useBase(); // 选中标识 -const active = ref("0"); +const active = ref(""); // 选择导航 -function select(index: number) { +function select(index: any) { menu.setMenu(index); // 获取第一个菜单地址 diff --git a/src/modules/base/layout/components/views.vue b/src/modules/base/layout/components/views.vue index 065e4ea..485ca2d 100644 --- a/src/modules/base/layout/components/views.vue +++ b/src/modules/base/layout/components/views.vue @@ -1,7 +1,7 @@ diff --git a/src/modules/demo/views/home/components/category-ratio.vue b/src/modules/demo/views/home/components/category-ratio.vue index 469cceb..6036bc5 100644 --- a/src/modules/demo/views/home/components/category-ratio.vue +++ b/src/modules/demo/views/home/components/category-ratio.vue @@ -74,7 +74,7 @@ const chartOption = reactive({ } &__container { - height: 415px; + height: 395px; padding: 0 20px; box-sizing: border-box; diff --git a/src/modules/demo/views/home/components/hot-search.vue b/src/modules/demo/views/home/components/hot-search.vue index 3c63401..261221d 100644 --- a/src/modules/demo/views/home/components/hot-search.vue +++ b/src/modules/demo/views/home/components/hot-search.vue @@ -42,40 +42,9 @@
- + - +
@@ -86,7 +55,7 @@