登录接口调试,项目正常运行,基础管理菜单基本分配
This commit is contained in:
parent
e23954a9de
commit
eb4e8c8c13
|
|
@ -5,11 +5,11 @@ import request from '@/utils/request'
|
|||
|
||||
/** 新增工程 */
|
||||
export const addProjectApi = (data) => {
|
||||
return request.post('/xxx/xx', data)
|
||||
return request.post('/base/project/add', data)
|
||||
}
|
||||
/** 删除工程 */
|
||||
export const deleteProjectApi = (id) => {
|
||||
return request.delete('/xxx/xx', id)
|
||||
return request.delete('/base/project/deleteProById', id)
|
||||
}
|
||||
/** 修改工程 */
|
||||
export const editProjectApi = (data) => {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export const deleteUnitTypeApi = (id) => {
|
|||
}
|
||||
/** 修改单位类型*/
|
||||
export const editUnitTypeApi = (data) => {
|
||||
return request.post('/xxx/xx', data)
|
||||
return request.post('/base/unittype/update', data)
|
||||
}
|
||||
/** 单位类型列表查询 */
|
||||
export const queryUnitTypeListApi = (data) => {
|
||||
|
|
|
|||
|
|
@ -12,47 +12,46 @@ const whiteList = ['/login', '/register']
|
|||
|
||||
router.beforeEach((to, from, next) => {
|
||||
NProgress.start()
|
||||
next()
|
||||
// if (getToken()) {
|
||||
// console.log(getToken())
|
||||
// to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
|
||||
// /* has token*/
|
||||
// if (to.path === '/login') {
|
||||
// next({ path: '/' })
|
||||
// NProgress.done()
|
||||
// } else if (whiteList.indexOf(to.path) !== -1) {
|
||||
// next()
|
||||
// } else {
|
||||
// if (store.getters.roles.length === 0) {
|
||||
// isRelogin.show = true
|
||||
// // 判断当前用户是否已拉取完user_info信息
|
||||
// store.dispatch('GetInfo').then(() => {
|
||||
// isRelogin.show = false
|
||||
// store.dispatch('GenerateRoutes').then(accessRoutes => {
|
||||
// // 根据roles权限生成可访问的路由表
|
||||
// router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
||||
// next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
||||
// })
|
||||
// }).catch(err => {
|
||||
// store.dispatch('LogOut').then(() => {
|
||||
// Message.error(err)
|
||||
// next({ path: '/' })
|
||||
// })
|
||||
// })
|
||||
// } else {
|
||||
// next()
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// // 没有token
|
||||
// if (whiteList.indexOf(to.path) !== -1) {
|
||||
// // 在免登录白名单,直接进入
|
||||
// next()
|
||||
// } else {
|
||||
// next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 否则全部重定向到登录页
|
||||
// NProgress.done()
|
||||
// }
|
||||
// }
|
||||
if (getToken()) {
|
||||
console.log(getToken())
|
||||
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
|
||||
/* has token*/
|
||||
if (to.path === '/login') {
|
||||
next({ path: '/' })
|
||||
NProgress.done()
|
||||
} else if (whiteList.indexOf(to.path) !== -1) {
|
||||
next()
|
||||
} else {
|
||||
if (store.getters.roles.length === 0) {
|
||||
isRelogin.show = true
|
||||
// 判断当前用户是否已拉取完user_info信息
|
||||
store.dispatch('GetInfo').then(() => {
|
||||
isRelogin.show = false
|
||||
store.dispatch('GenerateRoutes').then(accessRoutes => {
|
||||
// 根据roles权限生成可访问的路由表
|
||||
router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
||||
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
||||
})
|
||||
}).catch(err => {
|
||||
store.dispatch('LogOut').then(() => {
|
||||
Message.error(err)
|
||||
next({ path: '/' })
|
||||
})
|
||||
})
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 没有token
|
||||
if (whiteList.indexOf(to.path) !== -1) {
|
||||
// 在免登录白名单,直接进入
|
||||
next()
|
||||
} else {
|
||||
next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 否则全部重定向到登录页
|
||||
NProgress.done()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
router.afterEach(() => {
|
||||
|
|
|
|||
|
|
@ -72,30 +72,30 @@ export const constantRoutes = [
|
|||
name: 'Index',
|
||||
meta: { title: '首页', icon: 'dashboard', affix: true }
|
||||
},
|
||||
{
|
||||
path: 'ProjectManage',
|
||||
component: () => import('@/views/base/project'),
|
||||
name: 'ProjectManage',
|
||||
meta: { title: '工程管理', icon: 'dashboard', affix: true }
|
||||
},
|
||||
{
|
||||
path: 'ContactUnits',
|
||||
component: () => import('@/views/base/contun'),
|
||||
name: 'ContactUnits',
|
||||
meta: { title: '往来单位', icon: 'dashboard', affix: true }
|
||||
},
|
||||
{
|
||||
path: 'UnitType',
|
||||
component: () => import('@/views/base/unitType'),
|
||||
name: 'UnitType',
|
||||
meta: { title: '单位类型', icon: 'dashboard', affix: true }
|
||||
},
|
||||
{
|
||||
path: 'ProtocolManage',
|
||||
component: () => import('@/views/base/agreement'),
|
||||
name: 'ProtocolManage',
|
||||
meta: { title: '协议管理', icon: 'dashboard', affix: true }
|
||||
}
|
||||
// {
|
||||
// path: 'ProjectManage',
|
||||
// component: () => import('@/views/base/project'),
|
||||
// name: 'ProjectManage',
|
||||
// meta: { title: '工程管理', icon: 'dashboard', affix: true }
|
||||
// },
|
||||
// {
|
||||
// path: 'ContactUnits',
|
||||
// component: () => import('@/views/base/contun'),
|
||||
// name: 'ContactUnits',
|
||||
// meta: { title: '往来单位', icon: 'dashboard', affix: true }
|
||||
// },
|
||||
// {
|
||||
// path: 'UnitType',
|
||||
// component: () => import('@/views/base/unitType'),
|
||||
// name: 'UnitType',
|
||||
// meta: { title: '单位类型', icon: 'dashboard', affix: true }
|
||||
// },
|
||||
// {
|
||||
// path: 'ProtocolManage',
|
||||
// component: () => import('@/views/base/agreement'),
|
||||
// name: 'ProtocolManage',
|
||||
// meta: { title: '协议管理', icon: 'dashboard', affix: true }
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -92,6 +92,8 @@ const user = {
|
|||
commit('SET_TOKEN', data.access_token)
|
||||
setExpiresIn(data.expires_in)
|
||||
commit('SET_EXPIRES_IN', data.expires_in)
|
||||
|
||||
console.log(res, '登录成功')
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@
|
|||
>
|
||||
<el-row type="flex" justify="space-between" :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工程名称" prop="scrapNum">
|
||||
<el-input v-model="projectParams.scrapNum" />
|
||||
<el-form-item label="工程名称" prop="projectName">
|
||||
<el-input v-model="projectParams.projectName" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工程编号" prop="pro_code">
|
||||
<el-input v-model="projectParams.pro_code" />
|
||||
<el-form-item label="工程编号" prop="pcNo">
|
||||
<el-input v-model="projectParams.pcNo" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
@ -110,6 +110,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { addProjectApi } from '@/api/base/project.js'
|
||||
export default {
|
||||
name: 'FormProject',
|
||||
props: {
|
||||
|
|
@ -126,8 +127,8 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
projectParams: {
|
||||
scrapNum: '',
|
||||
pro_code: '',
|
||||
projectName: '', // 工程名称
|
||||
pcNo: '', // 工程编号
|
||||
pro_unit: '',
|
||||
pro_type_of: '',
|
||||
pro_type: '',
|
||||
|
|
@ -137,7 +138,7 @@ export default {
|
|||
},
|
||||
// 校验规则
|
||||
projectParamsRules: {
|
||||
scrapNum: [
|
||||
projectName: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入工程名称',
|
||||
|
|
@ -178,7 +179,7 @@ export default {
|
|||
methods: {
|
||||
/** 确认按钮 */
|
||||
onSubmit() {
|
||||
this.$refs.projectParamsRef.validate((valid) => {
|
||||
this.$refs.projectParamsRef.validate(valid => {
|
||||
if (valid) {
|
||||
console.log('校验通过')
|
||||
// 1. 表单校验通过后调后台 Api
|
||||
|
|
|
|||
|
|
@ -1,219 +1,279 @@
|
|||
<template>
|
||||
<div class="login">
|
||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
||||
<h3 class="title">博诺思后台管理系统</h3>
|
||||
<el-form-item prop="username">
|
||||
<el-input
|
||||
v-model="loginForm.username"
|
||||
type="text"
|
||||
auto-complete="off"
|
||||
placeholder="账号"
|
||||
<div class="login">
|
||||
<el-form
|
||||
ref="loginForm"
|
||||
:model="loginForm"
|
||||
:rules="loginRules"
|
||||
class="login-form"
|
||||
>
|
||||
<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"/>
|
||||
<h3 class="title">博诺思后台管理系统</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 bonus.vip All Rights Reserved.</span>
|
||||
</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 bonus.vip All Rights Reserved.</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCodeImg } from "@/api/login";
|
||||
import Cookies from "js-cookie";
|
||||
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;
|
||||
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,
|
||||
}
|
||||
});
|
||||
},
|
||||
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)
|
||||
};
|
||||
watch: {
|
||||
$route: {
|
||||
handler: function (route) {
|
||||
this.redirect = route.query && route.query.redirect
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
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();
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
.input-icon {
|
||||
height: 39px;
|
||||
width: 14px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
}
|
||||
.login-tip {
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
color: #bfbfbf;
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
color: #bfbfbf;
|
||||
}
|
||||
.login-code {
|
||||
width: 33%;
|
||||
height: 38px;
|
||||
float: right;
|
||||
img {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
}
|
||||
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;
|
||||
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;
|
||||
height: 38px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,124 +1,174 @@
|
|||
<template>
|
||||
<div class="container">
|
||||
<div class="login">
|
||||
<div class="login-form">
|
||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
||||
<h3 class="title">博诺思后台管理系统</h3>
|
||||
<template v-if="loginMethod === 'password'">
|
||||
<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>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-form-item prop="mobile">
|
||||
<el-input
|
||||
v-model="loginForm.mobile"
|
||||
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="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-form-item prop="verificationCode">
|
||||
<el-input v-model="loginForm.verificationCode" placeholder="请输入验证码">
|
||||
<template slot="append">
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="sendCode"
|
||||
:disabled="isSendingCode || !loginForm.code"
|
||||
class="send-code-button"
|
||||
>
|
||||
{{ countdown === 0 ? '获取验证码' : `${countdown}s` }}
|
||||
</el-button>
|
||||
</template>
|
||||
<svg-icon slot="prefix" icon-class="message" class="el-input__icon input-icon"/>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<div class="login-form-center">
|
||||
<el-link @click="toggleLoginMethod">{{ loginMethod === 'password' ? '短信登录' : '密码登录' }}</el-link>
|
||||
<router-link to="/register">
|
||||
<el-link>注册账号</el-link>
|
||||
</router-link>
|
||||
<el-checkbox v-model="loginForm.rememberMe">记住密码</el-checkbox>
|
||||
</div>
|
||||
<el-form-item style="width: 100%;">
|
||||
<el-button
|
||||
:loading="loading"
|
||||
size="medium"
|
||||
type="primary"
|
||||
style="width: 100%;"
|
||||
@click.native.prevent="isLogin"
|
||||
>
|
||||
<span v-if="!loading">登 录</span>
|
||||
<span v-else>登 录 中...</span>
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div class="login-divider">第三方登录</div>
|
||||
<div class="login-icons">
|
||||
<div class="login-icon">
|
||||
<img :src="dingding" alt="Weibo">
|
||||
</div>
|
||||
<div class="login-icon">
|
||||
<img :src="wx" alt="WeChat">
|
||||
</div>
|
||||
<div class="login-icon">
|
||||
<img :src="qq" alt="QQ">
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="login">
|
||||
<div class="login-form">
|
||||
<el-form
|
||||
ref="loginForm"
|
||||
:model="loginForm"
|
||||
:rules="loginRules"
|
||||
class="login-form"
|
||||
>
|
||||
<h3 class="title">博诺思后台管理系统</h3>
|
||||
<template v-if="loginMethod === 'password'">
|
||||
<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>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-form-item prop="mobile">
|
||||
<el-input
|
||||
v-model="loginForm.mobile"
|
||||
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="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-form-item prop="verificationCode">
|
||||
<el-input
|
||||
v-model="loginForm.verificationCode"
|
||||
placeholder="请输入验证码"
|
||||
>
|
||||
<template slot="append">
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="sendCode"
|
||||
:disabled="
|
||||
isSendingCode || !loginForm.code
|
||||
"
|
||||
class="send-code-button"
|
||||
>
|
||||
{{
|
||||
countdown === 0
|
||||
? '获取验证码'
|
||||
: `${countdown}s`
|
||||
}}
|
||||
</el-button>
|
||||
</template>
|
||||
<svg-icon
|
||||
slot="prefix"
|
||||
icon-class="message"
|
||||
class="el-input__icon input-icon"
|
||||
/>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<div class="login-form-center">
|
||||
<el-link @click="toggleLoginMethod">{{
|
||||
loginMethod === 'password' ? '短信登录' : '密码登录'
|
||||
}}</el-link>
|
||||
<router-link to="/register">
|
||||
<el-link>注册账号</el-link>
|
||||
</router-link>
|
||||
<el-checkbox v-model="loginForm.rememberMe"
|
||||
>记住密码</el-checkbox
|
||||
>
|
||||
</div>
|
||||
<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>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div class="login-divider">第三方登录</div>
|
||||
<div class="login-icons">
|
||||
<div class="login-icon">
|
||||
<img :src="dingding" alt="Weibo" />
|
||||
</div>
|
||||
<div class="login-icon">
|
||||
<img :src="wx" alt="WeChat" />
|
||||
</div>
|
||||
<div class="login-icon">
|
||||
<img :src="qq" alt="QQ" />
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
@ -130,315 +180,377 @@ import wx from '@/assets/images/wx.svg'
|
|||
import qq from '@/assets/images/QQ.svg'
|
||||
|
||||
export default {
|
||||
name: 'Login',
|
||||
data() {
|
||||
return {
|
||||
dingding: dingding,
|
||||
wx: wx,
|
||||
qq: qq,
|
||||
codeUrl: '',
|
||||
loginForm: {
|
||||
username: '',
|
||||
password: '',
|
||||
rememberMe: false,
|
||||
code: '',
|
||||
mobile: '',
|
||||
verificationCode: '',
|
||||
uuid: '',
|
||||
loginType: '',
|
||||
mobileCodeType: 'login'
|
||||
},
|
||||
passwordLoginRules: {
|
||||
username: [{ required: true, trigger: 'blur', message: '请输入您的账号' }],
|
||||
password: [{ required: true, trigger: 'blur', message: '请输入您的密码' }],
|
||||
code: [{ required: true, trigger: 'change', message: '请输入验证码' }]
|
||||
},
|
||||
mobileLoginRules: {
|
||||
mobile: [{ required: true, trigger: 'blur', message: '请输入您的手机号' }],
|
||||
verificationCode: [{ required: true, trigger: 'blur', message: '请输入验证码' }]
|
||||
},
|
||||
loading: false,
|
||||
captchaEnabled: true,
|
||||
redirect: undefined,
|
||||
isSendingCode: false,
|
||||
countdown: 0,
|
||||
loginMethod: 'password', // 'password' or 'mobile'
|
||||
supportsPhoneLogin: false,
|
||||
supportsEmailLogin: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
loginRules() {
|
||||
return this.loginMethod === 'password' ? this.passwordLoginRules : this.mobileLoginRules
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
$route: {
|
||||
handler(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 ? res.captchaEnabled : true
|
||||
if (this.captchaEnabled) {
|
||||
this.codeUrl = 'data:image/gif;base64,' + res.img
|
||||
this.loginForm.uuid = res.uuid
|
||||
name: 'Login',
|
||||
data() {
|
||||
return {
|
||||
dingding: dingding,
|
||||
wx: wx,
|
||||
qq: qq,
|
||||
codeUrl: '',
|
||||
loginForm: {
|
||||
username: '',
|
||||
password: '',
|
||||
rememberMe: false,
|
||||
code: '',
|
||||
mobile: '',
|
||||
verificationCode: '',
|
||||
uuid: '',
|
||||
loginType: '',
|
||||
mobileCodeType: 'login',
|
||||
},
|
||||
passwordLoginRules: {
|
||||
username: [
|
||||
{
|
||||
required: true,
|
||||
trigger: 'blur',
|
||||
message: '请输入您的账号',
|
||||
},
|
||||
],
|
||||
password: [
|
||||
{
|
||||
required: true,
|
||||
trigger: 'blur',
|
||||
message: '请输入您的密码',
|
||||
},
|
||||
],
|
||||
code: [
|
||||
{
|
||||
required: true,
|
||||
trigger: 'change',
|
||||
message: '请输入验证码',
|
||||
},
|
||||
],
|
||||
},
|
||||
mobileLoginRules: {
|
||||
mobile: [
|
||||
{
|
||||
required: true,
|
||||
trigger: 'blur',
|
||||
message: '请输入您的手机号',
|
||||
},
|
||||
],
|
||||
verificationCode: [
|
||||
{
|
||||
required: true,
|
||||
trigger: 'blur',
|
||||
message: '请输入验证码',
|
||||
},
|
||||
],
|
||||
},
|
||||
loading: false,
|
||||
captchaEnabled: true,
|
||||
redirect: undefined,
|
||||
isSendingCode: false,
|
||||
countdown: 0,
|
||||
loginMethod: 'password', // 'password' or 'mobile'
|
||||
supportsPhoneLogin: false,
|
||||
supportsEmailLogin: false,
|
||||
}
|
||||
})
|
||||
},
|
||||
getCookie() {
|
||||
const username = Cookies.get('username')
|
||||
const password = Cookies.get('password')
|
||||
const rememberMe = Cookies.get('rememberMe')
|
||||
this.loginForm.username = username || ''
|
||||
this.loginForm.password = password ? decrypt(password) : ''
|
||||
this.loginForm.rememberMe = rememberMe === 'true'
|
||||
computed: {
|
||||
loginRules() {
|
||||
return this.loginMethod === 'password'
|
||||
? this.passwordLoginRules
|
||||
: this.mobileLoginRules
|
||||
},
|
||||
},
|
||||
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.loginForm.loginType = this.loginMethod
|
||||
this.$store.dispatch('Login', this.loginForm)
|
||||
.then(() => this.$router.push({ path: this.redirect || '/' }))
|
||||
.catch(() => {
|
||||
this.loading = false
|
||||
if (this.captchaEnabled) this.getCode()
|
||||
watch: {
|
||||
$route: {
|
||||
handler(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 ? res.captchaEnabled : true
|
||||
if (this.captchaEnabled) {
|
||||
this.codeUrl = 'data:image/gif;base64,' + res.img
|
||||
this.loginForm.uuid = res.uuid
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
isLogin() {
|
||||
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')
|
||||
}
|
||||
let that = this
|
||||
this.loginForm.loginType = this.loginMethod
|
||||
this.$store.dispatch('IsLogin', this.loginForm)
|
||||
.then(res => {
|
||||
if (res.data) {
|
||||
this.$modal.confirm('账号已在其他地方登录是否继续登录!!!!').then(function() {
|
||||
return that.handleLogin()
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
})
|
||||
} else {
|
||||
that.handleLogin()
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false
|
||||
if (this.captchaEnabled) this.getCode()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
sendCode() {
|
||||
if (!this.loginForm.code) {
|
||||
this.$message.error('请先填写验证码')
|
||||
return
|
||||
}
|
||||
},
|
||||
getCookie() {
|
||||
const username = Cookies.get('username')
|
||||
const password = Cookies.get('password')
|
||||
const rememberMe = Cookies.get('rememberMe')
|
||||
this.loginForm.username = username || ''
|
||||
this.loginForm.password = password ? decrypt(password) : ''
|
||||
this.loginForm.rememberMe = rememberMe === 'true'
|
||||
},
|
||||
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.loginForm.loginType = this.loginMethod
|
||||
|
||||
if (!this.loginForm.mobile) {
|
||||
this.$message.error('请先填写手机号')
|
||||
return
|
||||
}
|
||||
this.$store.dispatch('GetPhoneCode', this.loginForm)
|
||||
.then(() => {
|
||||
this.isSendingCode = true
|
||||
this.countdown = 60
|
||||
const timer = setInterval(() => {
|
||||
this.countdown -= 1
|
||||
if (this.countdown <= 0) {
|
||||
clearInterval(timer)
|
||||
this.isSendingCode = false
|
||||
this.$store
|
||||
.dispatch('Login', this.loginForm)
|
||||
.then(() => {
|
||||
console.log(this.redirect, '重定向的地址')
|
||||
this.$router.push({ path: this.redirect || '/' })
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false
|
||||
if (this.captchaEnabled) this.getCode()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
isLogin() {
|
||||
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')
|
||||
}
|
||||
let that = this
|
||||
this.loginForm.loginType = this.loginMethod
|
||||
this.$store
|
||||
.dispatch('Login', this.loginForm)
|
||||
.then(res => {
|
||||
if (res.data) {
|
||||
this.$modal
|
||||
.confirm(
|
||||
'账号已在其他地方登录是否继续登录!!!!',
|
||||
)
|
||||
.then(function () {
|
||||
return that.handleLogin()
|
||||
})
|
||||
.then(() => {
|
||||
this.loading = false
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
} else {
|
||||
that.handleLogin()
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false
|
||||
if (this.captchaEnabled) this.getCode()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
sendCode() {
|
||||
if (!this.loginForm.code) {
|
||||
this.$message.error('请先填写验证码')
|
||||
return
|
||||
}
|
||||
}, 1000)
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false
|
||||
// 如果启用了验证码,则重新获取验证码
|
||||
if (this.captchaEnabled) {
|
||||
|
||||
if (!this.loginForm.mobile) {
|
||||
this.$message.error('请先填写手机号')
|
||||
return
|
||||
}
|
||||
this.$store
|
||||
.dispatch('GetPhoneCode', this.loginForm)
|
||||
.then(() => {
|
||||
this.isSendingCode = true
|
||||
this.countdown = 60
|
||||
const timer = setInterval(() => {
|
||||
this.countdown -= 1
|
||||
if (this.countdown <= 0) {
|
||||
clearInterval(timer)
|
||||
this.isSendingCode = false
|
||||
}
|
||||
}, 1000)
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false
|
||||
// 如果启用了验证码,则重新获取验证码
|
||||
if (this.captchaEnabled) {
|
||||
this.getCode()
|
||||
}
|
||||
// 其他失败处理逻辑
|
||||
this.isSendingCode = false
|
||||
this.countdown = 0
|
||||
})
|
||||
},
|
||||
toggleLoginMethod() {
|
||||
this.loginMethod =
|
||||
this.loginMethod === 'password' ? 'mobile' : 'password'
|
||||
this.loginForm.username = ''
|
||||
this.loginForm.password = ''
|
||||
this.loginForm.code = ''
|
||||
this.loginForm.verificationCode = ''
|
||||
this.loginForm.loginMethod = ''
|
||||
this.getCode()
|
||||
}
|
||||
// 其他失败处理逻辑
|
||||
this.isSendingCode = false
|
||||
this.countdown = 0
|
||||
})
|
||||
}
|
||||
,
|
||||
toggleLoginMethod() {
|
||||
this.loginMethod = this.loginMethod === 'password' ? 'mobile' : 'password'
|
||||
this.loginForm.username = ''
|
||||
this.loginForm.password = ''
|
||||
this.loginForm.code = ''
|
||||
this.loginForm.verificationCode = ''
|
||||
this.loginForm.loginMethod = ''
|
||||
this.getCode()
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
background-image: url("../assets/images/bg.png");
|
||||
background-size: cover;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
background-image: url('../assets/images/bg.png');
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.login {
|
||||
width: 42%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
width: 42%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 0 auto 30px;
|
||||
text-align: center;
|
||||
color: #707070;
|
||||
margin: 0 auto 30px;
|
||||
text-align: center;
|
||||
color: #707070;
|
||||
}
|
||||
|
||||
.login-form {
|
||||
border-radius: 6px;
|
||||
background: #ffffff;
|
||||
width: 400px;
|
||||
padding: 25px;
|
||||
border-radius: 6px;
|
||||
background: #ffffff;
|
||||
width: 400px;
|
||||
padding: 25px;
|
||||
|
||||
.el-input {
|
||||
height: 38px;
|
||||
.el-input {
|
||||
height: 38px;
|
||||
|
||||
input {
|
||||
height: 38px;
|
||||
input {
|
||||
height: 38px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.input-icon {
|
||||
height: 39px;
|
||||
width: 14px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
.input-icon {
|
||||
height: 39px;
|
||||
width: 14px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
.login-form-center {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
padding: 1%;
|
||||
margin-bottom: 5%;
|
||||
}
|
||||
.login-form-center {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
padding: 1%;
|
||||
margin-bottom: 5%;
|
||||
}
|
||||
}
|
||||
|
||||
.login-tip {
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
color: #bfbfbf;
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
color: #bfbfbf;
|
||||
}
|
||||
|
||||
.login-code {
|
||||
width: 33%;
|
||||
float: right;
|
||||
width: 33%;
|
||||
float: right;
|
||||
|
||||
img {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
}
|
||||
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;
|
||||
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;
|
||||
height: 38px;
|
||||
}
|
||||
|
||||
.login-container {
|
||||
text-align: center;
|
||||
margin-top: 50px;
|
||||
text-align: center;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.login-divider {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
margin: 20px 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.login-divider::before,
|
||||
.login-divider::after {
|
||||
content: '';
|
||||
flex: 1;
|
||||
border-bottom: 1px solid #ccc;
|
||||
content: '';
|
||||
flex: 1;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.login-divider:not(:empty)::before {
|
||||
margin-right: .25em;
|
||||
margin-right: 0.25em;
|
||||
}
|
||||
|
||||
.login-divider:not(:empty)::after {
|
||||
margin-left: .25em;
|
||||
margin-left: 0.25em;
|
||||
}
|
||||
|
||||
.login-icons {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.login-icon {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.login-icon img {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ module.exports = {
|
|||
proxy: {
|
||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||
[process.env.VUE_APP_BASE_API]: {
|
||||
target: `http://192.168.2.130:18080`,
|
||||
target: `http://192.168.2.39:18080`,
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||
|
|
|
|||
Loading…
Reference in New Issue