Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
R
rsbuild-vue3-template
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
曾哲
rsbuild-vue3-template
Commits
f5d9ac8a
提交
f5d9ac8a
authored
12月 30, 2024
作者:
zengzhe
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: update
上级
fd0495f5
全部展开
显示空白字符变更
内嵌
并排
正在显示
20 个修改的文件
包含
155 行增加
和
341 行删除
+155
-341
.env
.env
+4
-4
.env.development
.env.development
+7
-7
.env.production
.env.production
+13
-6
.env.test
.env.test
+6
-6
pre-commit
.husky/pre-commit
+0
-3
getEnv.ts
build/getEnv.ts
+23
-14
plugins.ts
build/plugins.ts
+0
-98
proxy.ts
build/proxy.ts
+0
-30
rsbuild-plugins.ts
build/rsbuild-plugins.ts
+49
-2
package.json
package.json
+4
-0
pnpm-lock.yaml
pnpm-lock.yaml
+0
-0
rsbuild.config.ts
rsbuild.config.ts
+14
-51
index.ts
src/api/index.ts
+1
-1
index.vue
src/components/PwdRisk/index.vue
+2
-2
env.d.ts
src/env.d.ts
+18
-11
index.ts
src/routers/index.ts
+1
-1
global.d.ts
src/typings/global.d.ts
+11
-13
index.vue
src/views/login/index.vue
+2
-4
tsconfig.json
tsconfig.json
+0
-1
vite.config.ts
vite.config.ts
+0
-87
没有找到文件。
.env
浏览文件 @
f5d9ac8a
# title
# title
VITE
_GLOB_APP_TITLE = '智慧教育后台管理系统'
PUBLIC
_GLOB_APP_TITLE = '智慧教育后台管理系统'
# 本地运行端口号
# 本地运行端口号
VITE
_PORT = 5173
PUBLIC
_PORT = 5173
# 启动时自动打开浏览器
# 启动时自动打开浏览器
VITE
_OPEN = false
PUBLIC
_OPEN = false
# 打包后是否生成包分析文件
# 打包后是否生成包分析文件
VITE
_REPORT = false
PUBLIC
_REPORT = false
.env.development
浏览文件 @
f5d9ac8a
...
@@ -7,22 +7,22 @@
...
@@ -7,22 +7,22 @@
# Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
# Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
###
###
# 本地环境
# 本地环境
VITE
_USER_NODE_ENV = development
PUBLIC
_USER_NODE_ENV = development
# 公共基础路径
# 公共基础路径
VITE
_PUBLIC_PATH = /
PUBLIC
_PUBLIC_PATH = /
# 打包时是否删除 console
# 打包时是否删除 console
VITE
_DROP_CONSOLE = true
PUBLIC
_DROP_CONSOLE = true
# 开发环境接口地址
# 开发环境接口地址
VITE
_API_URL = http://api.iep.casdio.com
PUBLIC
_API_URL = http://api.iep.casdio.com
# 汪洋
# 汪洋
#
VITE
_API_URL = http://172.16.3.197:8095
#
PUBLIC
_API_URL = http://172.16.3.197:8095
# 邹琪涛
# 邹琪涛
#
VITE
_API_URL = https://e28e-14-105-62-130.ngrok-free.app
#
PUBLIC
_API_URL = https://e28e-14-105-62-130.ngrok-free.app
# 开发环境跨域代理,支持配置多个
# 开发环境跨域代理,支持配置多个
VITE
_PROXY = []
PUBLIC
_PROXY = []
.env.production
浏览文件 @
f5d9ac8a
###
# @Author: zengzhe
# @Date: 2024-12-27 11:15:21
# @LastEditors: zengzhe
# @LastEditTime: 2024-12-27 14:53:30
# @Description:
###
# 线上环境
# 线上环境
VITE
_USER_NODE_ENV = production
PUBLIC
_USER_NODE_ENV = production
# 公共基础路径
# 公共基础路径
VITE
_PUBLIC_PATH = /
PUBLIC
_PUBLIC_PATH = /
# 是否启用 gzip 或 brotli 压缩打包,如果需要多个压缩规则,可以使用 “,” 分隔
# 是否启用 gzip 或 brotli 压缩打包,如果需要多个压缩规则,可以使用 “,” 分隔
# Optional: gzip | brotli | none
# Optional: gzip | brotli | none
VITE
_BUILD_COMPRESS = none
PUBLIC
_BUILD_COMPRESS = none
# 打包压缩后是否删除源文件
# 打包压缩后是否删除源文件
VITE
_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
PUBLIC
_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
# 打包时是否删除 console
# 打包时是否删除 console
VITE
_DROP_CONSOLE = true
PUBLIC
_DROP_CONSOLE = true
# 线上环境接口地址
# 线上环境接口地址
VITE
_API_URL = "https://api.iep.seevin.com"
PUBLIC
_API_URL = "https://api.iep.seevin.com"
.env.test
浏览文件 @
f5d9ac8a
...
@@ -7,20 +7,20 @@
...
@@ -7,20 +7,20 @@
# Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
# Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
###
###
# 测试环境
# 测试环境
VITE
_USER_NODE_ENV
=
test
PUBLIC
_USER_NODE_ENV
=
test
# 公共基础路径
# 公共基础路径
VITE
_PUBLIC_PATH
=
/
PUBLIC
_PUBLIC_PATH
=
/
# 是否启用 gzip 或 brotli 压缩打包,如果需要多个压缩规则,可以使用 “,” 分隔
# 是否启用 gzip 或 brotli 压缩打包,如果需要多个压缩规则,可以使用 “,” 分隔
# Optional: gzip | brotli | none
# Optional: gzip | brotli | none
VITE
_BUILD_COMPRESS
=
none
PUBLIC
_BUILD_COMPRESS
=
none
# 打包压缩后是否删除源文件
# 打包压缩后是否删除源文件
VITE
_BUILD_COMPRESS_DELETE_ORIGIN_FILE
=
false
PUBLIC
_BUILD_COMPRESS_DELETE_ORIGIN_FILE
=
false
# 打包时是否删除 console
# 打包时是否删除 console
VITE
_DROP_CONSOLE
=
true
PUBLIC
_DROP_CONSOLE
=
true
# 测试环境接口地址
# 测试环境接口地址
VITE
_API_URL
=
http
://
api
.
iep
.
casdio
.
com
PUBLIC
_API_URL
=
http
://
api
.
iep
.
casdio
.
com
.husky/pre-commit
浏览文件 @
f5d9ac8a
#!/usr/bin/env sh
.
"
$(
dirname
--
"
$0
"
)
/_/husky.sh"
npm run lint-staged
npm run lint-staged
build/getEnv.ts
浏览文件 @
f5d9ac8a
/*
/*
* @Author: zhanyoulin<zhanyoulin456@163.com>
* @Author: zhanyoulin<zhanyoulin456@163.com>
* @Date: 2023-06-23 11:04:27
* @Date: 2023-06-23 11:04:27
* @LastEditors: z
hanyoulin
* @LastEditors: z
engzhe
* @LastEditTime: 202
3-06-23 13:49:05
* @LastEditTime: 202
4-12-27 15:27:57
* @Description:
* @Description:
*/
*/
import
path
from
'path'
import
path
from
'path'
...
@@ -23,25 +23,34 @@ export function isTestFn(mode: string): boolean {
...
@@ -23,25 +23,34 @@ export function isTestFn(mode: string): boolean {
* Whether to generate package preview
* Whether to generate package preview
*/
*/
export
function
isReportMode
():
boolean
{
export
function
isReportMode
():
boolean
{
return
process
.
env
.
VITE
_REPORT
===
'true'
return
process
.
env
.
PUBLIC
_REPORT
===
'true'
}
}
// Read all environment variable configuration files to process.env
// Read all environment variable configuration files to process.env
export
function
wrapperEnv
(
envConf
:
Recordable
):
ViteEnv
{
export
function
wrapperEnv
(
envConf
:
Recordable
):
Recordable
{
const
ret
:
any
=
{}
const
ret
:
Recordable
=
{}
for
(
const
envName
of
Object
.
keys
(
envConf
))
{
for
(
const
envName
of
Object
.
keys
(
envConf
))
{
let
realName
=
envConf
[
envName
].
replace
(
/
\\
n/g
,
'
\
n'
)
// 只处理 process.env 开头的配置
realName
=
realName
===
'true'
?
true
:
realName
===
'false'
?
false
:
realName
if
(
envName
.
startsWith
(
'process.env.'
))
{
if
(
envName
===
'VITE_PORT'
)
realName
=
Number
(
realName
)
// 移除 process.env. 前缀
if
(
envName
===
'VITE_PROXY'
)
{
const
key
=
envName
.
replace
(
'process.env.'
,
''
)
try
{
// 移除值两端的引号
realName
=
JSON
.
parse
(
realName
)
let
value
=
envConf
[
envName
].
replace
(
/^
[
"'
](
.+
)[
"'
]
$/
,
'$1'
)
}
catch
(
error
)
{
console
.
log
(
error
)
// 转换特定类型的值
value
=
value
===
'true'
?
true
:
value
===
'false'
?
false
:
value
if
(
value
===
'null'
)
{
value
=
null
}
}
if
(
!
isNaN
(
Number
(
value
)))
{
value
=
Number
(
value
)
}
ret
[
key
]
=
value
}
}
ret
[
envName
]
=
realName
}
}
return
ret
return
ret
}
}
...
...
build/plugins.ts
deleted
100644 → 0
浏览文件 @
fd0495f5
import
{
resolve
}
from
'path'
import
{
PluginOption
}
from
'vite'
import
{
visualizer
}
from
'rollup-plugin-visualizer'
import
{
createHtmlPlugin
}
from
'vite-plugin-html'
import
{
createSvgIconsPlugin
}
from
'vite-plugin-svg-icons'
import
vue
from
'@vitejs/plugin-vue'
import
vueJsx
from
'@vitejs/plugin-vue-jsx'
import
viteCompression
from
'vite-plugin-compression'
import
Components
from
'unplugin-vue-components/vite'
import
AutoImport
from
'unplugin-auto-import/vite'
import
{
TDesignResolver
}
from
'unplugin-vue-components/resolvers'
import
legacy
from
'@vitejs/plugin-legacy'
// polyfill低版本谷歌浏览器
import
checker
from
'vite-plugin-checker'
/**
* 创建 vite 插件
* @param viteEnv
*/
export
const
createVitePlugins
=
(
viteEnv
:
ViteEnv
):
(
PluginOption
|
PluginOption
[])[]
=>
{
const
{
VITE_GLOB_APP_TITLE
,
VITE_REPORT
}
=
viteEnv
return
[
vue
(),
// vue 可以使用 jsx/tsx 语法
vueJsx
(),
// 创建打包压缩配置
createCompression
(
viteEnv
),
// eslintPlugin(),
// 注入变量到 html 文件
createHtmlPlugin
({
inject
:
{
data
:
{
title
:
VITE_GLOB_APP_TITLE
}
}
}),
// 使用 svg 图标
createSvgIconsPlugin
({
iconDirs
:
[
resolve
(
process
.
cwd
(),
'src/assets/icons'
)],
symbolId
:
'icon-[dir]-[name]'
}),
// 是否生成包预览,分析依赖包大小做优化处理
VITE_REPORT
&&
(
visualizer
({
filename
:
'stats.html'
,
gzipSize
:
true
,
brotliSize
:
true
})
as
PluginOption
),
AutoImport
({
imports
:
[
'vue'
,
'vue-router'
],
resolvers
:
[
TDesignResolver
({
library
:
'vue-next'
})
],
dts
:
'src/autoImport.d.ts'
}),
Components
({
// allow auto load markdown components under `./src/components/`
extensions
:
[
'vue'
,
'md'
],
// allow auto import and register components used in markdown
include
:
[
/
\.
vue$/
,
/
\.
vue
\?
vue/
,
/
\.
md$/
],
resolvers
:
[
TDesignResolver
({
library
:
'vue-next'
})
],
dts
:
'src/components.d.ts'
}),
legacy
({
targets
:
[
'defaults'
,
'not IE 11'
,
'chrome 68'
]
}),
checker
({
typescript
:
true
})
]
}
/**
* @description 根据 compress 配置,生成不同的压缩规则
* @param viteEnv
*/
const
createCompression
=
(
viteEnv
:
ViteEnv
):
PluginOption
|
PluginOption
[]
=>
{
const
{
VITE_BUILD_COMPRESS
=
'none'
,
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE
}
=
viteEnv
const
compressList
=
VITE_BUILD_COMPRESS
.
split
(
','
)
const
plugins
:
PluginOption
[]
=
[]
if
(
compressList
.
includes
(
'gzip'
))
{
plugins
.
push
(
viteCompression
({
ext
:
'.gz'
,
algorithm
:
'gzip'
,
deleteOriginFile
:
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE
})
)
}
if
(
compressList
.
includes
(
'brotli'
))
{
plugins
.
push
(
viteCompression
({
ext
:
'.br'
,
algorithm
:
'brotliCompress'
,
deleteOriginFile
:
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE
})
)
}
return
plugins
}
build/proxy.ts
deleted
100644 → 0
浏览文件 @
fd0495f5
import
type
{
ProxyOptions
}
from
'vite'
type
ProxyItem
=
[
string
,
string
]
type
ProxyList
=
ProxyItem
[]
type
ProxyTargetList
=
Record
<
string
,
ProxyOptions
>
/**
* 创建代理,用于解析 .env.development 代理配置
* @param list
*/
export
function
createProxy
(
list
:
ProxyList
=
[])
{
const
ret
:
ProxyTargetList
=
{}
for
(
const
[
prefix
,
target
]
of
list
)
{
const
httpsRE
=
/^https:
\/\/
/
const
isHttps
=
httpsRE
.
test
(
target
)
// https://github.com/http-party/node-http-proxy#options
ret
[
prefix
]
=
{
target
:
target
,
changeOrigin
:
true
,
ws
:
true
,
rewrite
:
path
=>
path
.
replace
(
new
RegExp
(
`^
${
prefix
}
`
),
''
),
// https is require secure=false
...(
isHttps
?
{
secure
:
false
}
:
{})
}
}
return
ret
}
build/rsbuild-plugins.ts
浏览文件 @
f5d9ac8a
/*
* @Author: zengzhe
* @Date: 2024-12-27 11:54:24
* @LastEditors: zengzhe
* @LastEditTime: 2024-12-27 17:00:00
* @Description:
*/
import
{
pluginBabel
}
from
'@rsbuild/plugin-babel'
import
{
pluginBabel
}
from
'@rsbuild/plugin-babel'
import
{
pluginVue
}
from
'@rsbuild/plugin-vue'
import
{
pluginVue
}
from
'@rsbuild/plugin-vue'
import
{
pluginVueJsx
}
from
'@rsbuild/plugin-vue-jsx'
import
{
pluginVueJsx
}
from
'@rsbuild/plugin-vue-jsx'
import
{
pluginLess
}
from
'@rsbuild/plugin-less'
import
{
pluginLess
}
from
'@rsbuild/plugin-less'
import
{
pluginTypeCheck
}
from
'@rsbuild/plugin-type-check'
import
{
pluginSvgSpriteLoader
}
from
'rsbuild-plugin-svg-sprite-loader'
import
AutoImport
from
'unplugin-auto-import/rspack'
import
Components
from
'unplugin-vue-components/rspack'
import
{
TDesignResolver
}
from
'unplugin-vue-components/resolvers'
import
{
join
}
from
'path'
export
const
createPlugins
=
()
=>
{
export
const
createPlugins
=
()
=>
{
return
[
return
{
plugins
:
[
pluginBabel
({
pluginBabel
({
include
:
/
\.(?:
jsx|tsx
)
$/
include
:
/
\.(?:
jsx|tsx
)
$/
}),
}),
pluginVue
(),
pluginVue
(),
pluginVueJsx
(),
pluginVueJsx
(),
pluginLess
()
pluginLess
(),
pluginTypeCheck
(),
pluginSvgSpriteLoader
({
path
:
join
(
__dirname
,
'../src/assets/icons'
),
symbolId
:
'icon-[name]'
})
],
tools
:
{
rspack
:
{
plugins
:
[
AutoImport
({
imports
:
[
'vue'
,
'vue-router'
],
resolvers
:
[
TDesignResolver
({
library
:
'vue-next'
})
],
dts
:
'src/autoImport.d.ts'
}),
Components
({
// allow auto load markdown components under `./src/components/`
extensions
:
[
'vue'
,
'md'
],
// allow auto import and register components used in markdown
include
:
[
/
\.
vue$/
,
/
\.
vue
\?
vue/
,
/
\.
md$/
],
resolvers
:
[
TDesignResolver
({
library
:
'vue-next'
})
],
dts
:
'src/components.d.ts'
})
]
]
}
}
}
}
}
package.json
浏览文件 @
f5d9ac8a
...
@@ -55,6 +55,7 @@
...
@@ -55,6 +55,7 @@
"
@rsbuild/core
"
:
"^1.1.13"
,
"
@rsbuild/core
"
:
"^1.1.13"
,
"
@rsbuild/plugin-babel
"
:
"^1.0.3"
,
"
@rsbuild/plugin-babel
"
:
"^1.0.3"
,
"
@rsbuild/plugin-less
"
:
"^1.1.0"
,
"
@rsbuild/plugin-less
"
:
"^1.1.0"
,
"
@rsbuild/plugin-type-check
"
:
"^1.2.0"
,
"
@rsbuild/plugin-vue
"
:
"^1.0.5"
,
"
@rsbuild/plugin-vue
"
:
"^1.0.5"
,
"
@rsbuild/plugin-vue-jsx
"
:
"^1.1.0"
,
"
@rsbuild/plugin-vue-jsx
"
:
"^1.1.0"
,
"
@rushstack/eslint-patch
"
:
"^1.8.0"
,
"
@rushstack/eslint-patch
"
:
"^1.8.0"
,
...
@@ -75,6 +76,9 @@
...
@@ -75,6 +76,9 @@
"
postcss-less
"
:
"^6.0.0"
,
"
postcss-less
"
:
"^6.0.0"
,
"
prettier
"
:
"^3.3.3"
,
"
prettier
"
:
"^3.3.3"
,
"
rollup-plugin-visualizer
"
:
"^5.12.0"
,
"
rollup-plugin-visualizer
"
:
"^5.12.0"
,
"
rsbuild-plugin-svg
"
:
"^0.0.2"
,
"
rsbuild-plugin-svg-sprite-loader
"
:
"^0.0.2"
,
"
rsbuild-svg-sprite-loader
"
:
"^0.0.1"
,
"
stylelint
"
:
"~16.2.1"
,
"
stylelint
"
:
"~16.2.1"
,
"
stylelint-config-standard
"
:
"^36.0.0"
,
"
stylelint-config-standard
"
:
"^36.0.0"
,
"
stylelint-order
"
:
"~6.0.4"
,
"
stylelint-order
"
:
"~6.0.4"
,
...
...
pnpm-lock.yaml
浏览文件 @
f5d9ac8a
差异被折叠。
点击展开。
rsbuild.config.ts
浏览文件 @
f5d9ac8a
...
@@ -2,31 +2,23 @@
...
@@ -2,31 +2,23 @@
* @Author: zengzhe
* @Author: zengzhe
* @Date: 2024-12-27 11:48:34
* @Date: 2024-12-27 11:48:34
* @LastEditors: zengzhe
* @LastEditors: zengzhe
* @LastEditTime: 2024-12-27 1
4:43:43
* @LastEditTime: 2024-12-27 1
7:00:41
* @Description:
* @Description:
*/
*/
import
{
resolve
}
from
'path'
import
{
resolve
}
from
'path'
import
{
defineConfig
,
loadEnv
}
from
'@rsbuild/core'
import
{
defineConfig
,
loadEnv
}
from
'@rsbuild/core'
import
{
createPlugins
}
from
'./build/rsbuild-plugins'
import
{
createPlugins
}
from
'./build/rsbuild-plugins'
import
pkg
from
'./package.json'
import
{
wrapperEnv
}
from
'./build/getEnv'
const
{
dependencies
,
devDependencies
,
name
,
version
}
=
pkg
import
dayjs
from
'dayjs'
const
{
publicVars
}
=
loadEnv
({
prefixes
:
[
'PUBLIC_'
]
})
import
AutoImport
from
'unplugin-auto-import/rspack'
const
Envs
=
wrapperEnv
(
publicVars
)
import
Components
from
'unplugin-vue-components/rspack'
import
{
TDesignResolver
}
from
'unplugin-vue-components/resolvers'
const
{
publicVars
}
=
loadEnv
({
prefixes
:
[
'VITE_'
]
})
const
__APP_INFO__
=
{
pkg
:
{
dependencies
,
devDependencies
,
name
,
version
},
lastBuildTime
:
dayjs
().
format
(
'YYYY-MM-DD HH:mm:ss'
),
importMeta
:
'import.meta'
}
export
default
defineConfig
({
export
default
defineConfig
({
root
:
process
.
cwd
(),
root
:
process
.
cwd
(),
server
:
{
server
:
{
base
:
'/'
,
base
:
Envs
.
PUBLIC_PUBLIC_PATH
,
host
:
'0.0.0.0'
,
port
:
Envs
.
PUBLIC_PORT
,
port
:
3000
,
open
:
Envs
.
PUBLIC_OPEN
,
open
:
true
,
cors
:
true
cors
:
true
},
},
resolve
:
{
resolve
:
{
...
@@ -35,16 +27,10 @@ export default defineConfig({
...
@@ -35,16 +27,10 @@ export default defineConfig({
}
}
},
},
html
:
{
html
:
{
title
:
publicVars
.
VITE_APP_TITLE
,
title
:
''
,
template
:
'./index.html'
template
:
'./index.html'
},
},
source
:
{
source
:
{
define
:
{
__APP_INFO__
:
JSON
.
stringify
(
__APP_INFO__
),
// 启用生产环境构建下激活不匹配的详细警告
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__
:
'false'
,
...
publicVars
},
entry
:
{
entry
:
{
index
:
'./src/main.ts'
index
:
'./src/main.ts'
}
}
...
@@ -55,32 +41,9 @@ export default defineConfig({
...
@@ -55,32 +41,9 @@ export default defineConfig({
},
},
minify
:
true
minify
:
true
},
},
plugins
:
createPlugins
(),
plugins
:
createPlugins
().
plugins
,
tools
:
{
tools
:
createPlugins
().
tools
,
rspack
:
{
performance
:
{
plugins
:
[
removeConsole
:
true
AutoImport
({
imports
:
[
'vue'
,
'vue-router'
],
resolvers
:
[
TDesignResolver
({
library
:
'vue-next'
})
],
dts
:
'src/autoImport.d.ts'
}),
Components
({
// allow auto load markdown components under `./src/components/`
extensions
:
[
'vue'
,
'md'
],
// allow auto import and register components used in markdown
include
:
[
/
\.
vue$/
,
/
\.
vue
\?
vue/
,
/
\.
md$/
],
resolvers
:
[
TDesignResolver
({
library
:
'vue-next'
})
],
dts
:
'src/components.d.ts'
})
]
}
}
}
})
})
src/api/index.ts
浏览文件 @
f5d9ac8a
...
@@ -25,7 +25,7 @@ export interface CustomAxiosRequestConfig extends InternalAxiosRequestConfig {
...
@@ -25,7 +25,7 @@ export interface CustomAxiosRequestConfig extends InternalAxiosRequestConfig {
const
config
=
{
const
config
=
{
// 默认地址请求地址,可在 .env.** 文件中修改
// 默认地址请求地址,可在 .env.** 文件中修改
baseURL
:
import
.
meta
.
env
.
VITE
_API_URL
as
string
,
baseURL
:
import
.
meta
.
env
.
PUBLIC
_API_URL
as
string
,
// 设置超时时间
// 设置超时时间
timeout
:
ResultEnum
.
TIMEOUT
as
number
,
timeout
:
ResultEnum
.
TIMEOUT
as
number
,
paramsSerializer
:
function
(
params
:
any
)
{
paramsSerializer
:
function
(
params
:
any
)
{
...
...
src/components/PwdRisk/index.vue
浏览文件 @
f5d9ac8a
<!--
<!--
* @Author: xiejiang
* @Author: xiejiang
* @Date: 2023-03-08 16:51:55
* @Date: 2023-03-08 16:51:55
* @LastEditors:
xiejiang
* @LastEditors:
zengzhe
* @LastEditTime: 2024-1
1-13 17:09:40
* @LastEditTime: 2024-1
2-27 15:38:09
* @Description: 密码风险等级
* @Description: 密码风险等级
* Copyright(c)2023 by 好老师教育科技有限公司 All right Reserved.
* Copyright(c)2023 by 好老师教育科技有限公司 All right Reserved.
-->
-->
...
...
src/
vite-
env.d.ts
→
src/env.d.ts
浏览文件 @
f5d9ac8a
/// <reference types="vite/client" />
/*
* @Author: zengzhe
* @Date: 2024-12-27 11:15:21
* @LastEditors: zengzhe
* @LastEditTime: 2024-12-27 15:10:51
* @Description:
*/
/// <reference types="@rsbuild/core/types" />
export
interface
ImportMetaEnv
{
export
interface
ImportMetaEnv
{
/** 项目标题 */
/** 项目标题 */
readonly
VITE
_GLOB_APP_TITLE
:
string
readonly
PUBLIC
_GLOB_APP_TITLE
:
string
/** 项目 本地端口 */
/** 项目 本地端口 */
readonly
VITE
_PORT
:
number
readonly
PUBLIC
_PORT
:
number
/** 是否自动打开浏览器 */
/** 是否自动打开浏览器 */
readonly
VITE
_OPEN
:
boolean
readonly
PUBLIC
_OPEN
:
boolean
/** 打包后是否生成包分析文件 */
/** 打包后是否生成包分析文件 */
readonly
VITE
_REPORT
:
boolean
readonly
PUBLIC
_REPORT
:
boolean
/** # 线上环境 */
/** # 线上环境 */
readonly
VITE
_USER_NODE_ENV
:
'development'
|
'production'
|
'test'
readonly
PUBLIC
_USER_NODE_ENV
:
'development'
|
'production'
|
'test'
/** # 公共基础路径 */
/** # 公共基础路径 */
readonly
VITE
_PUBLIC_PATH
:
string
readonly
PUBLIC
_PUBLIC_PATH
:
string
/** # 打包压缩算法 */
/** # 打包压缩算法 */
readonly
VITE
_BUILD_COMPRESS
:
'gzip'
|
'brotli'
|
'gzip,brotli'
|
'none'
readonly
PUBLIC
_BUILD_COMPRESS
:
'gzip'
|
'brotli'
|
'gzip,brotli'
|
'none'
/**打包时是否删除 console */
/**打包时是否删除 console */
readonly
VITE
_DROP_CONSOLE
:
boolean
readonly
PUBLIC
_DROP_CONSOLE
:
boolean
/** # 接口地址 */
/** # 接口地址 */
readonly
VITE
_API_URL
:
string
readonly
PUBLIC
_API_URL
:
string
/** # 接口代理 */
/** # 接口代理 */
readonly
VITE
_PROXY
:
[
string
,
string
][]
readonly
PUBLIC
_PROXY
:
[
string
,
string
][]
}
}
src/routers/index.ts
浏览文件 @
f5d9ac8a
...
@@ -57,7 +57,7 @@ router.beforeEach(async (to, from, next) => {
...
@@ -57,7 +57,7 @@ router.beforeEach(async (to, from, next) => {
NProgress
.
start
()
NProgress
.
start
()
// 2.动态设置标题
// 2.动态设置标题
const
title
=
import
.
meta
.
env
.
VITE
_GLOB_APP_TITLE
const
title
=
import
.
meta
.
env
.
PUBLIC
_GLOB_APP_TITLE
document
.
title
=
to
.
meta
.
title
?
`
${
to
.
meta
.
title
}
-
${
title
}
`
:
title
document
.
title
=
to
.
meta
.
title
?
`
${
to
.
meta
.
title
}
-
${
title
}
`
:
title
// 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由到登陆页
// 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由到登陆页
...
...
src/typings/global.d.ts
浏览文件 @
f5d9ac8a
...
@@ -65,17 +65,17 @@ declare namespace File {
...
@@ -65,17 +65,17 @@ declare namespace File {
declare
type
Recordable
<
T
=
any
>
=
Record
<
string
,
T
>
declare
type
Recordable
<
T
=
any
>
=
Record
<
string
,
T
>
declare
interface
ViteEnv
{
declare
interface
ViteEnv
{
VITE
_USER_NODE_ENV
:
'development'
|
'production'
|
'test'
PUBLIC
_USER_NODE_ENV
:
'development'
|
'production'
|
'test'
VITE
_GLOB_APP_TITLE
:
string
PUBLIC
_GLOB_APP_TITLE
:
string
VITE
_PORT
:
number
PUBLIC
_PORT
:
number
VITE
_OPEN
:
boolean
PUBLIC
_OPEN
:
boolean
VITE
_REPORT
:
boolean
PUBLIC
_REPORT
:
boolean
VITE
_BUILD_COMPRESS
:
'gzip'
|
'brotli'
|
'gzip,brotli'
|
'none'
PUBLIC
_BUILD_COMPRESS
:
'gzip'
|
'brotli'
|
'gzip,brotli'
|
'none'
VITE
_BUILD_COMPRESS_DELETE_ORIGIN_FILE
:
boolean
PUBLIC
_BUILD_COMPRESS_DELETE_ORIGIN_FILE
:
boolean
VITE
_DROP_CONSOLE
:
boolean
PUBLIC
_DROP_CONSOLE
:
boolean
VITE
_PUBLIC_PATH
:
string
PUBLIC
_PUBLIC_PATH
:
string
VITE
_API_URL
:
string
PUBLIC
_API_URL
:
string
VITE
_PROXY
:
[
string
,
string
][]
PUBLIC
_PROXY
:
[
string
,
string
][]
}
}
interface
ImportMetaEnv
extends
ViteEnv
{
interface
ImportMetaEnv
extends
ViteEnv
{
...
@@ -113,5 +113,3 @@ declare type NullableOrUndefined<T> = T | null | undefined
...
@@ -113,5 +113,3 @@ declare type NullableOrUndefined<T> = T | null | undefined
// 将对象中的属性部分变为可选
// 将对象中的属性部分变为可选
declare
type
Optional
<
T
,
K
extends
keyof
T
>
=
Omit
<
T
,
K
>
&
Partial
<
Pick
<
T
,
K
>>
declare
type
Optional
<
T
,
K
extends
keyof
T
>
=
Omit
<
T
,
K
>
&
Partial
<
Pick
<
T
,
K
>>
src/views/login/index.vue
浏览文件 @
f5d9ac8a
<!--
<!--
* @Author: xiejiang
* @Author: xiejiang
* @Date: 2024-11-05 10:14:56
* @Date: 2024-11-05 10:14:56
* @LastEditors:
xiejiang
* @LastEditors:
zengzhe
* @LastEditTime: 2024-12-
11 22:15:1
5
* @LastEditTime: 2024-12-
30 14:27:2
5
* @Description: 登录
* @Description: 登录
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
-->
...
@@ -70,7 +70,6 @@
...
@@ -70,7 +70,6 @@
</div>
</div>
</div>
</div>
</div>
</div>
<Dialog
<Dialog
:dialog-visible=
"isShowPuzzleVcode"
:dialog-visible=
"isShowPuzzleVcode"
title=
"请拖动滑块完成拼图"
title=
"请拖动滑块完成拼图"
...
@@ -94,7 +93,6 @@ import { HOME_URL } from '@/config'
...
@@ -94,7 +93,6 @@ import { HOME_URL } from '@/config'
// import logo from '@/assets/images/logo.png'
// import logo from '@/assets/images/logo.png'
import
welcome
from
'@/assets/images/welcome.png'
import
welcome
from
'@/assets/images/welcome.png'
import
welcomeInfo
from
'@/assets/images/welcome-info.png'
import
welcomeInfo
from
'@/assets/images/welcome-info.png'
onMounted
(()
=>
{})
onMounted
(()
=>
{})
const
validateTelePhone
:
CustomValidator
=
async
val
=>
{
const
validateTelePhone
:
CustomValidator
=
async
val
=>
{
...
...
tsconfig.json
浏览文件 @
f5d9ac8a
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
"useDefineForClassFields"
:
true
,
"useDefineForClassFields"
:
true
,
"module"
:
"ESNext"
,
"module"
:
"ESNext"
,
"moduleResolution"
:
"Node"
,
"moduleResolution"
:
"Node"
,
"types"
:
[
"vite/client"
],
/*
Strict
Type-Checking
Options
*/
/*
Strict
Type-Checking
Options
*/
"strict"
:
true
/*
Enable
all
strict
type-checking
options.
*/
,
"strict"
:
true
/*
Enable
all
strict
type-checking
options.
*/
,
//
"noImplicitAny"
:
true
,
/*
Raise
error
on
expressions
and
declarations
with
an
implied
'any'
type.
*/
//
"noImplicitAny"
:
true
,
/*
Raise
error
on
expressions
and
declarations
with
an
implied
'any'
type.
*/
...
...
vite.config.ts
deleted
100644 → 0
浏览文件 @
fd0495f5
/*
* @Author: zhanyoulin<zhanyoulin456@163.com>
* @Date: 2023-06-13 09:41:18
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-11 19:24:03
* @Description:
*/
import
{
defineConfig
,
loadEnv
,
ConfigEnv
,
UserConfig
}
from
'vite'
import
dayjs
from
'dayjs'
import
{
resolve
}
from
'path'
import
{
wrapperEnv
}
from
'./build/getEnv'
import
{
createProxy
}
from
'./build/proxy'
import
{
createVitePlugins
}
from
'./build/plugins'
import
pkg
from
'./package.json'
const
{
dependencies
,
devDependencies
,
name
,
version
}
=
pkg
const
__APP_INFO__
=
{
pkg
:
{
dependencies
,
devDependencies
,
name
,
version
},
lastBuildTime
:
dayjs
().
format
(
'YYYY-MM-DD HH:mm:ss'
),
importMeta
:
'import.meta'
}
// @see: https://vitejs.dev/config/
export
default
defineConfig
(({
mode
}:
ConfigEnv
):
UserConfig
=>
{
const
root
=
process
.
cwd
()
const
env
=
loadEnv
(
mode
,
root
)
const
viteEnv
=
wrapperEnv
(
env
)
return
{
base
:
viteEnv
.
VITE_PUBLIC_PATH
,
root
,
resolve
:
{
alias
:
{
'@'
:
resolve
(
__dirname
,
'./src'
)
}
},
define
:
{
__APP_INFO__
:
JSON
.
stringify
(
__APP_INFO__
),
// 启用生产环境构建下激活不匹配的详细警告
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__
:
'false'
},
css
:
{
preprocessorOptions
:
{
scss
:
{
// additionalData: `@use "@/styles/element/index.scss" as *;`
// api: 'modern-compiler'
}
}
},
server
:
{
host
:
'0.0.0.0'
,
port
:
viteEnv
.
VITE_PORT
,
open
:
viteEnv
.
VITE_OPEN
,
cors
:
true
,
// Load proxy configuration from .env.development
proxy
:
createProxy
(
viteEnv
.
VITE_PROXY
)
},
plugins
:
createVitePlugins
(
viteEnv
),
esbuild
:
{
pure
:
viteEnv
.
VITE_DROP_CONSOLE
?
[
'console.log'
,
'debugger'
]
:
[]
},
build
:
{
outDir
:
'dist'
,
minify
:
'esbuild'
,
// esbuild 打包更快,但是不能去除 console.log,terser打包慢,但能去除 console.log
// minify: "terser",
// terserOptions: {
// compress: {
// drop_console: viteEnv.VITE_DROP_CONSOLE,
// drop_debugger: true
// }
// },
// 禁用 gzip 压缩大小报告,可略微减少打包时间
reportCompressedSize
:
false
,
// 规定触发警告的 chunk 大小
chunkSizeWarningLimit
:
2000
,
rollupOptions
:
{
output
:
{
// Static resource classification and packaging
chunkFileNames
:
'assets/js/[name]-[hash].js'
,
entryFileNames
:
'assets/js/[name]-[hash].js'
,
assetFileNames
:
'assets/[ext]/[name]-[hash].[ext]'
}
}
}
}
})
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论