parent
673305e588
commit
36c2bad94a
@ -1 +0,0 @@
|
|||||||
custom: http://doc.ruoyi.vip/ruoyi-cloud/other/donate.html
|
|
Before Width: | Height: | Size: 509 KiB After Width: | Height: | Size: 1.3 MiB |
@ -1,200 +1,194 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="navbar">
|
<div class="navbar">
|
||||||
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
||||||
|
|
||||||
<breadcrumb id="breadcrumb-container" class="breadcrumb-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"/>
|
<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">
|
<!--todo 右上角添加信息提示等功能-->
|
||||||
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
|
|
||||||
</el-tooltip>
|
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
||||||
|
|
||||||
<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" />
|
<size-select id="size-select" class="right-menu-item hover-effect" />
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
|
||||||
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
</template>
|
||||||
|
|
||||||
<el-tooltip content="布局大小" effect="dark" placement="bottom">
|
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
|
||||||
<size-select id="size-select" class="right-menu-item hover-effect" />
|
<div class="avatar-wrapper">
|
||||||
</el-tooltip>
|
<img :src="avatar" class="user-avatar">
|
||||||
|
<i class="el-icon-caret-bottom" />
|
||||||
</template>
|
</div>
|
||||||
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
|
<router-link to="/user/profile">
|
||||||
<div class="avatar-wrapper">
|
<el-dropdown-item>个人中心</el-dropdown-item>
|
||||||
<img :src="avatar" class="user-avatar">
|
</router-link>
|
||||||
<i class="el-icon-caret-bottom" />
|
<el-dropdown-item @click.native="setting = true">
|
||||||
</div>
|
<span>布局设置</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
</el-dropdown-item>
|
||||||
<router-link to="/user/profile">
|
<el-dropdown-item divided @click.native="logout">
|
||||||
<el-dropdown-item>个人中心</el-dropdown-item>
|
<span>退出登录</span>
|
||||||
</router-link>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item @click.native="setting = true">
|
</el-dropdown-menu>
|
||||||
<span>布局设置</span>
|
</el-dropdown>
|
||||||
</el-dropdown-item>
|
</div>
|
||||||
<el-dropdown-item divided @click.native="logout">
|
</div>
|
||||||
<span>退出登录</span>
|
</template>
|
||||||
</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
<script>
|
||||||
</el-dropdown>
|
import { mapGetters } from 'vuex'
|
||||||
</div>
|
import Breadcrumb from '@/components/Breadcrumb'
|
||||||
</div>
|
import TopNav from '@/components/TopNav'
|
||||||
</template>
|
import Hamburger from '@/components/Hamburger'
|
||||||
|
import Screenfull from '@/components/Screenfull'
|
||||||
<script>
|
import SizeSelect from '@/components/SizeSelect'
|
||||||
import { mapGetters } from 'vuex'
|
import Search from '@/components/HeaderSearch'
|
||||||
import Breadcrumb from '@/components/Breadcrumb'
|
import RuoYiGit from '@/components/RuoYi/Git'
|
||||||
import TopNav from '@/components/TopNav'
|
import RuoYiDoc from '@/components/RuoYi/Doc'
|
||||||
import Hamburger from '@/components/Hamburger'
|
|
||||||
import Screenfull from '@/components/Screenfull'
|
export default {
|
||||||
import SizeSelect from '@/components/SizeSelect'
|
components: {
|
||||||
import Search from '@/components/HeaderSearch'
|
Breadcrumb,
|
||||||
import RuoYiGit from '@/components/RuoYi/Git'
|
TopNav,
|
||||||
import RuoYiDoc from '@/components/RuoYi/Doc'
|
Hamburger,
|
||||||
|
Screenfull,
|
||||||
export default {
|
SizeSelect,
|
||||||
components: {
|
Search,
|
||||||
Breadcrumb,
|
RuoYiGit,
|
||||||
TopNav,
|
RuoYiDoc
|
||||||
Hamburger,
|
},
|
||||||
Screenfull,
|
computed: {
|
||||||
SizeSelect,
|
...mapGetters([
|
||||||
Search,
|
'sidebar',
|
||||||
RuoYiGit,
|
'avatar',
|
||||||
RuoYiDoc
|
'device'
|
||||||
},
|
]),
|
||||||
computed: {
|
setting: {
|
||||||
...mapGetters([
|
get() {
|
||||||
'sidebar',
|
return this.$store.state.settings.showSettings
|
||||||
'avatar',
|
},
|
||||||
'device'
|
set(val) {
|
||||||
]),
|
this.$store.dispatch('settings/changeSetting', {
|
||||||
setting: {
|
key: 'showSettings',
|
||||||
get() {
|
value: val
|
||||||
return this.$store.state.settings.showSettings
|
})
|
||||||
},
|
}
|
||||||
set(val) {
|
},
|
||||||
this.$store.dispatch('settings/changeSetting', {
|
topNav: {
|
||||||
key: 'showSettings',
|
get() {
|
||||||
value: val
|
return this.$store.state.settings.topNav
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
topNav: {
|
methods: {
|
||||||
get() {
|
toggleSideBar() {
|
||||||
return this.$store.state.settings.topNav
|
this.$store.dispatch('app/toggleSideBar')
|
||||||
}
|
},
|
||||||
}
|
async logout() {
|
||||||
},
|
this.$confirm('确定注销并退出系统吗?', '提示', {
|
||||||
methods: {
|
confirmButtonText: '确定',
|
||||||
toggleSideBar() {
|
cancelButtonText: '取消',
|
||||||
this.$store.dispatch('app/toggleSideBar')
|
type: 'warning'
|
||||||
},
|
}).then(() => {
|
||||||
async logout() {
|
this.$store.dispatch('LogOut').then(() => {
|
||||||
this.$confirm('确定注销并退出系统吗?', '提示', {
|
location.href = '/index';
|
||||||
confirmButtonText: '确定',
|
})
|
||||||
cancelButtonText: '取消',
|
}).catch(() => {});
|
||||||
type: 'warning'
|
}
|
||||||
}).then(() => {
|
}
|
||||||
this.$store.dispatch('LogOut').then(() => {
|
}
|
||||||
location.href = '/index';
|
</script>
|
||||||
})
|
|
||||||
}).catch(() => {});
|
<style lang="scss" scoped>
|
||||||
}
|
.navbar {
|
||||||
}
|
height: 50px;
|
||||||
}
|
overflow: hidden;
|
||||||
</script>
|
position: relative;
|
||||||
|
background: #fff;
|
||||||
<style lang="scss" scoped>
|
box-shadow: 0 1px 4px rgba(0,21,41,.08);
|
||||||
.navbar {
|
|
||||||
height: 50px;
|
.hamburger-container {
|
||||||
overflow: hidden;
|
line-height: 46px;
|
||||||
position: relative;
|
height: 100%;
|
||||||
background: #fff;
|
float: left;
|
||||||
box-shadow: 0 1px 4px rgba(0,21,41,.08);
|
cursor: pointer;
|
||||||
|
transition: background .3s;
|
||||||
.hamburger-container {
|
-webkit-tap-highlight-color:transparent;
|
||||||
line-height: 46px;
|
|
||||||
height: 100%;
|
&:hover {
|
||||||
float: left;
|
background: rgba(0, 0, 0, .025)
|
||||||
cursor: pointer;
|
}
|
||||||
transition: background .3s;
|
}
|
||||||
-webkit-tap-highlight-color:transparent;
|
|
||||||
|
.breadcrumb-container {
|
||||||
&:hover {
|
float: left;
|
||||||
background: rgba(0, 0, 0, .025)
|
}
|
||||||
}
|
|
||||||
}
|
.topmenu-container {
|
||||||
|
position: absolute;
|
||||||
.breadcrumb-container {
|
left: 50px;
|
||||||
float: left;
|
}
|
||||||
}
|
|
||||||
|
.errLog-container {
|
||||||
.topmenu-container {
|
display: inline-block;
|
||||||
position: absolute;
|
vertical-align: top;
|
||||||
left: 50px;
|
}
|
||||||
}
|
|
||||||
|
.right-menu {
|
||||||
.errLog-container {
|
float: right;
|
||||||
display: inline-block;
|
height: 100%;
|
||||||
vertical-align: top;
|
line-height: 50px;
|
||||||
}
|
|
||||||
|
&:focus {
|
||||||
.right-menu {
|
outline: none;
|
||||||
float: right;
|
}
|
||||||
height: 100%;
|
|
||||||
line-height: 50px;
|
.right-menu-item {
|
||||||
|
display: inline-block;
|
||||||
&:focus {
|
padding: 0 8px;
|
||||||
outline: none;
|
height: 100%;
|
||||||
}
|
font-size: 18px;
|
||||||
|
color: #5a5e66;
|
||||||
.right-menu-item {
|
vertical-align: text-bottom;
|
||||||
display: inline-block;
|
|
||||||
padding: 0 8px;
|
&.hover-effect {
|
||||||
height: 100%;
|
cursor: pointer;
|
||||||
font-size: 18px;
|
transition: background .3s;
|
||||||
color: #5a5e66;
|
|
||||||
vertical-align: text-bottom;
|
&:hover {
|
||||||
|
background: rgba(0, 0, 0, .025)
|
||||||
&.hover-effect {
|
}
|
||||||
cursor: pointer;
|
}
|
||||||
transition: background .3s;
|
}
|
||||||
|
|
||||||
&:hover {
|
.avatar-container {
|
||||||
background: rgba(0, 0, 0, .025)
|
margin-right: 30px;
|
||||||
}
|
|
||||||
}
|
.avatar-wrapper {
|
||||||
}
|
margin-top: 5px;
|
||||||
|
position: relative;
|
||||||
.avatar-container {
|
|
||||||
margin-right: 30px;
|
.user-avatar {
|
||||||
|
cursor: pointer;
|
||||||
.avatar-wrapper {
|
width: 40px;
|
||||||
margin-top: 5px;
|
height: 40px;
|
||||||
position: relative;
|
border-radius: 10px;
|
||||||
|
}
|
||||||
.user-avatar {
|
|
||||||
cursor: pointer;
|
.el-icon-caret-bottom {
|
||||||
width: 40px;
|
cursor: pointer;
|
||||||
height: 40px;
|
position: absolute;
|
||||||
border-radius: 10px;
|
right: -20px;
|
||||||
}
|
top: 25px;
|
||||||
|
font-size: 12px;
|
||||||
.el-icon-caret-bottom {
|
}
|
||||||
cursor: pointer;
|
}
|
||||||
position: absolute;
|
}
|
||||||
right: -20px;
|
}
|
||||||
top: 25px;
|
}
|
||||||
font-size: 12px;
|
</style>
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
@ -1,219 +1,219 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="login">
|
<div class="login">
|
||||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
||||||
<h3 class="title">若依后台管理系统</h3>
|
<h3 class="title">后台管理系统</h3>
|
||||||
<el-form-item prop="username">
|
<el-form-item prop="username">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="loginForm.username"
|
v-model="loginForm.username"
|
||||||
type="text"
|
type="text"
|
||||||
auto-complete="off"
|
auto-complete="off"
|
||||||
placeholder="账号"
|
placeholder="账号"
|
||||||
>
|
>
|
||||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="password">
|
<el-form-item prop="password">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="loginForm.password"
|
v-model="loginForm.password"
|
||||||
type="password"
|
type="password"
|
||||||
auto-complete="off"
|
auto-complete="off"
|
||||||
placeholder="密码"
|
placeholder="密码"
|
||||||
@keyup.enter.native="handleLogin"
|
@keyup.enter.native="handleLogin"
|
||||||
>
|
>
|
||||||
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="code" v-if="captchaOnOff">
|
<el-form-item prop="code" v-if="captchaOnOff">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="loginForm.code"
|
v-model="loginForm.code"
|
||||||
auto-complete="off"
|
auto-complete="off"
|
||||||
placeholder="验证码"
|
placeholder="验证码"
|
||||||
style="width: 63%"
|
style="width: 63%"
|
||||||
@keyup.enter.native="handleLogin"
|
@keyup.enter.native="handleLogin"
|
||||||
>
|
>
|
||||||
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
|
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
|
||||||
</el-input>
|
</el-input>
|
||||||
<div class="login-code">
|
<div class="login-code">
|
||||||
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
|
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
|
||||||
<el-form-item style="width:100%;">
|
<el-form-item style="width:100%;">
|
||||||
<el-button
|
<el-button
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
size="medium"
|
size="medium"
|
||||||
type="primary"
|
type="primary"
|
||||||
style="width:100%;"
|
style="width:100%;"
|
||||||
@click.native.prevent="handleLogin"
|
@click.native.prevent="handleLogin"
|
||||||
>
|
>
|
||||||
<span v-if="!loading">登 录</span>
|
<span v-if="!loading">登 录</span>
|
||||||
<span v-else>登 录 中...</span>
|
<span v-else>登 录 中...</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
<div style="float: right;" v-if="register">
|
<div style="float: right;" v-if="register">
|
||||||
<router-link class="link-type" :to="'/register'">立即注册</router-link>
|
<router-link class="link-type" :to="'/register'">立即注册</router-link>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<!-- 底部 -->
|
<!-- 底部 -->
|
||||||
<div class="el-login-footer">
|
<div class="el-login-footer">
|
||||||
<span>Copyright © 2018-2021 ruoyi.vip All Rights Reserved.</span>
|
<span>Copyright © 2018-2021 ruoyi.vip All Rights Reserved.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getCodeImg } from "@/api/login";
|
import { getCodeImg } from "@/api/login";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Login",
|
name: "Login",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
codeUrl: "",
|
codeUrl: "",
|
||||||
loginForm: {
|
loginForm: {
|
||||||
username: "admin",
|
username: "admin",
|
||||||
password: "admin123",
|
password: "admin123",
|
||||||
rememberMe: false,
|
rememberMe: false,
|
||||||
code: "",
|
code: "",
|
||||||
uuid: ""
|
uuid: ""
|
||||||
},
|
},
|
||||||
loginRules: {
|
loginRules: {
|
||||||
username: [
|
username: [
|
||||||
{ required: true, trigger: "blur", message: "请输入您的账号" }
|
{ required: true, trigger: "blur", message: "请输入您的账号" }
|
||||||
],
|
],
|
||||||
password: [
|
password: [
|
||||||
{ required: true, trigger: "blur", message: "请输入您的密码" }
|
{ required: true, trigger: "blur", message: "请输入您的密码" }
|
||||||
],
|
],
|
||||||
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
||||||
},
|
},
|
||||||
loading: false,
|
loading: false,
|
||||||
// 验证码开关
|
// 验证码开关
|
||||||
captchaOnOff: true,
|
captchaOnOff: true,
|
||||||
// 注册开关
|
// 注册开关
|
||||||
register: false,
|
register: false,
|
||||||
redirect: undefined
|
redirect: undefined
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
$route: {
|
$route: {
|
||||||
handler: function(route) {
|
handler: function(route) {
|
||||||
this.redirect = route.query && route.query.redirect;
|
this.redirect = route.query && route.query.redirect;
|
||||||
},
|
},
|
||||||
immediate: true
|
immediate: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getCode();
|
this.getCode();
|
||||||
this.getCookie();
|
this.getCookie();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getCode() {
|
getCode() {
|
||||||
getCodeImg().then(res => {
|
getCodeImg().then(res => {
|
||||||
this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff;
|
this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff;
|
||||||
if (this.captchaOnOff) {
|
if (this.captchaOnOff) {
|
||||||
this.codeUrl = "data:image/gif;base64," + res.img;
|
this.codeUrl = "data:image/gif;base64," + res.img;
|
||||||
this.loginForm.uuid = res.uuid;
|
this.loginForm.uuid = res.uuid;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getCookie() {
|
getCookie() {
|
||||||
const username = Cookies.get("username");
|
const username = Cookies.get("username");
|
||||||
const password = Cookies.get("password");
|
const password = Cookies.get("password");
|
||||||
const rememberMe = Cookies.get('rememberMe')
|
const rememberMe = Cookies.get('rememberMe')
|
||||||
this.loginForm = {
|
this.loginForm = {
|
||||||
username: username === undefined ? this.loginForm.username : username,
|
username: username === undefined ? this.loginForm.username : username,
|
||||||
password: password === undefined ? this.loginForm.password : decrypt(password),
|
password: password === undefined ? this.loginForm.password : decrypt(password),
|
||||||
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
handleLogin() {
|
handleLogin() {
|
||||||
this.$refs.loginForm.validate(valid => {
|
this.$refs.loginForm.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
if (this.loginForm.rememberMe) {
|
if (this.loginForm.rememberMe) {
|
||||||
Cookies.set("username", this.loginForm.username, { expires: 30 });
|
Cookies.set("username", this.loginForm.username, { expires: 30 });
|
||||||
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
|
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
|
||||||
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
|
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
|
||||||
} else {
|
} else {
|
||||||
Cookies.remove("username");
|
Cookies.remove("username");
|
||||||
Cookies.remove("password");
|
Cookies.remove("password");
|
||||||
Cookies.remove('rememberMe');
|
Cookies.remove('rememberMe');
|
||||||
}
|
}
|
||||||
this.$store.dispatch("Login", this.loginForm).then(() => {
|
this.$store.dispatch("Login", this.loginForm).then(() => {
|
||||||
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
if (this.captchaOnOff) {
|
if (this.captchaOnOff) {
|
||||||
this.getCode();
|
this.getCode();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</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;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-image: url("../assets/images/login-background.jpg");
|
background-image: url("../assets/images/login-background.jpg");
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
}
|
}
|
||||||
.title {
|
.title {
|
||||||
margin: 0px auto 30px auto;
|
margin: 0px auto 30px auto;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #707070;
|
color: #707070;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-form {
|
.login-form {
|
||||||
border-radius: 6px;
|
border-radius: 36px;
|
||||||
background: #ffffff;
|
background: #f2f2f2;
|
||||||
width: 400px;
|
width: 400px;
|
||||||
padding: 25px 25px 5px 25px;
|
padding: 25px 25px 5px 25px;
|
||||||
.el-input {
|
.el-input {
|
||||||
height: 38px;
|
height: 38px;
|
||||||
input {
|
input {
|
||||||
height: 38px;
|
height: 38px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.input-icon {
|
.input-icon {
|
||||||
height: 39px;
|
height: 39px;
|
||||||
width: 14px;
|
width: 14px;
|
||||||
margin-left: 2px;
|
margin-left: 2px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.login-tip {
|
.login-tip {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #bfbfbf;
|
color: #bfbfbf;
|
||||||
}
|
}
|
||||||
.login-code {
|
.login-code {
|
||||||
width: 33%;
|
width: 33%;
|
||||||
height: 38px;
|
height: 38px;
|
||||||
float: right;
|
float: right;
|
||||||
img {
|
img {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
vertical-align: middle;
|
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>
|
||||||
|
@ -1,209 +1,209 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="register">
|
<div class="register">
|
||||||
<el-form ref="registerForm" :model="registerForm" :rules="registerRules" class="register-form">
|
<el-form ref="registerForm" :model="registerForm" :rules="registerRules" class="register-form">
|
||||||
<h3 class="title">若依后台管理系统</h3>
|
<h3 class="title">后台管理系统</h3>
|
||||||
<el-form-item prop="username">
|
<el-form-item prop="username">
|
||||||
<el-input v-model="registerForm.username" type="text" auto-complete="off" placeholder="账号">
|
<el-input v-model="registerForm.username" type="text" auto-complete="off" placeholder="账号">
|
||||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="password">
|
<el-form-item prop="password">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="registerForm.password"
|
v-model="registerForm.password"
|
||||||
type="password"
|
type="password"
|
||||||
auto-complete="off"
|
auto-complete="off"
|
||||||
placeholder="密码"
|
placeholder="密码"
|
||||||
@keyup.enter.native="handleRegister"
|
@keyup.enter.native="handleRegister"
|
||||||
>
|
>
|
||||||
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="confirmPassword">
|
<el-form-item prop="confirmPassword">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="registerForm.confirmPassword"
|
v-model="registerForm.confirmPassword"
|
||||||
type="password"
|
type="password"
|
||||||
auto-complete="off"
|
auto-complete="off"
|
||||||
placeholder="确认密码"
|
placeholder="确认密码"
|
||||||
@keyup.enter.native="handleRegister"
|
@keyup.enter.native="handleRegister"
|
||||||
>
|
>
|
||||||
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="code" v-if="captchaOnOff">
|
<el-form-item prop="code" v-if="captchaOnOff">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="registerForm.code"
|
v-model="registerForm.code"
|
||||||
auto-complete="off"
|
auto-complete="off"
|
||||||
placeholder="验证码"
|
placeholder="验证码"
|
||||||
style="width: 63%"
|
style="width: 63%"
|
||||||
@keyup.enter.native="handleRegister"
|
@keyup.enter.native="handleRegister"
|
||||||
>
|
>
|
||||||
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
|
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
|
||||||
</el-input>
|
</el-input>
|
||||||
<div class="register-code">
|
<div class="register-code">
|
||||||
<img :src="codeUrl" @click="getCode" class="register-code-img"/>
|
<img :src="codeUrl" @click="getCode" class="register-code-img"/>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item style="width:100%;">
|
<el-form-item style="width:100%;">
|
||||||
<el-button
|
<el-button
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
size="medium"
|
size="medium"
|
||||||
type="primary"
|
type="primary"
|
||||||
style="width:100%;"
|
style="width:100%;"
|
||||||
@click.native.prevent="handleRegister"
|
@click.native.prevent="handleRegister"
|
||||||
>
|
>
|
||||||
<span v-if="!loading">注 册</span>
|
<span v-if="!loading">注 册</span>
|
||||||
<span v-else>注 册 中...</span>
|
<span v-else>注 册 中...</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
<div style="float: right;">
|
<div style="float: right;">
|
||||||
<router-link class="link-type" :to="'/login'">使用已有账户登录</router-link>
|
<router-link class="link-type" :to="'/login'">使用已有账户登录</router-link>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<!-- 底部 -->
|
<!-- 底部 -->
|
||||||
<div class="el-register-footer">
|
<div class="el-register-footer">
|
||||||
<span>Copyright © 2018-2021 ruoyi.vip All Rights Reserved.</span>
|
<span>Copyright © 2018-2021 ruoyi.vip All Rights Reserved.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getCodeImg, register } from "@/api/login";
|
import { getCodeImg, register } from "@/api/login";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Register",
|
name: "Register",
|
||||||
data() {
|
data() {
|
||||||
const equalToPassword = (rule, value, callback) => {
|
const equalToPassword = (rule, value, callback) => {
|
||||||
if (this.registerForm.password !== value) {
|
if (this.registerForm.password !== value) {
|
||||||
callback(new Error("两次输入的密码不一致"));
|
callback(new Error("两次输入的密码不一致"));
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
codeUrl: "",
|
codeUrl: "",
|
||||||
registerForm: {
|
registerForm: {
|
||||||
username: "",
|
username: "",
|
||||||
password: "",
|
password: "",
|
||||||
confirmPassword: "",
|
confirmPassword: "",
|
||||||
code: "",
|
code: "",
|
||||||
uuid: ""
|
uuid: ""
|
||||||
},
|
},
|
||||||
registerRules: {
|
registerRules: {
|
||||||
username: [
|
username: [
|
||||||
{ required: true, trigger: "blur", message: "请输入您的账号" },
|
{ required: true, trigger: "blur", message: "请输入您的账号" },
|
||||||
{ min: 2, max: 20, message: '用户账号长度必须介于 2 和 20 之间', trigger: 'blur' }
|
{ min: 2, max: 20, message: '用户账号长度必须介于 2 和 20 之间', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
password: [
|
password: [
|
||||||
{ required: true, trigger: "blur", message: "请输入您的密码" },
|
{ required: true, trigger: "blur", message: "请输入您的密码" },
|
||||||
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
|
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
confirmPassword: [
|
confirmPassword: [
|
||||||
{ required: true, trigger: "blur", message: "请再次输入您的密码" },
|
{ required: true, trigger: "blur", message: "请再次输入您的密码" },
|
||||||
{ required: true, validator: equalToPassword, trigger: "blur" }
|
{ required: true, validator: equalToPassword, trigger: "blur" }
|
||||||
],
|
],
|
||||||
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
||||||
},
|
},
|
||||||
loading: false,
|
loading: false,
|
||||||
captchaOnOff: true
|
captchaOnOff: true
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getCode();
|
this.getCode();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getCode() {
|
getCode() {
|
||||||
getCodeImg().then(res => {
|
getCodeImg().then(res => {
|
||||||
this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff;
|
this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff;
|
||||||
if (this.captchaOnOff) {
|
if (this.captchaOnOff) {
|
||||||
this.codeUrl = "data:image/gif;base64," + res.img;
|
this.codeUrl = "data:image/gif;base64," + res.img;
|
||||||
this.registerForm.uuid = res.uuid;
|
this.registerForm.uuid = res.uuid;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleRegister() {
|
handleRegister() {
|
||||||
this.$refs.registerForm.validate(valid => {
|
this.$refs.registerForm.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
register(this.registerForm).then(res => {
|
register(this.registerForm).then(res => {
|
||||||
const username = this.registerForm.username;
|
const username = this.registerForm.username;
|
||||||
this.$alert("<font color='red'>恭喜你,您的账号 " + username + " 注册成功!</font>", '系统提示', {
|
this.$alert("<font color='red'>恭喜你,您的账号 " + username + " 注册成功!</font>", '系统提示', {
|
||||||
dangerouslyUseHTMLString: true,
|
dangerouslyUseHTMLString: true,
|
||||||
type: 'success'
|
type: 'success'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.$router.push("/login");
|
this.$router.push("/login");
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
if (this.captchaOnOff) {
|
if (this.captchaOnOff) {
|
||||||
this.getCode();
|
this.getCode();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style rel="stylesheet/scss" lang="scss">
|
<style rel="stylesheet/scss" lang="scss">
|
||||||
.register {
|
.register {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-image: url("../assets/images/login-background.jpg");
|
background-image: url("../assets/images/login-background.jpg");
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
}
|
}
|
||||||
.title {
|
.title {
|
||||||
margin: 0px auto 30px auto;
|
margin: 0px auto 30px auto;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #707070;
|
color: #707070;
|
||||||
}
|
}
|
||||||
|
|
||||||
.register-form {
|
.register-form {
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
width: 400px;
|
width: 400px;
|
||||||
padding: 25px 25px 5px 25px;
|
padding: 25px 25px 5px 25px;
|
||||||
.el-input {
|
.el-input {
|
||||||
height: 38px;
|
height: 38px;
|
||||||
input {
|
input {
|
||||||
height: 38px;
|
height: 38px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.input-icon {
|
.input-icon {
|
||||||
height: 39px;
|
height: 39px;
|
||||||
width: 14px;
|
width: 14px;
|
||||||
margin-left: 2px;
|
margin-left: 2px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.register-tip {
|
.register-tip {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #bfbfbf;
|
color: #bfbfbf;
|
||||||
}
|
}
|
||||||
.register-code {
|
.register-code {
|
||||||
width: 33%;
|
width: 33%;
|
||||||
height: 38px;
|
height: 38px;
|
||||||
float: right;
|
float: right;
|
||||||
img {
|
img {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.el-register-footer {
|
.el-register-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;
|
||||||
}
|
}
|
||||||
.register-code-img {
|
.register-code-img {
|
||||||
height: 38px;
|
height: 38px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in new issue