feat: 支持管理员配置导航栏上帮助中的url

This commit is contained in:
jiangweidong
2021-11-10 16:06:20 +08:00
committed by 老广
parent f000810ccf
commit 2d174bc46d
4 changed files with 68 additions and 4 deletions

View File

@@ -1215,6 +1215,13 @@
"SMS": "短信"
},
"xpack": {
"NavHelp": "导航栏 (帮助)",
"helpDocument": "帮助 (文档)",
"helpSupport": "帮助 (支持)",
"officialWebsite": "帮助 (官网)",
"helpDocumentTip": "可以更改网站导航栏 帮助 -> 文档 的网址",
"helpSupportTip": "可以更改网站导航栏 帮助 -> 支持 的网址",
"officialWebsiteTip": "可以更改网站导航栏 帮助 -> 官网 的网址",
"Admin": "管理员",
"Asset": "资产",
"Database": "数据库",

View File

@@ -1176,6 +1176,13 @@
"SMS": "SMS"
},
"xpack": {
"NavHelp": "Navigation (Help)",
"helpDocument": "Help (Docs)",
"helpSupport": "Help (Support)",
"officialWebsite": "Help (Website)",
"helpDocumentTip": "You can change the URL of the site navigation bar help -> Docs",
"helpSupportTip": "You can change the URL of the site navigation bar help -> Support",
"officialWebsiteTip": "You can change the URL of the site navigation bar help -> Website",
"Admin": "Admin",
"Asset": "Asset",
"Database": "Database",

View File

@@ -6,7 +6,7 @@
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="docs">{{ $t('common.nav.Docs') }}</el-dropdown-item>
<el-dropdown-item command="support">{{ $t('common.nav.Support') }}</el-dropdown-item>
<el-dropdown-item command="EnterpriseEdition">{{ $t('common.nav.EnterpriseEdition') }}</el-dropdown-item>
<el-dropdown-item v-if="!hasLicence" command="EnterpriseEdition">{{ $t('common.nav.EnterpriseEdition') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
@@ -14,17 +14,40 @@
<script>
export default {
name: 'Help',
data() {
return {
URLSite: {
HELP_DOCUMENT_URL: '',
HELP_SUPPORT_URL: ''
}
}
},
computed: {
hasLicence() {
return this.$store.getters.hasValidLicense
}
},
created() {
this.initHelpURL()
},
methods: {
initHelpURL() {
const url = '/api/v1/settings/setting/?category=other'
this.$axios.get(url).then(resp => {
this.URLSite.HELP_DOCUMENT_URL = resp.HELP_DOCUMENT_URL
this.URLSite.HELP_SUPPORT_URL = resp.HELP_SUPPORT_URL
})
},
handleCommand(command) {
switch (command) {
case 'support':
window.open('http://www.jumpserver.org/support/', '_blank')
window.open(this.URLSite.HELP_SUPPORT_URL, '_blank')
break
case 'EnterpriseEdition':
window.open('https://jumpserver.org/enterprise.html', '_blank')
break
default:
window.open('http://docs.jumpserver.org', '_blank')
window.open(this.URLSite.HELP_DOCUMENT_URL, '_blank')
break
}
}

View File

@@ -51,7 +51,22 @@ export default {
helpText: this.$t('xpack.HelpText.CrontabOfCreateUpdatePage')
},
TICKETS_ENABLED: {
hidden: () => !this.$store.getters.hasValidLicense
hidden: () => this.hasValidLicense()
},
HELP_DOCUMENT_URL: {
label: this.$t('xpack.helpDocument'),
helpText: this.$t('xpack.helpDocumentTip'),
hidden: () => !this.hasValidLicense()
},
HELP_SUPPORT_URL: {
label: this.$t('xpack.helpSupport'),
helpText: this.$t('xpack.helpSupportTip'),
hidden: () => !this.hasValidLicense()
},
OFFICIAL_WEBSITE_URL: {
label: this.$t('xpack.officialWebsite'),
helpText: this.$t('xpack.officialWebsiteTip'),
hidden: () => !this.hasValidLicense()
}
},
submitMethod() {
@@ -59,7 +74,19 @@ export default {
}
}
},
created() {
if (this.hasValidLicense()) {
this.fields.push([
this.$t('xpack.NavHelp'), [
'HELP_DOCUMENT_URL', 'HELP_SUPPORT_URL', 'OFFICIAL_WEBSITE_URL'
]
])
}
},
methods: {
hasValidLicense() {
return this.$store.getters.hasValidLicense
}
}
}
</script>