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端登录
@PostMapping("login")
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 captcha = redisService.getCacheObject(CacheConstants.CAPTCHA_CODE_KEY + uuid).toString();
if (StringUtils.isBlank(captcha)) {

View File

@ -1,53 +1,70 @@
<template>
<div class="navbar">
<hamburger
id="hamburger-container"
:is-active="sidebar.opened"
class="hamburger-container"
@toggleClick="toggleSideBar"
/>
<div class="navbar">
<hamburger
id="hamburger-container"
:is-active="sidebar.opened"
class="hamburger-container"
@toggleClick="toggleSideBar"
/>
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav" />
<top-nav id="topmenu-container" class="topmenu-container" v-if="topNav" />
<breadcrumb
id="breadcrumb-container"
class="breadcrumb-container"
v-if="!topNav"
/>
<top-nav
id="topmenu-container"
class="topmenu-container"
v-if="topNav"
/>
<div class="right-menu">
<template v-if="device !== 'mobile'">
<search id="header-search" class="right-menu-item" />
<div class="right-menu">
<template v-if="device !== 'mobile'">
<search id="header-search" class="right-menu-item" />
<!-- <el-tooltip content="源码地址" effect="dark" placement="bottom">-->
<!-- <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />-->
<!-- </el-tooltip>-->
<!-- <el-tooltip content="源码地址" effect="dark" placement="bottom">-->
<!-- <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />-->
<!-- </el-tooltip>-->
<!-- <el-tooltip content="文档地址" effect="dark" placement="bottom">-->
<!-- <ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />-->
<!-- </el-tooltip>-->
<!-- <el-tooltip content="文档地址" effect="dark" placement="bottom">-->
<!-- <ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />-->
<!-- </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">
<size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip>
</template>
<el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select
id="size-select"
class="right-menu-item hover-effect"
/>
</el-tooltip>
</template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<div class="avatar-wrapper">
<img :src="avatar" class="user-avatar" />
<i class="el-icon-caret-bottom" />
<el-dropdown
class="avatar-container right-menu-item hover-effect"
trigger="click"
>
<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>
<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>
</template>
<script>
@ -62,144 +79,141 @@ import RuoYiGit from '@/components/RuoYi/Git'
import RuoYiDoc from '@/components/RuoYi/Doc'
export default {
components: {
Breadcrumb,
TopNav,
Hamburger,
Screenfull,
SizeSelect,
Search,
RuoYiGit,
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,
})
},
components: {
Breadcrumb,
TopNav,
Hamburger,
Screenfull,
SizeSelect,
Search,
RuoYiGit,
RuoYiDoc,
},
topNav: {
get() {
return this.$store.state.settings.topNav
},
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: {
get() {
return this.$store.state.settings.topNav
},
},
},
},
methods: {
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
methods: {
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>
<style lang="scss" scoped>
.navbar {
height: 50px;
overflow: hidden;
position: relative;
background: #fff;
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
height: 50px;
overflow: hidden;
position: relative;
background: #fff;
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
.hamburger-container {
line-height: 46px;
height: 100%;
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 {
.hamburger-container {
line-height: 46px;
height: 100%;
float: left;
cursor: pointer;
transition: background 0.3s;
-webkit-tap-highlight-color: transparent;
&:hover {
background: rgba(0, 0, 0, 0.025);
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;
}
}
.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;
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>

View File

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

View File

@ -204,7 +204,5 @@ export default new Router({
mode: 'history', // 去掉url中的#
scrollBehavior: () => ({ y: 0 }),
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(() => {
isRelogin.show = false;
store.dispatch('LogOut').then(() => {
// location.href = '/login';
// location.href = '/gl/login';
location.href = process.env.NODE_ENV === 'production-nw' ? '/gl/login' : '/login'
location.href = '/login'
})
}).catch(() => {
isRelogin.show = false;

View File

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

View File

@ -19,7 +19,7 @@ module.exports = {
// 部署生产环境和开发环境下的URL。
// 默认情况下Vue CLI 会假设你的应用是被部署在一个域名的根路径上
// 例如 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
outputDir: 'dist',
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)