feat(系统设置): 显示设置

This commit is contained in:
Captain.B 2020-11-05 12:31:55 +08:00
parent da97ae04fd
commit b3682de7a4
6 changed files with 320 additions and 283 deletions

View File

@ -28,7 +28,7 @@ import java.util.Map;
import java.util.Objects;
@Configuration
@ConditionalOnProperty(prefix="sso",name = "mode", havingValue = "local", matchIfMissing = true)
@ConditionalOnProperty(prefix = "sso", name = "mode", havingValue = "local", matchIfMissing = true)
public class ShiroConfig implements EnvironmentAware {
private Environment env;
@ -43,6 +43,8 @@ public class ShiroConfig implements EnvironmentAware {
shiroFilterFactoryBean.getFilters().put("apikey", new ApiKeyFilter());
Map<String, String> filterChainDefinitionMap = shiroFilterFactoryBean.getFilterChainDefinitionMap();
ShiroUtils.loadBaseFilterChain(filterChainDefinitionMap);
filterChainDefinitionMap.put("/display/info", "anon");
filterChainDefinitionMap.put("/display/file/*", "anon");
filterChainDefinitionMap.put("/**", "apikey, authc");
return shiroFilterFactoryBean;
}

View File

@ -14,6 +14,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
@ -141,4 +142,12 @@ public class FileService {
example.createCriteria().andIdIn(fileIds);
return fileMetadataMapper.selectByExample(example);
}
public void deleteFileById(String fileId) {
deleteFileByIds(Collections.singletonList(fileId));
}
public FileMetadata getFileMetadataById(String fileId) {
return fileMetadataMapper.selectByPrimaryKey(fileId);
}
}

@ -1 +1 @@
Subproject commit 597a1681d1327a622b2a38bac3f17ae9daf95442
Subproject commit 7238c00412997c529a2a28a47956977ebf83aa13

View File

@ -7,7 +7,8 @@
</el-row>
<el-row id="header-top" type="flex" justify="space-between" align="middle">
<el-col :span="12">
<a class="logo"/>
<img v-if="logoId" :src="'/display/file/' + logoId" style="width: 156px;height: 37px;" alt="">
<a v-else class="logo"/>
<ms-top-menus/>
</el-col>
@ -24,107 +25,117 @@
</template>
<script>
import MsTopMenus from "./components/common/head/HeaderTopMenus";
import MsView from "./components/common/router/View";
import MsUser from "./components/common/head/HeaderUser";
import MsHeaderOrgWs from "./components/common/head/HeaderOrgWs";
import MsLanguageSwitch from "./components/common/head/LanguageSwitch";
import {saveLocalStorage} from "../common/js/utils";
import MsTopMenus from "./components/common/head/HeaderTopMenus";
import MsView from "./components/common/router/View";
import MsUser from "./components/common/head/HeaderUser";
import MsHeaderOrgWs from "./components/common/head/HeaderOrgWs";
import MsLanguageSwitch from "./components/common/head/LanguageSwitch";
import {saveLocalStorage} from "@/common/js/utils";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const header = requireComponent.keys().length > 0 ? requireComponent("./license/LicenseMessage.vue") : {};
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const header = requireComponent.keys().length > 0 ? requireComponent("./license/LicenseMessage.vue") : {};
export default {
name: 'app',
props: {},
data() {
return {
licenseHeader: null,
auth: false,
header: {},
}
},
beforeCreate() {
this.$get("/isLogin").then(response => {
if (response.data.success) {
this.$setLang(response.data.data.language);
saveLocalStorage(response.data);
this.auth = true;
//
if (header.default !== undefined) {
this.licenseHeader = "LicenseMessage";
}
} else {
window.location.href = "/login"
}
}).catch(() => {
window.location.href = "/login"
});
},
components: {
MsLanguageSwitch,
MsUser,
MsView,
MsTopMenus,
MsHeaderOrgWs,
"LicenseMessage": header.default
export default {
name: 'app',
props: {},
data() {
return {
licenseHeader: null,
auth: false,
header: {},
logoId: '_blank',
}
},
beforeCreate() {
this.$get("/isLogin").then(response => {
if (response.data.success) {
this.$setLang(response.data.data.language);
saveLocalStorage(response.data);
this.auth = true;
//
if (header.default !== undefined) {
this.licenseHeader = "LicenseMessage";
}
} else {
window.location.href = "/login"
}
}).catch(() => {
window.location.href = "/login"
});
},
created() {
this.$get("/display/info", response => {
this.logoId = response.data[0].paramValue;
let title = response.data[4].paramValue;
if (title) {
document.title = title;
}
})
},
components: {
MsLanguageSwitch,
MsUser,
MsView,
MsTopMenus,
MsHeaderOrgWs,
"LicenseMessage": header.default
}
}
</script>
<style scoped>
#header-top {
width: 100%;
padding: 0 10px;
background-color: rgb(44, 42, 72);
color: rgb(245, 245, 245);
font-size: 14px;
}
#header-top {
width: 100%;
padding: 0 10px;
background-color: rgb(44, 42, 72);
color: rgb(245, 245, 245);
font-size: 14px;
}
.logo {
width: 156px;
margin-bottom: 0;
border: 0;
margin-right: 20px;
display: inline-block;
line-height: 37px;
background-size: 156px 30px;
box-sizing: border-box;
height: 37px;
background-repeat: no-repeat;
background-position: 50% center;
background-image: url("../assets/logo-light-MeterSphere.svg");
}
.logo {
width: 156px;
margin-bottom: 0;
border: 0;
margin-right: 20px;
display: inline-block;
line-height: 37px;
background-size: 156px 30px;
box-sizing: border-box;
height: 37px;
background-repeat: no-repeat;
background-position: 50% center;
background-image: url("../assets/logo-light-MeterSphere.svg");
}
.menus > * {
color: inherit;
padding: 0;
max-width: 180px;
white-space: pre;
cursor: pointer;
line-height: 40px;
}
.menus > * {
color: inherit;
padding: 0;
max-width: 180px;
white-space: pre;
cursor: pointer;
line-height: 40px;
}
.header-top-menus {
display: inline-block;
border: 0;
}
.header-top-menus {
display: inline-block;
border: 0;
}
.menus > a {
padding-right: 15px;
text-decoration: none;
}
.menus > a {
padding-right: 15px;
text-decoration: none;
}
.align-right {
float: right;
}
.align-right {
float: right;
}
.license-head {
height: 30px;
background: #BA331B;
text-align: center;
line-height: 30px;
color: white;
}
.license-head {
height: 30px;
background: #BA331B;
text-align: center;
line-height: 30px;
color: white;
}
</style>

