Merge remote-tracking branch 'origin/dev-nx' into dev-nx

This commit is contained in:
csyue 2024-05-29 19:35:43 +08:00
commit 5bcf664c40
7 changed files with 354 additions and 359 deletions

View File

@ -58,9 +58,9 @@ public class TokenController {
//web端登录 //web端登录
@PostMapping("login") @PostMapping("login")
public R<?> login(@RequestBody LoginBody form) throws Exception { public R<?> login(@RequestBody LoginBody form) throws Exception {
//String decryptedData = RsaUtil.decryptByPrivateKey(form.getPassword(), privateKey); String decryptedData = RsaUtil.decryptByPrivateKey(form.getPassword(), privateKey);
// 用户登录 // 用户登录
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); LoginUser userInfo = sysLoginService.login(form.getUsername(), decryptedData);
String uuid = form.getUuid(); String uuid = form.getUuid();
String captcha = redisService.getCacheObject(CacheConstants.CAPTCHA_CODE_KEY + uuid).toString(); String captcha = redisService.getCacheObject(CacheConstants.CAPTCHA_CODE_KEY + uuid).toString();
if (StringUtils.isBlank(captcha)) { if (StringUtils.isBlank(captcha)) {

View File

@ -1,53 +1,70 @@
<template> <template>
<div class="navbar"> <div class="navbar">
<hamburger <hamburger
id="hamburger-container" id="hamburger-container"
:is-active="sidebar.opened" :is-active="sidebar.opened"
class="hamburger-container" class="hamburger-container"
@toggleClick="toggleSideBar" @toggleClick="toggleSideBar"
/> />
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav" /> <breadcrumb
<top-nav id="topmenu-container" class="topmenu-container" v-if="topNav" /> id="breadcrumb-container"
class="breadcrumb-container"
v-if="!topNav"
/>
<top-nav
id="topmenu-container"
class="topmenu-container"
v-if="topNav"
/>
<div class="right-menu"> <div class="right-menu">
<template v-if="device !== 'mobile'"> <template v-if="device !== 'mobile'">
<search id="header-search" class="right-menu-item" /> <search id="header-search" class="right-menu-item" />
<!-- <el-tooltip content="源码地址" effect="dark" placement="bottom">--> <!-- <el-tooltip content="源码地址" effect="dark" placement="bottom">-->
<!-- <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />--> <!-- <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />-->
<!-- </el-tooltip>--> <!-- </el-tooltip>-->
<!-- <el-tooltip content="文档地址" effect="dark" placement="bottom">--> <!-- <el-tooltip content="文档地址" effect="dark" placement="bottom">-->
<!-- <ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />--> <!-- <ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />-->
<!-- </el-tooltip>--> <!-- </el-tooltip>-->
<screenfull id="screenfull" class="right-menu-item hover-effect" /> <screenfull
id="screenfull"
class="right-menu-item hover-effect"
/>
<el-tooltip content="布局大小" effect="dark" placement="bottom"> <el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" /> <size-select
</el-tooltip> id="size-select"
</template> class="right-menu-item hover-effect"
/>
</el-tooltip>
</template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click"> <el-dropdown
<div class="avatar-wrapper"> class="avatar-container right-menu-item hover-effect"
<img :src="avatar" class="user-avatar" /> trigger="click"
<i class="el-icon-caret-bottom" /> >
<div class="avatar-wrapper">
<img :src="avatar" class="user-avatar" />
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown">
<router-link to="/user/profile">
<el-dropdown-item>个人中心</el-dropdown-item>
</router-link>
<el-dropdown-item @click.native="setting = true">
<span>布局设置</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div> </div>
<el-dropdown-menu slot="dropdown">
<router-link to="/user/profile">
<el-dropdown-item>个人中心</el-dropdown-item>
</router-link>
<el-dropdown-item @click.native="setting = true">
<span>布局设置</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div> </div>
</div>
</template> </template>
<script> <script>
@ -62,144 +79,141 @@ import RuoYiGit from '@/components/RuoYi/Git'
import RuoYiDoc from '@/components/RuoYi/Doc' import RuoYiDoc from '@/components/RuoYi/Doc'
export default { export default {
components: { components: {
Breadcrumb, Breadcrumb,
TopNav, TopNav,
Hamburger, Hamburger,
Screenfull, Screenfull,
SizeSelect, SizeSelect,
Search, Search,
RuoYiGit, RuoYiGit,
RuoYiDoc, RuoYiDoc,
},
computed: {
...mapGetters(['sidebar', 'avatar', 'device']),
setting: {
get() {
return this.$store.state.settings.showSettings
},
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showSettings',
value: val,
})
},
}, },
topNav: { computed: {
get() { ...mapGetters(['sidebar', 'avatar', 'device']),
return this.$store.state.settings.topNav setting: {
}, get() {
return this.$store.state.settings.showSettings
},
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showSettings',
value: val,
})
},
},
topNav: {
get() {
return this.$store.state.settings.topNav
},
},
}, },
}, methods: {
methods: { toggleSideBar() {
toggleSideBar() { this.$store.dispatch('app/toggleSideBar')
this.$store.dispatch('app/toggleSideBar') },
async logout() {
this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = '/login'
})
})
.catch(() => {})
},
}, },
async logout() {
this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
this.$store.dispatch('LogOut').then(() => {
// location.href = '/login';
// location.href = '/gl/login';
location.href = process.env.NODE_ENV === 'production-nw' ? '/gl/login' : '/login'
})
})
.catch(() => {})
},
},
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.navbar { .navbar {
height: 50px; height: 50px;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
background: #fff; background: #fff;
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08); box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
.hamburger-container { .hamburger-container {
line-height: 46px; line-height: 46px;
height: 100%; height: 100%;
float: left; float: left;
cursor: pointer;
transition: background 0.3s;
-webkit-tap-highlight-color: transparent;
&:hover {
background: rgba(0, 0, 0, 0.025);
}
}
.breadcrumb-container {
float: left;
}
.topmenu-container {
position: absolute;
left: 50px;
}
.errLog-container {
display: inline-block;
vertical-align: top;
}
.right-menu {
float: right;
height: 100%;
line-height: 50px;
&:focus {
outline: none;
}
.right-menu-item {
display: inline-block;
padding: 0 8px;
height: 100%;
font-size: 18px;
color: #5a5e66;
vertical-align: text-bottom;
&.hover-effect {
cursor: pointer; cursor: pointer;
transition: background 0.3s; transition: background 0.3s;
-webkit-tap-highlight-color: transparent;
&:hover { &:hover {
background: rgba(0, 0, 0, 0.025); background: rgba(0, 0, 0, 0.025);
} }
}
} }
.avatar-container { .breadcrumb-container {
margin-right: 30px; float: left;
}
.avatar-wrapper {
margin-top: 5px; .topmenu-container {
position: relative; position: absolute;
left: 50px;
.user-avatar { }
cursor: pointer;
width: 40px; .errLog-container {
height: 40px; display: inline-block;
border-radius: 10px; vertical-align: top;
} }
.el-icon-caret-bottom { .right-menu {
cursor: pointer; float: right;
position: absolute; height: 100%;
right: -20px; line-height: 50px;
top: 25px;
font-size: 12px; &:focus {
} outline: none;
} }
.right-menu-item {
display: inline-block;
padding: 0 8px;
height: 100%;
font-size: 18px;
color: #5a5e66;
vertical-align: text-bottom;
&.hover-effect {
cursor: pointer;
transition: background 0.3s;
&:hover {
background: rgba(0, 0, 0, 0.025);
}
}
}
.avatar-container {
margin-right: 30px;
.avatar-wrapper {
margin-top: 5px;
position: relative;
.user-avatar {
cursor: pointer;
width: 40px;
height: 40px;
border-radius: 10px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
top: 25px;
font-size: 12px;
}
}
}
} }
}
} }
</style> </style>

