From b94034a4a1e0bc5b71e330b1b8f951d8ada52587 Mon Sep 17 00:00:00 2001 From: mengyxu Date: Tue, 12 Dec 2023 13:59:01 +0800 Subject: [PATCH] update --- examples/App.vue | 3 +- package.json | 2 +- packages/base/data/modify-form.vue | 5 +- packages/base/index.ts | 3 +- packages/base/item/light-box.vue | 73 ++++++++++++++++++++++++++++ packages/base/item/select.vue | 10 +++- packages/manage/common/head.vue | 45 ++++++++++++++++- packages/manage/common/menu-tree.vue | 7 +-- packages/manage/router/index.vue | 24 +++++++-- plugs/config/size/large.ts | 3 +- plugs/config/size/normal.ts | 3 +- plugs/config/size/small.ts | 3 +- plugs/config/styles/dark.ts | 1 + plugs/config/styles/plain.ts | 2 + plugs/element/message.ts | 27 +++++----- plugs/http/axios2.ts | 24 ++++++++- plugs/store/index.ts | 8 +-- 17 files changed, 200 insertions(+), 43 deletions(-) create mode 100644 packages/base/item/light-box.vue diff --git a/examples/App.vue b/examples/App.vue index 2e36856..f6ab9d5 100644 --- a/examples/App.vue +++ b/examples/App.vue @@ -1,5 +1,6 @@ + \ No newline at end of file diff --git a/packages/base/item/select.vue b/packages/base/item/select.vue index 578920b..303fec4 100644 --- a/packages/base/item/select.vue +++ b/packages/base/item/select.vue @@ -2,7 +2,7 @@ - + @@ -69,6 +69,14 @@ const setWidth = () => { width.value = state.size.searchWidth; } } +const parse = (str) => { + const num = Number(str); + if (!isNaN(num)) { + return num; + } else { + return str; + } +} watch(() => state.size, (n, o) => { setWidth(); }) diff --git a/packages/manage/common/head.vue b/packages/manage/common/head.vue index 89469bf..646672c 100644 --- a/packages/manage/common/head.vue +++ b/packages/manage/common/head.vue @@ -1,4 +1,6 @@ + {{ username }} - + @@ -111,6 +114,10 @@ const props = defineProps({ type: String, default: null, }, + username: { + type: String, + default: null, + }, styleAble: { type: Boolean, }, @@ -124,8 +131,24 @@ const props = defineProps({ type: String, default: null, }, + closeAble: { + type: Boolean, + default: false, + }, }); +const isClose = ref(false) +const close = () => { + isClose.value = !isClose.value; + if (isClose.value) { + state.size.asideWidth = '0px'; + commit("initSize"); + } else { + state.size.asideWidth = state.size.aside + 'px'; + commit("initSize"); + } +} + const rules = { old: [new SimpleRequired('pwd.oldPwd')], new: [new SimpleRequired('pwd.newPwd'), new SimplePassword()], @@ -184,6 +207,15 @@ const changeSize = type => { onMounted(() => { }); \ No newline at end of file diff --git a/plugs/config/size/large.ts b/plugs/config/size/large.ts index c362870..a9dbd6b 100644 --- a/plugs/config/size/large.ts +++ b/plugs/config/size/large.ts @@ -7,7 +7,8 @@ export default class Small extends Normal { titleSize = '20px'; //标题字体尺寸 headIconSize = '24px'; //头部图标尺寸 headHeight = '60px'; //头部高度 - headMenuWidth = '350px'; //头部右侧菜单宽度 + closeTop = '45px'; //展开收起菜单按钮 + headMenuWidth = '450px'; //头部右侧菜单宽度 asideWidth = '200px'; //左侧菜单宽度 mainPad = '8px'; diff --git a/plugs/config/size/normal.ts b/plugs/config/size/normal.ts index c109857..4901b21 100644 --- a/plugs/config/size/normal.ts +++ b/plugs/config/size/normal.ts @@ -6,7 +6,8 @@ export default class Normal { titleSize = '18px'; //标题字体尺寸 headIconSize = '20px'; //头部图标尺寸 headHeight = '50px'; //头部高度 - headMenuWidth = '300px'; //头部右侧菜单宽度 + closeTop = '40px'; //展开收起菜单按钮 + headMenuWidth = '400px'; //头部右侧菜单宽度 asideWidth = '180px'; //左侧菜单宽度 mainHeight = ''; //通用页面组件高度 mainPad = '5px'; //通用页面组件内边距 diff --git a/plugs/config/size/small.ts b/plugs/config/size/small.ts index b3232f7..5f19980 100644 --- a/plugs/config/size/small.ts +++ b/plugs/config/size/small.ts @@ -7,7 +7,8 @@ export default class Small extends Normal { titleSize = '16px'; //标题字体尺寸 headIconSize = '16px'; //头部图标尺寸 headHeight = '45px'; //头部高度 - headMenuWidth = '250px'; //头部右侧菜单宽度 + closeTop = '35px'; //展开收起菜单按钮 + headMenuWidth = '350px'; //头部右侧菜单宽度 asideWidth = '160px'; //左侧菜单宽度 menuIconSize = '16px'; diff --git a/plugs/config/styles/dark.ts b/plugs/config/styles/dark.ts index 571d640..d7c0b55 100644 --- a/plugs/config/styles/dark.ts +++ b/plugs/config/styles/dark.ts @@ -6,6 +6,7 @@ export default class Dark extends Plain { bodyBg = dark[3]; //全局背景颜色 titleColor = light[0]; //标题颜色 color = grey[5]; //全局字体颜色 + selectionBg = '#0438a2'; //全局文字选中后背景 headBg = dark[2]; //头部背景颜色 menuBg = dark[2]; //菜单背景颜色 diff --git a/plugs/config/styles/plain.ts b/plugs/config/styles/plain.ts index 93426dc..53cf67d 100644 --- a/plugs/config/styles/plain.ts +++ b/plugs/config/styles/plain.ts @@ -6,6 +6,8 @@ export default class Plain { bodyBg = light[7]; //全局背景颜色 titleColor = light[0]; //标题颜色 color = '#4e5969'; //全局字体颜色 + selectionBg = '#3367d1'; //全局文字选中后背景 + selectionColor = '#fff'; //全局文字选中后背景 // headBg = '#2e8ae3'; //头部背景颜色 headBg = '#40c9c6'; //头部背景颜色 diff --git a/plugs/element/message.ts b/plugs/element/message.ts index d3d3c9f..fa889da 100644 --- a/plugs/element/message.ts +++ b/plugs/element/message.ts @@ -1,10 +1,4 @@ -import { - ElLoading, - ElMessage, - ElNotification, - ElMessageBox, - Action, -} from 'element-plus'; +import { ElLoading, ElMessage, ElNotification, ElMessageBox, Action } from 'element-plus'; let curMsg; let count = 0; let instance; @@ -82,16 +76,15 @@ export const confirm = (msg: string, title: string) => { type: 'warning', }) .then(resolve) - .catch(reject); + .catch((error) => { + if (reject != null) { + reject(error); + } + }); }); }; -export const prompt = ( - msg: string, - title: string, - pattern: RegExp, - errorMsg: string -) => { +export const prompt = (msg: string, title: string, pattern: RegExp, errorMsg: string) => { return new Promise((resolve, reject) => { ElMessageBox.confirm(msg, title, { confirmButtonText: t('base.confirm'), @@ -102,6 +95,10 @@ export const prompt = ( inputErrorMessage: errorMsg, }) .then(resolve) - .catch(reject); + .catch((error) => { + if (reject != null) { + reject(error); + } + }); }); }; diff --git a/plugs/http/axios2.ts b/plugs/http/axios2.ts index de799a9..5c3e417 100644 --- a/plugs/http/axios2.ts +++ b/plugs/http/axios2.ts @@ -13,8 +13,7 @@ const config = { const _axios = axios.create(config); _axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'; _axios.defaults.headers.put['Content-Type'] = 'application/json;charset=UTF-8'; -_axios.defaults.headers.delete['Content-Type'] = - 'application/json;charset=UTF-8'; +_axios.defaults.headers.delete['Content-Type'] = 'application/json;charset=UTF-8'; export const registerBaseUrl = (url) => { _axios.defaults.baseURL = url; @@ -174,6 +173,27 @@ export function upload(file, url, data) { }); } +export function getFile(url, data?, noMsg?, noLoading?) { + return new Promise((resolve, reject) => { + if (!noLoading) { + loading(); + } + _axios({ + method: 'get', + url: url, // 请求地址 + params: data, // 参数 + responseType: 'blob', // 表明返回服务器返回的数据类型 + }).then( + (response: any) => { + handResponse(response, resolve, noMsg, noLoading); + }, + (err) => { + handError(err, reject, noMsg, noLoading); + } + ); + }); +} + export function download(fileName, url, data = {}, callBack?) { loading(); _axios({ diff --git a/plugs/store/index.ts b/plugs/store/index.ts index 40333bd..de8d27e 100644 --- a/plugs/store/index.ts +++ b/plugs/store/index.ts @@ -8,11 +8,6 @@ export class State { A: '启用', B: '禁用', }, - test: { - a: 'A', - b: 'B', - c: 'C', - }, }; style = Styles.plain; size = Size.normal; @@ -64,8 +59,7 @@ export class Mutations { height = size.height; } size.mainHeight = Math.floor(height - head) + 'px'; - size.tableHeight = - height - 2 * (mainPad + searchRowPad) - 3 - searchRow - head; + size.tableHeight = height - 2 * (mainPad + searchRowPad) - 3 - searchRow - head; size.pTableHeight = size.tableHeight - size.pageHeight; }; updateDict = (state, param) => {