UP

UP
This commit is contained in:
sc 2021-10-13 19:03:06 +08:00
parent b2840617a0
commit 1c45eba3d4
6 changed files with 179 additions and 99 deletions

BIN
public/img/auth_banner.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

View File

@ -1,4 +1,19 @@
export default {
login: {
slogan: 'High performance / delicate / grace',
describe: 'Vue3 + element plus based front-end solutions in the background.',
signInTitle: 'Sign in',
rememberMe: 'Remember me',
forgetPassword: 'Forget password',
signIn: 'Sign in',
signInOther: 'Sign in with',
userPlaceholder: 'user / phone / email',
userError: 'Please input a user name',
PWPlaceholder: 'Please input a password',
PWError: 'Please input a password',
admin: 'Administrator',
user: 'User'
},
user: {
dynamic: 'Dynamic',
info: 'User Info',

View File

@ -1,4 +1,19 @@
export default {
login: {
slogan: '高性能 / 精緻 / 優雅',
describe: 'Vue 3+Element-Palusによる中バックグラウンドの先端解決策。',
signInTitle: 'ユーザー登録',
rememberMe: '覚えてください',
forgetPassword: 'パスワードを忘れます',
signIn: 'ログイン',
signInOther: 'その他のログイン方式',
userPlaceholder: 'ユーザ名/携帯電話/メールアドレス',
userError: 'ユーザ名を入力してください',
PWPlaceholder: 'パスワードを入力してください',
PWError: 'パスワードを入力してください',
admin: '管理者',
user: 'ユーザー'
},
user: {
dynamic: 'ダイナミック',
info: 'ユーザー',

View File

@ -1,4 +1,19 @@
export default {
login: {
slogan: '高性能 / 精致 / 优雅',
describe: '基于Vue3 + Element-Plus 的中后台前端解决方案。',
signInTitle: '用户登录',
rememberMe: '记住我',
forgetPassword: '忘记密码',
signIn: '登录',
signInOther: '其他登录方式',
userPlaceholder: '用户名 / 手机 / 邮箱',
userError: '请输入用户名',
PWPlaceholder: '请输入密码',
PWError: '请输入密码',
admin: '管理员',
user: '用户'
},
user: {
dynamic: '近期动态',
info: '个人信息',

View File

@ -31,13 +31,7 @@
#app {background: $--background;color: $--text-color;}
/* 登录 */
.login_bg {background: $--background !important;}
.login-form {background: $--card-background !important;}
.login-logo h2 {color: $--text-color !important;}
@media (max-width: 1000px){
.login_bg {background: $--card-background !important;}
.login_container {background: $--card-background !important;}
}
.login_bg {background: $--card-background !important;}
.el-menu {
--el-menu-item-hover-fill: rgba(0,0,0,0.2);

View File

@ -1,61 +1,77 @@
<template>
<div class="login_bg">
<div class="login_container">
<div class="login_body">
<div class="login-form">
<div class="login-logo">
<img class="logo" :alt="$CONFIG.APP_NAME" src="img/logo.png">
<h2>用户登录</h2>
</div>
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="0" size="large">
<el-form-item prop="user">
<el-input v-model="ruleForm.user" prefix-icon="el-icon-user" clearable placeholder="用户名 / 手机 / 邮箱">
<template #append>
<el-select v-model="userType" placeholder="请选择" style="width: 130px;">
<el-option label="管理员" value="admin"></el-option>
<el-option label="用户" value="user"></el-option>
</el-select>
</template>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="ruleForm.password" prefix-icon="el-icon-lock" clearable show-password placeholder="请输入密码"></el-input>
</el-form-item>
<el-form-item style="margin-bottom: 10px;">
<el-row>
<el-col :span="12">
<el-checkbox label="记住我" v-model="ruleForm.autologin"></el-checkbox>
</el-col>
<el-col :span="12" style="text-align: right;">
<el-button type="text">忘记密码</el-button>
</el-col>
</el-row>
</el-form-item>
<el-form-item>
<el-button type="primary" style="width: 100%;" :loading="islogin" round @click="login"> </el-button>
</el-form-item>
</el-form>
<el-divider>其他登录方式</el-divider>
<div class="login-oauth">
<el-button size="small" type="primary" icon="el-icon-platform-eleme" circle></el-button>
<el-button size="small" type="success" icon="el-icon-s-goods" circle></el-button>
<el-button size="small" type="info" icon="el-icon-s-promotion" circle></el-button>
<el-button size="small" type="warning" icon="el-icon-menu" circle></el-button>
</div>
</div>
<div class="login-sidebox">
<div class="login-sidebox__title">
<h2>SCUI</h2>
<h4>高性能 / 精致 / 优雅</h4>
<p>基于Vue3 + Element-Plus 的中后台前端解决方案</p>
</div>
<img src="img/loginbg.svg"/>
<div class="login_adv" style="background-image: url(img/auth_banner.jpg);">
<div class="login_adv__title">
<h2>SCUI</h2>
<h4>{{ $t('login.slogan') }}</h4>
<p>{{ $t('login.describe') }}</p>
<div>
<span><i class="sc-icon-vuejs-fill"></i></span>
<span><i class="add el-icon-plus"></i></span>
<span><i class="el-icon-platform-eleme"></i></span>
</div>
</div>
<div class="login_adv__bottom">
© {{$CONFIG.APP_NAME}} {{$CONFIG.APP_VER}}
</div>
</div>
<div class="login_main">
<div class="login_config">
<el-button :icon="config.theme=='dark'?'el-icon-sunny':'el-icon-moon'" circle type="info" @click="configTheme"></el-button>
<el-dropdown trigger="click" placement="bottom-end" @command="configLang">
<el-button circle>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 512 512"><path d="M478.33 433.6l-90-218a22 22 0 0 0-40.67 0l-90 218a22 22 0 1 0 40.67 16.79L316.66 406h102.67l18.33 44.39A22 22 0 0 0 458 464a22 22 0 0 0 20.32-30.4zM334.83 362L368 281.65L401.17 362z" fill="currentColor"></path><path d="M267.84 342.92a22 22 0 0 0-4.89-30.7c-.2-.15-15-11.13-36.49-34.73c39.65-53.68 62.11-114.75 71.27-143.49H330a22 22 0 0 0 0-44H214V70a22 22 0 0 0-44 0v20H54a22 22 0 0 0 0 44h197.25c-9.52 26.95-27.05 69.5-53.79 108.36c-31.41-41.68-43.08-68.65-43.17-68.87a22 22 0 0 0-40.58 17c.58 1.38 14.55 34.23 52.86 83.93c.92 1.19 1.83 2.35 2.74 3.51c-39.24 44.35-77.74 71.86-93.85 80.74a22 22 0 1 0 21.07 38.63c2.16-1.18 48.6-26.89 101.63-85.59c22.52 24.08 38 35.44 38.93 36.1a22 22 0 0 0 30.75-4.9z" fill="currentColor"></path></svg>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item v-for="item in lang" :key="item.value" :command="item" :class="{'selected':config.lang==item.value}">{{item.name}}</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
<div class="login-form">
<div class="login-header">
<div class="logo">
<img :alt="$CONFIG.APP_NAME" src="img/logo.png">
<label>{{$CONFIG.APP_NAME}}</label>
</div>
<h2>{{ $t('login.signInTitle') }}</h2>
</div>
<el-form ref="loginForm" :model="ruleForm" :rules="rules" label-width="0" size="large">
<el-form-item prop="user">
<el-input v-model="ruleForm.user" prefix-icon="el-icon-user" clearable :placeholder="$t('login.userPlaceholder')">
<template #append>
<el-select v-model="userType" style="width: 130px;">
<el-option :label="$t('login.admin')" value="admin"></el-option>
<el-option :label="$t('login.user')" value="user"></el-option>
</el-select>
</template>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="ruleForm.password" prefix-icon="el-icon-lock" clearable show-password :placeholder="$t('login.PWPlaceholder')"></el-input>
</el-form-item>
<el-form-item style="margin-bottom: 10px;">
<el-row>
<el-col :span="12">
<el-checkbox :label="$t('login.rememberMe')" v-model="ruleForm.autologin"></el-checkbox>
</el-col>
<el-col :span="12" style="text-align: right;">
<el-button type="text">{{ $t('login.forgetPassword') }}</el-button>
</el-col>
</el-row>
</el-form-item>
<el-form-item>
<el-button type="primary" style="width: 100%;" :loading="islogin" round @click="login">{{ $t('login.signIn') }}</el-button>
</el-form-item>
</el-form>
<el-divider>{{ $t('login.signInOther') }}</el-divider>
<div class="login-oauth">
<el-button size="small" type="success" icon="sc-icon-wechat-fill" circle></el-button>
</div>
</div>
<div class="login-footer">© {{$CONFIG.APP_NAME}} {{$CONFIG.APP_VER}}</div>
</div>
</div>
</template>
@ -72,13 +88,31 @@
},
rules: {
user: [
{required: true, message: '请输入用户名', trigger: 'blur'}
{required: true, message: this.$t('login.userError'), trigger: 'blur'}
],
password: [
{required: true, message: '请输入密码', trigger: 'blur'}
{required: true, message: this.$t('login.PWError'), trigger: 'blur'}
]
},
islogin: false
islogin: false,
config: {
lang: this.$TOOL.data.get('APP_LANG') || this.$CONFIG.LANG,
theme: this.$TOOL.data.get('APP_THEME') || 'default'
},
lang: [
{
name: '简体中文',
value: 'zh-cn',
},
{
name: 'English',
value: 'en',
},
{
name: '日本語',
value: 'ja',
}
]
}
},
watch:{
@ -90,6 +124,14 @@
this.ruleForm.user = 'user'
this.ruleForm.password = 'user'
}
},
'config.theme'(val){
document.body.setAttribute('data-theme', val)
this.$TOOL.data.set("APP_THEME", val);
},
'config.lang'(val){
this.$i18n.locale = val
this.$TOOL.data.set("APP_LANG", val);
}
},
created: function() {
@ -105,6 +147,10 @@
},
methods: {
async login(){
var validate = await this.$refs.loginForm.validate().catch(()=>{})
if(!validate){ return false }
this.islogin = true
var data = {
username: this.ruleForm.user,
@ -141,54 +187,49 @@
})
this.$message.success("Login Success 登录成功")
this.islogin = false
},
configTheme(){
this.config.theme = this.config.theme=='default'?'dark':'default'
},
configLang(command){
this.config.lang = command.value
}
}
}
</script>
<style scoped>
.login_bg {position: absolute;top:0px;left:0px;right:0px;bottom:0px;}
.login_container {position: absolute;top:50%;left:50%;width: 1100px;margin: 0 auto;z-index: 1;transform: translate(-50%, -50%);}
.login_body {width: inherit;display: flex;box-shadow: 0px 20px 80px 0px rgba(0,0,0,0.3);}
.login-sidebox {width: 50%;padding: 60px;color: #fff;background:var(--el-color-primary);position: relative;overflow: hidden;}
.login-sidebox__title h2 {font-size: 30px;}
.login-sidebox__title h4 {font-size: 18px;margin-top: 10px;font-weight: normal;}
.login-sidebox__title p {font-size: 14px;margin-top:10px;line-height: 1.8;color: rgba(255,255,255,0.6);}
.login-sidebox img {position: absolute;left:-120px;bottom:-160px;width: 550px;}
.login_bg {width: 100%;height: 100%;background: #fff;display: flex;}
.login_adv {width: 33.33333%;background-color: #555;background-size: cover;background-position: center center;background-repeat: no-repeat;position: relative;}
.login_adv__title {color: #fff;padding: 40px;}
.login_adv__title h2 {font-size: 40px;}
.login_adv__title h4 {font-size: 18px;margin-top: 10px;font-weight: normal;}
.login_adv__title p {font-size: 14px;margin-top:10px;line-height: 1.8;color: rgba(255,255,255,0.6);}
.login_adv__title div {margin-top: 10px;display: flex;align-items: center;}
.login_adv__title div span {margin-right: 15px;}
.login_adv__title div i {font-size: 40px;}
.login_adv__title div i.add {font-size: 20px;color: rgba(255,255,255,0.6);}
.login_adv__bottom {position: absolute;left:0px;right: 0px;bottom: 0px;color: #fff;padding: 40px;background-image:linear-gradient(transparent, #000);}
.login-logo {text-align: center;margin-bottom: 30px;}
.login-logo .logo {width: 70px;height: 70px;vertical-align: bottom;}
.login-logo h2 {font-size: 24px;margin-top: 20px;color: #40485b;}
.login-title {margin-top: 20px;}
.login-title h2 {font-size: 22px;font-weight: normal;}
.login-title p {font-size: 12px;margin-top:40px;line-height: 1.8;color: rgba(255,255,255,0.8);}
.login-form {width: 50%;padding: 60px 100px;background: #fff;}
.login_main {flex: 1;overflow: auto;display:flex;}
.login-form {width: 400px;margin: auto;padding:20px 0;}
.login-header {margin-bottom: 20px;}
.login-header .logo {display: flex;align-items: center;}
.login-header .logo img {width: 35px;height: 35px;vertical-align: bottom;margin-right: 10px;}
.login-header .logo label {font-size: 24px;}
.login-header h2 {font-size: 24px;font-weight: bold;margin-top: 50px;}
.login-oauth {display: flex;justify-content:space-around;}
.login-form .el-divider {margin-top:40px;}
.login-footer {text-align: center;color: #999;margin-top: 50px;}
.login_config {position: absolute;top:20px;right: 20px;}
.el-dropdown-menu__item.selected {color: var(--el-color-primary);}
.demo-user-item {display: flex;align-items: center;line-height: 1;padding:10px 0;}
.demo-user-item .icon {margin-right: 20px;}
.demo-user-item .info h2 {font-size: 14px;}
.demo-user-item .info p {color: #666;margin-top: 6px;}
@media (max-height: 650px){
.login_bg {position: static;}
.login_container {position: static;transform: none;margin:50px auto;}
.login-footer {margin-bottom: 50px;}
}
@media (max-width: 1200px){
.login_container {width: 900px;}
.login-form {padding:60px;}
.login-form {width: 340px;}
}
@media (max-width: 1000px){
.login_container {width: 100%;background: #fff;margin: 0;transform:none;top:0px;bottom:0px;left:0px;right: 0px;}
.login_body {box-shadow: none;}
.login-form {width:100%;padding:60px 40px;}
.login-sidebox {display: none;}
.login-footer {margin-top: 0;}
.login_main {display: block;}
.login-form {width:100%;padding:20px 40px;}
.login_adv {display: none;}
}
</style>