Browse Source

修改登陆页

pull/81/head
starsliao 1 year ago
parent
commit
a477b94ab6
  1. 6
      flask-consul/views/login.py
  2. 1
      install/docker-compose/all_install.sh
  3. BIN
      vue-consul/src/assets/login_images/bg.png
  4. 2
      vue-consul/src/main.js
  5. 2
      vue-consul/src/settings.js
  6. 16
      vue-consul/src/settings.js.tensuns
  7. 24
      vue-consul/src/views/ldap/logo.vue
  8. 31
      vue-consul/src/views/login/index.vue

6
flask-consul/views/login.py

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

1
install/docker-compose/all_install.sh

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

BIN
vue-consul/src/assets/login_images/bg.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 144 KiB

2
vue-consul/src/main.js

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

2
vue-consul/src/settings.js

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

16
vue-consul/src/settings.js.tensuns

@ -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
}

24
vue-consul/src/views/ldap/logo.vue

@ -1,7 +1,7 @@
<template>
<div>
<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-row>
<el-col :span="8" align='center'><div class="grid-content bg-purple">
@ -154,24 +154,36 @@ export default {
},
handleAvatarSuccess1(res, file) {
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) {
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) {
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) {
const isJPG = file.type === 'image/jpeg' || file.type === 'image/png'
const isLt2M = file.size / 1024 < 512
const isLt2M = file.size / 1024 < 380
if (!isJPG) {
this.$message.error('上传LOGO图片只能是 JPG/PNG 格式!')
}
if (!isLt2M) {
this.$message.error('上传LOGO图片大小不能超过 512KB!')
this.$message.error('上传LOGO图片大小不能超过 380KB!')
}
return isJPG && isLt2M
}

31
vue-consul/src/views/login/index.vue

@ -1,13 +1,13 @@
<template>
<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>
<img :src="loginlogo" width="720" :height=height>
<br><br>
</div>
<div v-else class="title-container" style="text-align:center; padding: 160px 70px 0;">
<img :src="loginlogo" width="100" height="100"><br><br><br><br>
<h3 style="font-size:45px" class="title">{{ logintitle }}</h3><br>
<div v-else class="title-container" style="text-align:center; padding: 260px 70px 0;">
<img :src="loginlogo" width="100" height="100"><br><br><br>
<h1 style="font-size:40px" class="title">{{ logintitle }}</h1>
</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-item prop="username">
@ -17,7 +17,7 @@
<el-input
ref="username"
v-model="loginForm.username"
placeholder="Username"
placeholder="用户名"
name="username"
type="text"
tabindex="1"
@ -34,7 +34,7 @@
ref="password"
v-model="loginForm.password"
:type="passwordType"
placeholder="Password"
placeholder="密码"
name="password"
tabindex="2"
auto-complete="on"
@ -45,7 +45,7 @@
</span>
</el-form-item>
<!-- <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>
<div align="center" class="title-container">
<span style="font-size:12px" class="title">{{ VER }}</span>
@ -93,7 +93,7 @@ export default {
passwordType: 'password',
loginlogo: '',
loginbgimg: '',
logintitle: 'T e n S u n S',
logintitle: 'Welcome to TenSunS',
isbig: true,
height: '330',
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 {
border: 2px solid rgba(255, 255, 255, 0.3);
border: 0px solid rgba(255, 255, 255, 0);
background: rgba(0, 0, 0, 0.1);
border-radius: 5px;
color: #454545;
}
.el-form-item__content {
line-height: 33px;
position: relative;
font-size: 14px
}
}
</style>

Loading…
Cancel
Save