修改登陆页

pull/81/head
starsliao 1 year ago
parent 66d7a01ca2
commit a477b94ab6

@ -64,15 +64,13 @@ class Logo(Resource):
try: try:
b64img = base64.b64encode(img.read()).decode('utf-8') b64img = base64.b64encode(img.read()).decode('utf-8')
consul_kv.put_kv(consul_kv_path,b64img) consul_kv.put_kv(consul_kv_path,b64img)
return {"code": 20000, "data": "导入成功!"} return {"code": 20000, "data": "LOGO设置成功!"}
except Exception as e: except Exception as e:
logger.error(f"【logo】导入失败,{e}\n{traceback.format_exc()}") logger.error(f"【logo】导入失败,{e}\n{traceback.format_exc()}")
return {"code": 50000, "data": "导入失败!"} return {"code": 50000, "data": "LOGO导入失败!"}
def get(self, logo_opt): def get(self, logo_opt):
if logo_opt == 'logo': if logo_opt == 'logo':
isbig = consul_kv.get_value('ConsulManager/img/isbig') isbig = consul_kv.get_value('ConsulManager/img/isbig')
if isbig == {}:
isbig = True
if isbig: if isbig:
consul_kv_path = 'ConsulManager/img/biglogo' consul_kv_path = 'ConsulManager/img/biglogo'
else: else:

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
export PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
tsspath="/opt/tensuns" tsspath="/opt/tensuns"
uuid=`uuidgen` uuid=`uuidgen`
adminpwd=`uuidgen|awk -F- '{print $1}'` adminpwd=`uuidgen|awk -F- '{print $1}'`

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 144 KiB

@ -46,7 +46,7 @@ Object.keys(filters).forEach(key => {
}) })
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.prototype.VER = 'v1.0.0' Vue.prototype.VER = 'v1.0.1'
new Vue({ new Vue({
el: '#app', el: '#app',

@ -1,6 +1,6 @@
module.exports = { module.exports = {
title: '后羿 - TenSunS', title: 'TenSunS',
/** /**
* @type {boolean} true | false * @type {boolean} true | false

@ -1,16 +0,0 @@
module.exports = {
title: '后羿 - TenSunS',
/**
* @type {boolean} true | false
* @description Whether fix the header
*/
fixedHeader: false,
/**
* @type {boolean} true | false
* @description Whether show the logo in sidebar
*/
sidebarLogo: false
}

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<el-alert type="success" center close-text=""> <el-alert type="success" center close-text="">
图片大小不能超过512KB,建议使用<el-link type="primary" href="https://tinypng.com/" target="_blank">TinyPNG</el-link>线 图片大小不能超过380KB,建议使用<el-link type="primary" href="https://tinypng.com/" target="_blank">TinyPNG</el-link>线
</el-alert> </el-alert>
<el-row> <el-row>
<el-col :span="8" align='center'><div class="grid-content bg-purple"> <el-col :span="8" align='center'><div class="grid-content bg-purple">
@ -154,24 +154,36 @@ export default {
}, },
handleAvatarSuccess1(res, file) { handleAvatarSuccess1(res, file) {
this.imageUrl1 = URL.createObjectURL(file.raw) this.imageUrl1 = URL.createObjectURL(file.raw)
this.$message.success('LOGO设置成功!') if (res.code === 20000) {
this.$message.success(res.data)
} else {
this.$message.error(res.data)
}
}, },
handleAvatarSuccess2(res, file) { handleAvatarSuccess2(res, file) {
this.imageUrl2 = URL.createObjectURL(file.raw) this.imageUrl2 = URL.createObjectURL(file.raw)
this.$message.success('LOGO设置成功!') if (res.code === 20000) {
this.$message.success(res.data)
} else {
this.$message.error(res.data)
}
}, },
handleAvatarSuccess3(res, file) { handleAvatarSuccess3(res, file) {
this.imageUrl3 = URL.createObjectURL(file.raw) this.imageUrl3 = URL.createObjectURL(file.raw)
this.$message.success('LOGO设置成功!') if (res.code === 20000) {
this.$message.success(res.data)
} else {
this.$message.error(res.data)
}
}, },
beforeAvatarUpload(file) { beforeAvatarUpload(file) {
const isJPG = file.type === 'image/jpeg' || file.type === 'image/png' const isJPG = file.type === 'image/jpeg' || file.type === 'image/png'
const isLt2M = file.size / 1024 < 512 const isLt2M = file.size / 1024 < 380
if (!isJPG) { if (!isJPG) {
this.$message.error('上传LOGO图片只能是 JPG/PNG 格式!') this.$message.error('上传LOGO图片只能是 JPG/PNG 格式!')
} }
if (!isLt2M) { if (!isLt2M) {
this.$message.error('上传LOGO图片大小不能超过 512KB!') this.$message.error('上传LOGO图片大小不能超过 380KB!')
} }
return isJPG && isLt2M return isJPG && isLt2M
} }

@ -1,13 +1,13 @@
<template> <template>
<div class="login-container" :style="{ 'background-image': 'url(' + loginbgimg + ')' }"> <div class="login-container" :style="{ 'background-image': 'url(' + loginbgimg + ')' }">
<div v-if="isbig" class="title-container" style="text-align:center"> <div v-if="isbig" class="title-container" style="text-align:center; padding: 160px 70px 0;">
<br><br> <br><br>
<img :src="loginlogo" width="720" :height=height> <img :src="loginlogo" width="720" :height=height>
<br><br> <br><br>
</div> </div>
<div v-else class="title-container" style="text-align:center; padding: 160px 70px 0;"> <div v-else class="title-container" style="text-align:center; padding: 260px 70px 0;">
<img :src="loginlogo" width="100" height="100"><br><br><br><br> <img :src="loginlogo" width="100" height="100"><br><br><br>
<h3 style="font-size:45px" class="title">{{ logintitle }}</h3><br> <h1 style="font-size:40px" class="title">{{ logintitle }}</h1>
</div> </div>
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left" style="padding: 10px 100px 0;"> <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left" style="padding: 10px 100px 0;">
<el-form-item prop="username"> <el-form-item prop="username">
@ -17,7 +17,7 @@
<el-input <el-input
ref="username" ref="username"
v-model="loginForm.username" v-model="loginForm.username"
placeholder="Username" placeholder="用户名"
name="username" name="username"
type="text" type="text"
tabindex="1" tabindex="1"
@ -34,7 +34,7 @@
ref="password" ref="password"
v-model="loginForm.password" v-model="loginForm.password"
:type="passwordType" :type="passwordType"
placeholder="Password" placeholder="密码"
name="password" name="password"
tabindex="2" tabindex="2"
auto-complete="on" auto-complete="on"
@ -45,7 +45,7 @@
</span> </span>
</el-form-item> </el-form-item>
<!-- <el-checkbox v-model="loginForm.Ldapchecked" label="启动ldap验证" border class="ldap" /> --> <!-- <el-checkbox v-model="loginForm.Ldapchecked" label="启动ldap验证" border class="ldap" /> -->
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin"> </el-button> <el-button :loading="loading" type="primary" round class="login-button" @click.native.prevent="handleLogin"> </el-button>
</el-form> </el-form>
<div align="center" class="title-container"> <div align="center" class="title-container">
<span style="font-size:12px" class="title">{{ VER }}</span> <span style="font-size:12px" class="title">{{ VER }}</span>
@ -93,7 +93,7 @@ export default {
passwordType: 'password', passwordType: 'password',
loginlogo: '', loginlogo: '',
loginbgimg: '', loginbgimg: '',
logintitle: 'T e n S u n S', logintitle: 'Welcome to TenSunS',
isbig: true, isbig: true,
height: '330', height: '330',
redirect: undefined redirect: undefined
@ -219,12 +219,25 @@ $cursor: #fff;
} }
} }
.login-button {
width:60%;
display: block;
margin: 0 auto;
margin-bottom:15px;
border: 0px solid rgba(255, 255, 255, 0);
background: rgba(0, 0, 0, 0.2);
}
.el-form-item { .el-form-item {
border: 2px solid rgba(255, 255, 255, 0.3); border: 0px solid rgba(255, 255, 255, 0);
background: rgba(0, 0, 0, 0.1); background: rgba(0, 0, 0, 0.1);
border-radius: 5px; border-radius: 5px;
color: #454545; color: #454545;
} }
.el-form-item__content {
line-height: 33px;
position: relative;
font-size: 14px
}
} }
</style> </style>

Loading…
Cancel
Save