Commit 838318c8 authored by WizardEpoch's avatar WizardEpoch

style: eslint+prettier格式化

parent f6903cc9
# port # port
VITE_PORT = 3100 VITE_PORT = 80
# 网站标题 # 网站标题
VITE_GLOB_APP_TITLE = JeecgBoot 企业级低代码平台 VITE_GLOB_APP_TITLE = 工务系统
# 简称,用于配置文件名字 不要出现空格、数字开头等特殊字符 # 简称,用于配置文件名字 不要出现空格、数字开头等特殊字符
VITE_GLOB_APP_SHORT_NAME = JeecgBootAdmin VITE_GLOB_APP_SHORT_NAME = WorkSystem
# 单点登录服务端地址 # 单点登录服务端地址
VITE_GLOB_APP_CAS_BASE_URL=http://cas.test.com:8443/cas VITE_GLOB_APP_CAS_BASE_URL=http://47.94.207.62
# 是否开启单点登录 # 是否开启单点登录
VITE_GLOB_APP_OPEN_SSO = false VITE_GLOB_APP_OPEN_SSO = false
# 开启微前端模式 # 开启微前端模式
VITE_GLOB_APP_OPEN_QIANKUN=true VITE_GLOB_APP_OPEN_QIANKUN=false
# 文件预览地址 # 文件预览地址
VITE_GLOB_ONLINE_VIEW_URL=http://fileview.jeecg.com/onlinePreview VITE_GLOB_ONLINE_VIEW_URL=http://fileview.jeecg.com/onlinePreview
......
...@@ -5,16 +5,16 @@ VITE_USE_MOCK = true ...@@ -5,16 +5,16 @@ VITE_USE_MOCK = true
VITE_PUBLIC_PATH = / VITE_PUBLIC_PATH = /
# 跨域代理,您可以配置多个 ,请注意,没有换行符 # 跨域代理,您可以配置多个 ,请注意,没有换行符
VITE_PROXY = [["/jeecgboot","http://localhost:8080/jeecg-boot"],["/upload","http://localhost:3300/upload"]] VITE_PROXY = [["/hzsomms","http://192.168.11.39/hzsomms"],["/upload","http://localhost:3300/upload"]]
# 控制台不输出 # 控制台不输出
VITE_DROP_CONSOLE = false VITE_DROP_CONSOLE = false
#后台接口父地址(必填) #后台接口父地址(必填)
VITE_GLOB_API_URL=/jeecgboot VITE_GLOB_API_URL=/hzsomms
#后台接口全路径地址(必填) #后台接口全路径地址(必填)
VITE_GLOB_DOMAIN_URL=http://localhost:8080/jeecg-boot VITE_GLOB_DOMAIN_URL=http://192.168.11.39/hzsomms
# 接口前缀 # 接口前缀
VITE_GLOB_API_URL_PREFIX= VITE_GLOB_API_URL_PREFIX=
......
...@@ -19,7 +19,7 @@ VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false ...@@ -19,7 +19,7 @@ VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
VITE_GLOB_API_URL=/jeecgboot VITE_GLOB_API_URL=/jeecgboot
#后台接口全路径地址(必填) #后台接口全路径地址(必填)
VITE_GLOB_DOMAIN_URL=http://jeecg-boot-system:8080/jeecg-boot VITE_GLOB_DOMAIN_URL=http://47.94.207.62/hzsomms
# 接口父路径前缀 # 接口父路径前缀
VITE_GLOB_API_URL_PREFIX= VITE_GLOB_API_URL_PREFIX=
......
##### 版本号:
##### 问题描述:
##### 截图&代码:
#### 友情提示(为了提高issue处理效率):
- 未按格式要求发帖,会被直接删掉;
- 描述过于简单或模糊,导致无法分析处理的,会被直接删掉;
- 请自己初判问题描述是否清楚,是否方便我们调查处理;
MIT License
Copyright (c) 2020-present, Jeecg
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
开源协议补充
JeecgBoot 是由 北京敲敲云科技有限公司 发行的软件。 总部位于北京,地址:中国·北京·朝阳区科荟前街1号院奥林佳泰大厦。邮箱:jeecgos@163.com
本软件受适用的国家软件著作权法(包括国际条约)和双重保护许可。
1.允许基于本平台软件开展业务系统开发。
2.不得基于该平台软件的基础,修改包装成一个与JeecgBoot平台软件功能类似的产品进行发布、销售,或与JeecgBoot参与同类软件产品市场的竞争。
违反此条款属于侵权行为,须赔偿侵权经济损失,同时立即停止著作权侵权行为。
解释权归:http://www.jeecg.com
\ No newline at end of file
...@@ -6,8 +6,6 @@ JEECG BOOT 低代码开发平台(Vue3前端) ...@@ -6,8 +6,6 @@ JEECG BOOT 低代码开发平台(Vue3前端)
[![](https://img.shields.io/badge/Author-北京敲敲云科技-orange.svg)](http://www.jeecg.com) [![](https://img.shields.io/badge/Author-北京敲敲云科技-orange.svg)](http://www.jeecg.com)
[![](https://img.shields.io/badge/Blog-官方博客-blue.svg)](https://jeecg.blog.csdn.net) [![](https://img.shields.io/badge/Blog-官方博客-blue.svg)](https://jeecg.blog.csdn.net)
[![](https://img.shields.io/badge/version-3.5.2-brightgreen.svg)](https://github.com/zhangdaiscott/jeecg-boot) [![](https://img.shields.io/badge/version-3.5.2-brightgreen.svg)](https://github.com/zhangdaiscott/jeecg-boot)
[![GitHub stars](https://img.shields.io/github/stars/zhangdaiscott/jeecg-boot.svg?style=social&label=Stars)](https://github.com/zhangdaiscott/jeecg-boot)
[![GitHub forks](https://img.shields.io/github/forks/zhangdaiscott/jeecg-boot.svg?style=social&label=Fork)](https://github.com/zhangdaiscott/jeecg-boot)
......
...@@ -15,7 +15,10 @@ export interface GenerateColorsParams { ...@@ -15,7 +15,10 @@ export interface GenerateColorsParams {
color?: string; color?: string;
} }
export function generateAntColors(color: string, theme: GenerateTheme = 'default') { export function generateAntColors(
color: string,
theme: GenerateTheme = 'default'
) {
return generate(color, { return generate(color, {
theme, theme,
}); });
...@@ -51,7 +54,9 @@ export function generateColors({ ...@@ -51,7 +54,9 @@ export function generateColors({
.toRgbString(); .toRgbString();
}); });
const shortAlphaColors = alphaColors.map((item) => item.replace(/\s/g, '').replace(/0\./g, '.')); const shortAlphaColors = alphaColors.map((item) =>
item.replace(/\s/g, '').replace(/0\./g, '.')
);
const tinycolorLightens = arr const tinycolorLightens = arr
.map((_t, i) => { .map((_t, i) => {
......
...@@ -14,7 +14,11 @@ async function generateIcon() { ...@@ -14,7 +14,11 @@ async function generateIcon() {
id, id,
})); }));
const choices = collections.map((item) => ({ key: item.id, value: item.id, name: item.name })); const choices = collections.map((item) => ({
key: item.id,
value: item.id,
name: item.name,
}));
inquirer inquirer
.prompt([ .prompt([
...@@ -44,24 +48,38 @@ async function generateIcon() { ...@@ -44,24 +48,38 @@ async function generateIcon() {
const { iconSet, output, useType } = answers; const { iconSet, output, useType } = answers;
const outputDir = path.resolve(process.cwd(), output); const outputDir = path.resolve(process.cwd(), output);
fs.ensureDir(outputDir); fs.ensureDir(outputDir);
const genCollections = collections.filter((item) => [iconSet].includes(item.id)); const genCollections = collections.filter((item) =>
[iconSet].includes(item.id)
);
const prefixSet: string[] = []; const prefixSet: string[] = [];
for (const info of genCollections) { for (const info of genCollections) {
const data = await fs.readJSON(path.join(dir, 'json', `${info.id}.json`)); const data = await fs.readJSON(
path.join(dir, 'json', `${info.id}.json`)
);
if (data) { if (data) {
const { prefix } = data; const { prefix } = data;
const isLocal = useType === 'local'; const isLocal = useType === 'local';
const icons = Object.keys(data.icons).map((item) => `${isLocal ? prefix + ':' : ''}${item}`); const icons = Object.keys(data.icons).map(
(item) => `${isLocal ? prefix + ':' : ''}${item}`
);
await fs.writeFileSync( await fs.writeFileSync(
path.join(output, `icons.data.ts`), path.join(output, `icons.data.ts`),
`export default ${isLocal ? JSON.stringify(icons) : JSON.stringify({ prefix, icons })}` `export default ${
isLocal
? JSON.stringify(icons)
: JSON.stringify({ prefix, icons })
}`
); );
prefixSet.push(prefix); prefixSet.push(prefix);
} }
} }
fs.emptyDir(path.join(process.cwd(), 'node_modules/.vite')); fs.emptyDir(path.join(process.cwd(), 'node_modules/.vite'));
console.log(`✨ ${colors.cyan(`[${pkg.name}]`)}` + ' - Icon generated successfully:' + `[${prefixSet}]`); console.log(
`✨ ${colors.cyan(`[${pkg.name}]`)}` +
' - Icon generated successfully:' +
`[${prefixSet}]`
);
}); });
} }
......
...@@ -3,5 +3,7 @@ ...@@ -3,5 +3,7 @@
* @param env * @param env
*/ */
export const getConfigFileName = (env: Record<string, any>) => { export const getConfigFileName = (env: Record<string, any>) => {
return `__PRODUCTION__${env.VITE_GLOB_APP_SHORT_NAME || '__APP'}__CONF__`.toUpperCase().replace(/\s/g, ''); return `__PRODUCTION__${env.VITE_GLOB_APP_SHORT_NAME || '__APP'}__CONF__`
.toUpperCase()
.replace(/\s/g, '');
}; };
...@@ -33,15 +33,28 @@ function createConfig(params: CreateConfigParams) { ...@@ -33,15 +33,28 @@ function createConfig(params: CreateConfigParams) {
fs.mkdirp(getRootPath(OUTPUT_DIR)); fs.mkdirp(getRootPath(OUTPUT_DIR));
writeFileSync(getRootPath(`${OUTPUT_DIR}/${configFileName}`), configStr); writeFileSync(getRootPath(`${OUTPUT_DIR}/${configFileName}`), configStr);
console.log(colors.cyan(`✨ [${pkg.name}]`) + ` - configuration file is build successfully:`); console.log(
console.log(colors.gray(OUTPUT_DIR + '/' + colors.green(configFileName)) + '\n'); colors.cyan(`✨ [${pkg.name}]`) +
` - configuration file is build successfully:`
);
console.log(
colors.gray(OUTPUT_DIR + '/' + colors.green(configFileName)) + '\n'
);
} catch (error) { } catch (error) {
console.log(colors.red('configuration file configuration file failed to package:\n' + error)); console.log(
colors.red(
'configuration file configuration file failed to package:\n' + error
)
);
} }
} }
export function runBuildConfig() { export function runBuildConfig() {
const config = getEnvConfig(); const config = getEnvConfig();
const configFileName = getConfigFileName(config); const configFileName = getConfigFileName(config);
createConfig({ config, configName: configFileName, configFileName: GLOB_CONFIG_FILE_NAME }); createConfig({
config,
configName: configFileName,
configFileName: GLOB_CONFIG_FILE_NAME,
});
} }
...@@ -14,7 +14,9 @@ export const runBuild = async () => { ...@@ -14,7 +14,9 @@ export const runBuild = async () => {
runBuildConfig(); runBuildConfig();
} }
console.log(`✨ ${colors.cyan(`[${pkg.name}]`)}` + ' - build successfully!'); console.log(
`✨ ${colors.cyan(`[${pkg.name}]`)}` + ' - build successfully!'
);
} catch (error) { } catch (error) {
console.log(colors.red('vite build error:\n' + error)); console.log(colors.red('vite build error:\n' + error));
process.exit(1); process.exit(1);
......
...@@ -17,11 +17,17 @@ import { configVisualizerConfig } from './visualizer'; ...@@ -17,11 +17,17 @@ import { configVisualizerConfig } from './visualizer';
import { configThemePlugin } from './theme'; import { configThemePlugin } from './theme';
import { configImageminPlugin } from './imagemin'; import { configImageminPlugin } from './imagemin';
import { configSvgIconsPlugin } from './svgSprite'; import { configSvgIconsPlugin } from './svgSprite';
import OptimizationPersist from 'vite-plugin-optimize-persist' import OptimizationPersist from 'vite-plugin-optimize-persist';
import PkgConfig from 'vite-plugin-package-config' import PkgConfig from 'vite-plugin-package-config';
export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
const { VITE_USE_IMAGEMIN, VITE_USE_MOCK, VITE_LEGACY, VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE } = viteEnv; const {
VITE_USE_IMAGEMIN,
VITE_USE_MOCK,
VITE_LEGACY,
VITE_BUILD_COMPRESS,
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE,
} = viteEnv;
const vitePlugins: (PluginOption | PluginOption[])[] = [ const vitePlugins: (PluginOption | PluginOption[])[] = [
// have to // have to
...@@ -69,7 +75,12 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { ...@@ -69,7 +75,12 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
VITE_USE_IMAGEMIN && vitePlugins.push(configImageminPlugin()); VITE_USE_IMAGEMIN && vitePlugins.push(configImageminPlugin());
// rollup-plugin-gzip // rollup-plugin-gzip
vitePlugins.push(configCompressPlugin(VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE)); vitePlugins.push(
configCompressPlugin(
VITE_BUILD_COMPRESS,
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE
)
);
// vite-plugin-pwa // vite-plugin-pwa
vitePlugins.push(configPwaConfig(viteEnv)); vitePlugins.push(configPwaConfig(viteEnv));
......
{ {
"name": "jeecgboot-vue3", "name": "WorkSystem",
"version": "3.5.2", "version": "1.0.0",
"author": {
"name": "jeecg",
"email": "jeecgos@163.com",
"url": "https://github.com/jeecgboot/jeecgboot-vue3"
},
"scripts": { "scripts": {
"bootstrap": "pnpm install", "bootstrap": "pnpm install",
"serve": "npm run dev", "serve": "npm run dev",
......
This diff is collapsed.
module.exports = { module.exports = {
printWidth: 150, printWidth: 80,
tabWidth: 2, tabWidth: 2,
useTabs: false, useTabs: false,
semi: true, //语句末尾使用分号 semi: true, //语句末尾使用分号
......
...@@ -13,13 +13,15 @@ enum Api { ...@@ -13,13 +13,15 @@ enum Api {
export const getMenuList = () => { export const getMenuList = () => {
return new Promise((resolve) => { return new Promise((resolve) => {
//为了兼容mock和接口数据 //为了兼容mock和接口数据
defHttp.get<getMenuListResultModel>({ url: Api.GetMenuList }).then((res) => { defHttp
if (Array.isArray(res)) { .get<getMenuListResultModel>({ url: Api.GetMenuList })
resolve(res); .then((res) => {
} else { if (Array.isArray(res)) {
resolve(res['menu']); resolve(res);
} } else {
}); resolve(res['menu']);
}
});
}); });
}; };
......
...@@ -8,7 +8,10 @@ const { uploadUrl = '' } = useGlobSetting(); ...@@ -8,7 +8,10 @@ const { uploadUrl = '' } = useGlobSetting();
/** /**
* @description: Upload interface * @description: Upload interface
*/ */
export function uploadApi(params: UploadFileParams, onUploadProgress: (progressEvent: ProgressEvent) => void) { export function uploadApi(
params: UploadFileParams,
onUploadProgress: (progressEvent: ProgressEvent) => void
) {
return defHttp.uploadFile<UploadApiResult>( return defHttp.uploadFile<UploadApiResult>(
{ {
url: uploadUrl, url: uploadUrl,
...@@ -20,7 +23,10 @@ export function uploadApi(params: UploadFileParams, onUploadProgress: (progressE ...@@ -20,7 +23,10 @@ export function uploadApi(params: UploadFileParams, onUploadProgress: (progressE
/** /**
* @description: Upload interface * @description: Upload interface
*/ */
export function uploadImg(params: UploadFileParams, onUploadProgress: (progressEvent: ProgressEvent) => void) { export function uploadImg(
params: UploadFileParams,
onUploadProgress: (progressEvent: ProgressEvent) => void
) {
return defHttp.uploadFile<UploadApiResult>( return defHttp.uploadFile<UploadApiResult>(
{ {
url: `${uploadUrl}/sys/common/upload`, url: `${uploadUrl}/sys/common/upload`,
......
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import { LoginParams, LoginResultModel, GetUserInfoModel } from './model/userModel'; import {
LoginParams,
LoginResultModel,
GetUserInfoModel,
} from './model/userModel';
import { ErrorMessageMode } from '/#/axios'; import { ErrorMessageMode } from '/#/axios';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
...@@ -47,7 +51,10 @@ enum Api { ...@@ -47,7 +51,10 @@ enum Api {
/** /**
* @description: user login api * @description: user login api
*/ */
export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal') { export function loginApi(
params: LoginParams,
mode: ErrorMessageMode = 'modal'
) {
return defHttp.post<LoginResultModel>( return defHttp.post<LoginResultModel>(
{ {
url: Api.Login, url: Api.Login,
...@@ -62,7 +69,10 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal') ...@@ -62,7 +69,10 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal')
/** /**
* @description: user phoneLogin api * @description: user phoneLogin api
*/ */
export function phoneLoginApi(params: LoginParams, mode: ErrorMessageMode = 'modal') { export function phoneLoginApi(
params: LoginParams,
mode: ErrorMessageMode = 'modal'
) {
return defHttp.post<LoginResultModel>( return defHttp.post<LoginResultModel>(
{ {
url: Api.phoneLogin, url: Api.phoneLogin,
...@@ -78,17 +88,19 @@ export function phoneLoginApi(params: LoginParams, mode: ErrorMessageMode = 'mod ...@@ -78,17 +88,19 @@ export function phoneLoginApi(params: LoginParams, mode: ErrorMessageMode = 'mod
* @description: getUserInfo * @description: getUserInfo
*/ */
export function getUserInfo() { export function getUserInfo() {
return defHttp.get<GetUserInfoModel>({ url: Api.GetUserInfo }, {}).catch((e) => { return defHttp
// update-begin--author:zyf---date:20220425---for:【VUEN-76】捕获接口超时异常,跳转到登录界面 .get<GetUserInfoModel>({ url: Api.GetUserInfo }, {})
if (e && (e.message.includes('timeout') || e.message.includes('401'))) { .catch((e) => {
//接口不通时跳转到登录界面 // update-begin--author:zyf---date:20220425---for:【VUEN-76】捕获接口超时异常,跳转到登录界面
const userStore = useUserStoreWithOut(); if (e && (e.message.includes('timeout') || e.message.includes('401'))) {
userStore.setToken(''); //接口不通时跳转到登录界面
setAuthCache(TOKEN_KEY, null); const userStore = useUserStoreWithOut();
router.push(PageEnum.BASE_LOGIN); userStore.setToken('');
} setAuthCache(TOKEN_KEY, null);
// update-end--author:zyf---date:20220425---for:【VUEN-76】捕获接口超时异常,跳转到登录界面 router.push(PageEnum.BASE_LOGIN);
}); }
// update-end--author:zyf---date:20220425---for:【VUEN-76】捕获接口超时异常,跳转到登录界面
});
} }
export function getPermCode() { export function getPermCode() {
...@@ -108,15 +120,20 @@ export function getCodeInfo(currdatetime) { ...@@ -108,15 +120,20 @@ export function getCodeInfo(currdatetime) {
*/ */
export function getCaptcha(params) { export function getCaptcha(params) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
defHttp.post({ url: Api.getCaptcha, params }, { isTransformResponse: false }).then((res) => { defHttp
console.log(res); .post({ url: Api.getCaptcha, params }, { isTransformResponse: false })
if (res.success) { .then((res) => {
resolve(true); console.log(res);
} else { if (res.success) {
createErrorModal({ title: '错误提示', content: res.message || '未知问题' }); resolve(true);
reject(); } else {
} createErrorModal({
}); title: '错误提示',
content: res.message || '未知问题',
});
reject();
}
});
}); });
} }
...@@ -124,24 +141,39 @@ export function getCaptcha(params) { ...@@ -124,24 +141,39 @@ export function getCaptcha(params) {
* @description: 注册接口 * @description: 注册接口
*/ */
export function register(params) { export function register(params) {
return defHttp.post({ url: Api.registerApi, params }, { isReturnNativeResponse: true }); return defHttp.post(
{ url: Api.registerApi, params },
{ isReturnNativeResponse: true }
);
} }
/** /**
*校验用户是否存在 *校验用户是否存在
* @param params * @param params
*/ */
export const checkOnlyUser = (params) => defHttp.get({ url: Api.checkOnlyUser, params }, { isTransformResponse: false }); export const checkOnlyUser = (params) =>
defHttp.get(
{ url: Api.checkOnlyUser, params },
{ isTransformResponse: false }
);
/** /**
*校验手机号码 *校验手机号码
* @param params * @param params
*/ */
export const phoneVerify = (params) => defHttp.post({ url: Api.phoneVerify, params }, { isTransformResponse: false }); export const phoneVerify = (params) =>
defHttp.post(
{ url: Api.phoneVerify, params },
{ isTransformResponse: false }
);
/** /**
*密码修改 *密码修改
* @param params * @param params
*/ */
export const passwordChange = (params) => defHttp.get({ url: Api.passwordChange, params }, { isTransformResponse: false }); export const passwordChange = (params) =>
defHttp.get(
{ url: Api.passwordChange, params },
{ isTransformResponse: false }
);
/** /**
* @description: 第三方登录 * @description: 第三方登录
*/ */
...@@ -160,15 +192,23 @@ export function thirdLogin(params, mode: ErrorMessageMode = 'modal') { ...@@ -160,15 +192,23 @@ export function thirdLogin(params, mode: ErrorMessageMode = 'modal') {
*/ */
export function setThirdCaptcha(params) { export function setThirdCaptcha(params) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
defHttp.post({ url: Api.getThirdCaptcha, params }, { isTransformResponse: false }).then((res) => { defHttp
console.log(res); .post(
if (res.success) { { url: Api.getThirdCaptcha, params },
resolve(true); { isTransformResponse: false }
} else { )
createErrorModal({ title: '错误提示', content: res.message || '未知问题' }); .then((res) => {
reject(); console.log(res);
} if (res.success) {
}); resolve(true);
} else {
createErrorModal({
title: '错误提示',
content: res.message || '未知问题',
});
reject();
}
});
}); });
} }
......
import { on } from '/@/utils/domUtils'; import { on } from '/@/utils/domUtils';
import { isServer } from '/@/utils/is'; import { isServer } from '/@/utils/is';
import type { ComponentPublicInstance, DirectiveBinding, ObjectDirective } from 'vue'; import type {
ComponentPublicInstance,
DirectiveBinding,
ObjectDirective,
} from 'vue';
type DocumentHandler = <T extends MouseEvent>(mouseup: T, mousedown: T) => void; type DocumentHandler = <T extends MouseEvent>(mouseup: T, mousedown: T) => void;
...@@ -25,7 +29,10 @@ if (!isServer) { ...@@ -25,7 +29,10 @@ if (!isServer) {
}); });
} }
function createDocumentHandler(el: HTMLElement, binding: DirectiveBinding): DocumentHandler { function createDocumentHandler(
el: HTMLElement,
binding: DirectiveBinding
): DocumentHandler {
let excludes: HTMLElement[] = []; let excludes: HTMLElement[] = [];
if (Array.isArray(binding.arg)) { if (Array.isArray(binding.arg)) {
excludes = binding.arg; excludes = binding.arg;
...@@ -43,14 +50,26 @@ function createDocumentHandler(el: HTMLElement, binding: DirectiveBinding): Docu ...@@ -43,14 +50,26 @@ function createDocumentHandler(el: HTMLElement, binding: DirectiveBinding): Docu
const mouseDownTarget = mousedown.target as Node; const mouseDownTarget = mousedown.target as Node;
const isBound = !binding || !binding.instance; const isBound = !binding || !binding.instance;
const isTargetExists = !mouseUpTarget || !mouseDownTarget; const isTargetExists = !mouseUpTarget || !mouseDownTarget;
const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget); const isContainedByEl =
el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
const isSelf = el === mouseUpTarget; const isSelf = el === mouseUpTarget;
const isTargetExcluded = const isTargetExcluded =
(excludes.length && excludes.some((item) => item?.contains(mouseUpTarget))) || (excludes.length &&
excludes.some((item) => item?.contains(mouseUpTarget))) ||
(excludes.length && excludes.includes(mouseDownTarget as HTMLElement)); (excludes.length && excludes.includes(mouseDownTarget as HTMLElement));
const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget)); const isContainedByPopper =
if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) { popperRef &&
(popperRef.contains(mouseUpTarget) ||
popperRef.contains(mouseDownTarget));
if (
isBound ||
isTargetExists ||
isContainedByEl ||
isSelf ||
isTargetExcluded ||
isContainedByPopper
) {
return; return;
} }
binding.value(); binding.value();
......
...@@ -46,9 +46,12 @@ ...@@ -46,9 +46,12 @@
const { getOpenKeepAlive, getCanEmbedIFramePage } = useRootSetting(); const { getOpenKeepAlive, getCanEmbedIFramePage } = useRootSetting();
const { getBasicTransition, getEnableTransition } = useTransitionSetting(); const { getBasicTransition, getEnableTransition } =
useTransitionSetting();
const openCache = computed(() => unref(getOpenKeepAlive) && unref(getShowMultipleTab)); const openCache = computed(
() => unref(getOpenKeepAlive) && unref(getShowMultipleTab)
);
const getCaches = computed((): string[] => { const getCaches = computed((): string[] => {
if (!unref(getOpenKeepAlive)) { if (!unref(getOpenKeepAlive)) {
......
...@@ -4,7 +4,8 @@ export const PARENT_LAYOUT_NAME = 'ParentLayout'; ...@@ -4,7 +4,8 @@ export const PARENT_LAYOUT_NAME = 'ParentLayout';
export const PAGE_NOT_FOUND_NAME = 'PageNotFound'; export const PAGE_NOT_FOUND_NAME = 'PageNotFound';
export const EXCEPTION_COMPONENT = () => import('/@/views/sys/exception/Exception.vue'); export const EXCEPTION_COMPONENT = () =>
import('/@/views/sys/exception/Exception.vue');
/** /**
* @description: default layout * @description: default layout
......
import type { RouteRecordRaw } from 'vue-router'; import type { RouteRecordRaw } from 'vue-router';
import type { App } from 'vue'; import type { App } from 'vue';
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'; import { createRouter, createWebHistory } from 'vue-router';
import { basicRoutes } from './routes'; import { basicRoutes } from './routes';
// 白名单应该包含基本静态路由 // 白名单应该包含基本静态路由
......
...@@ -2,7 +2,10 @@ import type { RouteRecordRaw, RouteMeta } from 'vue-router'; ...@@ -2,7 +2,10 @@ import type { RouteRecordRaw, RouteMeta } from 'vue-router';
import { RoleEnum } from '/@/enums/roleEnum'; import { RoleEnum } from '/@/enums/roleEnum';
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
export type Component<T extends any = any> = ReturnType<typeof defineComponent> | (() => Promise<typeof import('*.vue')>) | (() => Promise<T>); export type Component<T = any> =
| ReturnType<typeof defineComponent>
| (() => Promise<typeof import('*.vue')>)
| (() => Promise<T>);
// @ts-ignore // @ts-ignore
export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> { export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
...@@ -45,9 +48,8 @@ export interface Menu { ...@@ -45,9 +48,8 @@ export interface Menu {
tag?: MenuTag; tag?: MenuTag;
hideMenu?: boolean; hideMenu?: boolean;
alwaysShow?: boolean; alwaysShow?: boolean;
} }
export interface MenuModule { export interface MenuModule {
......
import type { ProjectConfig, HeaderSetting, MenuSetting, TransitionSetting, MultiTabsSetting } from '/#/config'; import type {
ProjectConfig,
HeaderSetting,
MenuSetting,
TransitionSetting,
MultiTabsSetting,
} from '/#/config';
import type { BeforeMiniState } from '/#/store'; import type { BeforeMiniState } from '/#/store';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
...@@ -20,7 +26,7 @@ interface AppState { ...@@ -20,7 +26,7 @@ interface AppState {
// When the window shrinks, remember some states, and restore these states when the window is restored // When the window shrinks, remember some states, and restore these states when the window is restored
beforeMiniInfo: BeforeMiniState; beforeMiniInfo: BeforeMiniState;
// 页面跳转临时参数存储 // 页面跳转临时参数存储
messageHrefParams: any messageHrefParams: any;
} }
let timeId: TimeoutHandle; let timeId: TimeoutHandle;
export const useAppStore = defineStore({ export const useAppStore = defineStore({
...@@ -30,14 +36,16 @@ export const useAppStore = defineStore({ ...@@ -30,14 +36,16 @@ export const useAppStore = defineStore({
pageLoading: false, pageLoading: false,
projectConfig: Persistent.getLocal(PROJ_CFG_KEY), projectConfig: Persistent.getLocal(PROJ_CFG_KEY),
beforeMiniInfo: {}, beforeMiniInfo: {},
messageHrefParams: {} messageHrefParams: {},
}), }),
getters: { getters: {
getPageLoading(): boolean { getPageLoading(): boolean {
return this.pageLoading; return this.pageLoading;
}, },
getDarkMode(): 'light' | 'dark' | string { getDarkMode(): 'light' | 'dark' | string {
return this.darkMode || localStorage.getItem(APP_DARK_MODE_KEY_) || darkMode; return (
this.darkMode || localStorage.getItem(APP_DARK_MODE_KEY_) || darkMode
);
}, },
getBeforeMiniInfo(): BeforeMiniState { getBeforeMiniInfo(): BeforeMiniState {
...@@ -60,9 +68,9 @@ export const useAppStore = defineStore({ ...@@ -60,9 +68,9 @@ export const useAppStore = defineStore({
getMultiTabsSetting(): MultiTabsSetting { getMultiTabsSetting(): MultiTabsSetting {
return this.getProjectConfig.multiTabsSetting; return this.getProjectConfig.multiTabsSetting;
}, },
getMessageHrefParams():any{ getMessageHrefParams(): any {
return this.messageHrefParams; return this.messageHrefParams;
} },
}, },
actions: { actions: {
setPageLoading(loading: boolean): void { setPageLoading(loading: boolean): void {
...@@ -102,7 +110,6 @@ export const useAppStore = defineStore({ ...@@ -102,7 +110,6 @@ export const useAppStore = defineStore({
setMessageHrefParams(params: any): void { setMessageHrefParams(params: any): void {
this.messageHrefParams = params; this.messageHrefParams = params;
}, },
}, },
}); });
......
...@@ -6,7 +6,11 @@ import { useI18n } from '/@/hooks/web/useI18n'; ...@@ -6,7 +6,11 @@ import { useI18n } from '/@/hooks/web/useI18n';
import { useUserStore } from './user'; import { useUserStore } from './user';
import { useAppStoreWithOut } from './app'; import { useAppStoreWithOut } from './app';
import { toRaw } from 'vue'; import { toRaw } from 'vue';
import { transformObjToRoute, flatMultiLevelRoutes, addSlashToRouteComponent } from '/@/router/helper/routeHelper'; import {
transformObjToRoute,
flatMultiLevelRoutes,
addSlashToRouteComponent,
} from '/@/router/helper/routeHelper';
import { transformRouteToMenu } from '/@/router/helper/menuHelper'; import { transformRouteToMenu } from '/@/router/helper/menuHelper';
import projectSetting from '/@/settings/projectSetting'; import projectSetting from '/@/settings/projectSetting';
...@@ -18,7 +22,7 @@ import { ERROR_LOG_ROUTE, PAGE_NOT_FOUND_ROUTE } from '/@/router/routes/basic'; ...@@ -18,7 +22,7 @@ import { ERROR_LOG_ROUTE, PAGE_NOT_FOUND_ROUTE } from '/@/router/routes/basic';
import { filter } from '/@/utils/helper/treeHelper'; import { filter } from '/@/utils/helper/treeHelper';
import { getMenuList,switchVue3Menu } from '/@/api/sys/menu'; import { getMenuList, switchVue3Menu } from '/@/api/sys/menu';
import { getPermCode } from '/@/api/sys/user'; import { getPermCode } from '/@/api/sys/user';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
...@@ -136,7 +140,8 @@ export const usePermissionStore = defineStore({ ...@@ -136,7 +140,8 @@ export const usePermissionStore = defineStore({
let routes: AppRouteRecordRaw[] = []; let routes: AppRouteRecordRaw[] = [];
const roleList = toRaw(userStore.getRoleList) || []; const roleList = toRaw(userStore.getRoleList) || [];
const { permissionMode = projectSetting.permissionMode } = appStore.getProjectConfig; const { permissionMode = projectSetting.permissionMode } =
appStore.getProjectConfig;
const routeFilter = (route: AppRouteRecordRaw) => { const routeFilter = (route: AppRouteRecordRaw) => {
const { meta } = route; const { meta } = route;
...@@ -156,7 +161,8 @@ export const usePermissionStore = defineStore({ ...@@ -156,7 +161,8 @@ export const usePermissionStore = defineStore({
* */ * */
const patchHomeAffix = (routes: AppRouteRecordRaw[]) => { const patchHomeAffix = (routes: AppRouteRecordRaw[]) => {
if (!routes || routes.length === 0) return; if (!routes || routes.length === 0) return;
let homePath: string = userStore.getUserInfo.homePath || PageEnum.BASE_HOME; let homePath: string =
userStore.getUserInfo.homePath || PageEnum.BASE_HOME;
function patcher(routes: AppRouteRecordRaw[], parentPath = '') { function patcher(routes: AppRouteRecordRaw[], parentPath = '') {
if (parentPath) parentPath = parentPath + '/'; if (parentPath) parentPath = parentPath + '/';
routes.forEach((route: AppRouteRecordRaw) => { routes.forEach((route: AppRouteRecordRaw) => {
...@@ -245,10 +251,10 @@ export const usePermissionStore = defineStore({ ...@@ -245,10 +251,10 @@ export const usePermissionStore = defineStore({
title: '检测提示', title: '检测提示',
content: content:
'当前菜单表是 <b>Vue2版本</b>,导致菜单加载异常!<br>点击确认,切换到Vue3版菜单!', '当前菜单表是 <b>Vue2版本</b>,导致菜单加载异常!<br>点击确认,切换到Vue3版菜单!',
onOk:function () { onOk: function () {
switchVue3Menu(); switchVue3Menu();
location.reload(); location.reload();
} },
}), }),
100 100
); );
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"noUnusedParameters": true, "noUnusedParameters": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"lib": ["dom", "esnext"], "lib": ["dom", "esnext"],
"types": ["vite/client", "jest"], "types": ["vite/client", "jest", "ant-design-vue"],
"typeRoots": ["./node_modules/@types/", "./types"], "typeRoots": ["./node_modules/@types/", "./types"],
"noImplicitAny": false, "noImplicitAny": false,
"skipLibCheck": true, "skipLibCheck": true,
......
import { MenuTypeEnum, MenuModeEnum, TriggerEnum, MixSidebarTriggerEnum } from '/@/enums/menuEnum'; import {
MenuTypeEnum,
MenuModeEnum,
TriggerEnum,
MixSidebarTriggerEnum,
} from '/@/enums/menuEnum';
import { import {
ContentEnum, ContentEnum,
PermissionModeEnum, PermissionModeEnum,
......
import type { ComponentRenderProxy, VNode, VNodeChild, ComponentPublicInstance, FunctionalComponent, PropType as VuePropType } from 'vue'; import type {
ComponentRenderProxy,
VNode,
VNodeChild,
ComponentPublicInstance,
FunctionalComponent,
PropType as VuePropType,
} from 'vue';
declare global { declare global {
const __APP_INFO__: { const __APP_INFO__: {
...@@ -88,5 +95,7 @@ declare global { ...@@ -88,5 +95,7 @@ declare global {
} }
declare module 'vue' { declare module 'vue' {
export type JSXComponent<Props = any> = { new (): ComponentPublicInstance<Props> } | FunctionalComponent<Props>; export type JSXComponent<Props = any> =
| { new (): ComponentPublicInstance<Props> }
| FunctionalComponent<Props>;
} }
...@@ -27,7 +27,8 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { ...@@ -27,7 +27,8 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
// The boolean type read by loadEnv is a string. This function can be converted to boolean type // The boolean type read by loadEnv is a string. This function can be converted to boolean type
const viteEnv = wrapperEnv(env); const viteEnv = wrapperEnv(env);
const { VITE_PORT, VITE_PUBLIC_PATH, VITE_PROXY, VITE_DROP_CONSOLE } = viteEnv; const { VITE_PORT, VITE_PUBLIC_PATH, VITE_PROXY, VITE_DROP_CONSOLE } =
viteEnv;
const isBuild = command === 'build'; const isBuild = command === 'build';
......
...@@ -37,13 +37,14 @@ function createEnterPlugin(maxOutput = 8) { ...@@ -37,13 +37,14 @@ function createEnterPlugin(maxOutput = 8) {
[`*> .-enter-${d}:nth-child(${index})`]: { [`*> .-enter-${d}:nth-child(${index})`]: {
transform: `translate${upd}(-50px)`, transform: `translate${upd}(-50px)`,
}, },
[`* > .enter-${d}:nth-child(${index}),* > .-enter-${d}:nth-child(${index})`]: { [`* > .enter-${d}:nth-child(${index}),* > .-enter-${d}:nth-child(${index})`]:
'z-index': `${10 - index}`, {
opacity: '0', 'z-index': `${10 - index}`,
animation: `enter-${d}-animation 0.4s ease-in-out 0.3s`, opacity: '0',
'animation-fill-mode': 'forwards', animation: `enter-${d}-animation 0.4s ease-in-out 0.3s`,
'animation-delay': `${(index * 1) / 10}s`, 'animation-fill-mode': 'forwards',
}, 'animation-delay': `${(index * 1) / 10}s`,
},
}; };
}; };
const handler = ({ addBase }) => { const handler = ({ addBase }) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment