feat: antdv4.0 init

pull/28/head
xingyu 2023-07-29 18:46:43 +08:00
parent 35f1298ee6
commit 4fb4cb9e82
819 changed files with 17792 additions and 16878 deletions

View File

@ -1,74 +1,15 @@
const process = require('node:process')
process.env.ESLINT_TSCONFIG = 'tsconfig.json'
module.exports = {
root: true,
env: {
browser: true,
node: true,
es6: true
},
parser: 'vue-eslint-parser',
plugins: ['vue'],
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 2020,
sourceType: 'module',
jsxPragma: 'React',
ecmaFeatures: {
jsx: true
}
},
extends: ['plugin:vue/vue3-recommended', 'prettier', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
extends: '@antfu',
rules: {
'max-len': ['error', { code: 140, tabWidth: 2, ignoreComments: true }],
'vue/script-setup-uses-vars': 'error',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-empty-function': 'off',
'vue/custom-event-name-casing': 'off',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_'
}
],
'no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_'
}
],
'space-before-function-paren': 'off',
'vue/attributes-order': 'off',
'vue/one-component-per-file': 'off',
'vue/html-closing-bracket-newline': 'off',
'vue/max-attributes-per-line': 'off',
'vue/multiline-html-element-content-newline': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/attribute-hyphenation': 'off',
'vue/require-default-prop': 'off',
'vue/require-explicit-emits': 'off',
'vue/html-self-closing': [
'error',
{
html: {
void: 'always',
normal: 'never',
component: 'always'
},
svg: 'always',
math: 'always'
}
],
'vue/multi-word-component-names': 'off'
}
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'no-case-declarations': 'off',
'no-console': 'off',
'n/prefer-global/process': 'off',
},
}

View File

@ -1,8 +0,0 @@
// .lintstagedrc.js
module.exports = {
'*.js': ['prettier --config prettier.config.js --write', 'eslint --fix --ext .js'],
'*.ts': ['prettier --config prettier.config.js --write', 'eslint --fix --ext .ts'],
'*.vue': ['prettier --config prettier.config.js --write', 'eslint --fix --ext .vue'],
'*.tsx': ['prettier --config prettier.config.js --write', 'eslint --fix --ext .tsx'],
'*.json': 'prettier --config prettier.config.js --write'
}

64
.vscode/settings.json vendored
View File

@ -1,7 +1,5 @@
{
"typescript.tsdk": "./node_modules/typescript/lib",
"volar.tsPlugin": true,
"volar.tsPluginStatus": false,
"npm.packageManager": "pnpm",
"editor.tabSize": 2,
"prettier.printWidth": 140, //
@ -60,33 +58,24 @@
"path-intellisense.mappings": {
"@/": "${workspaceRoot}/src"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
"[typescriptreact]": {
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[css]": {
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
"[less]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"prettier.enable": false,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": true,
"source.organizeImports": false
},
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml"
],
"[vue]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
@ -136,27 +125,6 @@
"pnpm",
"antd"
],
"vetur.format.scriptInitialIndent": true,
"vetur.format.styleInitialIndent": true,
"vetur.validation.script": false,
"MicroPython.executeButton": [
{
"text": "▶",
"tooltip": "运行",
"alignment": "left",
"command": "extension.executeFile",
"priority": 3.5
}
],
"MicroPython.syncButton": [
{
"text": "$(sync)",
"tooltip": "同步",
"alignment": "left",
"command": "extension.execute",
"priority": 4
}
],
//
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,

View File

@ -17,7 +17,7 @@ export interface GenerateColorsParams {
export function generateAntColors(color: string, theme: GenerateTheme = 'default') {
return generate(color, {
theme
theme,
})
}
@ -31,7 +31,7 @@ export function getThemeColors(color?: string) {
}
export function generateColors({ color = primaryColor, mixLighten, mixDarken, tinycolor }: GenerateColorsParams) {
const arr = new Array(19).fill(0)
const arr = Array.from({ length: 19 }).fill(0)
const lightens = arr.map((_t, i) => {
return mixLighten(color, i / 5)
})
@ -46,7 +46,7 @@ export function generateColors({ color = primaryColor, mixLighten, mixDarken, ti
.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
.map((_t, i) => {
@ -54,7 +54,7 @@ export function generateColors({ color = primaryColor, mixLighten, mixDarken, ti
.lighten(i * 5)
.toHexString()
})
.filter((item) => item !== '#ffffff')
.filter(item => item !== '#ffffff')
const tinycolorDarkens = arr
.map((_t, i) => {
@ -62,8 +62,8 @@ export function generateColors({ color = primaryColor, mixLighten, mixDarken, ti
.darken(i * 5)
.toHexString()
})
.filter((item) => item !== '#000000')
.filter(item => item !== '#000000')
return [...lightens, ...darkens, ...alphaColors, ...shortAlphaColors, ...tinycolorDarkens, ...tinycolorLightens].filter(
(item) => !item.includes('-')
item => !item.includes('-'),
)
}

View File

@ -1,6 +1,6 @@
import { generateAntColors, primaryColor } from '../config/themeConfig'
import { resolve } from 'node:path'
import { getThemeVariables } from 'ant-design-vue/dist/theme'
import { resolve } from 'path'
import { generateAntColors, primaryColor } from '../config/themeConfig'
/**
* less global variable
@ -11,16 +11,15 @@ export function generateModifyVars(dark = false) {
const primaryColorObj: Record<string, string> = {}
for (let index = 0; index < 10; index++) {
for (let index = 0; index < 10; index++)
primaryColorObj[`primary-${index + 1}`] = palettes[index]
}
const modifyVars = getThemeVariables({ dark })
return {
...modifyVars,
// Used for global import to avoid the need to import each style file separately
// reference: Avoid repeated references
hack: `${modifyVars.hack} @import (reference) "${resolve('src/design/config.less')}";`,
'hack': `${modifyVars.hack} @import (reference) "${resolve('src/design/config.less')}";`,
'primary-color': primary,
...primaryColorObj,
'info-color': primary,
@ -28,10 +27,10 @@ export function generateModifyVars(dark = false) {
'success-color': '#55D187', // Success color
'error-color': '#ED6F6F', // False color
'warning-color': '#EFBD47', // Warning color
//'border-color-base': '#EEEEEE',
// 'border-color-base': '#EEEEEE',
'font-size-base': '14px', // Main font size
'border-radius-base': '2px', // Component/float fillet
'link-color': primary, // Link color
'app-content-background': '#fafafa' // Link color
'app-content-background': '#fafafa', // Link color
}
}

View File

@ -1,4 +1,4 @@
import path from 'path'
import path from 'node:path'
import fs from 'fs-extra'
import inquirer from 'inquirer'
import colors from 'picocolors'
@ -11,10 +11,10 @@ async function generateIcon() {
const collections = Object.entries(raw).map(([id, v]) => ({
...(v as any),
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
.prompt([
@ -23,39 +23,39 @@ async function generateIcon() {
name: 'useType',
choices: [
{ key: 'local', value: 'local', name: 'Local' },
{ key: 'onLine', value: 'onLine', name: 'OnLine' }
{ key: 'onLine', value: 'onLine', name: 'OnLine' },
],
message: 'How to use icons?'
message: 'How to use icons?',
},
{
type: 'list',
name: 'iconSet',
choices: choices,
message: 'Select the icon set that needs to be generated?'
choices,
message: 'Select the icon set that needs to be generated?',
},
{
type: 'input',
name: 'output',
message: 'Select the icon set that needs to be generated?',
default: 'src/components/Icon/data'
}
default: 'src/components/Icon/data',
},
])
.then(async (answers) => {
const { iconSet, output, useType } = answers
const outputDir = path.resolve(process.cwd(), output)
await fs.ensureDir(outputDir)
const genCollections = collections.filter((item) => [iconSet].includes(item.id))
const genCollections = collections.filter(item => [iconSet].includes(item.id))
const prefixSet: string[] = []
for (const info of genCollections) {
const data = await fs.readJSON(path.join(dir, 'json', `${info.id}.json`))
if (data) {
const { prefix } = data
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(
path.join(output, `icons.data.ts`),
`export default ${isLocal ? JSON.stringify(icons) : JSON.stringify({ prefix, icons })}`
path.join(output, 'icons.data.ts'),
`export default ${isLocal ? JSON.stringify(icons) : JSON.stringify({ prefix, icons })}`,
)
prefixSet.push(prefix)
}

View File

@ -2,6 +2,6 @@
* Get the configuration file variable name
* @param env
*/
export const getConfigFileName = (env: Record<string, any>) => {
export function getConfigFileName(env: Record<string, any>) {
return `__PRODUCTION__${env.VITE_GLOB_APP_SHORT_NAME || '__APP'}__CONF__`.toUpperCase().replace(/\s/g, '')
}

View File

@ -1,9 +1,9 @@
/**
* Generate additional configuration files when used for packaging. The file can be configured with some global variables, so that it can be changed directly externally without repackaging
*/
import { GLOB_CONFIG_FILE_NAME, OUTPUT_DIR } from '../constant'
import fs, { writeFileSync } from 'fs-extra'
import colors from 'picocolors'
import { GLOB_CONFIG_FILE_NAME, OUTPUT_DIR } from '../constant'
import { getEnvConfig, getRootPath } from '../utils'
import { getConfigFileName } from '../getConfigFileName'
@ -33,10 +33,11 @@ function createConfig(params: CreateConfigParams) {
fs.mkdirp(getRootPath(OUTPUT_DIR))
writeFileSync(getRootPath(`${OUTPUT_DIR}/${configFileName}`), configStr)
console.log(colors.cyan(`✨ [${pkg.name}]`) + ` - configuration file is build successfully:`)
console.log(colors.gray(OUTPUT_DIR + '/' + colors.green(configFileName)) + '\n')
} catch (error) {
console.log(colors.red('configuration file configuration file failed to package:\n' + error))
console.log(`${colors.cyan(`✨ [${pkg.name}]`)} - configuration file is build successfully:`)
console.log(`${colors.gray(`${OUTPUT_DIR}/${colors.green(configFileName)}`)}\n`)
}
catch (error) {
console.log(colors.red(`configuration file configuration file failed to package:\n${error}`))
}
}

View File

@ -1,22 +1,22 @@
// #!/usr/bin/env node
import { runBuildConfig } from './buildConf'
import colors from 'picocolors'
import pkg from '../../package.json'
import { runBuildConfig } from './buildConf'
export const runBuild = async () => {
export async function runBuild() {
try {
const argvList = process.argv.splice(2)
// Generate configuration file
if (!argvList.includes('disabled-config')) {
if (!argvList.includes('disabled-config'))
runBuildConfig()
}
console.log(`${colors.cyan(`[${pkg.name}]`)}` + ' - build successfully!')
} catch (error) {
console.log(colors.red('vite build error:\n' + error))
}
catch (error) {
console.log(colors.red(`vite build error:\n${error}`))
process.exit(1)
}
}

View File

@ -1,5 +1,5 @@
import fs from 'fs'
import path from 'path'
import fs from 'node:fs'
import path from 'node:path'
import dotenv from 'dotenv'
export function isDevFn(mode: string): boolean {
@ -25,13 +25,14 @@ export function wrapperEnv(envConf: Recordable): ViteEnv {
let realName = envConf[envName].replace(/\\n/g, '\n')
realName = realName === 'true' ? true : realName === 'false' ? false : realName
if (envName === 'VITE_PORT') {
if (envName === 'VITE_PORT')
realName = Number(realName)
}
if (envName === 'VITE_PROXY' && realName) {
try {
realName = JSON.parse(realName.replace(/'/g, '"'))
} catch (error) {
}
catch (error) {
realName = ''
}
}
@ -70,15 +71,15 @@ export function getEnvConfig(match = 'VITE_GLOB_', confFiles = getConfFiles()) {
try {
const env = dotenv.parse(fs.readFileSync(path.resolve(process.cwd(), item)))
envConfig = { ...envConfig, ...env }
} catch (e) {
}
catch (e) {
console.error(`Error in parsing ${item}`, e)
}
})
const reg = new RegExp(`^(${match})`)
Object.keys(envConfig).forEach((key) => {
if (!reg.test(key)) {
if (!reg.test(key))
Reflect.deleteProperty(envConfig, key)
}
})
return envConfig
}

View File

@ -28,7 +28,7 @@ const include = [
'ant-design-vue',
'ant-design-vue/es/style',
'ant-design-vue/es/locale/zh_CN',
'ant-design-vue/es/locale/en_US'
'ant-design-vue/es/locale/en_US',
]
const exclude = ['@iconify/json']

View File

@ -7,7 +7,7 @@ import compressPlugin from 'vite-plugin-compression'
export function configCompressPlugin(
compress: 'gzip' | 'brotli' | 'none' = 'none',
deleteOriginFile = false
deleteOriginFile = false,
): PluginOption | PluginOption[] {
const compressList = compress.split(',')
@ -17,8 +17,8 @@ export function configCompressPlugin(
plugins.push(
compressPlugin({
ext: '.gz',
deleteOriginFile
})
deleteOriginFile,
}),
)
}
@ -27,8 +27,8 @@ export function configCompressPlugin(
compressPlugin({
ext: '.br',
algorithm: 'brotliCompress',
deleteOriginFile
})
deleteOriginFile,
}),
)
}
return plugins

View File

@ -21,7 +21,7 @@ export function configHtmlPlugin(env: ViteEnv, isBuild: boolean) {
inject: {
// Inject data into ejs template
data: {
title: VITE_GLOB_APP_TITLE
title: VITE_GLOB_APP_TITLE,
},
// Embed the generated app.config.js file
tags: isBuild
@ -29,12 +29,12 @@ export function configHtmlPlugin(env: ViteEnv, isBuild: boolean) {
{
tag: 'script',
attrs: {
src: getAppConfigSrc()
}
}
src: getAppConfigSrc(),
},
},
]
: []
}
: [],
},
})
return htmlPlugin
}

View File

@ -1,9 +1,11 @@
import { PluginOption } from 'vite'
import type { PluginOption } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import progress from 'vite-plugin-progress'
import purgeIcons from 'vite-plugin-purge-icons'
import VitePluginCertificate from 'vite-plugin-mkcert'
import UnoCSS from 'unocss/vite'
import { presetTypography, presetUno } from 'unocss'
import { configPwaConfig } from './pwa'
import { configHtmlPlugin } from './html'
import { configCompressPlugin } from './compress'
@ -11,8 +13,6 @@ import { configStyleImportPlugin } from './styleImport'
import { configVisualizerConfig } from './visualizer'
import { configThemePlugin } from './theme'
import { configSvgIconsPlugin } from './svgSprite'
import UnoCSS from 'unocss/vite'
import { presetTypography, presetUno } from 'unocss'
export async function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
const { VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE } = viteEnv
@ -24,13 +24,13 @@ export async function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
vueJsx(),
// UnoCSS
UnoCSS({
presets: [presetUno(), presetTypography()]
presets: [presetUno(), presetTypography()],
}),
// 打包进度条
progress(),
VitePluginCertificate({
source: 'coding'
})
source: 'coding',
}),
]
// vite-vue-plugin-html

