master
parent
48d42c32b1
commit
e29f66b455
|
@ -0,0 +1,20 @@
|
||||||
|
package com.jing.common.security.annotation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限注解的验证模式
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum Logical
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 必须具有所有的元素
|
||||||
|
*/
|
||||||
|
AND,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 只需具有其中一个元素
|
||||||
|
*/
|
||||||
|
OR
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
package ${packageName}.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import ${packageName}.domain.${ClassName};
|
||||||
|
#if($table.sub)
|
||||||
|
import ${packageName}.domain.${subClassName};
|
||||||
|
#end
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${functionName}Mapper接口
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @date ${datetime}
|
||||||
|
*/
|
||||||
|
public interface ${ClassName}Mapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询${functionName}
|
||||||
|
*
|
||||||
|
* @param ${pkColumn.javaField} ${functionName}主键
|
||||||
|
* @return ${functionName}
|
||||||
|
*/
|
||||||
|
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询${functionName}列表
|
||||||
|
*
|
||||||
|
* @param ${className} ${functionName}
|
||||||
|
* @return ${functionName}集合
|
||||||
|
*/
|
||||||
|
public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增${functionName}
|
||||||
|
*
|
||||||
|
* @param ${className} ${functionName}
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insert${ClassName}(${ClassName} ${className});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改${functionName}
|
||||||
|
*
|
||||||
|
* @param ${className} ${functionName}
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int update${ClassName}(${ClassName} ${className});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除${functionName}
|
||||||
|
*
|
||||||
|
* @param ${pkColumn.javaField} ${functionName}主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除${functionName}
|
||||||
|
*
|
||||||
|
* @param ${pkColumn.javaField}s 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||||
|
#if($table.sub)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除${subTable.functionName}
|
||||||
|
*
|
||||||
|
* @param ${pkColumn.javaField}s 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增${subTable.functionName}
|
||||||
|
*
|
||||||
|
* @param ${subclassName}List ${subTable.functionName}列表
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int batch${subClassName}(List<${subClassName}> ${subclassName}List);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过${functionName}主键删除${subTable.functionName}信息
|
||||||
|
*
|
||||||
|
* @param ${pkColumn.javaField} ${functionName}ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||||
|
#end
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 登录方法
|
||||||
|
export function login(username, password, code, uuid) {
|
||||||
|
return request({
|
||||||
|
url: '/auth/login',
|
||||||
|
headers: {
|
||||||
|
isToken: false,
|
||||||
|
repeatSubmit: false
|
||||||
|
},
|
||||||
|
method: 'post',
|
||||||
|
data: { username, password, code, uuid }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 注册方法
|
||||||
|
export function register(data) {
|
||||||
|
return request({
|
||||||
|
url: '/auth/register',
|
||||||
|
headers: {
|
||||||
|
isToken: false
|
||||||
|
},
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 刷新方法
|
||||||
|
export function refreshToken() {
|
||||||
|
return request({
|
||||||
|
url: '/auth/refresh',
|
||||||
|
method: 'post'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取用户详细信息
|
||||||
|
export function getInfo() {
|
||||||
|
return request({
|
||||||
|
url: '/system/user/getInfo',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 退出方法
|
||||||
|
export function logout() {
|
||||||
|
return request({
|
||||||
|
url: '/auth/logout',
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取验证码
|
||||||
|
export function getCodeImg() {
|
||||||
|
return request({
|
||||||
|
url: '/code',
|
||||||
|
headers: {
|
||||||
|
isToken: false
|
||||||
|
},
|
||||||
|
method: 'get',
|
||||||
|
timeout: 20000
|
||||||
|
})
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询登录日志列表
|
||||||
|
export function list(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/logininfor/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除登录日志
|
||||||
|
export function delLogininfor(infoId) {
|
||||||
|
return request({
|
||||||
|
url: '/system/logininfor/' + infoId,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解锁用户登录状态
|
||||||
|
export function unlockLogininfor(userName) {
|
||||||
|
return request({
|
||||||
|
url: '/system/logininfor/unlock/' + userName,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 清空登录日志
|
||||||
|
export function cleanLogininfor() {
|
||||||
|
return request({
|
||||||
|
url: '/system/logininfor/clean',
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1566036016814" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5261" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M896 128h-85.333333a42.666667 42.666667 0 0 0 0 85.333333h42.666666v640H170.666667V213.333333h42.666666a42.666667 42.666667 0 0 0 0-85.333333H128a42.666667 42.666667 0 0 0-42.666667 42.666667v725.333333a42.666667 42.666667 0 0 0 42.666667 42.666667h768a42.666667 42.666667 0 0 0 42.666667-42.666667V170.666667a42.666667 42.666667 0 0 0-42.666667-42.666667z" p-id="5262"></path><path d="M341.333333 298.666667a42.666667 42.666667 0 0 0 42.666667-42.666667V128a42.666667 42.666667 0 0 0-85.333333 0v128a42.666667 42.666667 0 0 0 42.666666 42.666667zM512 298.666667a42.666667 42.666667 0 0 0 42.666667-42.666667V128a42.666667 42.666667 0 0 0-85.333334 0v128a42.666667 42.666667 0 0 0 42.666667 42.666667zM682.666667 298.666667a42.666667 42.666667 0 0 0 42.666666-42.666667V128a42.666667 42.666667 0 0 0-85.333333 0v128a42.666667 42.666667 0 0 0 42.666667 42.666667zM341.333333 768a42.666667 42.666667 0 0 0 42.666667-42.666667 128 128 0 0 1 256 0 42.666667 42.666667 0 0 0 85.333333 0 213.333333 213.333333 0 0 0-107.52-184.32A128 128 0 0 0 640 469.333333a128 128 0 0 0-256 0 128 128 0 0 0 22.186667 71.68A213.333333 213.333333 0 0 0 298.666667 725.333333a42.666667 42.666667 0 0 0 42.666666 42.666667z m128-298.666667a42.666667 42.666667 0 1 1 42.666667 42.666667 42.666667 42.666667 0 0 1-42.666667-42.666667z" p-id="5263"></path></svg>
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 509 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
|
@ -0,0 +1,93 @@
|
||||||
|
<template>
|
||||||
|
<div class="sidebar-logo-container" :class="{'collapse':collapse}" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
|
||||||
|
<transition name="sidebarLogoFade">
|
||||||
|
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
|
||||||
|
<img v-if="logo" :src="logo" class="sidebar-logo" />
|
||||||
|
<h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
|
||||||
|
</router-link>
|
||||||
|
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
|
||||||
|
<img v-if="logo" :src="logo" class="sidebar-logo" />
|
||||||
|
<h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
|
||||||
|
</router-link>
|
||||||
|
</transition>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import logoImg from '@/assets/logo/logo.png'
|
||||||
|
import variables from '@/assets/styles/variables.scss'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'SidebarLogo',
|
||||||
|
props: {
|
||||||
|
collapse: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
variables() {
|
||||||
|
return variables;
|
||||||
|
},
|
||||||
|
sideTheme() {
|
||||||
|
return this.$store.state.settings.sideTheme
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: process.env.VUE_APP_TITLE,
|
||||||
|
logo: logoImg
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.sidebarLogoFade-enter-active {
|
||||||
|
transition: opacity 1.5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebarLogoFade-enter,
|
||||||
|
.sidebarLogoFade-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-logo-container {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 50px;
|
||||||
|
line-height: 50px;
|
||||||
|
background: #2b2f3a;
|
||||||
|
text-align: center;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
& .sidebar-logo-link {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
& .sidebar-logo {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
& .sidebar-title {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 50px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.collapse {
|
||||||
|
.sidebar-logo {
|
||||||
|
margin-right: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,86 @@
|
||||||
|
import Vue from 'vue'
|
||||||
|
|
||||||
|
import Cookies from 'js-cookie'
|
||||||
|
|
||||||
|
import Element from 'element-ui'
|
||||||
|
import './assets/styles/element-variables.scss'
|
||||||
|
|
||||||
|
import '@/assets/styles/index.scss' // global css
|
||||||
|
import '@/assets/styles/ruoyi.scss' // ruoyi css
|
||||||
|
import App from './App'
|
||||||
|
import store from './store'
|
||||||
|
import router from './router'
|
||||||
|
import directive from './directive' // directive
|
||||||
|
import plugins from './plugins' // plugins
|
||||||
|
import { download } from '@/utils/request'
|
||||||
|
|
||||||
|
import './assets/icons' // icon
|
||||||
|
import './permission' // permission control
|
||||||
|
import { getDicts } from "@/api/system/dict/data";
|
||||||
|
import { getConfigKey } from "@/api/system/config";
|
||||||
|
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
|
||||||
|
// 分页组件
|
||||||
|
import Pagination from "@/components/Pagination";
|
||||||
|
// 自定义表格工具组件
|
||||||
|
import RightToolbar from "@/components/RightToolbar"
|
||||||
|
// 富文本组件
|
||||||
|
import Editor from "@/components/Editor"
|
||||||
|
// 文件上传组件
|
||||||
|
import FileUpload from "@/components/FileUpload"
|
||||||
|
// 图片上传组件
|
||||||
|
import ImageUpload from "@/components/ImageUpload"
|
||||||
|
// 图片预览组件
|
||||||
|
import ImagePreview from "@/components/ImagePreview"
|
||||||
|
// 字典标签组件
|
||||||
|
import DictTag from '@/components/DictTag'
|
||||||
|
// 头部标签组件
|
||||||
|
import VueMeta from 'vue-meta'
|
||||||
|
// 字典数据组件
|
||||||
|
import DictData from '@/components/DictData'
|
||||||
|
|
||||||
|
// 全局方法挂载
|
||||||
|
Vue.prototype.getDicts = getDicts
|
||||||
|
Vue.prototype.getConfigKey = getConfigKey
|
||||||
|
Vue.prototype.parseTime = parseTime
|
||||||
|
Vue.prototype.resetForm = resetForm
|
||||||
|
Vue.prototype.addDateRange = addDateRange
|
||||||
|
Vue.prototype.selectDictLabel = selectDictLabel
|
||||||
|
Vue.prototype.selectDictLabels = selectDictLabels
|
||||||
|
Vue.prototype.download = download
|
||||||
|
Vue.prototype.handleTree = handleTree
|
||||||
|
|
||||||
|
// 全局组件挂载
|
||||||
|
Vue.component('DictTag', DictTag)
|
||||||
|
Vue.component('Pagination', Pagination)
|
||||||
|
Vue.component('RightToolbar', RightToolbar)
|
||||||
|
Vue.component('Editor', Editor)
|
||||||
|
Vue.component('FileUpload', FileUpload)
|
||||||
|
Vue.component('ImageUpload', ImageUpload)
|
||||||
|
Vue.component('ImagePreview', ImagePreview)
|
||||||
|
|
||||||
|
Vue.use(directive)
|
||||||
|
Vue.use(plugins)
|
||||||
|
Vue.use(VueMeta)
|
||||||
|
DictData.install()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If you don't want to use mock-server
|
||||||
|
* you want to use MockJs for mock api
|
||||||
|
* you can execute: mockXHR()
|
||||||
|
*
|
||||||
|
* Currently MockJs will be used in the production environment,
|
||||||
|
* please remove it before going online! ! !
|
||||||
|
*/
|
||||||
|
|
||||||
|
Vue.use(Element, {
|
||||||
|
size: Cookies.get('size') || 'medium' // set element-ui default size
|
||||||
|
})
|
||||||
|
|
||||||
|
Vue.config.productionTip = false
|
||||||
|
|
||||||
|
new Vue({
|
||||||
|
el: '#app',
|
||||||
|
router,
|
||||||
|
store,
|
||||||
|
render: h => h(App)
|
||||||
|
})
|
|
@ -0,0 +1,219 @@
|
||||||
|
<template>
|
||||||
|
<div class="login">
|
||||||
|
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
||||||
|
<h3 class="title">jing系统</h3>
|
||||||
|
<el-form-item prop="username">
|
||||||
|
<el-input
|
||||||
|
v-model="loginForm.username"
|
||||||
|
type="text"
|
||||||
|
auto-complete="off"
|
||||||
|
placeholder="账号"
|
||||||
|
>
|
||||||
|
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="password">
|
||||||
|
<el-input
|
||||||
|
v-model="loginForm.password"
|
||||||
|
type="password"
|
||||||
|
auto-complete="off"
|
||||||
|
placeholder="密码"
|
||||||
|
@keyup.enter.native="handleLogin"
|
||||||
|
>
|
||||||
|
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="code" v-if="captchaEnabled">
|
||||||
|
<el-input
|
||||||
|
v-model="loginForm.code"
|
||||||
|
auto-complete="off"
|
||||||
|
placeholder="验证码"
|
||||||
|
style="width: 63%"
|
||||||
|
@keyup.enter.native="handleLogin"
|
||||||
|
>
|
||||||
|
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
|
||||||
|
</el-input>
|
||||||
|
<div class="login-code">
|
||||||
|
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
|
||||||
|
<el-form-item style="width:100%;">
|
||||||
|
<el-button
|
||||||
|
:loading="loading"
|
||||||
|
size="medium"
|
||||||
|
type="primary"
|
||||||
|
style="width:100%;"
|
||||||
|
@click.native.prevent="handleLogin"
|
||||||
|
>
|
||||||
|
<span v-if="!loading">登 录</span>
|
||||||
|
<span v-else>登 录 中...</span>
|
||||||
|
</el-button>
|
||||||
|
<div style="float: right;" v-if="register">
|
||||||
|
<router-link class="link-type" :to="'/register'">立即注册</router-link>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<!-- 底部 -->
|
||||||
|
<div class="el-login-footer">
|
||||||
|
<span>Copyright © 2018-2024 ruoyi.vip All Rights Reserved.</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getCodeImg } from "@/api/login";
|
||||||
|
import Cookies from "js-cookie";
|
||||||
|
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Login",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
codeUrl: "",
|
||||||
|
loginForm: {
|
||||||
|
username: "admin",
|
||||||
|
password: "admin123",
|
||||||
|
rememberMe: false,
|
||||||
|
code: "",
|
||||||
|
uuid: ""
|
||||||
|
},
|
||||||
|
loginRules: {
|
||||||
|
username: [
|
||||||
|
{ required: true, trigger: "blur", message: "请输入您的账号" }
|
||||||
|
],
|
||||||
|
password: [
|
||||||
|
{ required: true, trigger: "blur", message: "请输入您的密码" }
|
||||||
|
],
|
||||||
|
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
||||||
|
},
|
||||||
|
loading: false,
|
||||||
|
// 验证码开关
|
||||||
|
captchaEnabled: true,
|
||||||
|
// 注册开关
|
||||||
|
register: false,
|
||||||
|
redirect: undefined
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
$route: {
|
||||||
|
handler: function(route) {
|
||||||
|
this.redirect = route.query && route.query.redirect;
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getCode();
|
||||||
|
this.getCookie();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getCode() {
|
||||||
|
getCodeImg().then(res => {
|
||||||
|
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
|
||||||
|
if (this.captchaEnabled) {
|
||||||
|
this.codeUrl = "data:image/gif;base64," + res.img;
|
||||||
|
this.loginForm.uuid = res.uuid;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getCookie() {
|
||||||
|
const username = Cookies.get("username");
|
||||||
|
const password = Cookies.get("password");
|
||||||
|
const rememberMe = Cookies.get('rememberMe')
|
||||||
|
this.loginForm = {
|
||||||
|
username: username === undefined ? this.loginForm.username : username,
|
||||||
|
password: password === undefined ? this.loginForm.password : decrypt(password),
|
||||||
|
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
||||||
|
};
|
||||||
|
},
|
||||||
|
handleLogin() {
|
||||||
|
this.$refs.loginForm.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
this.loading = true;
|
||||||
|
if (this.loginForm.rememberMe) {
|
||||||
|
Cookies.set("username", this.loginForm.username, { expires: 30 });
|
||||||
|
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
|
||||||
|
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
|
||||||
|
} else {
|
||||||
|
Cookies.remove("username");
|
||||||
|
Cookies.remove("password");
|
||||||
|
Cookies.remove('rememberMe');
|
||||||
|
}
|
||||||
|
this.$store.dispatch("Login", this.loginForm).then(() => {
|
||||||
|
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
||||||
|
}).catch(() => {
|
||||||
|
this.loading = false;
|
||||||
|
if (this.captchaEnabled) {
|
||||||
|
this.getCode();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style rel="stylesheet/scss" lang="scss">
|
||||||
|
.login {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
background-image: url("../assets/images/login-background.jpg");
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
margin: 0px auto 30px auto;
|
||||||
|
text-align: center;
|
||||||
|
color: #707070;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form {
|
||||||
|
border-radius: 6px;
|
||||||
|
background: #ffffff;
|
||||||
|
width: 400px;
|
||||||
|
padding: 25px 25px 5px 25px;
|
||||||
|
.el-input {
|
||||||
|
height: 38px;
|
||||||
|
input {
|
||||||
|
height: 38px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.input-icon {
|
||||||
|
height: 39px;
|
||||||
|
width: 14px;
|
||||||
|
margin-left: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.login-tip {
|
||||||
|
font-size: 13px;
|
||||||
|
text-align: center;
|
||||||
|
color: #bfbfbf;
|
||||||
|
}
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
.login-code-img {
|
||||||
|
height: 38px;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in New Issue