Skip to content

Commit

Permalink
chore: 同步 v3-admin 版本 v2.3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
pany-ang committed Jan 21, 2022
1 parent 8ae9d67 commit f173737
Show file tree
Hide file tree
Showing 5 changed files with 264 additions and 252 deletions.
43 changes: 20 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "v3-admin-electron",
"version": "2.3.6",
"version": "2.3.9",
"homepage": "https://github.com/un-pany/v3-admin-electron",
"scripts": {
"dev": "vue-cli-service electron:serve",
Expand All @@ -15,53 +15,50 @@
"@element-plus/icons-vue": "^0.2.4",
"axios": "^0.24.0",
"dayjs": "^1.10.7",
"element-plus": "1.3.0-beta.1",
"element-plus": "1.3.0-beta.5",
"lodash": "^4.17.21",
"normalize.css": "^8.0.1",
"nprogress": "^0.2.0",
"path-to-regexp": "^6.2.0",
"screenfull": "^5.1.0",
"screenfull": "^5.2.0",
"terser-webpack-plugin": "^4.2.3",
"vue": "^3.2.26",
"vue": "^3.2.27",
"vue-router": "^4.0.12",
"vuex": "^4.0.2"
},
"devDependencies": {
"@types/electron-devtools-installer": "^2.2.0",
"@types/js-cookie": "^2.2.6",
"@types/lodash": "^4.14.175",
"@types/js-cookie": "^3.0.1",
"@types/lodash": "^4.14.178",
"@types/nprogress": "^0.2.0",
"@typescript-eslint/eslint-plugin": "^5.5.0",
"@typescript-eslint/parser": "^5.5.0",
"@typescript-eslint/eslint-plugin": "^5.9.1",
"@typescript-eslint/parser": "^5.9.1",
"@vue/cli-plugin-babel": "^4.5.15",
"@vue/cli-plugin-eslint": "^4.5.15",
"@vue/cli-plugin-router": "^4.5.15",
"@vue/cli-plugin-typescript": "^4.5.15",
"@vue/cli-plugin-vuex": "^4.5.15",
"@vue/cli-service": "^4.5.15",
"@vue/compiler-sfc": "^3.2.26",
"@vue/eslint-config-standard": "^6.0.0",
"@vue/eslint-config-typescript": "^7.0.0",
"babel-loader": "^8.2.2",
"compression-webpack-plugin": "^6.1.1",
"@vue/compiler-sfc": "^3.2.27",
"@vue/eslint-config-standard": "^6.1.0",
"@vue/eslint-config-typescript": "^10.0.0",
"babel-loader": "^8.2.3",
"electron": "^13.0.0",
"electron-devtools-installer": "^3.1.0",
"eslint": "^7.32.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-standard": "^4.1.0",
"eslint-plugin-vue": "^7.19.1",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-vue": "^7.20.0",
"lint-staged": "^10.5.4",
"sass": "^1.42.1",
"sass": "^1.47.0",
"sass-loader": "^10.2.0",
"style-loader": "^3.3.0",
"style-resources-loader": "^1.4.1",
"svg-sprite-loader": "^6.0.9",
"typescript": "^4.5.2",
"style-resources-loader": "^1.5.0",
"svg-sprite-loader": "^6.0.11",
"typescript": "^4.5.4",
"vue-cli-plugin-electron-builder": "~2.1.1",
"vue-cli-plugin-style-resources-loader": "^0.1.5",
"webpackbar": "^5.0.0-3"
"webpackbar": "^5.0.2"
},
"gitHooks": {
"pre-commit": "lint-staged"
Expand Down
4 changes: 2 additions & 2 deletions src/components/theme-switch/index.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<el-dropdown trigger="click">
<el-dropdown trigger="click" @command="handleSetTheme">
<svg-icon name="theme" font-size="20px" />
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item
v-for="(theme, index) in themeList"
:key="index"
:disabled="activeThemeName === theme.name"
@click="handleSetTheme(theme.name)"
:command="theme.name"
>
<span>{{ theme.title }}</span>
</el-dropdown-item>
Expand Down
34 changes: 14 additions & 20 deletions src/views/login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
</div>
<div class="content">
<el-form
ref="IloginFormDom"
:model="IloginForm"
:rules="IloginRules"
ref="loginFormDom"
:model="loginForm"
:rules="loginRules"
auto-complete="on"
label-position="left"
@keyup.enter="handleLogin"
Expand All @@ -20,7 +20,7 @@
</span>
<el-input
ref="userNameDom"
v-model="IloginForm.username"
v-model="loginForm.username"
placeholder="用户名"
name="username"
type="text"
Expand All @@ -35,7 +35,7 @@
<el-input
:key="passwordType"
ref="passwordDom"
v-model="IloginForm.password"
v-model="loginForm.password"
:type="passwordType"
placeholder="密码"
name="password"
Expand All @@ -52,7 +52,7 @@
</span>
<el-input
ref="codeDom"
v-model="IloginForm.code"
v-model="loginForm.code"
placeholder="验证码"
name="code"
type="text"
Expand Down Expand Up @@ -84,26 +84,20 @@ interface ILoginForm {
checkCode: string
}
interface ILoginRules {
username: any[]
password: any[]
code: any[]
}
// hooks
const router = useRouter()
// dom
const IloginFormDom = ref<any>()
const loginFormDom = ref<any>()
const passwordDom = ref<any>()
// data
const src = ref<string>('')
const IloginForm = reactive<ILoginForm>({
const loginForm = reactive<ILoginForm>({
username: 'admin', // admin 或 editor
password: '123456',
code: '1234',
checkCode: ''
})
const IloginRules = reactive<ILoginRules>({
const loginRules = reactive({
username: [
{ required: true, message: '请输入用户名', trigger: 'blur' }
],
Expand All @@ -126,12 +120,12 @@ const showPwd: () => void = () => {
}
}
const handleLogin: () => void | boolean = () => {
IloginFormDom.value.validate(async(valid: boolean) => {
loginFormDom.value.validate(async(valid: boolean) => {
if (valid) {
loading.value = true
store.dispatch('user/login', {
username: IloginForm.username,
password: IloginForm.password
username: loginForm.username,
password: loginForm.password
}).then(() => {
loading.value = false
router.push({ path: '/' }).catch((err) => {
Expand All @@ -150,15 +144,15 @@ const handleLogin: () => void | boolean = () => {
const createCode: () => void = () => {
// 先清空验证码的输入
let code = ''
IloginForm.code = ''
loginForm.code = ''
const codeLength = 12
// 随机数
const random: Array<number | string> = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
for (let i = 0; i < codeLength; i++) {
const index = Math.floor(Math.random() * 36)
code += random[index]
}
IloginForm.checkCode = code
loginForm.checkCode = code
src.value = `/api/v1/login/authcode?token=${code}` // 实际开放中,可替换成自己的地址,模板只是提供一个参考
}
// createCode()
Expand Down
11 changes: 1 addition & 10 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* 配置文件 */
const path = require('path')
const WebpackBar = require('webpackbar')
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')

const {
Expand Down Expand Up @@ -38,15 +37,7 @@ module.exports = {
config.plugins = [
new WebpackBar({
name: title
}),
// gzip
// new CompressionWebpackPlugin({
// filename: '[path][base].gz',
// test: /\.(js|css)?$/i,
// threshold: 10240,
// minRatio: 0.8,
// deleteOriginalAssets: true
// })
})
],
// 生产环境清除 console.log
config.optimization = {
Expand Down
Loading

0 comments on commit f173737

Please sign in to comment.