View File

@ -17,15 +17,15 @@ export function configPwaConfig(env: ViteEnv) {
{
src: './resource/img/pwa-192x192.png',
sizes: '192x192',
type: 'image/png'
type: 'image/png',
},
{
src: './resource/img/pwa-512x512.png',
sizes: '512x512',
type: 'image/png'
}
]
}
type: 'image/png',
},
],
},
})
return pwaPlugin
}

View File

@ -5,9 +5,9 @@
import { createStyleImportPlugin } from 'vite-plugin-style-import'
export function configStyleImportPlugin(_isBuild: boolean) {
if (!_isBuild) {
if (!_isBuild)
return []
}
const styleImportPlugin = createStyleImportPlugin({
libs: [
{
@ -44,12 +44,12 @@ export function configStyleImportPlugin(_isBuild: boolean) {
'skeleton-title',
'skeleton-paragraph',
'skeleton-image',
'skeleton-button'
'skeleton-button',
]
// 这里是需要额外引入样式的子组件列表
// 单独引入子组件时需引入组件样式,否则会在打包后导致子组件样式丢失
const replaceList = {
textarea: 'input',
'textarea': 'input',
'typography-text': 'typography',
'typography-title': 'typography',
'typography-paragraph': 'typography',
@ -66,17 +66,17 @@ export function configStyleImportPlugin(_isBuild: boolean) {
'layout-header': 'layout',
'month-picker': 'date-picker',
'range-picker': 'date-picker',
'image-preview-group': 'image'
'image-preview-group': 'image',
}
return ignoreList.includes(name)
? ''
: replaceList.hasOwnProperty(name)
? `ant-design-vue/es/${replaceList[name]}/style/index`
: `ant-design-vue/es/${name}/style/index`
}
}
]
? `ant-design-vue/es/${replaceList[name]}/style/index`
: `ant-design-vue/es/${name}/style/index`
},
},
],
})
return styleImportPlugin
}

View File

@ -3,16 +3,16 @@
* https://github.com/anncwb/vite-plugin-svg-icons
*/
import path from 'node:path'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import path from 'path'
import { PluginOption } from 'vite'
import type { PluginOption } from 'vite'
export function configSvgIconsPlugin(isBuild: boolean) {
const svgIconsPlugin = createSvgIconsPlugin({
iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
svgoOptions: isBuild,
// default
symbolId: 'icon-[dir]-[name]'
symbolId: 'icon-[dir]-[name]',
})
return svgIconsPlugin as PluginOption
}

View File

@ -2,17 +2,17 @@
* Vite plugin for website theme color switching
* https://github.com/xingyuv/vite-vue-plugin-theme
*/
import path from 'node:path'
import type { PluginOption } from 'vite'
import path from 'path'
import { viteThemePlugin, antdDarkThemePlugin, mixLighten, mixDarken, tinycolor } from 'vite-vue-plugin-theme'
import { getThemeColors, generateColors } from '../../config/themeConfig'
import { antdDarkThemePlugin, mixDarken, mixLighten, tinycolor, viteThemePlugin } from 'vite-vue-plugin-theme'
import { generateColors, getThemeColors } from '../../config/themeConfig'
import { generateModifyVars } from '../../generate/generateModifyVars'
export function configThemePlugin(isBuild: boolean): PluginOption[] {
const colors = generateColors({
mixDarken,
mixLighten,
tinycolor
tinycolor,
})
const plugin = [
viteThemePlugin({
@ -37,15 +37,15 @@ export function configThemePlugin(isBuild: boolean): PluginOption[] {
}
return s.startsWith('[data-theme') ? s : `[data-theme] ${s}`
},
colorVariables: [...getThemeColors(), ...colors]
colorVariables: [...getThemeColors(), ...colors],
}),
antdDarkThemePlugin({
preloadFiles: [
path.resolve(process.cwd(), 'node_modules/ant-design-vue/dist/antd.less'),
//path.resolve(process.cwd(), 'node_modules/ant-design-vue/dist/antd.dark.less'),
path.resolve(process.cwd(), 'src/design/index.less')
// path.resolve(process.cwd(), 'node_modules/ant-design-vue/dist/antd.dark.less'),
path.resolve(process.cwd(), 'src/design/index.less'),
],
filter: (id) => (isBuild ? !id.endsWith('antd.less') : true),
filter: id => (isBuild ? !id.endsWith('antd.less') : true),
// extractCss: false,
darkModifyVars: {
...generateModifyVars(true),
@ -74,9 +74,9 @@ export function configThemePlugin(isBuild: boolean): PluginOption[] {
'alert-warning-icon-color': '#d89614',
'alert-error-border-color': '#58181c',
'alert-error-bg-color': '#2a1215',
'alert-error-icon-color': '#a61d24'
}
})
'alert-error-icon-color': '#a61d24',
},
}),
]
return plugin as unknown as PluginOption[]

View File

@ -2,8 +2,8 @@
* Package file volume analysis
*/
import visualizer from 'rollup-plugin-visualizer'
import type { PluginOption } from 'vite'
import { isReportMode } from '../../utils'
import { PluginOption } from 'vite'
export function configVisualizerConfig() {
if (isReportMode()) {
@ -11,7 +11,7 @@ export function configVisualizerConfig() {
filename: './node_modules/.cache/visualizer/stats.html',
open: true,
gzipSize: true,
brotliSize: true
brotliSize: true,
}) as PluginOption
}
return []

View File

@ -22,12 +22,12 @@ export function createProxy(list: ProxyList = []) {
// https://github.com/http-party/node-http-proxy#options
ret[prefix] = {
target: target,
target,
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(new RegExp(`^${prefix}`), ''),
rewrite: path => path.replace(new RegExp(`^${prefix}`), ''),
// https is require secure=false
...(isHttps ? { secure: false } : {})
...(isHttps ? { secure: false } : {}),
}
}
return ret

View File

@ -1,25 +1,25 @@
const fs = require('fs')
const path = require('path')
const { execSync } = require('child_process')
const fs = require('node:fs')
const path = require('node:path')
const { execSync } = require('node:child_process')
const scopes = fs
.readdirSync(path.resolve(__dirname, 'src'), { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name.replace(/s$/, ''))
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name.replace(/s$/, ''))
// precomputed scope
const scopeComplete = execSync('git status --porcelain || true')
.toString()
.trim()
.split('\n')
.find((r) => ~r.indexOf('M src'))
.find(r => ~r.indexOf('M src'))
?.replace(/(\/)/g, '%%')
?.match(/src%%((\w|-)*)/)?.[1]
?.replace(/s$/, '')
/** @type {import('cz-git').UserConfig} */
module.exports = {
ignores: [(commit) => commit.includes('init')],
ignores: [commit => commit.includes('init')],
extends: ['@commitlint/config-conventional'],
rules: {
'body-leading-blank': [2, 'always'],
@ -31,8 +31,8 @@ module.exports = {
'type-enum': [
2,
'always',
['feat', 'fix', 'perf', 'style', 'docs', 'test', 'refactor', 'build', 'ci', 'chore', 'revert', 'wip', 'workflow', 'types', 'release']
]
['feat', 'fix', 'perf', 'style', 'docs', 'test', 'refactor', 'build', 'ci', 'chore', 'revert', 'wip', 'workflow', 'types', 'release'],
],
},
prompt: {
/** @use `yarn commit :f` */
@ -41,7 +41,7 @@ module.exports = {
r: 'docs: update README',
s: 'style: update code format',
b: 'build: bump dependencies',
c: 'chore: update config'
c: 'chore: update config',
},
customScopesAlign: !scopeComplete ? 'top' : 'bottom',
defaultScope: scopeComplete,
@ -53,7 +53,7 @@ module.exports = {
typesAppend: [
{ value: 'wip', name: 'wip: work in process' },
{ value: 'workflow', name: 'workflow: workflow improvements' },
{ value: 'types', name: 'types: type definition file changes' }
{ value: 'types', name: 'types: type definition file changes' },
],
// 中英文对照版
@ -67,7 +67,7 @@ module.exports = {
footerPrefixsSelect: '选择关联issue前缀 (可选):',
customFooterPrefixs: '输入自定义issue前缀 :',
footer: '列举关联issue (可选) 例如: #31, #I3244 :\n',
confirmCommit: '是否提交或修改commit ?'
confirmCommit: '是否提交或修改commit ?',
},
types: [
{ value: 'feat', name: 'feat: 新增功能' },
@ -83,9 +83,9 @@ module.exports = {
{ value: 'chore', name: 'chore: 对构建过程或辅助工具和库的更改 (不影响源文件、测试用例)' },
{ value: 'wip', name: 'wip: 正在开发中' },
{ value: 'workflow', name: 'workflow: 工作流程改进' },
{ value: 'types', name: 'types: 类型定义文件修改' }
{ value: 'types', name: 'types: 类型定义文件修改' },
],
emptyScopesAlias: 'empty: 不填写',
customScopesAlias: 'custom: 自定义'
}
customScopesAlias: 'custom: 自定义',
},
}

View File

@ -11,13 +11,13 @@
<body>
<script>
(() => {
var htmlRoot = document.getElementById('htmlRoot');
var theme = window.localStorage.getItem('__APP__DARK__MODE__');
let htmlRoot = document.getElementById('htmlRoot')
let theme = window.localStorage.getItem('__APP__DARK__MODE__')
if (htmlRoot && theme) {
htmlRoot.setAttribute('data-theme', theme);
theme = htmlRoot = null;
htmlRoot.setAttribute('data-theme', theme)
theme = htmlRoot = null
}
})();
})()
</script>
<div id="app">
<style>

View File

@ -1,11 +1,25 @@
{
"name": "yudao-ui-admin-vben",
"version": "1.8.0-snapshot",
"packageManager": "pnpm@8.6.0",
"author": {
"name": "xingyuv",
"email": "xingyu4j@vip.qq.com",
"url": "https://gitee.com/xingyuv"
},
"license": "MIT",
"homepage": "https://gitee.com/xingyuv",
"repository": {
"type": "git",
"url": "git+https://gitee.com/xingyuv/vue-vben-admin.git"
},
"bugs": {
"url": "https://gitee.com/xingyuv/issues"
},
"engines": {
"node": ">= 16.0.0",
"pnpm": ">=8.6.0"
},
"scripts": {
"commit": "czg",
"bootstrap": "pnpm install",
@ -20,12 +34,11 @@
"type:check": "vue-tsc --noEmit --skipLibCheck",
"preview": "pnpm build && vite preview",
"preview:dist": "vite preview",
"log": "conventional-changelog -p angular -i CHANGELOG.md -s",
"clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite",
"clean:lib": "rimraf node_modules",
"lint:eslint": "eslint --cache --max-warnings 0 \"src/**/*.{vue,ts,tsx}\" --fix",
"lint:prettier": "prettier --write \"src/**/*.{js,json,ts,tsx,css,less,scss,vue,html,md}\"",
"lint:style": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"lint:stylelint": "stylelint \"**/*.{vue,css,less,scss}\" --fix --cache --cache-location node_modules/.cache/stylelint/",
"lint:lint-staged": "lint-staged",
"npm:check": "npx npm-check-updates",
"reinstall": "rimraf pnpm-lock.yaml && rimraf package.lock.json && rimraf node_modules && pnpm bootstrap",
@ -67,6 +80,7 @@
"xlsx": "^0.18.5"
},
"devDependencies": {
"@antfu/eslint-config": "^0.39.8",
"@commitlint/cli": "^17.6.7",
"@commitlint/config-conventional": "^17.6.7",
"@iconify/json": "^2.2.95",
@ -86,16 +100,11 @@
"@vitejs/plugin-vue": "4.2.3",
"@vitejs/plugin-vue-jsx": "^3.0.1",
"@vue/compiler-sfc": "^3.3.4",
"autoprefixer": "^10.4.14",
"conventional-changelog-cli": "^3.0.0",
"cross-env": "^7.0.3",
"cz-git": "^1.7.0",
"czg": "^1.7.0",
"dotenv": "^16.3.1",
"eslint": "^8.46.0",
"eslint-config-prettier": "^8.9.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-vue": "^9.15.1",
"esno": "^0.17.0",
"fs-extra": "^11.1.1",
"husky": "^8.0.3",
@ -110,14 +119,16 @@
"rimraf": "^5.0.1",
"rollup": "^3.27.0",
"rollup-plugin-visualizer": "^5.9.2",
"unocss": "^0.54.0",
"stylelint": "^15.10.2",
"stylelint-config-recess-order": "^4.3.0",
"stylelint-config-recommended": "^13.0.0",
"stylelint-config-recommended-vue": "^1.5.0",
"stylelint-config-standard": "^34.0.0",
"stylelint-order": "^6.0.3",
"stylelint-prettier": "^4.0.2",
"terser": "^5.19.2",
"typescript": "^5.1.6",
"unocss": "^0.54.0",
"vite": "^4.4.7",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-mkcert": "^1.16.0",
@ -131,43 +142,8 @@
"vue-eslint-parser": "^9.3.1",
"vue-tsc": "^1.8.8"
},
"repository": {
"type": "git",
"url": "git+https://gitee.com/xingyuv/vue-vben-admin.git"
},
"license": "MIT",
"bugs": {
"url": "https://gitee.com/xingyuv/issues"
},
"homepage": "https://gitee.com/xingyuv",
"packageManager": "pnpm@8.6.0",
"engines": {
"node": ">= 16.0.0",
"pnpm": ">=8.6.0"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write"
],
"{!(package)*.json,*.code-snippets,.!(browserslist)*rc}": [
"prettier --write--parser json"
],
"package.json": [
"prettier --write"
],
"*.vue": [
"eslint --fix",
"prettier --write",
"stylelint --fix"
],
"*.{scss,less,styl,html}": [
"stylelint --fix",
"prettier --write"
],
"*.md": [
"prettier --write"
]
"*": "eslint --fix"
},
"config": {
"commitizen": {

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +0,0 @@
module.exports = {
// 一行代码的最大字符数默认是80
printWidth: 140,
// tab宽度为2空格
tabWidth: 2,
// 使用tab缩进默认false
useTabs: false,
// 结尾是否添加分号, 默认true
semi: false,
// vue script和style标签中是否缩进,开启可能会破坏编辑器的代码折叠
vueIndentScriptAndStyle: false,
// 使用单引号, 默认false(在jsx中配置无效, 默认都是双引号)
singleQuote: true,
// object对象中key值是否加引号 as-needed只有在需求要的情况下加引号consistent是有一个需要引号就统一加preserve是保留用户输入的引号
quoteProps: 'as-needed',
// object对象里面的key和value值和括号间的空格
bracketSpacing: true,
// 行尾逗号,默认none,可选 none|es5|all
// es5 包括es5中的数组、对象
// all 包括函数对象等所有可选
trailingComma: 'none',
// 在jsx文件中的引号需要单独设置 默认false
jsxSingleQuote: false,
// 箭头函数单个参数的情况是否省略括号默认always是总是带括号
// avoid 能省略括号的时候就省略 例如x => x
// always 总是有括号
arrowParens: 'always',
insertPragma: false,
requirePragma: false,
proseWrap: 'never',
htmlWhitespaceSensitivity: 'strict',
// endOfLine: "<lf|crlf|cr|auto>" 行尾换行符,默认是lf
endOfLine: 'auto',
// range是format执行的范围可以选执行一个文件的一部分默认的设置是整个文件
rangeStart: 0,
rangeEnd: Infinity
}

View File

@ -1,11 +1,3 @@
<template>
<ConfigProvider :locale="getAntdLocale" :component-size="componentSize">
<AppProvider>
<RouterView />
</AppProvider>
</ConfigProvider>
</template>
<script lang="ts" setup>
import { computed } from 'vue'
import { ConfigProvider } from 'ant-design-vue'
@ -15,6 +7,7 @@ import { useLocale } from '@/locales/useLocale'
import { useAppStore } from '@/store/modules/app'
import 'dayjs/locale/zh-cn'
// support Multi-language
const { getAntdLocale } = useLocale()
@ -25,3 +18,11 @@ const componentSize = computed(() => appStore.getComponentSize)
// Listening to page changes and dynamically changing site titles
useTitle()
</script>
<template>
<ConfigProvider :locale="getAntdLocale" :component-size="componentSize">
<AppProvider>
<RouterView />
</AppProvider>
</ConfigProvider>
</template>

View File

@ -1,5 +1,5 @@
import type { TentantNameVO } from './model/loginModel'
import { defHttp } from '@/utils/http/axios'
import { TentantNameVO } from './model/loginModel'
import { getRefreshToken } from '@/utils/auth'
enum Api {
@ -9,7 +9,7 @@ enum Api {
LoginOut = '/system/auth/logout',
GetUserInfo = '/system/auth/get-permission-info',
GetCaptcha = '/system/captcha/get',
CheckCaptcha = '/system/captcha/check'
CheckCaptcha = '/system/captcha/check',
}
// 刷新访问令牌
@ -38,8 +38,8 @@ export function sendSmsCode(mobile, scene) {
url: '/system/auth/send-sms-code',
data: {
mobile,
scene
}
scene,
},
})
}
@ -56,31 +56,31 @@ export function checkCaptcha(data) {
// ========== OAUTH 2.0 相关 ==========
export function getAuthorize(clientId) {
return defHttp.get({ url: '/system/oauth2/authorize?clientId=' + clientId })
return defHttp.get({ url: `/system/oauth2/authorize?clientId=${clientId}` })
}
export function authorize(responseType, clientId, redirectUri, state, autoApprove, checkedScopes, uncheckedScopes) {
// 构建 scopes
const scopes = {}
for (const scope of checkedScopes) {
for (const scope of checkedScopes)
scopes[scope] = true
}
for (const scope of uncheckedScopes) {
for (const scope of uncheckedScopes)
scopes[scope] = false
}
// 发起请求
return defHttp.post({
url: '/system/oauth2/authorize',
headers: {
'Content-type': 'application/x-www-form-urlencoded'
'Content-type': 'application/x-www-form-urlencoded',
},
params: {
response_type: responseType,
client_id: clientId,
redirect_uri: redirectUri,
state: state,
state,
auto_approve: autoApprove,
scope: JSON.stringify(scopes)
}
scope: JSON.stringify(scopes),
},
})
}

View File

