Merge branch 'dev' of github.com:dataease/dataease into dev

This commit is contained in:
taojinlong
2022-08-22 16:26:36 +08:00
10 changed files with 177 additions and 71 deletions

View File

@@ -1987,7 +1987,9 @@ export default {
mobileBG: 'Mobile Login page BG',
helpLink: 'Help Document Link',
homeLink: 'Home Link',
defaultHomeLink: 'Default is the system built-in home page'
defaultHomeLink: 'Default is the system built-in home page',
showFoot: 'Show login page footer',
footContent: 'Foot content'
},
auth: {

View File

@@ -1995,7 +1995,9 @@ export default {
mobileBG: '移動端登錄頁背景',
helpLink: '幫助文檔鏈接',
homeLink: '首頁鏈接',
defaultHomeLink: '默認為系統內置首頁'
defaultHomeLink: '默認為系統內置首頁',
showFoot: '顯示登錄頁腳',
footContent: '頁腳內容'
},
auth: {

View File

@@ -2005,8 +2005,9 @@ export default {
mobileBG: '移动端登录页背景',
helpLink: '帮助文档链接',
homeLink: '首页链接',
defaultHomeLink: '默认为系统内置首页'
defaultHomeLink: '默认为系统内置首页',
showFoot: '显示登录页脚',
footContent: '页脚内容'
},
auth: {
no_item_selected: '请在左侧选择组织、角色或用户',

View File

@@ -14,10 +14,11 @@ import {
filterAsyncRouter
} from '@/store/modules/permission'
import {
isMobile
isMobile,
changeFavicon
} from '@/utils/index'
import Layout from '@/layout/index'
// import bus from './utils/bus'
import { getSysUI } from '@/utils/auth'
import { getSocket } from '@/websocket'
@@ -27,7 +28,32 @@ NProgress.configure({
const whiteList = ['/login', '/401', '/404', '/delink', '/nolic'] // no redirect whitelist
router.beforeEach(async(to, from, next) => {
const routeBefore = (callBack) => {
let uiInfo = getSysUI()
if (!uiInfo || Object.keys(uiInfo).length === 0) {
store.dispatch('user/getUI').then(() => {
document.title = getPageTitle()
uiInfo = getSysUI()
if (uiInfo['ui.favicon'] && uiInfo['ui.favicon'].paramValue) {
const faviconUrl = '/system/ui/image/' + this.uiInfo['ui.favicon'].paramValue
changeFavicon(faviconUrl)
}
callBack()
}).catch(err => {
document.title = getPageTitle()
console.error(err)
callBack()
})
} else {
document.title = getPageTitle()
if (uiInfo['ui.favicon'] && uiInfo['ui.favicon'].paramValue) {
const faviconUrl = '/system/ui/image/' + this.uiInfo['ui.favicon'].paramValue
changeFavicon(faviconUrl)
}
callBack()
}
}
router.beforeEach(async(to, from, next) => routeBefore(() => {
// start progress bar
NProgress.start()
const mobileIgnores = ['/delink']
@@ -97,7 +123,7 @@ router.beforeEach(async(to, from, next) => {
NProgress.done()
}
}
})
}))
export const loadMenus = (next, to) => {
buildMenus().then(res => {
const datas = res.data

View File

@@ -106,7 +106,11 @@ export function baseWaterfallOptionAntV(plot, container, chart, action) {
}
function getMeta(chart) {
const meta = {}
const meta = {
field: {
type: 'cat'
}
}
const yaxis = JSON.parse(chart.yaxis)
if (yaxis && yaxis.length > 0) {
const f = yaxis[0]

View File

@@ -1,64 +1,68 @@
<template>
<div v-show="contentShow" class="login-background">
<div class="login-container">
<el-row v-loading="loading" type="flex">
<el-col :span="12">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" size="default">
<div class="login-logo">
<svg-icon v-if="!loginLogoUrl && axiosFinished" icon-class="DataEase" custom-class="login-logo-icon" />
<img v-if="loginLogoUrl && axiosFinished" :src="loginLogoUrl" alt="">
</div>
<div v-if="uiInfo && uiInfo['ui.loginTitle'] && uiInfo['ui.loginTitle'].paramValue" class="login-welcome">
{{ uiInfo['ui.loginTitle'].paramValue }}
</div>
<div v-else class="login-welcome">
{{ $t('login.welcome') + (uiInfo && uiInfo['ui.title'] && uiInfo['ui.title'].paramValue || ' DataEase') }}
</div>
<div class="login-form">
<el-form-item v-if="loginTypes.length > 1">
<el-radio-group v-if="loginTypes.length > 1" v-model="loginForm.loginType" @change="changeLoginType">
<el-radio :label="0" size="mini">{{ $t('login.default_login') }}</el-radio>
<el-radio v-if="loginTypes.includes(1)" :label="1" size="mini">LDAP</el-radio>
<el-radio v-if="loginTypes.includes(2)" :label="2" size="mini">OIDC</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item prop="username">
<el-input v-model="loginForm.username" placeholder="ID" autofocus :disabled="loginTypes.includes(2) && loginForm.loginType === 2" />
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="loginForm.password"
:placeholder="$t('login.password')"
show-password
maxlength="30"
show-word-limit
autocomplete="new-password"
:disabled="loginTypes.includes(2) && loginForm.loginType === 2"
@keypress.enter.native="handleLogin"
/>
</el-form-item>
</div>
<div class="login-btn">
<el-button type="primary" class="submit" size="default" :disabled="loginTypes.includes(2) && loginForm.loginType === 2" @click.native.prevent="handleLogin">
{{ $t('commons.login') }}
</el-button>
<div v-if="uiInfo && uiInfo['ui.demo.tips'] && uiInfo['ui.demo.tips'].paramValue" class="demo-tips">
{{ uiInfo['ui.demo.tips'].paramValue }}
<div>
<div v-show="contentShow" class="login-background">
<div class="login-container">
<el-row v-loading="loading" type="flex">
<el-col :span="12">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" size="default">
<div class="login-logo">
<svg-icon v-if="!loginLogoUrl && axiosFinished" icon-class="DataEase" custom-class="login-logo-icon" />
<img v-if="loginLogoUrl && axiosFinished" :src="loginLogoUrl" alt="">
</div>
</div>
<div class="login-msg">
{{ msg }}
</div>
</el-form>
</el-col>
<el-col v-loading="!axiosFinished" :span="12">
<div v-if="!loginImageUrl && axiosFinished" class="login-image" />
<div v-if="loginImageUrl && axiosFinished" class="login-image-de" :style="{background:'url(' + loginImageUrl + ') no-repeat', 'backgroundSize':'contain'}" />
</el-col>
</el-row>
</div>
<plugin-com v-if="loginTypes.includes(2) && loginForm.loginType === 2" ref="SSOComponent" component-name="SSOComponent" />
<div v-if="uiInfo && uiInfo['ui.loginTitle'] && uiInfo['ui.loginTitle'].paramValue" class="login-welcome">
{{ uiInfo['ui.loginTitle'].paramValue }}
</div>
<div v-else class="login-welcome">
{{ $t('login.welcome') + (uiInfo && uiInfo['ui.title'] && uiInfo['ui.title'].paramValue || ' DataEase') }}
</div>
<div class="login-form">
<el-form-item v-if="loginTypes.length > 1">
<el-radio-group v-if="loginTypes.length > 1" v-model="loginForm.loginType" @change="changeLoginType">
<el-radio :label="0" size="mini">{{ $t('login.default_login') }}</el-radio>
<el-radio v-if="loginTypes.includes(1)" :label="1" size="mini">LDAP</el-radio>
<el-radio v-if="loginTypes.includes(2)" :label="2" size="mini">OIDC</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item prop="username">
<el-input v-model="loginForm.username" placeholder="ID" autofocus :disabled="loginTypes.includes(2) && loginForm.loginType === 2" />
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="loginForm.password"
:placeholder="$t('login.password')"
show-password
maxlength="30"
show-word-limit
autocomplete="new-password"
:disabled="loginTypes.includes(2) && loginForm.loginType === 2"
@keypress.enter.native="handleLogin"
/>
</el-form-item>
</div>
<div class="login-btn">
<el-button type="primary" class="submit" size="default" :disabled="loginTypes.includes(2) && loginForm.loginType === 2" @click.native.prevent="handleLogin">
{{ $t('commons.login') }}
</el-button>
<div v-if="uiInfo && uiInfo['ui.demo.tips'] && uiInfo['ui.demo.tips'].paramValue" class="demo-tips">
{{ uiInfo['ui.demo.tips'].paramValue }}
</div>
</div>
<div class="login-msg">
{{ msg }}
</div>
</el-form>
</el-col>
<el-col v-loading="!axiosFinished" :span="12">
<div v-if="!loginImageUrl && axiosFinished" class="login-image" />
<div v-if="loginImageUrl && axiosFinished" class="login-image-de" :style="{background:'url(' + loginImageUrl + ') no-repeat', 'backgroundSize':'contain'}" />
</el-col>
</el-row>
</div>
<plugin-com v-if="loginTypes.includes(2) && loginForm.loginType === 2" ref="SSOComponent" component-name="SSOComponent" />
</div>
<div v-if="showFoot" class="dynamic-login-foot" v-html="footContent" />
</div>
</template>
@@ -101,7 +105,9 @@ export default {
'chart-tree',
'dataset-tree'
],
defaultType: 0
defaultType: 0,
showFoot: false,
footContent: ''
}
},
computed: {
@@ -159,8 +165,6 @@ export default {
created() {
this.$store.dispatch('user/getUI').then(() => {
// const uiLists = this.$store.state.user.uiInfo
// this.uiInfo = format(uiLists)
this.axiosFinished = true
this.showLoginImage()
}).catch(err => {
@@ -200,6 +204,13 @@ export default {
const faviconUrl = '/system/ui/image/' + this.uiInfo['ui.favicon'].paramValue
changeFavicon(faviconUrl)
}
if (this.uiInfo['ui.showFoot'] && this.uiInfo['ui.showFoot'].paramValue) {
this.showFoot = this.uiInfo['ui.showFoot'].paramValue === true || this.uiInfo['ui.showFoot'].paramValue === 'true'
if (this.showFoot) {
const content = this.uiInfo['ui.footContent'] && this.uiInfo['ui.footContent'].paramValue
this.footContent = content
}
}
},
initCache() {
this.clearLocalStorage.forEach(item => {
@@ -386,4 +397,16 @@ export default {
}
}
}
.dynamic-login-foot {
visibility: visible;
width: 100%;
position: fixed;
z-index: 302;
bottom: 0;
left: 0;
height: auto;
padding-top: 1px;
zoom: 1;
margin: 0;
}
</style>