|
@@ -1,73 +1,108 @@
|
|
|
<template>
|
|
|
- <div class='full-screen flex flex-center '>
|
|
|
- <el-card class='login'>
|
|
|
- <div class='flex flex-center' style='width: 100%'>
|
|
|
- <div class='flex-child-average flex flex-center left'>
|
|
|
- <div class='flex flex-justify-start flex-align-start full-height '>
|
|
|
- <img src='@/assets/img/logo.png' class='padding-14 logo'/>
|
|
|
- <img src='https://hooray.gitee.io/fantastic-admin-example/assets/login-banner.a565fac8.png' class='logo-main' />
|
|
|
+ <div class="full-screen flex flex-center">
|
|
|
+ <el-card class="login">
|
|
|
+ <div class="flex flex-center" style="width: 100%">
|
|
|
+ <div class="flex-child-average flex flex-center left">
|
|
|
+ <div class="flex flex-justify-start flex-align-start full-height">
|
|
|
+ <img
|
|
|
+ src="@/assets/img/logo.png"
|
|
|
+ class="padding-14 logo"
|
|
|
+ alt="logo"
|
|
|
+ />
|
|
|
+ <img
|
|
|
+ src="https://hooray.gitee.io/fantastic-admin-example/assets/login-banner.a565fac8.png"
|
|
|
+ class="logo-main"
|
|
|
+ alt="logo-main"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div class='flex-child-average right'>
|
|
|
- <div class='padding-20'>
|
|
|
- <span class='font-24 black bold '>欢迎来到梧桐树云项目管理云平台👏</span>
|
|
|
- <el-form class='form' :model="form" :rules="rules" ref='loginForm'>
|
|
|
- <el-form-item prop='name'>
|
|
|
+ <div class="flex-child-average right">
|
|
|
+ <div class="padding-20">
|
|
|
+ <span class="font-24 black bold"
|
|
|
+ >欢迎来到梧桐树云项目管理云平台👏</span
|
|
|
+ >
|
|
|
+ <el-form class="form" :model="form" :rules="rules" ref="loginForm">
|
|
|
+ <el-form-item prop="name">
|
|
|
<el-input
|
|
|
- v-model='form.name'
|
|
|
- size='large'
|
|
|
+ v-model="form.name"
|
|
|
+ size="large"
|
|
|
placeholder="用户名"
|
|
|
prefix-icon="Avatar"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop='pass'>
|
|
|
+ <el-form-item prop="pass">
|
|
|
<el-input
|
|
|
- v-model='form.pass'
|
|
|
- size='large'
|
|
|
+ v-model="form.pass"
|
|
|
+ size="large"
|
|
|
placeholder="密码"
|
|
|
- :type='flag ? "text" : "password"'
|
|
|
- prefix-icon="WalletFilled">
|
|
|
- <template v-slot:suffix>
|
|
|
- <div @click='flag=!flag' class='pointer'>
|
|
|
- <el-icon v-if='!flag'><Hide /></el-icon>
|
|
|
- <el-icon v-else><View /></el-icon>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
+ :type="flag ? 'text' : 'password'"
|
|
|
+ prefix-icon="WalletFilled"
|
|
|
+ >
|
|
|
+ <template v-slot:suffix>
|
|
|
+ <div @click="flag = !flag" class="pointer">
|
|
|
+ <el-icon v-if="!flag"><Hide /></el-icon>
|
|
|
+ <el-icon v-else><View /></el-icon>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop='code'>
|
|
|
+ <el-form-item prop="code">
|
|
|
<el-input
|
|
|
- v-model='form.code'
|
|
|
- size='large'
|
|
|
+ v-model="form.code"
|
|
|
+ size="large"
|
|
|
placeholder="验证码"
|
|
|
prefix-icon="Refresh"
|
|
|
- class='append'
|
|
|
+ class="append"
|
|
|
>
|
|
|
<template v-slot:append>
|
|
|
- <img :src='code' class='pic' style='height: 40px;background-color: red;background-blend-mode: lighten;' />
|
|
|
+ <img
|
|
|
+ :src="code"
|
|
|
+ class="pic"
|
|
|
+ alt="refresh"
|
|
|
+ style="
|
|
|
+ height: 40px;
|
|
|
+ background-color: red;
|
|
|
+ background-blend-mode: lighten;
|
|
|
+ "
|
|
|
+ />
|
|
|
</template>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <div class='flex flex-align-center flex-justify-between full-width'>
|
|
|
+ <div
|
|
|
+ class="flex flex-align-center flex-justify-between full-width"
|
|
|
+ >
|
|
|
<div></div>
|
|
|
- <el-link type='primary' :underline='false' class='font-12'>忘记密码?</el-link>
|
|
|
+ <el-link type="primary" :underline="false" class="font-12"
|
|
|
+ >忘记密码?</el-link
|
|
|
+ >
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
- <el-button type='primary' class='full-width' size='large' @click='submint'>登录</el-button>
|
|
|
- <div class='mt-10 flex flex-center'>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ class="full-width"
|
|
|
+ size="large"
|
|
|
+ @click="submint"
|
|
|
+ >登录</el-button
|
|
|
+ >
|
|
|
+ <div class="mt-10 flex flex-center">
|
|
|
<span>还没账户?</span>
|
|
|
- <el-link type='primary' :underline='false'>注册账户</el-link>
|
|
|
+ <el-link type="primary" :underline="false">注册账户</el-link>
|
|
|
</div>
|
|
|
- <el-divider/>
|
|
|
- <div class='flex flex-col'>
|
|
|
- <span class='grey-6'>
|
|
|
- 由梧桐经济学院提供技术支持
|
|
|
- </span>
|
|
|
+ <el-divider />
|
|
|
+ <div class="flex flex-col">
|
|
|
+ <span class="grey-6"> 由梧桐经济学院提供技术支持 </span>
|
|
|
<div>
|
|
|
- <el-button size='small' type='primary' plain class='mt-10' @click='loginAdmin'>admin</el-button>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ class="mt-10"
|
|
|
+ @click="loginAdmin"
|
|
|
+ >admin</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -85,85 +120,105 @@
|
|
|
}
|
|
|
</route>
|
|
|
|
|
|
-<script>
|
|
|
-import md5 from 'js-md5'
|
|
|
-import { useStore } from '@/store/user.js'
|
|
|
-import { setToken } from '../utils/auth.js'
|
|
|
+<script lang="js">
|
|
|
+import md5 from 'js-md5';
|
|
|
+import { useStore } from '@/store/user.js';
|
|
|
+import { setToken } from '../utils/auth.js';
|
|
|
export default {
|
|
|
name: 'login',
|
|
|
- setup () {
|
|
|
- const user = useStore()
|
|
|
- return { user }
|
|
|
+ setup() {
|
|
|
+ const user = useStore();
|
|
|
+ return { user };
|
|
|
},
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
flag: false,
|
|
|
form: {
|
|
|
name: '',
|
|
|
- pass: ''
|
|
|
+ pass: '',
|
|
|
},
|
|
|
rules: {
|
|
|
name: [
|
|
|
{ required: true, message: '请输入用户名', trigger: 'blur' },
|
|
|
- { min: 3, max: 12, message: '长度在 3 到 12 个字符', trigger: 'blur' }
|
|
|
+ {
|
|
|
+ min: 3,
|
|
|
+ max: 12,
|
|
|
+ message: '长度在 3 到 12 个字符',
|
|
|
+ trigger: 'blur',
|
|
|
+ },
|
|
|
],
|
|
|
pass: [
|
|
|
{ required: true, message: '请输入密码', trigger: 'blur' },
|
|
|
- { min: 3, max: 12, message: '长度在 3 到 12 个字符', trigger: 'blur' }
|
|
|
+ {
|
|
|
+ min: 3,
|
|
|
+ max: 12,
|
|
|
+ message: '长度在 3 到 12 个字符',
|
|
|
+ trigger: 'blur',
|
|
|
+ },
|
|
|
],
|
|
|
code: [
|
|
|
{ required: true, message: '请输入验证码', trigger: 'blur' },
|
|
|
- { min: 5, max: 5, message: '验证码不正确', trigger: 'blur' }
|
|
|
- ]
|
|
|
+ { min: 5, max: 5, message: '验证码不正确', trigger: 'blur' },
|
|
|
+ ],
|
|
|
},
|
|
|
code: '',
|
|
|
- header: ''
|
|
|
- }
|
|
|
+ header: '',
|
|
|
+ };
|
|
|
},
|
|
|
- created () {
|
|
|
- this.init()
|
|
|
+ created() {
|
|
|
+ this.init();
|
|
|
},
|
|
|
methods: {
|
|
|
- init () {
|
|
|
- this.$api.login.captcha().then(res => {
|
|
|
- this.code = res.image
|
|
|
- this.header = res.key
|
|
|
- })
|
|
|
+ init() {
|
|
|
+ this.$api.login.captcha().then((res) => {
|
|
|
+ this.code = res.image;
|
|
|
+ this.header = res.key;
|
|
|
+ });
|
|
|
},
|
|
|
- submint () {
|
|
|
+ submint() {
|
|
|
this.$refs.loginForm.validate((res) => {
|
|
|
if (res) {
|
|
|
- const params = { tenantId: '000000', username: this.form.name, password: md5(this.form.pass), grant_type: 'captcha', scope: 'all', type: 'account' }
|
|
|
- const header = { captchaKey: this.header, captchaCode: this.form.code }
|
|
|
- this.$api.login.login(params, header).then(res => {
|
|
|
+ const params = {
|
|
|
+ tenantId: '000000',
|
|
|
+ username: this.form.name,
|
|
|
+ password: md5(this.form.pass),
|
|
|
+ grant_type: 'captcha',
|
|
|
+ scope: 'all',
|
|
|
+ type: 'account',
|
|
|
+ };
|
|
|
+ const header = {
|
|
|
+ captchaKey: this.header,
|
|
|
+ captchaCode: this.form.code,
|
|
|
+ };
|
|
|
+ this.$api.login.login(params, header).then((res) => {
|
|
|
if (res.error_description) {
|
|
|
- this.$message.error(res.error_description)
|
|
|
- this.init()
|
|
|
+ this.$message.error(res.error_description);
|
|
|
+ this.init();
|
|
|
} else {
|
|
|
// 保存信息
|
|
|
- this.user.setUserInfo(res)
|
|
|
- setToken(res.access_token)
|
|
|
- this.$router.replace('/')
|
|
|
+ this.user.setUserInfo(res);
|
|
|
+ setToken(res.access_token);
|
|
|
+ this.$router.replace('/');
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
} else {
|
|
|
- return false
|
|
|
+ return false;
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
- loginAdmin () {
|
|
|
- this.form.name = 'admin'
|
|
|
- this.form.pass = 'admin'
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+ loginAdmin() {
|
|
|
+ this.form.name = 'admin';
|
|
|
+ this.form.pass = 'admin';
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
-<style lang='scss' scoped>
|
|
|
-.login{
|
|
|
- :deep(.el-card__body){
|
|
|
+<style lang="scss" scoped>
|
|
|
+.login {
|
|
|
+ :deep(.el-card__body) {
|
|
|
padding: 0 !important;
|
|
|
- };
|
|
|
+ }
|
|
|
padding: 0;
|
|
|
display: flex;
|
|
|
top: 50%;
|
|
@@ -173,7 +228,7 @@ export default {
|
|
|
width: 950px;
|
|
|
height: 500px;
|
|
|
.left {
|
|
|
- background-color: #F5F7FA;
|
|
|
+ background-color: #f5f7fa;
|
|
|
height: 500px;
|
|
|
.logo {
|
|
|
width: 45px;
|
|
@@ -189,18 +244,18 @@ export default {
|
|
|
.right {
|
|
|
background-color: white;
|
|
|
height: 500px;
|
|
|
- .form{
|
|
|
+ .form {
|
|
|
margin-top: 30px;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
.append {
|
|
|
- :deep(.el-input-group__append){
|
|
|
+ :deep(.el-input-group__append) {
|
|
|
background-color: white;
|
|
|
}
|
|
|
.pic {
|
|
|
- border-top: #DDDFE5 1px solid;
|
|
|
- border-bottom: #DDDFE5 1px solid;
|
|
|
+ border-top: #dddfe5 1px solid;
|
|
|
+ border-bottom: #dddfe5 1px solid;
|
|
|
}
|
|
|
}
|
|
|
</style>
|