View File

@ -32,10 +32,7 @@ router.beforeEach((to, from, next) => {
}).catch(err => { }).catch(err => {
store.dispatch('LogOut').then(() => { store.dispatch('LogOut').then(() => {
Message.error(err) Message.error(err)
// next({ path: '/login' }) next({ path: '/login' })
// next({ path: '/gl/login' })
next({ path: process.env.NODE_ENV === 'production-nw' ? '/gl/login' : '/login' })
}) })
}) })
} else { } else {

View File

@ -204,7 +204,5 @@ export default new Router({
mode: 'history', // 去掉url中的# mode: 'history', // 去掉url中的#
scrollBehavior: () => ({ y: 0 }), scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes, routes: constantRoutes,
base: process.env.NODE_ENV === 'production-nw' ? '/gl' : ''
}) })

View File

@ -87,10 +87,7 @@ service.interceptors.response.use(res => {
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => { MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
isRelogin.show = false; isRelogin.show = false;
store.dispatch('LogOut').then(() => { store.dispatch('LogOut').then(() => {
// location.href = '/login'; location.href = '/login'
// location.href = '/gl/login';
location.href = process.env.NODE_ENV === 'production-nw' ? '/gl/login' : '/login'
}) })
}).catch(() => { }).catch(() => {
isRelogin.show = false; isRelogin.show = false;

View File

@ -3,11 +3,7 @@
<div class="login-bar"> <div class="login-bar">
<div class="form-bar"> <div class="form-bar">
<h3 class="title">请重置登录密码</h3> <h3 class="title">请重置登录密码</h3>
<el-form <el-form ref="form" :model="user" :rules="rules">
ref="form"
:model="user"
:rules="rules"
>
<el-form-item label="旧密码" prop="oldPassword"> <el-form-item label="旧密码" prop="oldPassword">
<el-input <el-input
v-model="user.oldPassword" v-model="user.oldPassword"
@ -33,10 +29,15 @@
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" style="width: 48.5%;" @click="submit" <el-button
type="primary"
style="width: 48.5%"
@click="submit"
>确认修改</el-button >确认修改</el-button
> >
<el-button style="width: 48.5%;" @click="close">返回登录页</el-button> <el-button style="width: 48.5%" @click="close"
>返回登录页</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@ -45,204 +46,192 @@
</template> </template>
<script> <script>
import { updateUserPwd } from '@/api/system/user' import { updateUserPwd } from '@/api/system/user'
import { validPassword } from '@/utils/validate' import { validPassword } from '@/utils/validate'
export default { export default {
data() { data() {
const passwordRegex = (rule, value, callback) => { const passwordRegex = (rule, value, callback) => {
// const reg = // const reg =
// /^((?=.*[A-Za-z])(?=.*\d)|(?=.*[A-Za-z])(?=.*[!@#$%^&*()_+\-\=])|(?=.*\d)(?=.*[!@#$%^&*()_+\-\=]))[A-Za-z\d!@#$%^&*()_+\-\=]{8,20}$/ // /^((?=.*[A-Za-z])(?=.*\d)|(?=.*[A-Za-z])(?=.*[!@#$%^&*()_+\-\=])|(?=.*\d)(?=.*[!@#$%^&*()_+\-\=]))[A-Za-z\d!@#$%^&*()_+\-\=]{8,20}$/
if (value.length < 8 || value.length > 20) { if (value.length < 8 || value.length > 20) {
callback(new Error('密码长度在 8 到 20 个字符')) callback(new Error('密码长度在 8 到 20 个字符'))
} else if (!validPassword(value)) { } else if (!validPassword(value)) {
callback( callback(
new Error('密码须包含数字、字母、特殊符号中的两种以上'), new Error('密码须包含数字、字母、特殊符号中的两种以上'),
) )
} else if (this.user.oldPassword === value) { } else if (this.user.oldPassword === value) {
callback(new Error('新密码不能与旧密码相同')) callback(new Error('新密码不能与旧密码相同'))
} else { } else {
callback() callback()
}
} }
const equalToPassword = (rule, value, callback) => { }
if (this.user.newPassword !== value) { const equalToPassword = (rule, value, callback) => {
callback(new Error('两次输入的密码不一致')) if (this.user.newPassword !== value) {
} else { callback(new Error('两次输入的密码不一致'))
callback() } else {
} callback()
} }
return { }
user: { return {
oldPassword: undefined, user: {
newPassword: undefined, oldPassword: undefined,
confirmPassword: undefined, newPassword: undefined,
}, confirmPassword: undefined,
// },
rules: { //
oldPassword: [ rules: {
{ oldPassword: [
required: true, {
message: '旧密码不能为空', required: true,
trigger: 'blur', message: '旧密码不能为空',
}, trigger: 'blur',
], },
newPassword: [ ],
{ newPassword: [
required: true, {
message: '新密码不能为空', required: true,
trigger: 'blur', message: '新密码不能为空',
}, trigger: 'blur',
{ },
required: true, {
validator: passwordRegex, required: true,
trigger: 'blur', validator: passwordRegex,
}, trigger: 'blur',
], },
confirmPassword: [ ],
{ confirmPassword: [
required: true, {
message: '确认密码不能为空', required: true,
trigger: 'blur', message: '确认密码不能为空',
}, trigger: 'blur',
{ },
required: true, {
validator: equalToPassword, required: true,
trigger: 'blur', validator: equalToPassword,
}, trigger: 'blur',
], },
}, ],
} },
}, }
methods: { },
submit() { methods: {
this.$refs['form'].validate((valid) => { submit() {
if (valid) { this.$refs['form'].validate((valid) => {
updateUserPwd( if (valid) {
this.user.oldPassword, updateUserPwd(
this.user.newPassword, this.user.oldPassword,
).then((response) => { this.user.newPassword,
this.$modal.msgSuccess('修改成功') ).then((response) => {
// this.$modal.msgSuccess('修改成功')
this.$store.dispatch('LogOut').then(() => { //
// location.href = '/login'; this.$store.dispatch('LogOut').then(() => {
// location.href = '/gl/login'; location.href = '/login'
location.href =
process.env.NODE_ENV === 'production-nw'
? '/gl/login'
: '/login'
})
}) })
} })
}) }
}, })
close() {
this.$store.dispatch('LogOut').then(() => {
// location.href = '/login';
// location.href = '/gl/login';
location.href =
process.env.NODE_ENV === 'production-nw'
? '/gl/login'
: '/login'
})
},
}, },
} close() {
this.$store.dispatch('LogOut').then(() => {
location.href = '/login'
})
},
},
}
</script> </script>
<style rel="stylesheet/scss" lang="scss"> <style rel="stylesheet/scss" lang="scss">
.login { .login {
//display: flex; //display: flex;
//justify-content: center; //justify-content: center;
//align-items: center; //align-items: center;
position: relative; position: relative;
height: 100%; height: 100%;
background-image: url('../assets/images/login.png'); background-image: url('../assets/images/login.png');
background-size: 100% 100%; background-size: 100% 100%;
//background: #1891FF; //background: #1891FF;
} }
.title { .title {
margin: 0px auto 30px auto; margin: 0px auto 30px auto;
//text-align: center; //text-align: center;
color: #707070; color: #707070;
} }
.login-bar { .login-bar {
position: absolute; position: absolute;
height: auto; height: auto;
top: 20%; top: 20%;
left: 14%; left: 14%;
width: auto; width: auto;
height: 500px; height: 500px;
border-radius: 6px; border-radius: 6px;
display: flex; display: flex;
background: #fff; background: #fff;
text-align: center; text-align: center;
padding-top: 40px; padding-top: 40px;
} }
.form-bar { .form-bar {
//height: 500px; //height: 500px;
width: 360px; width: 360px;
background: #fff; background: #fff;
} }
.login-form { .login-form {
//border-radius: 6px; //border-radius: 6px;
//height: 100%; //height: 100%;
background: #ffffff; background: #ffffff;
width: 400px; width: 400px;
padding: 25px 25px 5px 25px; padding: 25px 25px 5px 25px;
.el-input { .el-input {
height: 45px; height: 45px;
input { input {
height: 38px; height: 38px;
}
}
.input-icon {
height: 39px;
width: 14px;
margin-left: 2px;
} }
} }
.login-tip { .input-icon {
font-size: 13px; height: 39px;
text-align: center; width: 14px;
color: #bfbfbf; margin-left: 2px;
} }
}
.login-code { .login-tip {
width: 33%; font-size: 13px;
height: 38px; text-align: center;
float: right; color: #bfbfbf;
}
img { .login-code {
cursor: pointer; width: 33%;
vertical-align: middle; height: 38px;
} float: right;
img {
cursor: pointer;
vertical-align: middle;
} }
}
.el-login-footer { .el-login-footer {
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
text-align: center; text-align: center;
color: #fff; color: #fff;
font-family: Arial; font-family: Arial;
font-size: 12px; font-size: 12px;
letter-spacing: 1px; letter-spacing: 1px;
} }
.login-code-img { .login-code-img {
height: 38px; height: 38px;
} }
</style> </style>

View File

@ -19,7 +19,7 @@ module.exports = {
// 部署生产环境和开发环境下的URL。 // 部署生产环境和开发环境下的URL。
// 默认情况下Vue CLI 会假设你的应用是被部署在一个域名的根路径上 // 默认情况下Vue CLI 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。 // 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
publicPath: process.env.NODE_ENV === 'production' ? '/gl/' : '/', ///gl/ publicPath: process.env.NODE_ENV === 'production' ? '/' : '/', ///gl/
// 在npm run build 或 yarn build 时 生成文件的目录名称要和baseUrl的生产环境路径一致默认dist // 在npm run build 或 yarn build 时 生成文件的目录名称要和baseUrl的生产环境路径一致默认dist
outputDir: 'dist', outputDir: 'dist',
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下) // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)