@ -1 +1 @@
Subproject commit f6f172c6451d0f9c51f5e3246a66dde9edcd7a5d
Subproject commit fbada3651ec6a756d416485987e5b9e82a48e49e

View File

@ -4,15 +4,16 @@
<el-col :span="12">
<el-form :model="form" :rules="rules" ref="form">
<div class="logo">
<img src="../assets/logo-dark-MeterSphere.svg" style="width: 224px" alt="">
<img v-if="loginLogoId" :src="'/display/file/' + loginLogoId" style="width: 224px;height: 45px;" alt="">
<img v-else src="../assets/logo-dark-MeterSphere.svg" style="width: 224px; " alt="">
</div>
<div class="title">
<span id="s1">{{$t('commons.login')}}</span>
<span id="s1">{{ $t('commons.login') }}</span>
<span id="s2">MeterSphere</span>
</div>
<div class="border"></div>
<div class="welcome">
{{$t('commons.welcome')}}
{{ $t('commons.welcome') }}
</div>
<div class="form">
<el-form-item v-slot:default>
@ -32,241 +33,255 @@
</div>
<div class="btn">
<el-button type="primary" class="submit" @click="submit('form')">
{{$t('commons.login')}}
{{ $t('commons.login') }}
</el-button>
</div>
<div class="msg">
{{msg}}
{{ msg }}
</div>
</el-form>
</el-col>
<el-col :span="12" class="image">
<div></div>
<el-col :span="12">
<img v-if="loginImageId" :src="'/display/file/' + loginImageId" style="height: 560px; width: 100%">
<img v-else src="../assets/info.png" style="height: 560px; width: 100%">
</el-col>
</el-row>
</div>
</template>
<script>
import {saveLocalStorage} from '../common/js/utils';
import {DEFAULT_LANGUAGE} from "../common/js/constants";
import {saveLocalStorage} from '@/common/js/utils';
import {DEFAULT_LANGUAGE} from "@/common/js/constants";
export default {
name: "Login",
data() {
/*let validateEmail = (rule, value, callback) => {
// eslint-disable-next-line no-useless-escape
let EMAIL_REGEX = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if (!EMAIL_REGEX.test(value)) {
callback(new Error('邮箱格式不正确'));
export default {
name: "Login",
data() {
/*let validateEmail = (rule, value, callback) => {
// eslint-disable-next-line no-useless-escape
let EMAIL_REGEX = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if (!EMAIL_REGEX.test(value)) {
callback(new Error('邮箱格式不正确'));
} else {
callback();
}
};*/
return {
result: {},
form: {
username: '',
password: '',
authenticate: 'LOCAL'
},
rules: {
username: [
{required: true, message: this.$t('commons.input_login_username'), trigger: 'blur'},
],
password: [
{required: true, message: this.$t('commons.input_password'), trigger: 'blur'},
{min: 6, max: 20, message: this.$t('commons.input_limit', [6, 20]), trigger: 'blur'}
]
},
msg: '',
ready: false,
openLdap: false,
loginLogoId: '_blank',
loginImageId: '_blank',
}
},
beforeCreate() {
this.result = this.$get("/isLogin").then(response => {
if (!response.data.success) {
if (response.data.message === 'sso') {
window.location.href = "/sso/login"
} else {
callback();
this.ready = true;
}
};*/
return {
result: {},
form: {
username: '',
password: '',
authenticate: 'LOCAL'
},
rules: {
username: [
{required: true, message: this.$t('commons.input_login_username'), trigger: 'blur'},
],
password: [
{required: true, message: this.$t('commons.input_password'), trigger: 'blur'},
{min: 6, max: 20, message: this.$t('commons.input_limit', [6, 20]), trigger: 'blur'}
]
},
msg: '',
ready: false,
openLdap: false
} else {
let user = response.data.data;
saveLocalStorage(response.data);
this.getLanguage(user.language);
window.location.href = "/"
}
});
this.$get("/ldap/open", response => {
this.openLdap = response.data;
})
},
created: function () {
// ,,
document.addEventListener("keydown", this.watchEnter);
this.result = this.$get("/display/info", response => {
this.loginLogoId = response.data[1].paramValue;
this.loginImageId = response.data[2].paramValue;
let loginTitle = response.data[3].paramValue;
if (loginTitle) {
document.title = loginTitle;
}
})
},
destroyed() {
//
document.removeEventListener("keydown", this.watchEnter);
},
methods: {
//
watchEnter(e) {
let keyNum = e.which; //
//keycody=13
if (keyNum === 13) {
//
this.submit('form');
}
},
beforeCreate() {
this.$get("/isLogin").then(response => {
if (!response.data.success) {
if (response.data.message === 'sso') {
window.location.href = "/sso/login"
} else {
this.ready = true;
submit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
switch (this.form.authenticate) {
case "LOCAL":
this.normalLogin();
break;
case "LDAP":
this.ldapLogin();
break;
default:
this.normalLogin();
}
} else {
let user = response.data.data;
saveLocalStorage(response.data);
this.getLanguage(user.language);
window.location.href = "/"
return false;
}
});
this.$get("/ldap/open", response => {
this.openLdap = response.data;
})
},
created: function () {
// ,,
document.addEventListener("keydown", this.watchEnter);
normalLogin() {
this.result = this.$post("signin", this.form, response => {
saveLocalStorage(response);
sessionStorage.setItem('loginSuccess', 'true');
this.getLanguage(response.data.language);
});
},
destroyed() {
//
document.removeEventListener("keydown", this.watchEnter);
ldapLogin() {
this.result = this.$post("ldap/signin", this.form, response => {
saveLocalStorage(response);
sessionStorage.setItem('loginSuccess', 'true');
this.getLanguage(response.data.language);
});
},
methods: {
//
watchEnter(e) {
let keyNum = e.which; //
//keycody=13
if (keyNum === 13) {
//
this.submit('form');
}
},
submit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
switch (this.form.authenticate) {
case "LOCAL":
this.normalLogin();
break;
case "LDAP":
this.ldapLogin();
break;
default:
this.normalLogin();
}
} else {
return false;
}
});
},
normalLogin() {
this.result = this.$post("signin", this.form, response => {
saveLocalStorage(response);
sessionStorage.setItem('loginSuccess', 'true');
this.getLanguage(response.data.language);
});
},
ldapLogin() {
this.result = this.$post("ldap/signin", this.form, response => {
saveLocalStorage(response);
sessionStorage.setItem('loginSuccess', 'true');
this.getLanguage(response.data.language);
});
},
getLanguage(language) {
if (!language) {
this.$get("language", response => {
language = response.data;
localStorage.setItem(DEFAULT_LANGUAGE, language);
window.location.href = "/"
})
} else {
getLanguage(language) {
if (!language) {
this.$get("language", response => {
language = response.data;
localStorage.setItem(DEFAULT_LANGUAGE, language);
window.location.href = "/"
}
})
} else {
window.location.href = "/"
}
}
}
}
</script>
<style scoped>
.container {
min-width: 800px;
max-width: 1440px;
height: 560px;
margin: calc((100vh - 560px) / 2) auto 0;
background-color: #FFFFFF;
}
.container {
min-width: 800px;
max-width: 1440px;
height: 560px;
margin: calc((100vh - 560px) / 2) auto 0;
background-color: #FFFFFF;
}
.logo {
margin: 30px 30px 0;
}
.logo {
margin: 30px 30px 0;
}
.title {
margin-top: 50px;
font-size: 32px;
letter-spacing: 0;
text-align: center;
}
.title {
margin-top: 50px;
font-size: 32px;
letter-spacing: 0;
text-align: center;
}
.title > #s1 {
color: #999999;
}
.title > #s1 {
color: #999999;
}
.title > #s2 {
color: #151515;
}
.title > #s2 {
color: #151515;
}
.border {
height: 2px;
margin: 20px auto 20px;
position: relative;
width: 80px;
background: #8B479B;
}
.border {
height: 2px;
margin: 20px auto 20px;
position: relative;
width: 80px;
background: #8B479B;
}
.welcome {
margin-top: 50px;
font-size: 14px;
color: #999999;
letter-spacing: 0;
line-height: 18px;
text-align: center;
}
.welcome {
margin-top: 50px;
font-size: 14px;
color: #999999;
letter-spacing: 0;
line-height: 18px;
text-align: center;
}
.form {
margin-top: 30px;
padding: 0 40px;
}
.form {
margin-top: 30px;
padding: 0 40px;
}
.btn {
margin-top: 40px;
padding: 0 40px;
}
.btn {
margin-top: 40px;
padding: 0 40px;
}
.btn > .submit {
width: 100%;
border-radius: 0;
border-color: #8B479B;
background-color: #8B479B;
}
.btn > .submit {
width: 100%;
border-radius: 0;
border-color: #8B479B;
background-color: #8B479B;
}
.btn > .submit:hover {
border-color: rgba(139, 71, 155, 0.9);
background-color: rgba(139, 71, 155, 0.9);
}
.btn > .submit:hover {
border-color: rgba(139, 71, 155, 0.9);
background-color: rgba(139, 71, 155, 0.9);
}
.btn > .submit:active {
border-color: rgba(139, 71, 155, 0.8);
background-color: rgba(139, 71, 155, 0.8);
}
.btn > .submit:active {
border-color: rgba(139, 71, 155, 0.8);
background-color: rgba(139, 71, 155, 0.8);
}
.msg {
margin-top: 10px;
padding: 0 40px;
color: red;
text-align: center;
}
.msg {
margin-top: 10px;
padding: 0 40px;
color: red;
text-align: center;
}
.image {
background: url(../assets/info.png);
height: 560px;
}
.image {
background: url(../assets/info.png);
height: 560px;
}
</style>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Neue Haas Grotesk Text Pro", "Arial Nova", "Segoe UI", "Helvetica Neue", ".PingFang SC", "PingFang SC", "Source Han Sans SC", "Noto Sans CJK SC", "Source Han Sans CN", "Noto Sans SC", "Source Han Sans TC", "Noto Sans CJK TC", "Hiragino Sans GB", sans-serif;
font-size: 14px;
background-color: #F5F5F5;
line-height: 26px;
color: #2B415C;
-webkit-font-smoothing: antialiased;
margin: 0;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Neue Haas Grotesk Text Pro", "Arial Nova", "Segoe UI", "Helvetica Neue", ".PingFang SC", "PingFang SC", "Source Han Sans SC", "Noto Sans CJK SC", "Source Han Sans CN", "Noto Sans SC", "Source Han Sans TC", "Noto Sans CJK TC", "Hiragino Sans GB", sans-serif;
font-size: 14px;
background-color: #F5F5F5;
line-height: 26px;
color: #2B415C;
-webkit-font-smoothing: antialiased;
margin: 0;
}
.form .el-input > .el-input__inner {
border-radius: 0;
}
.form .el-input > .el-input__inner {
border-radius: 0;
}
</style>