@ -1,9 +1,9 @@
export type UserLoginVO = {
export interface UserLoginVO {
username: string
password: string
captchaVerification: string
}
export type TentantNameVO = {
export interface TentantNameVO {
id: number
}

View File

@ -1,4 +1,5 @@
import type { RouteMeta } from 'vue-router'
export interface RouteItem {
path: string
component: any

View File

@ -1,4 +1,4 @@
import { RouteItem } from './menuModel'
import type { RouteItem } from './menuModel'
/**
* @description: Login interface parameters

View File

@ -57,7 +57,7 @@ enum Api {
uploadAvatarApi = '/system/user/profile/update-avatar',
updateUserPwdApi = '/system/user/profile/update-password',
socialBindApi = '/system/social-user/bind',
socialUnbindApi = '/system/social-user/unbind'
socialUnbindApi = '/system/social-user/unbind',
}
/**
@ -79,9 +79,9 @@ export function updateUserPwdApi(oldPassword: string, newPassword: string) {
return defHttp.put({
url: Api.updateUserPwdApi,
data: {
oldPassword: oldPassword,
newPassword: newPassword
}
oldPassword,
newPassword,
},
})
}
@ -91,10 +91,10 @@ export function uploadAvatarApi(data) {
url: Api.uploadAvatarApi,
headers: {
'Content-type': ContentTypeEnum.FORM_DATA,
// @ts-ignore
ignoreCancelToken: true
// @ts-expect-error
'ignoreCancelToken': true,
},
data
data,
})
}
@ -105,8 +105,8 @@ export function socialBind(type, code, state) {
data: {
type,
code,
state
}
state,
},
})
}
@ -116,14 +116,14 @@ export function socialUnbind(type, openid) {
url: Api.socialUnbindApi,
data: {
type,
openid
}
openid,
},
})
}
// 社交授权的跳转
export function socialAuthRedirect(type, redirectUri) {
return defHttp.get({
url: '/system/auth/social-auth-redirect?type=' + type + '&redirectUri=' + redirectUri
url: `/system/auth/social-auth-redirect?type=${type}&redirectUri=${redirectUri}`,
})
}

View File

@ -1,8 +1,8 @@
import { UploadApiResult } from './model/uploadModel'
import type { AxiosProgressEvent } from 'axios'
import type { UploadApiResult } from './model/uploadModel'
import { defHttp } from '@/utils/http/axios'
import { UploadFileParams } from '@/types/axios'
import type { UploadFileParams } from '@/types/axios'
import { useGlobSetting } from '@/hooks/setting'
import { AxiosProgressEvent } from 'axios'
const { uploadUrl = '' } = useGlobSetting()
@ -13,8 +13,8 @@ export function uploadApi(params: UploadFileParams, onUploadProgress: (progressE
return defHttp.uploadFile<UploadApiResult>(
{
url: uploadUrl,
onUploadProgress
onUploadProgress,
},
params
params,
)
}

View File

@ -1,13 +1,13 @@
import type { GetUserInfoModel, LoginParams, LoginResultModel, SmsLoginParams } from './model/userModel'
import { defHttp } from '@/utils/http/axios'
import { LoginParams, LoginResultModel, GetUserInfoModel, SmsLoginParams } from './model/userModel'
import { ErrorMessageMode } from '@/types/axios'
import type { ErrorMessageMode } from '@/types/axios'
enum Api {
Login = '/system/auth/login',
Logout = '/system/auth/logout',
SmsLogin = '/system/auth/sms-login',
GetUserInfo = '/system/auth/get-permission-info'
GetUserInfo = '/system/auth/get-permission-info',
}
/**

View File

@ -9,5 +9,5 @@ export function getProcessDefinitionList(params) {
}
export function getProcessDefinitionBpmnXML(id) {
return defHttp.get({ url: '/bpm/process-definition/get-bpmn-xml?id=' + id })
return defHttp.get({ url: `/bpm/process-definition/get-bpmn-xml?id=${id}` })
}

View File

@ -1,6 +1,6 @@
import { defHttp } from '@/utils/http/axios'
export type FormVO = {
export interface FormVO {
id: number
name: string
conf: string
@ -22,12 +22,12 @@ export function updateForm(data: FormVO) {
// 删除工作流的表单定义
export function deleteForm(id: number) {
return defHttp.delete({ url: '/bpm/form/delete?id=' + id })
return defHttp.delete({ url: `/bpm/form/delete?id=${id}` })
}
// 获得工作流的表单定义
export function getForm(id: number) {
return defHttp.get({ url: '/bpm/form/get?id=' + id })
return defHttp.get({ url: `/bpm/form/get?id=${id}` })
}
// 获得工作流的表单定义分页

View File

@ -1,6 +1,6 @@
import { defHttp } from '@/utils/http/axios'
export type LeaveVO = {
export interface LeaveVO {
id: number
result: number
type: number
@ -18,7 +18,7 @@ export function createLeave(data: LeaveVO) {
// 获得请假申请
export function getLeave(id: number) {
return defHttp.get({ url: '/bpm/oa/leave/get?id=' + id })
return defHttp.get({ url: `/bpm/oa/leave/get?id=${id}` })
}
// 获得请假申请分页

View File

@ -1,19 +1,19 @@
import { UploadApiResult } from '@/api/base/model/uploadModel'
import type { AxiosProgressEvent } from 'axios'
import type { UploadApiResult } from '@/api/base/model/uploadModel'
import { useGlobSetting } from '@/hooks/setting'
import { UploadFileParams } from '@/types/axios'
import type { UploadFileParams } from '@/types/axios'
import { defHttp } from '@/utils/http/axios'
import { AxiosProgressEvent } from 'axios'
const { apiUrl = '' } = useGlobSetting()
export type ProcessDefinitionVO = {
export interface ProcessDefinitionVO {
id: string
version: number
deploymentTIme: string
suspensionState: number
}
export type ModelVO = {
export interface ModelVO {
id: number
formName: string
key: string
@ -35,7 +35,7 @@ export function getModelPage(params) {
}
export function getModel(id: number) {
return defHttp.get({ url: '/bpm/model/get?id=' + id })
return defHttp.get({ url: `/bpm/model/get?id=${id}` })
}
export function updateModel(data: ModelVO) {
@ -52,19 +52,19 @@ export function createModel(data: ModelVO) {
}
export function deleteModel(id: number) {
return defHttp.delete({ url: '/bpm/model/delete?id=' + id })
return defHttp.delete({ url: `/bpm/model/delete?id=${id}` })
}
export function deployModel(id: number) {
return defHttp.post({ url: '/bpm/model/deploy?id=' + id })
return defHttp.post({ url: `/bpm/model/deploy?id=${id}` })
}
export function importModel(params: UploadFileParams, onUploadProgress: (progressEvent: AxiosProgressEvent) => void) {
return defHttp.uploadFile<UploadApiResult>(
{
url: apiUrl + '/bpm/model/import',
onUploadProgress
url: `${apiUrl}/bpm/model/import`,
onUploadProgress,
},
params
params,
)
}

View File

@ -1,10 +1,10 @@
import { defHttp } from '@/utils/http/axios'
export type task = {
export interface task {
id: string
name: string
}
export type ProcessInstanceVO = {
export interface ProcessInstanceVO {
id: number
name: string
processDefinitionId: string
@ -29,12 +29,12 @@ export function createProcessInstance(data: ProcessInstanceVO) {
export function cancelProcessInstance(id: number, reason: string) {
const data = {
id: id,
reason: reason
id,
reason,
}
return defHttp.delete({ url: '/bpm/process-instance/cancel', data })
}
export function getProcessInstance(id: number) {
return defHttp.get({ url: '/bpm/process-instance/get?id=' + id })
return defHttp.get({ url: `/bpm/process-instance/get?id=${id}` })
}

View File

@ -29,6 +29,6 @@ export function updateTaskAssignee(data) {
export function getTaskListByProcessInstanceId(processInstanceId) {
return defHttp.get({
url: '/bpm/task/list-by-process-instance-id?processInstanceId=' + processInstanceId
url: `/bpm/task/list-by-process-instance-id?processInstanceId=${processInstanceId}`,
})
}

View File

@ -1,4 +1,4 @@
export type FormVO = {
export interface FormVO {
id: number
name: string
conf: string
@ -8,7 +8,7 @@ export type FormVO = {
createTime: string
}
export type TaskProcessVO = {
export interface TaskProcessVO {
id: string
name: string
startUserId: number
@ -16,7 +16,7 @@ export type TaskProcessVO = {
processDefinitionId: string
}
export type TaskTodoVO = {
export interface TaskTodoVO {
id: string
name: string
claimTime: string
@ -25,7 +25,7 @@ export type TaskTodoVO = {
processInstance: TaskProcessVO
}
export type TaskDoneVO = {
export interface TaskDoneVO {
id: string
name: string
claimTime: string

View File

@ -1,6 +1,6 @@
import { defHttp } from '@/utils/http/axios'
export type TaskAssignVO = {
export interface TaskAssignVO {
id: number
modelId: string
processDefinitionId: string

View File

@ -1,6 +1,6 @@
import { defHttp } from '@/utils/http/axios'
export type UserGroupVO = {
export interface UserGroupVO {
id: number
name: string
description: string
@ -22,12 +22,12 @@ export function updateUserGroup(data: UserGroupVO) {
// 删除用户组
export function deleteUserGroup(id: number) {
return defHttp.delete({ url: '/bpm/user-group/delete?id=' + id })
return defHttp.delete({ url: `/bpm/user-group/delete?id=${id}` })
}
// 获得用户组
export function getUserGroup(id: number) {
return defHttp.get({ url: '/bpm/user-group/get?id=' + id })
return defHttp.get({ url: `/bpm/user-group/get?id=${id}` })
}
// 获得用户组分页

View File

@ -53,7 +53,7 @@ export function getApiErrorLogPage(params: ApiErrorLogPageReqVO) {
// 更新 API 错误日志的处理状态
export function updateApiErrorLogProcess(id: number, processStatus: number) {
return defHttp.put({
url: '/infra/api-error-log/update-status?id=' + id + '&processStatus=' + processStatus
url: `/infra/api-error-log/update-status?id=${id}&processStatus=${processStatus}`,
})
}
@ -62,8 +62,8 @@ export function exportApiErrorLog(params: ApiErrorLogExportReqVO) {
return defHttp.download(
{
url: '/infra/api-error-log/export-excel',
params
params,
},
'错误日志.xls'
'错误日志.xls',
)
}

View File

@ -1,5 +1,5 @@
import type { CodegenCreateListReqVO, CodegenUpdateReqVO } from './types'
import { defHttp } from '@/utils/http/axios'
import type { CodegenUpdateReqVO, CodegenCreateListReqVO } from './types'
// 查询列表代码生成表定义
export function getCodegenTablePage(params) {
@ -8,7 +8,7 @@ export function getCodegenTablePage(params) {
// 查询详情代码生成表定义
export function getCodegenTable(id: number) {
return defHttp.get({ url: '/infra/codegen/detail?tableId=' + id })
return defHttp.get({ url: `/infra/codegen/detail?tableId=${id}` })
}
// 新增代码生成表定义
@ -23,22 +23,22 @@ export function updateCodegenTable(data: CodegenUpdateReqVO) {
// 基于数据库的表结构,同步数据库的表和字段定义
export function syncCodegenFromDB(id: number) {
return defHttp.put({ url: '/infra/codegen/sync-from-db?tableId=' + id })
return defHttp.put({ url: `/infra/codegen/sync-from-db?tableId=${id}` })
}
// 基于 SQL 建表语句,同步数据库的表和字段定义
export function syncCodegenFromSQL(id: number, sql: string) {
return defHttp.put({ url: '/infra/codegen/sync-from-sql?tableId=' + id + '&sql=' + sql })
return defHttp.put({ url: `/infra/codegen/sync-from-sql?tableId=${id}&sql=${sql}` })
}
// 预览生成代码
export function previewCodegen(id: number) {
return defHttp.get({ url: '/infra/codegen/preview?tableId=' + id })
return defHttp.get({ url: `/infra/codegen/preview?tableId=${id}` })
}
// 下载生成代码
export function downloadCodegen(data) {
return defHttp.download({ url: '/infra/codegen/download?tableId=' + data.id }, data.tableName + '.zip')
return defHttp.download({ url: `/infra/codegen/download?tableId=${data.id}` }, `${data.tableName}.zip`)
}
// 获得表定义
@ -53,5 +53,5 @@ export function createCodegenList(data) {
// 删除代码生成表定义
export function deleteCodegenTable(id: number) {
return defHttp.delete({ url: '/infra/codegen/delete?tableId=' + id })
return defHttp.delete({ url: `/infra/codegen/delete?tableId=${id}` })
}

View File

@ -1,4 +1,4 @@
export type CodegenTableVO = {
export interface CodegenTableVO {
id: number
tableId: number
isParentMenuIdValid: boolean
@ -18,7 +18,7 @@ export type CodegenTableVO = {
parentMenuId: number
}
export type CodegenColumnVO = {
export interface CodegenColumnVO {
id: number
tableId: number
columnName: string
@ -39,23 +39,23 @@ export type CodegenColumnVO = {
listOperationResult: number
htmlType: string
}
export type DatabaseTableVO = {
export interface DatabaseTableVO {
name: string
comment: string
}
export type CodegenDetailVO = {
export interface CodegenDetailVO {
table: CodegenTableVO
columns: CodegenColumnVO[]
}
export type CodegenPreviewVO = {
export interface CodegenPreviewVO {
filePath: string
code: string
}
export type CodegenUpdateReqVO = {
export interface CodegenUpdateReqVO {
table: CodegenTableVO
columns: CodegenColumnVO[]
}
export type CodegenCreateListReqVO = {
export interface CodegenCreateListReqVO {
dataSourceConfigId: number
tableNames: string[]
}

View File

@ -33,12 +33,12 @@ export function getConfigPage(params: ConfigPageReqVO) {
// 查询参数详情
export function getConfig(id: number) {
return defHttp.get({ url: '/infra/config/get?id=' + id })
return defHttp.get({ url: `/infra/config/get?id=${id}` })
}
// 根据参数键名查询参数值
export function getConfigKey(configKey: string) {
return defHttp.get({ url: '/infra/config/get-value-by-key?key=' + configKey })
return defHttp.get({ url: `/infra/config/get-value-by-key?key=${configKey}` })
}
// 新增参数
@ -53,7 +53,7 @@ export function updateConfig(data: ConfigVO) {
// 删除参数
export function deleteConfig(id: number) {
return defHttp.delete({ url: '/infra/config/delete?id=' + id })
return defHttp.delete({ url: `/infra/config/delete?id=${id}` })
}
// 导出参数

View File

@ -16,7 +16,7 @@ export function getDataSourceConfigList() {
// 查询数据源配置详情
export function getDataSourceConfig(id: number) {
return defHttp.get({ url: '/infra/data-source-config/get?id=' + id })
return defHttp.get({ url: `/infra/data-source-config/get?id=${id}` })
}
// 新增数据源配置
@ -31,5 +31,5 @@ export function updateDataSourceConfig(data: DataSourceConfigVO) {
// 删除数据源配置
export function deleteDataSourceConfig(id: number) {
return defHttp.delete({ url: '/infra/data-source-config/delete?id=' + id })
return defHttp.delete({ url: `/infra/data-source-config/delete?id=${id}` })
}

View File

@ -24,5 +24,5 @@ export function getFilePage(params: FilePageReqVO) {
// 删除文件
export function deleteFile(id: number) {
return defHttp.delete({ url: '/infra/file/delete?id=' + id })
return defHttp.delete({ url: `/infra/file/delete?id=${id}` })
}

View File

@ -37,12 +37,12 @@ export function getFileConfigPage(params: FileConfigPageReqVO) {
// 查询文件配置详情
export function getFileConfig(id: number) {
return defHttp.get({ url: '/infra/file-config/get?id=' + id })
return defHttp.get({ url: `/infra/file-config/get?id=${id}` })
}
// 更新文件配置为主配置
export function updateFileConfigMaster(id: number) {
return defHttp.put({ url: '/infra/file-config/update-master?id=' + id })
return defHttp.put({ url: `/infra/file-config/update-master?id=${id}` })
}
// 新增文件配置
@ -57,10 +57,10 @@ export function updateFileConfig(data: FileConfigVO) {
// 删除文件配置
export function deleteFileConfig(id: number) {
return defHttp.delete({ url: '/infra/file-config/delete?id=' + id })
return defHttp.delete({ url: `/infra/file-config/delete?id=${id}` })
}
// 测试文件配置
export function testFileConfig(id: number) {
return defHttp.get({ url: '/infra/file-config/test?id=' + id })
return defHttp.get({ url: `/infra/file-config/test?id=${id}` })
}

View File

@ -32,7 +32,7 @@ export function getJobPage(params: JobPageReqVO) {
// 任务详情
export function getJob(id: number) {
return defHttp.get({ url: '/infra/job/get?id=' + id })
return defHttp.get({ url: `/infra/job/get?id=${id}` })
}
// 新增任务
@ -47,7 +47,7 @@ export function updateJob(data: JobVO) {
// 删除定时任务调度
export function deleteJob(id: number) {
return defHttp.delete({ url: '/infra/job/delete?id=' + id })
return defHttp.delete({ url: `/infra/job/delete?id=${id}` })
}
// 导出定时任务调度
@ -59,17 +59,17 @@ export function exportJob(params: JobExportReqVO) {
export function updateJobStatus(id: number, status: number) {
const params = {
id,
status
status,
}
return defHttp.put({ url: '/infra/job/update-status', params })
}
// 定时任务立即执行一次
export function runJob(id: number) {
return defHttp.put({ url: '/infra/job/trigger?id=' + id })
return defHttp.put({ url: `/infra/job/trigger?id=${id}` })
}
// 获得定时任务的下 n 次执行时间
export function getJobNextTimes(id: number) {
return defHttp.get({ url: '/infra/job/get_next_times?id=' + id })
return defHttp.get({ url: `/infra/job/get_next_times?id=${id}` })
}

View File

@ -37,7 +37,7 @@ export function getJobLogPage(params: JobLogPageReqVO) {
// 任务日志详情
export function getJobLog(id: number) {
return defHttp.get({ url: '/infra/job-log/get?id=' + id })
return defHttp.get({ url: `/infra/job-log/get?id=${id}` })
}
// 导出定时任务日志

View File

@ -17,25 +17,25 @@ export function getKeyList(keyTemplate: string) {
return defHttp.get({
url: '/infra/redis/get-key-list',
params: {
keyTemplate
}
keyTemplate,
},
})
}
// 获取缓存内容
export function getKeyValue(key: string) {
return defHttp.get({ url: '/infra/redis/get-key-value?key=' + key })
return defHttp.get({ url: `/infra/redis/get-key-value?key=${key}` })
}
// 根据键名删除缓存
export function deleteKey(key: string) {
return defHttp.delete({ url: '/infra/redis/delete-key?key=' + key })
return defHttp.delete({ url: `/infra/redis/delete-key?key=${key}` })
}
export function deleteKeys(keyTemplate: string) {
return defHttp.delete({
url: '/infra/redis/delete-keys?',
params: {
keyTemplate
}
keyTemplate,
},
})
}

View File

@ -17,12 +17,12 @@ export function updateAccount(data) {
// 删除公众号账号
export function deleteAccount(id) {
return defHttp.delete({ url: '/mp/account/delete?id=' + id, method: 'delete' })
return defHttp.delete({ url: `/mp/account/delete?id=${id}`, method: 'delete' })
}
// 获得公众号账号
export function getAccount(id) {
return defHttp.get({ url: '/mp/account/get?id=' + id })
return defHttp.get({ url: `/mp/account/get?id=${id}` })
}
// 获得公众号账号分页
@ -37,10 +37,10 @@ export function getSimpleAccounts() {
// 生成公众号二维码
export function generateAccountQrCode(id) {
return defHttp.put({ url: '/mp/account/generate-qr-code?id=' + id })
return defHttp.put({ url: `/mp/account/generate-qr-code?id=${id}` })
}
// 清空公众号 API 配额
export function clearAccountQuota(id) {
return defHttp.put({ url: '/mp/account/clear-quota?id=' + id })
return defHttp.put({ url: `/mp/account/clear-quota?id=${id}` })
}

View File

@ -12,12 +12,12 @@ export function updateAutoReply(data) {
// 删除公众号的自动回复
export function deleteAutoReply(id) {
return defHttp.delete({ url: '/mp/auto-reply/delete?id=' + id })
return defHttp.delete({ url: `/mp/auto-reply/delete?id=${id}` })
}
// 获得公众号的自动回复
export function getAutoReply(id) {
return defHttp.get({ url: '/mp/auto-reply/get?id=' + id })
return defHttp.get({ url: `/mp/auto-reply/get?id=${id}` })
}
// 获得公众号的自动回复分页

View File

@ -8,19 +8,19 @@ export function getDraftPage(params) {
// 创建公众号草稿
export function createDraft(accountId, articles) {
return defHttp.post({
url: '/mp/draft/create?accountId=' + accountId,
url: `/mp/draft/create?accountId=${accountId}`,
data: {
articles
}
articles,
},
})
}
// 更新公众号草稿
export function updateDraft(accountId, mediaId, articles) {
return defHttp.put({ url: '/mp/draft/update?accountId=' + accountId + '&mediaId=' + mediaId, data: articles })
return defHttp.put({ url: `/mp/draft/update?accountId=${accountId}&mediaId=${mediaId}`, data: articles })
}
// 删除公众号草稿
export function deleteDraft(accountId, mediaId) {
return defHttp.delete({ url: '/mp/draft/delete?accountId=' + accountId + '&mediaId=' + mediaId })
return defHttp.delete({ url: `/mp/draft/delete?accountId=${accountId}&mediaId=${mediaId}` })
}

View File

@ -7,10 +7,10 @@ export function getFreePublishPage(params) {
// 删除公众号素材
export function deleteFreePublish(accountId, articleId) {
return defHttp.delete({ url: '/mp/free-publish/delete?accountId=' + accountId + '&&articleId=' + articleId })
return defHttp.delete({ url: `/mp/free-publish/delete?accountId=${accountId}&&articleId=${articleId}` })
}
// 发布公众号素材
export function submitFreePublish(accountId, mediaId) {
return defHttp.post({ url: '/mp/free-publish/submit?accountId=' + accountId + '&&mediaId=' + mediaId })
return defHttp.post({ url: `/mp/free-publish/submit?accountId=${accountId}&&mediaId=${mediaId}` })
}

View File

@ -7,5 +7,5 @@ export function getMaterialPage(params) {
// 删除公众号永久素材
export function deletePermanentMaterial(id) {
return defHttp.delete({ url: '/mp/material/delete-permanent?id=' + id })
return defHttp.delete({ url: `/mp/material/delete-permanent?id=${id}` })
}

View File

@ -2,7 +2,7 @@ import { defHttp } from '@/utils/http/axios'
// 获得公众号菜单列表
export function getMenuList(accountId) {
return defHttp.get({ url: '/mp/menu/list?accountId=' + accountId })
return defHttp.get({ url: `/mp/menu/list?accountId=${accountId}` })
}
// 保存公众号菜单
@ -11,12 +11,12 @@ export function saveMenu(accountId, menus) {
url: '/mp/menu/save',
data: {
accountId,
menus
}
menus,
},
})
}
// 删除公众号菜单
export function deleteMenu(accountId) {
return defHttp.delete({ url: '/mp/menu/delete?accountId=' + accountId })
return defHttp.delete({ url: `/mp/menu/delete?accountId=${accountId}` })
}

View File

@ -7,7 +7,7 @@ export function updateUser(data) {
// 获得公众号粉丝
export function getUser(id) {
return defHttp.get({ url: '/mp/user/get?id=' + id })
return defHttp.get({ url: `/mp/user/get?id=${id}` })
}
// 获得公众号粉丝分页
@ -17,5 +17,5 @@ export function getUserPage(params) {
// 同步公众号粉丝
export function syncUser(accountId) {
return defHttp.post({ url: '/mp/user/sync?accountId=' + accountId })
return defHttp.post({ url: `/mp/user/sync?accountId=${accountId}` })
}

View File

@ -12,12 +12,12 @@ export function updateTag(data) {
// 删除公众号标签
export function deleteTag(id) {
return defHttp.delete({ url: '/mp/tag/delete?id=' + id })
return defHttp.delete({ url: `/mp/tag/delete?id=${id}` })
}
// 获得公众号标签
export function getTag(id) {
return defHttp.get({ url: '/mp/tag/get?id=' + id })
return defHttp.get({ url: `/mp/tag/get?id=${id}` })
}
// 获得公众号标签分页
@ -32,5 +32,5 @@ export function getSimpleTags() {
// 同步公众号标签
export function syncTag(accountId) {
return defHttp.post({ url: '/mp/tag/sync?accountId=' + accountId })
return defHttp.post({ url: `/mp/tag/sync?accountId=${accountId}` })
}

View File

@ -44,7 +44,7 @@ export function getAppPage(params: AppPageReqVO) {
// 查询详情支付应用
export function getApp(id: number) {
return defHttp.get({ url: '/pay/app/get?id=' + id })
return defHttp.get({ url: `/pay/app/get?id=${id}` })
}
// 新增支付应用
@ -64,7 +64,7 @@ export function changeAppStatus(data: AppUpdateStatusReqVO) {
// 删除支付应用
export function deleteApp(id: number) {
return defHttp.delete({ url: '/pay/app/delete?id=' + id })
return defHttp.delete({ url: `/pay/app/delete?id=${id}` })
}
// 导出支付应用
@ -74,5 +74,5 @@ export function exportApp(params: AppExportReqVO) {
// 根据商ID称搜索应用列表
export function getAppListByMerchantId(merchantId: number) {
return defHttp.get({ url: '/pay/app/list-merchant-id', params: { merchantId: merchantId } })
return defHttp.get({ url: '/pay/app/list-merchant-id', params: { merchantId } })
}

View File

@ -42,11 +42,11 @@ export function getChannelPage(params: ChannelPageReqVO) {
// 查询详情支付渠道
export function getChannel(merchantId: number, appId: string, code: string) {
const params = {
merchantId: merchantId,
appId: appId,
code: code
merchantId,
appId,
code,
}
return defHttp.get({ url: '/pay/channel/get-channel', params: params })
return defHttp.get({ url: '/pay/channel/get-channel', params })
}
// 新增支付渠道
@ -61,7 +61,7 @@ export function updateChannel(data: ChannelVO) {
// 删除支付渠道
export function deleteChannel(id: number) {
return defHttp.delete({ url: '/pay/channel/delete?id=' + id })
return defHttp.delete({ url: `/pay/channel/delete?id=${id}` })
}
// 导出支付渠道

View File

@ -7,7 +7,7 @@ export function getDemoOrderPage(params) {
// 获得示例订单
export function getDemoOrder(id: number) {
return defHttp.get({ url: '/pay/demo-order/get?id=' + id })
return defHttp.get({ url: `/pay/demo-order/get?id=${id}` })
}
// 创建示例订单
@ -17,5 +17,5 @@ export function createDemoOrder(data) {
// 退款示例订单
export function refundDemoOrder(id: number) {
return defHttp.put({ url: '/pay/demo-order/refund?id=' + id })
return defHttp.put({ url: `/pay/demo-order/refund?id=${id}` })
}

View File

@ -35,7 +35,7 @@ export function getMerchantPage(params: MerchantPageReqVO) {
// 查询详情支付商户
export function getMerchant(id: number) {
return defHttp.get({ url: '/pay/merchant/get?id=' + id })
return defHttp.get({ url: `/pay/merchant/get?id=${id}` })
}
// 根据商户名称搜索商户列表
@ -43,8 +43,8 @@ export function getMerchantListByName(name: string) {
return defHttp.get({
url: '/pay/merchant/list-by-name?id=',
params: {
name: name
}
name,
},
})
}
@ -60,7 +60,7 @@ export function updateMerchant(data: MerchantVO) {
// 删除支付商户
export function deleteMerchant(id: number) {
return defHttp.delete({ url: '/pay/merchant/delete?id=' + id })
return defHttp.delete({ url: `/pay/merchant/delete?id=${id}` })
}
// 导出支付商户
@ -71,7 +71,7 @@ export function exportMerchant(params: MerchantExportReqVO) {
export function changeMerchantStatus(id: number, status: number) {
const data = {
id,
status
status,
}
return defHttp.put({ url: '/pay/merchant/update-status', data })
}

View File

@ -85,12 +85,12 @@ export function getOrderPage(params: OrderPageReqVO) {
// 查询详情支付订单
export function getOrder(id: number) {
return defHttp.get({ url: '/pay/order/get?id=' + id })
return defHttp.get({ url: `/pay/order/get?id=${id}` })
}
// 查询详情支付订单
export function getOrderDetail(id: number) {
return defHttp.get({ url: '/pay/order/get-detail?id=' + id })
return defHttp.get({ url: `/pay/order/get-detail?id=${id}` })
}
// 新增支付订单
@ -105,7 +105,7 @@ export function updateOrder(data: OrderVO) {
// 删除支付订单
export function deleteOrder(id: number) {
return defHttp.delete({ url: '/pay/order/delete?id=' + id })
return defHttp.delete({ url: `/pay/order/delete?id=${id}` })
}
// 导出支付订单

View File

@ -92,7 +92,7 @@ export function getRefundPage(params: RefundPageReqVO) {
// 查询详情退款订单
export function getRefund(id: number) {
return defHttp.get({ url: '/pay/refund/get?id=' + id })
return defHttp.get({ url: `/pay/refund/get?id=${id}` })
}
// 新增退款订单
@ -107,7 +107,7 @@ export function updateRefund(data: RefundVO) {
// 删除退款订单
export function deleteRefund(id: number) {
return defHttp.delete({ url: '/pay/refund/delete?id=' + id })
return defHttp.delete({ url: `/pay/refund/delete?id=${id}` })
}
// 导出退款订单

View File

@ -7,5 +7,5 @@ export function getAreaTree() {
// 获得 IP 对应的地区名
export function getAreaByIp(ip: string) {
return defHttp.get({ url: '/system/area/get-by-ip?ip=' + ip })
return defHttp.get({ url: `/system/area/get-by-ip?ip=${ip}` })
}

View File

@ -29,7 +29,7 @@ export function getDeptPage(params: DeptPageReqVO) {
// 查询部门详情
export function getDept(id: number) {
return defHttp.get({ url: '/system/dept/get?id=' + id })
return defHttp.get({ url: `/system/dept/get?id=${id}` })
}
// 新增部门
@ -44,5 +44,5 @@ export function updateDept(params: DeptVO) {
// 删除部门
export function deleteDept(id: number) {
return defHttp.delete({ url: '/system/dept/delete?id=' + id })
return defHttp.delete({ url: `/system/dept/delete?id=${id}` })
}

View File

@ -1,5 +1,5 @@
import type { DictDataExportReqVO, DictDataPageReqVO, DictDataVO } from './types'
import { defHttp } from '@/utils/http/axios'
import type { DictDataVO, DictDataPageReqVO, DictDataExportReqVO } from './types'
// 查询字典数据(精简)列表
export function listSimpleDictData() {
@ -13,7 +13,7 @@ export function getDictDataPage(params: DictDataPageReqVO) {
// 查询字典数据详情
export function getDictData(id: number) {
return defHttp.get({ url: '/system/dict-data/get?id=' + id })
return defHttp.get({ url: `/system/dict-data/get?id=${id}` })
}
// 新增字典数据
@ -28,7 +28,7 @@ export function updateDictData(data: DictDataVO) {
// 删除字典数据
export function deleteDictData(id: number) {
return defHttp.delete({ url: '/system/dict-data/delete?id=' + id })
return defHttp.delete({ url: `/system/dict-data/delete?id=${id}` })
}
// 导出字典类型数据
export function exportDictData(params: DictDataExportReqVO) {

View File

@ -1,5 +1,5 @@
import type { DictTypeExportReqVO, DictTypePageReqVO, DictTypeVO } from './types'
import { defHttp } from '@/utils/http/axios'
import type { DictTypeVO, DictTypePageReqVO, DictTypeExportReqVO } from './types'
// 查询字典(精简)列表
export function listSimpleDictType() {
@ -13,7 +13,7 @@ export function getDictTypePage(params: DictTypePageReqVO) {
// 查询字典详情
export function getDictType(id: number) {
return defHttp.get({ url: '/system/dict-type/get?id=' + id })
return defHttp.get({ url: `/system/dict-type/get?id=${id}` })
}
// 新增字典
@ -28,7 +28,7 @@ export function updateDictType(data: DictTypeVO) {
// 删除字典
export function deleteDictType(id: number) {
return defHttp.delete({ url: '/system/dict-type/delete?id=' + id })
return defHttp.delete({ url: `/system/dict-type/delete?id=${id}` })
}
// 导出字典类型
export function exportDictType(params: DictTypeExportReqVO) {

View File

@ -1,4 +1,4 @@
export type DictTypeVO = {
export interface DictTypeVO {
id: number
name: string
type: string
@ -7,21 +7,21 @@ export type DictTypeVO = {
createTime: Date
}
export type DictTypePageReqVO = {
export interface DictTypePageReqVO {
name: string
type: string
status: number
createTime: Date[]
}
export type DictTypeExportReqVO = {
export interface DictTypeExportReqVO {
name: string
type: string
status: number
createTime: Date[]
}
export type DictDataVO = {
export interface DictDataVO {
id: number
sort: number
label: string
@ -33,13 +33,13 @@ export type DictDataVO = {
remark: string
createTime: Date
}
export type DictDataPageReqVO = {
export interface DictDataPageReqVO {
label: string
dictType: string
status: number
}
export type DictDataExportReqVO = {
export interface DictDataExportReqVO {
label: string
dictType: string
status: number

View File

@ -25,7 +25,7 @@ export function getErrorCodePage(params: ErrorCodePageReqVO) {
// 查询错误码详情
export function getErrorCode(id: number) {
return defHttp.get({ url: '/system/error-code/get?id=' + id })
return defHttp.get({ url: `/system/error-code/get?id=${id}` })
}
// 新增错误码
@ -40,7 +40,7 @@ export function updateErrorCode(data: ErrorCodeVO) {
// 删除错误码
export function deleteErrorCode(id: number) {
return defHttp.delete({ url: '/system/error-code/delete?id=' + id })
return defHttp.delete({ url: `/system/error-code/delete?id=${id}` })
}
// 导出错误码

View File

@ -12,12 +12,12 @@ export function updateMailAccount(data) {
// 删除邮箱账号
export function deleteMailAccount(id: number) {
return defHttp.delete({ url: '/system/mail-account/delete?id=' + id })
return defHttp.delete({ url: `/system/mail-account/delete?id=${id}` })
}
// 获得邮箱账号
export function getMailAccount(id: number) {
return defHttp.get({ url: '/system/mail-account/get?id=' + id })
return defHttp.get({ url: `/system/mail-account/get?id=${id}` })
}
// 获得邮箱账号分页

View File

@ -2,7 +2,7 @@ import { defHttp } from '@/utils/http/axios'
// 获得邮件日志
export function getMailLog(id: number) {
return defHttp.get({ url: '/system/mail-log/get?id=' + id })
return defHttp.get({ url: `/system/mail-log/get?id=${id}` })
}
// 获得邮件日志分页

View File

@ -12,12 +12,12 @@ export function updateMailTemplate(data) {
// 删除邮件模版
export function deleteMailTemplate(id: number) {
return defHttp.delete({ url: '/system/mail-template/delete?id=' + id })
return defHttp.delete({ url: `/system/mail-template/delete?id=${id}` })
}
// 获得邮件模版
export function getMailTemplate(id: number) {
return defHttp.get({ url: '/system/mail-template/get?id=' + id })
return defHttp.get({ url: `/system/mail-template/get?id=${id}` })
}
// 获得邮件模版分页
@ -26,7 +26,7 @@ export function getMailTemplatePage(params) {
}
// 邮件模板
export type MailTemplate = {
export interface MailTemplate {
name: string // 标题
code: string // 编码
accountId: number
@ -40,7 +40,7 @@ export type MailTemplate = {
createTime: number
}
export type SendMailParams = {
export interface SendMailParams {
mail: string
templateCode: string
templateParams: {

View File

@ -33,7 +33,7 @@ export function getMenuList(params: MenuPageReqVO) {
// 获取菜单详情
export function getMenu(id: number) {
return defHttp.get({ url: '/system/menu/get?id=' + id })
return defHttp.get({ url: `/system/menu/get?id=${id}` })
}
// 新增菜单
@ -48,5 +48,5 @@ export function updateMenu(data: MenuVO) {
// 删除菜单
export function deleteMenu(id: number) {
return defHttp.delete({ url: '/system/menu/delete?id=' + id })
return defHttp.delete({ url: `/system/menu/delete?id=${id}` })
}

View File

@ -23,7 +23,7 @@ export function getNoticePage(params: NoticePageReqVO) {
// 查询公告详情
export function getNotice(id: number) {
return defHttp.get({ url: '/system/notice/get?id=' + id })
return defHttp.get({ url: `/system/notice/get?id=${id}` })
}
// 新增公告
@ -38,5 +38,5 @@ export function updateNotice(data: NoticeVO) {
// 删除公告
export function deleteNotice(id: number) {
return defHttp.delete({ url: '/system/notice/delete?id=' + id })
return defHttp.delete({ url: `/system/notice/delete?id=${id}` })
}

View File

@ -1,5 +1,5 @@
import { defHttp } from '@/utils/http/axios'
import qs from 'qs'
import { defHttp } from '@/utils/http/axios'
// 获得站内信分页
export function getNotifyMessagePage(params) {
@ -13,7 +13,7 @@ export function getMyNotifyMessagePage(params) {
// 批量标记已读
export function updateNotifyMessageRead(ids: number[]) {
return defHttp.put({ url: '/system/notify-message/update-read?' + qs.stringify({ ids: ids }, { indices: false }) })
return defHttp.put({ url: `/system/notify-message/update-read?${qs.stringify({ ids }, { indices: false })}` })
}
// 标记所有站内信为已读

View File

@ -12,12 +12,12 @@ export function updateNotifyTemplate(data) {
// 删除站内信模板
export function deleteNotifyTemplate(id: number) {
return defHttp.delete({ url: '/system/notify-template/delete?id=' + id })
return defHttp.delete({ url: `/system/notify-template/delete?id=${id}` })
}
// 获得站内信模板
export function getNotifyTemplate(id: number) {
return defHttp.get({ url: '/system/notify-template/get?id=' + id })
return defHttp.get({ url: `/system/notify-template/get?id=${id}` })
}
// 获得站内信模板分页
@ -35,7 +35,7 @@ export function exportNotifyTemplateExcel(params) {
return defHttp.download({ url: '/system/notify-template/export-excel', params }, '导出站内信模板.xls')
}
export type SendNotifyParam = {
export interface SendNotifyParam {
userId: number
templateCode: string
templateParams: {
@ -43,7 +43,7 @@ export type SendNotifyParam = {
}
}
export type NotifyTemplate = {
export interface NotifyTemplate {
name: string
code: string
type: number

View File

@ -32,7 +32,7 @@ export function getOAuth2ClientPage(params: OAuth2ClientPageReqVO) {
// 查询 OAuth2详情
export function getOAuth2Client(id: number) {
return defHttp.get({ url: '/system/oauth2-client/get?id=' + id })
return defHttp.get({ url: `/system/oauth2-client/get?id=${id}` })
}
// 新增 OAuth2
@ -47,5 +47,5 @@ export function updateOAuth2Client(data: OAuth2ClientVO) {
// 删除 OAuth2
export function deleteOAuth2Client(id: number) {
return defHttp.delete({ url: '/system/oauth2-client/delete?id=' + id })
return defHttp.delete({ url: `/system/oauth2-client/delete?id=${id}` })
}

View File

@ -24,5 +24,5 @@ export function getAccessTokenPage(params: OAuth2TokenPageReqVO) {
// 删除 token
export function deleteAccessToken(accessToken: number) {
return defHttp.delete({ url: '/system/oauth2-token/delete?accessToken=' + accessToken })
return defHttp.delete({ url: `/system/oauth2-token/delete?accessToken=${accessToken}` })
}

View File

@ -9,7 +9,7 @@ export interface OperateLogVO {
name: string
type: number
content: string
exts: Map<String, Object>
exts: Map<string, Object>
defHttpMethod: string
defHttpUrl: string
userIp: string

View File

@ -18,7 +18,7 @@ export interface PermissionAssignRoleDataScopeReqVO {
// 查询角色拥有的菜单权限
export function listRoleMenus(roleId: number) {
return defHttp.get({ url: '/system/permission/list-role-resources?roleId=' + roleId })
return defHttp.get({ url: `/system/permission/list-role-resources?roleId=${roleId}` })
}
// 赋予角色菜单权限
@ -33,7 +33,7 @@ export function assignRoleDataScope(data: PermissionAssignRoleDataScopeReqVO) {
// 查询用户拥有的角色数组
export function listUserRoles(userId: number) {
return defHttp.get({ url: '/system/permission/list-user-roles?userId=' + userId })
return defHttp.get({ url: `/system/permission/list-user-roles?userId=${userId}` })
}
// 赋予用户角色

View File

@ -34,7 +34,7 @@ export function listSimplePosts() {
// 查询岗位详情
export function getPost(id: number) {
return defHttp.get({ url: '/system/post/get?id=' + id })
return defHttp.get({ url: `/system/post/get?id=${id}` })
}
// 新增岗位
@ -49,7 +49,7 @@ export function updatePost(data: PostVO) {
// 删除岗位
export function deletePost(id: number) {
return defHttp.delete({ url: '/system/post/delete?id=' + id })
return defHttp.delete({ url: `/system/post/delete?id=${id}` })
}
// 导出岗位

View File

@ -41,7 +41,7 @@ export function listSimpleRoles() {
// 查询角色详情
export function getRole(id: number) {
return defHttp.get({ url: '/system/role/get?id=' + id })
return defHttp.get({ url: `/system/role/get?id=${id}` })
}
// 新增角色
@ -61,7 +61,7 @@ export function updateRoleStatus(data: UpdateStatusReqVO) {
// 删除角色
export function deleteRole(id: number) {
return defHttp.delete({ url: '/system/role/delete?id=' + id })
return defHttp.delete({ url: `/system/role/delete?id=${id}` })
}
// 导出角色

View File

@ -30,7 +30,7 @@ export function getSensitiveWordPage(params: SensitiveWordPageReqVO) {
// 查询敏感词详情
export function getSensitiveWord(id: number) {
return defHttp.get({ url: '/system/sensitive-word/get?id=' + id })
return defHttp.get({ url: `/system/sensitive-word/get?id=${id}` })
}
// 新增敏感词
@ -45,7 +45,7 @@ export function updateSensitiveWord(data: SensitiveWordVO) {
// 删除敏感词
export function deleteSensitiveWord(id: number) {
return defHttp.delete({ url: '/system/sensitive-word/delete?id=' + id })
return defHttp.delete({ url: `/system/sensitive-word/delete?id=${id}` })
}
// 导出敏感词
@ -60,5 +60,5 @@ export function getSensitiveWordTags() {
// 获得文本所包含的不合法的敏感词数组
export function validateText(id: number) {
return defHttp.get({ url: '/system/sensitive-word/validate-text?' + id })
return defHttp.get({ url: `/system/sensitive-word/validate-text?${id}` })
}

View File

@ -31,7 +31,7 @@ export function getSimpleSmsChannels() {
// 查询短信渠道详情
export function getSmsChannel(id: number) {
return defHttp.get({ url: '/system/sms-channel/get?id=' + id })
return defHttp.get({ url: `/system/sms-channel/get?id=${id}` })
}
// 新增短信渠道
@ -46,5 +46,5 @@ export function updateSmsChannel(data: SmsChannelVO) {
// 删除短信渠道
export function deleteSmsChannel(id: number) {
return defHttp.delete({ url: '/system/sms-channel/delete?id=' + id })
return defHttp.delete({ url: `/system/sms-channel/delete?id=${id}` })
}

View File

@ -50,7 +50,7 @@ export function getSmsTemplatePage(params: SmsTemplatePageReqVO) {
// 查询短信模板详情
export function getSmsTemplate(id: number) {
return defHttp.get({ url: '/system/sms-template/get?id=' + id })
return defHttp.get({ url: `/system/sms-template/get?id=${id}` })
}
// 新增短信模板
@ -65,11 +65,11 @@ export function updateSmsTemplate(data: SmsTemplateVO) {
// 删除短信模板
export function deleteSmsTemplate(id: number) {
return defHttp.delete({ url: '/system/sms-template/delete?id=' + id })
return defHttp.delete({ url: `/system/sms-template/delete?id=${id}` })
}
// 邮件模板
export type SmsTemplate = {
export interface SmsTemplate {
name: string // 标题
code: string // 编码
accountId: number

View File

@ -38,7 +38,7 @@ export function getTenantPage(params: TenantPageReqVO) {
// 查询租户详情
export function getTenant(id: number) {
return defHttp.get({ url: '/system/tenant/get?id=' + id })
return defHttp.get({ url: `/system/tenant/get?id=${id}` })
}
// 新增租户
@ -53,7 +53,7 @@ export function updateTenant(data: TenantVO) {
// 删除租户
export function deleteTenant(id: number) {
return defHttp.delete({ url: '/system/tenant/delete?id=' + id })
return defHttp.delete({ url: `/system/tenant/delete?id=${id}` })
}
// 导出租户

View File

@ -26,7 +26,7 @@ export function getTenantPackagePage(params: TenantPackagePageReqVO) {
// 获得租户
export function getTenantPackage(id: number) {
return defHttp.get({ url: '/system/tenant-package/get?id=' + id })
return defHttp.get({ url: `/system/tenant-package/get?id=${id}` })
}
// 新增租户套餐
@ -41,7 +41,7 @@ export function updateTenantPackage(data: TenantPackageVO) {
// 删除租户套餐
export function deleteTenantPackage(id: number) {
return defHttp.delete({ url: '/system/tenant-package/delete?id=' + id })
return defHttp.delete({ url: `/system/tenant-package/delete?id=${id}` })
}
// 获取租户套餐精简信息列表
export function getTenantPackageList() {

View File

@ -39,7 +39,7 @@ export function getUserPage(params: UserPageReqVO) {
// 查询用户详情
export function getUser(id: number) {
return defHttp.get({ url: '/system/user/get?id=' + id })
return defHttp.get({ url: `/system/user/get?id=${id}` })
}
// 新增用户
@ -54,7 +54,7 @@ export function updateUser(data: UserVO) {
// 删除用户
export function deleteUser(id: number) {
return defHttp.delete({ url: '/system/user/delete?id=' + id })
return defHttp.delete({ url: `/system/user/delete?id=${id}` })
}
// 导出用户
@ -71,7 +71,7 @@ export function importUserTemplate() {
export function resetUserPwd(id: number, password: string) {
const data = {
id,
password
password,
}
return defHttp.put({ url: '/system/user/update-password', data })
}
@ -80,7 +80,7 @@ export function resetUserPwd(id: number, password: string) {
export function updateUserStatus(id: number, status: number) {
const data = {
id,
status
status,
}
return defHttp.put({ url: '/system/user/update-status', data })
}

View File

@ -1,11 +1,10 @@
import { withInstall } from '@/utils'
import appLogo from './src/AppLogo.vue'
import appProvider from './src/AppProvider.vue'
import appSearch from './src/search/AppSearch.vue'
import appSizePicker from './src/AppSizePicker.vue'
import appLocalePicker from './src/AppLocalePicker.vue'
import appDarkModeToggle from './src/AppDarkModeToggle.vue'
import { withInstall } from '@/utils'
export { useAppProviderContext } from './src/useAppContext'

View File

@ -1,10 +1,3 @@
<template>
<div v-if="getShowDarkModeToggle" :class="getClass" @click="toggleDarkMode">
<div :class="`${prefixCls}-inner`"></div>
<SvgIcon size="14" name="sun" />
<SvgIcon size="14" name="moon" />
</div>
</template>
<script lang="ts" setup>
import { computed, unref } from 'vue'
import { SvgIcon } from '@/components/Icon'
@ -22,8 +15,8 @@ const isDark = computed(() => getDarkMode.value === ThemeEnum.DARK)
const getClass = computed(() => [
prefixCls,
{
[`${prefixCls}--dark`]: unref(isDark)
}
[`${prefixCls}--dark`]: unref(isDark),
},
])
function toggleDarkMode() {
@ -34,6 +27,15 @@ function toggleDarkMode() {
updateSidebarBgColor()
}
</script>
<template>
<div v-if="getShowDarkModeToggle" :class="getClass" @click="toggleDarkMode">
<div :class="`${prefixCls}-inner`" />
<SvgIcon size="14" name="sun" />
<SvgIcon size="14" name="moon" />
</div>
</template>
<style lang="less" scoped>
@prefix-cls: ~'@{namespace}-dark-switch';
@ -46,6 +48,8 @@ html[data-theme='dark'] {
.@{prefix-cls} {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
width: 50px;
height: 26px;
padding: 0 6px;
@ -53,8 +57,6 @@ html[data-theme='dark'] {
cursor: pointer;
background-color: #151515;
border-radius: 30px;
justify-content: space-between;
align-items: center;
&-inner {
position: absolute;

View File

@ -1,22 +1,7 @@
<template>
<Dropdown
placement="bottom"
:trigger="['click']"
:dropMenuList="localeList"
:selectedKeys="selectedKeys"
@menu-event="handleMenuEvent"
overlayClassName="app-locale-picker-overlay"
>
<span class="cursor-pointer flex items-center">
<Icon icon="ion:language" />
<span v-if="showText" class="ml-1">{{ getLocaleText }}</span>
</span>
</Dropdown>
</template>
<script lang="ts" setup>
import { computed, ref, unref, watchEffect } from 'vue'
import type { LocaleType } from '@/types/config'
import type { DropMenu } from '@/components/Dropdown'
import { ref, watchEffect, unref, computed } from 'vue'
import { Dropdown } from '@/components/Dropdown'
import { Icon } from '@/components/Icon'
import { useLocale } from '@/locales/useLocale'
@ -30,7 +15,7 @@ const props = defineProps({
/**
* Whether to refresh the interface when changing
*/
reload: { type: Boolean }
reload: { type: Boolean },
})
const selectedKeys = ref<string[]>([])
@ -39,10 +24,10 @@ const { changeLocale, getLocale } = useLocale()
const getLocaleText = computed(() => {
const key = selectedKeys.value[0]
if (!key) {
if (!key)
return ''
}
return localeList.find((item) => item.event === key)?.text
return localeList.find(item => item.event === key)?.text
})
watchEffect(() => {
@ -56,13 +41,29 @@ async function toggleLocale(lang: LocaleType | string) {
}
function handleMenuEvent(menu: DropMenu) {
if (unref(getLocale) === menu.event) {
if (unref(getLocale) === menu.event)
return
}
toggleLocale(menu.event as string)
}
</script>
<template>
<Dropdown
placement="bottom"
:trigger="['click']"
:drop-menu-list="localeList"
:selected-keys="selectedKeys"
overlay-class-name="app-locale-picker-overlay"
@menu-event="handleMenuEvent"
>
<span class="cursor-pointer flex items-center">
<Icon icon="ion:language" />
<span v-if="showText" class="ml-1">{{ getLocaleText }}</span>
</span>
</Dropdown>
</template>
<style lang="less">
.app-locale-picker-overlay {
.ant-dropdown-menu-item {

View File

@ -1,11 +1,3 @@
<template>
<div class="anticon" :class="getAppLogoClass" @click="goHome">
<img src="@/assets/images/logo.png" />
<div class="ml-2 truncate md:opacity-100" :class="getTitleClass" v-show="showTitle">
{{ title }}
</div>
</div>
</template>
<script lang="ts" setup>
import { computed, unref } from 'vue'
import { useGlobSetting } from '@/hooks/setting'
@ -20,7 +12,7 @@ const props = defineProps({
//
showTitle: { type: Boolean, default: true },
//
alwaysShowTitle: { type: Boolean }
alwaysShowTitle: { type: Boolean },
})
const { prefixCls } = useDesign('app-logo')
@ -33,14 +25,24 @@ const getAppLogoClass = computed(() => [prefixCls, props.theme, { 'collapsed-sho
const getTitleClass = computed(() => [
`${prefixCls}__title`,
{
'xs:opacity-0': !props.alwaysShowTitle
}
'xs:opacity-0': !props.alwaysShowTitle,
},
])
function goHome() {
go(PageEnum.BASE_HOME)
}
</script>
<template>
<div class="anticon" :class="getAppLogoClass" @click="goHome">
<img src="@/assets/images/logo.png">
<div v-show="showTitle" class="ml-2 truncate md:opacity-100" :class="getTitleClass">
{{ title }}
</div>
</div>
</template>
<style lang="less" scoped>
@prefix-cls: ~'@{namespace}-app-logo';
@ -70,8 +72,8 @@ function goHome() {
&__title {
font-size: 16px;
font-weight: 700;
transition: all 0.5s;
line-height: normal;
transition: all 0.5s;
}
}
</style>

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { defineComponent, toRefs, ref, unref } from 'vue'
import { defineComponent, ref, toRefs, unref } from 'vue'
import { createAppProviderContext } from './useAppContext'
import { createBreakpointListen } from '@/hooks/event/useBreakpoint'
import { prefixCls } from '@/settings/designSetting'
@ -10,7 +10,7 @@ const props = {
/**
* class style prefix
*/
prefixCls: { type: String, default: prefixCls }
prefixCls: { type: String, default: prefixCls },
}
export default defineComponent({
@ -26,9 +26,9 @@ export default defineComponent({
// Monitor screen breakpoint information changes
createBreakpointListen(({ screenMap, sizeEnum, width }) => {
const lgWidth = screenMap.get(sizeEnum.LG)
if (lgWidth) {
if (lgWidth)
isMobile.value = width.value - 1 < lgWidth
}
handleRestoreState()
})
@ -45,18 +45,19 @@ export default defineComponent({
if (!unref(isSetState)) {
isSetState.value = true
const {
menuSetting: { type: menuType, mode: menuMode, collapsed: menuCollapsed, split: menuSplit }
menuSetting: { type: menuType, mode: menuMode, collapsed: menuCollapsed, split: menuSplit },
} = appStore.getProjectConfig
appStore.setProjectConfig({
menuSetting: {
type: MenuTypeEnum.SIDEBAR,
mode: MenuModeEnum.INLINE,
split: false
}
split: false,
},
})
appStore.setBeforeMiniInfo({ menuMode, menuCollapsed, menuType, menuSplit })
}
} else {
}
else {
if (unref(isSetState)) {
isSetState.value = false
const { menuMode, menuCollapsed, menuType, menuSplit } = appStore.getBeforeMiniInfo
@ -65,13 +66,13 @@ export default defineComponent({
type: menuType,
mode: menuMode,
collapsed: menuCollapsed,
split: menuSplit
}
split: menuSplit,
},
})
}
}
}
return () => slots.default?.()
}
},
})
</script>

View File

@ -1,44 +1,29 @@
<template>
<Dropdown
placement="bottom"
:trigger="['click']"
:dropMenuList="sizeList"
:selectedKeys="selectedKeys"
@menu-event="handleMenuEvent"
overlayClassName="app-locale-picker-overlay"
>
<span class="cursor-pointer flex items-center">
<Icon icon="mdi:format-size" />
<span v-if="showText" class="ml-1">{{ getSizeText }}</span>
</span>
</Dropdown>
</template>
<script lang="ts" setup>
import { computed, ref, unref, watchEffect } from 'vue'
import type { AppSizeType } from '@/types/config'
import type { DropMenu } from '@/components/Dropdown'
import { ref, watchEffect, unref, computed } from 'vue'
import { Dropdown } from '@/components/Dropdown'
import { Icon } from '@/components/Icon'
import { sizeList } from '@/settings/sizeSetting'
import { useAppStore } from '@/store/modules/app'
const appStore = useAppStore()
const props = defineProps({
//
showText: { type: Boolean, default: true },
//
reload: { type: Boolean }
reload: { type: Boolean },
})
const appStore = useAppStore()
const selectedKeys = ref<string[]>([])
const getSizeText = computed(() => {
const key = selectedKeys.value[0]
if (!key) {
if (!key)
return ''
}
return sizeList.find((item) => item.event === key)?.text
return sizeList.find(item => item.event === key)?.text
})
watchEffect(() => {
@ -52,13 +37,29 @@ async function toggleSize(size: AppSizeType) {
}
function handleMenuEvent(menu: DropMenu) {
if (unref(appStore.getComponentSize) === menu.event) {
if (unref(appStore.getComponentSize) === menu.event)
return
}
toggleSize(menu.event as AppSizeType)
}
</script>
<template>
<Dropdown
placement="bottom"
:trigger="['click']"
:drop-menu-list="sizeList"
:selected-keys="selectedKeys"
overlay-class-name="app-locale-picker-overlay"
@menu-event="handleMenuEvent"
>
<span class="cursor-pointer flex items-center">
<Icon icon="mdi:format-size" />
<span v-if="showText" class="ml-1">{{ getSizeText }}</span>
</span>
</Dropdown>
</template>
<style lang="less">
.app-locale-picker-overlay {
.ant-dropdown-menu-item {

View File

@ -21,13 +21,13 @@ export default defineComponent({
<Tooltip>
{{
title: () => t('common.searchText'),
default: () => <SearchOutlined />
default: () => <SearchOutlined />,
}}
</Tooltip>
<AppSearchModal onClose={changeModal.bind(null, false)} visible={unref(showModal)} />
</div>
)
}
}
},
})
</script>

View File

@ -1,3 +1,12 @@
<script lang="ts" setup>
import AppSearchKeyItem from './AppSearchKeyItem.vue'
import { useDesign } from '@/hooks/web/useDesign'
import { useI18n } from '@/hooks/web/useI18n'
const { prefixCls } = useDesign('app-search-footer')
const { t } = useI18n()
</script>
<template>
<div :class="`${prefixCls}`">
<AppSearchKeyItem :class="`${prefixCls}-item`" icon="ant-design:enter-outlined" />
@ -10,19 +19,14 @@
</div>
</template>
<script lang="ts" setup>
import AppSearchKeyItem from './AppSearchKeyItem.vue'
import { useDesign } from '@/hooks/web/useDesign'
import { useI18n } from '@/hooks/web/useI18n'
const { prefixCls } = useDesign('app-search-footer')
const { t } = useI18n()
</script>
<style lang="less" scoped>
@prefix-cls: ~'@{namespace}-app-search-footer';
.@{prefix-cls} {
position: relative;
display: flex;
flex-shrink: 0;
align-items: center;
height: 44px;
padding: 0 16px;
font-size: 12px;
@ -30,11 +34,11 @@ const { t } = useI18n()
background-color: @component-background;
border-top: 1px solid @border-color-base;
border-radius: 0 0 16px 16px;
align-items: center;
flex-shrink: 0;
&-item {
display: flex;
align-items: center;
justify-content: center;
width: 20px;
height: 18px;
padding-bottom: 2px;
@ -45,8 +49,6 @@ const { t } = useI18n()
inset 0 -2px 0 0 #cdcde6,
inset 0 0 1px 1px #fff,
0 1px 2px 1px rgb(30 35 90 / 40%);
align-items: center;
justify-content: center;
&:nth-child(2),
&:nth-child(3),

View File

@ -1,11 +1,13 @@
<script lang="ts" setup>
import { Icon } from '@/components/Icon'
defineProps({
icon: String,
})
</script>
<template>
<span :class="$attrs.class">
<Icon :icon="icon" />
</span>
</template>
<script lang="ts" setup>
import { Icon } from '@/components/Icon'
defineProps({
icon: String
})
</script>

Some files were not shown because too many files have changed in this diff Show More