diff --git a/build/config/themeConfig.ts b/build/config/themeConfig.ts index 5ab671a..8dbe118 100644 --- a/build/config/themeConfig.ts +++ b/build/config/themeConfig.ts @@ -30,7 +30,12 @@ export function getThemeColors(color?: string) { return [...lightColors, ...modeColors]; } -export function generateColors({ color = primaryColor, mixLighten, mixDarken, tinycolor }: GenerateColorsParams) { +export function generateColors({ + color = primaryColor, + mixLighten, + mixDarken, + tinycolor, +}: GenerateColorsParams) { const arr = new Array(19).fill(0); const lightens = arr.map((_t, i) => { return mixLighten(color, i / 5); @@ -63,5 +68,12 @@ export function generateColors({ color = primaryColor, mixLighten, mixDarken, ti .toHexString(); }) .filter((item) => item !== '#000000'); - return [...lightens, ...darkens, ...alphaColors, ...shortAlphaColors, ...tinycolorDarkens, ...tinycolorLightens].filter((item) => !item.includes('-')); + return [ + ...lightens, + ...darkens, + ...alphaColors, + ...shortAlphaColors, + ...tinycolorDarkens, + ...tinycolorLightens, + ].filter((item) => !item.includes('-')); } diff --git a/mock/_util.ts b/mock/_util.ts index aae271d..6a171d5 100644 --- a/mock/_util.ts +++ b/mock/_util.ts @@ -9,7 +9,12 @@ export function resultSuccess(result: T, { message = 'ok' } = {} }; } -export function resultPageSuccess(pageNo: number, pageSize: number, list: T[], { message = 'ok' } = {}) { +export function resultPageSuccess( + pageNo: number, + pageSize: number, + list: T[], + { message = 'ok' } = {} +) { const pageData = pagination(pageNo, pageSize, list); return { @@ -32,7 +37,10 @@ export function resultError(message = 'Request failed', { code = -1, result = nu export function pagination(pageNo: number, pageSize: number, array: T[]): T[] { const offset = (pageNo - 1) * Number(pageSize); - const ret = offset + Number(pageSize) >= array.length ? array.slice(offset, array.length) : array.slice(offset, offset + Number(pageSize)); + const ret = + offset + Number(pageSize) >= array.length + ? array.slice(offset, array.length) + : array.slice(offset, offset + Number(pageSize)); return ret; } diff --git a/mock/demo/select-demo.ts b/mock/demo/select-demo.ts index 7105769..ca2d949 100644 --- a/mock/demo/select-demo.ts +++ b/mock/demo/select-demo.ts @@ -20,9 +20,9 @@ export default [ timeout: 1000, method: 'get', response: ({ query }) => { - const { keyword, count } = query; + const { keyword,count} = query; console.log(keyword); - return resultSuccess(demoList(keyword, count)); + return resultSuccess(demoList(keyword,count)); }, }, ] as MockMethod[]; diff --git a/mock/demo/system.ts b/mock/demo/system.ts index e2ed4cc..940c04e 100644 --- a/mock/demo/system.ts +++ b/mock/demo/system.ts @@ -2,183 +2,196 @@ import { MockMethod } from 'vite-plugin-mock'; import { resultError, resultPageSuccess, resultSuccess, baseUrl } from '../_util'; const accountList = (() => { - const result: any[] = []; - for (let index = 0; index < 20; index++) { - result.push({ - id: `${index}`, - account: '@first', - email: '@email', - nickname: '@cname()', - role: '@first', - createTime: '@datetime', - remark: '@cword(10,20)', - 'status|1': ['0', '1'], - }); - } - return result; -})(); - -const userList = (() => { - const result: any[] = []; - for (let index = 0; index < 20; index++) { - result.push({ - id: `${index}`, - username: '@first', - email: '@email', - realname: '@cname()', - createTime: '@datetime', - remark: '@cword(10,20)', - avatar: 'https://q1.qlogo.cn/g?b=qq&nk=190848757&s=640', - }); - } - return result; -})(); - -const roleList = (() => { - const result: any[] = []; - for (let index = 0; index < 4; index++) { - result.push({ - id: index + 1, - orderNo: `${index + 1}`, - roleName: ['超级管理员', '管理员', '文章管理员', '普通用户'][index], - roleValue: '@first', - createTime: '@datetime', - remark: '@cword(10,20)', - menu: [['0', '1', '2'], ['0', '1'], ['0', '2'], ['2']][index], - 'status|1': ['0', '1'], - }); - } - return result; -})(); - -const newRoleList = (() => { - const result: any[] = []; - for (let index = 0; index < 4; index++) { - result.push({ - id: index + 1, - orderNo: `${index + 1}`, - roleName: ['超级管理员', '管理员', '文章管理员', '普通用户'][index], - roleCode: '@first', - createTime: '@datetime', - remark: '@cword(10,20)', - }); - } - return result; -})(); - -const testList = (() => { - const result: any[] = []; - for (let index = 0; index < 4; index++) { - result.push({ - id: index + 1, - orderNo: `${index + 1}`, - testName: ['数据1', '数据2', '数据3', '数据4'][index], - testValue: '@first', - createTime: '@datetime', - }); - } - return result; -})(); - -const tableDemoList = (() => { - const result: any[] = []; - for (let index = 0; index < 4; index++) { - result.push({ - id: index + 1, - orderCode: '2008200' + `${index + 1}`, - orderMoney: '@natural(1000,3000)', - ctype: '@natural(1,2)', - content: '@cword(10,20)', - orderDate: '@datetime', - }); - } - return result; -})(); - -const deptList = (() => { - const result: any[] = []; - for (let index = 0; index < 3; index++) { - result.push({ - id: `${index}`, - deptName: ['华东分部', '华南分部', '西北分部'][index], - orderNo: index + 1, - createTime: '@datetime', - remark: '@cword(10,20)', - 'status|1': ['0', '0', '1'], - children: (() => { - const children: any[] = []; - for (let j = 0; j < 4; j++) { - children.push({ - id: `${index}-${j}`, - deptName: ['研发部', '市场部', '商务部', '财务部'][j], - orderNo: j + 1, + const result: any[] = []; + for (let index = 0; index < 20; index++) { + result.push({ + id: `${index}`, + account: '@first', + email: '@email', + nickname: '@cname()', + role: '@first', createTime: '@datetime', remark: '@cword(10,20)', 'status|1': ['0', '1'], - parentDept: `${index}`, - children: undefined, - }); - } - return children; - })(), - }); - } - return result; + }); + } + return result; +})(); + +const userList = (() => { + const result: any[] = []; + for (let index = 0; index < 20; index++) { + result.push({ + id: `${index}`, + username: '@first', + email: '@email', + realname: '@cname()', + createTime: '@datetime', + remark: '@cword(10,20)', + avatar: 'https://q1.qlogo.cn/g?b=qq&nk=190848757&s=640' + }); + } + return result; +})(); + +const roleList = (() => { + const result: any[] = []; + for (let index = 0; index < 4; index++) { + result.push({ + id: index + 1, + orderNo: `${index + 1}`, + roleName: ['超级管理员', '管理员', '文章管理员', '普通用户'][index], + roleValue: '@first', + createTime: '@datetime', + remark: '@cword(10,20)', + menu: [['0', '1', '2'], ['0', '1'], ['0', '2'], ['2']][index], + 'status|1': ['0', '1'], + }); + } + return result; +})(); + +const newRoleList = (() => { + const result: any[] = []; + for (let index = 0; index < 4; index++) { + result.push({ + id: index + 1, + orderNo: `${index + 1}`, + roleName: ['超级管理员', '管理员', '文章管理员', '普通用户'][index], + roleCode: '@first', + createTime: '@datetime', + remark: '@cword(10,20)' + }); + } + return result; +})(); + +const testList = (() => { + const result: any[] = []; + for (let index = 0; index < 4; index++) { + result.push({ + id: index + 1, + orderNo: `${index + 1}`, + testName: ['数据1', '数据2', '数据3', '数据4'][index], + testValue: '@first', + createTime: '@datetime' + }); + } + return result; +})(); + +const tableDemoList = (() => { + const result: any[] = []; + for (let index = 0; index < 4; index++) { + result.push({ + id: index + 1, + orderCode: '2008200' + `${index + 1}`, + orderMoney: '@natural(1000,3000)', + ctype: '@natural(1,2)', + content: '@cword(10,20)', + orderDate: '@datetime' + }); + } + return result; +})(); + +const deptList = (() => { + const result: any[] = []; + for (let index = 0; index < 3; index++) { + result.push({ + id: `${index}`, + deptName: ['华东分部', '华南分部', '西北分部'][index], + orderNo: index + 1, + createTime: '@datetime', + remark: '@cword(10,20)', + 'status|1': ['0', '0', '1'], + children: (() => { + const children: any[] = []; + for (let j = 0; j < 4; j++) { + children.push({ + id: `${index}-${j}`, + deptName: ['研发部', '市场部', '商务部', '财务部'][j], + orderNo: j + 1, + createTime: '@datetime', + remark: '@cword(10,20)', + 'status|1': ['0', '1'], + parentDept: `${index}`, + children: undefined, + }); + } + return children; + })(), + }); + } + return result; })(); const menuList = (() => { - const result: any[] = []; - for (let index = 0; index < 3; index++) { - result.push({ - id: `${index}`, - icon: ['ion:layers-outline', 'ion:git-compare-outline', 'ion:tv-outline'][index], - component: 'LAYOUT', - type: '0', - menuName: ['Dashboard', '权限管理', '功能'][index], - permission: '', - orderNo: index + 1, - createTime: '@datetime', - 'status|1': ['0', '0', '1'], - children: (() => { - const children: any[] = []; - for (let j = 0; j < 4; j++) { - children.push({ - id: `${index}-${j}`, - type: '1', - menuName: ['菜单1', '菜单2', '菜单3', '菜单4'][j], - icon: 'ion:document', - permission: ['menu1:view', 'menu2:add', 'menu3:update', 'menu4:del'][index], - component: ['/dashboard/welcome/index', '/dashboard/Analysis/index', '/dashboard/workbench/index', '/dashboard/test/index'][j], - orderNo: j + 1, + const result: any[] = []; + for (let index = 0; index < 3; index++) { + result.push({ + id: `${index}`, + icon: ['ion:layers-outline', 'ion:git-compare-outline', 'ion:tv-outline'][index], + component: 'LAYOUT', + type: '0', + menuName: ['Dashboard', '权限管理', '功能'][index], + permission: '', + orderNo: index + 1, createTime: '@datetime', - 'status|1': ['0', '1'], - parentMenu: `${index}`, + 'status|1': ['0', '0', '1'], children: (() => { - const children: any[] = []; - for (let k = 0; k < 4; k++) { - children.push({ - id: `${index}-${j}-${k}`, - type: '2', - menuName: '按钮' + (j + 1) + '-' + (k + 1), - icon: '', - permission: ['menu1:view', 'menu2:add', 'menu3:update', 'menu4:del'][index] + ':btn' + (k + 1), - component: ['/dashboard/welcome/index', '/dashboard/Analysis/index', '/dashboard/workbench/index', '/dashboard/test/index'][j], - orderNo: j + 1, - createTime: '@datetime', - 'status|1': ['0', '1'], - parentMenu: `${index}-${j}`, - children: undefined, - }); - } - return children; + const children: any[] = []; + for (let j = 0; j < 4; j++) { + children.push({ + id: `${index}-${j}`, + type: '1', + menuName: ['菜单1', '菜单2', '菜单3', '菜单4'][j], + icon: 'ion:document', + permission: ['menu1:view', 'menu2:add', 'menu3:update', 'menu4:del'][index], + component: [ + '/dashboard/welcome/index', + '/dashboard/Analysis/index', + '/dashboard/workbench/index', + '/dashboard/test/index', + ][j], + orderNo: j + 1, + createTime: '@datetime', + 'status|1': ['0', '1'], + parentMenu: `${index}`, + children: (() => { + const children: any[] = []; + for (let k = 0; k < 4; k++) { + children.push({ + id: `${index}-${j}-${k}`, + type: '2', + menuName: '按钮' + (j + 1) + '-' + (k + 1), + icon: '', + permission: + ['menu1:view', 'menu2:add', 'menu3:update', 'menu4:del'][index] + + ':btn' + + (k + 1), + component: [ + '/dashboard/welcome/index', + '/dashboard/Analysis/index', + '/dashboard/workbench/index', + '/dashboard/test/index', + ][j], + orderNo: j + 1, + createTime: '@datetime', + 'status|1': ['0', '1'], + parentMenu: `${index}-${j}`, + children: undefined, + }); + } + return children; + })(), + }); + } + return children; })(), - }); - } - return children; - })(), - }); - } - return result; + }); + } + return result; })(); export default [ diff --git a/mock/sys/menu.ts b/mock/sys/menu.ts index 45d292b..73bda64 100644 --- a/mock/sys/menu.ts +++ b/mock/sys/menu.ts @@ -1,4 +1,4 @@ -import { resultSuccess, resultError, getRequestToken, requestParams, baseUrl } from '../_util'; +import { resultSuccess, resultError, getRequestToken, requestParams,baseUrl} from '../_util'; import { MockMethod } from 'vite-plugin-mock'; import { createFakeUserList } from './user'; diff --git a/mock/sys/user.ts b/mock/sys/user.ts index bcbe02b..34175e7 100644 --- a/mock/sys/user.ts +++ b/mock/sys/user.ts @@ -51,7 +51,9 @@ export default [ method: 'post', response: ({ body }) => { const { username, password } = body; - const checkUser = createFakeUserList().find((item) => item.username === username && password === item.password); + const checkUser = createFakeUserList().find( + (item) => item.username === username && password === item.password + ); if (!checkUser) { return resultError('Incorrect account or password!'); } diff --git a/prettier.config.js b/prettier.config.js index bd6a55b..f16d810 100644 --- a/prettier.config.js +++ b/prettier.config.js @@ -1,5 +1,5 @@ module.exports = { - printWidth: 200, + printWidth: 150, tabWidth: 2, useTabs: false, semi: true, //语句末尾使用分号 diff --git a/src/components/Application/src/AppLocalePicker.vue b/src/components/Application/src/AppLocalePicker.vue index 6fabc66..d600bba 100644 --- a/src/components/Application/src/AppLocalePicker.vue +++ b/src/components/Application/src/AppLocalePicker.vue @@ -3,7 +3,14 @@ * @Description: Multi-language switching component -->