feat: 新增系统设置帮助文档/官网设置
This commit is contained in:
@@ -128,6 +128,7 @@ export default {
|
||||
register: 'Registrations',
|
||||
page403: 'No Access',
|
||||
page404: 'Match Page Not Found',
|
||||
helpDoc: 'System User Documentation',
|
||||
account: {
|
||||
index: "Personal Center",
|
||||
profile: "Personal Info",
|
||||
@@ -155,8 +156,12 @@ export default {
|
||||
|
||||
// 布局
|
||||
loayouts: {
|
||||
basic: {
|
||||
officialUrl: 'Official',
|
||||
helpDoc: 'Doc',
|
||||
},
|
||||
rightContent: {
|
||||
helpDoc: "Help Documentation",
|
||||
helpDoc: "System User Documentation",
|
||||
fullscreen: "Full Screen",
|
||||
logout: "Logout",
|
||||
profile: "Profile",
|
||||
@@ -1025,8 +1030,9 @@ export default {
|
||||
saveSuccess: 'Submit ands Save Successful',
|
||||
revert: 'Reset',
|
||||
revertSuccess: 'Reset Successful',
|
||||
uploadFormat: 'Only the upload image format ({format}) is supported',
|
||||
uploadSize: 'Image file size must be less than {size}MB',
|
||||
uploadFile: 'Upload File',
|
||||
uploadFormat: 'Only the upload file format ({format}) is supported',
|
||||
uploadSize: 'The file size must be less than {size}MB.',
|
||||
uploadSuccess: 'File uploaded successfully, submit and save to take effect',
|
||||
sysLogo: 'System Logo',
|
||||
sysLogoBrand: 'Brand',
|
||||
@@ -1040,11 +1046,9 @@ export default {
|
||||
sysLogoInstruction3: 'Displayed as logo + system name to the system logo area.',
|
||||
sysLogoInstruction4: 'Logo size ratio size',
|
||||
sysName: 'System Name',
|
||||
sysNamePlease: 'Please enter the system name',
|
||||
sysNameLimitation: 'System Name Restrictions',
|
||||
sysNameTipContent: 'Confirm that you want to submit the current changed system name?',
|
||||
sysCopyright: 'Copyright Notice',
|
||||
sysCopyrightPlease: 'Please enter copyright notice',
|
||||
sysCopyrightLimitation: 'Copyright Notice Limitation',
|
||||
sysCopyrightTipContent: 'Confirmation of submitting a copyright notice for the current change?',
|
||||
sysLoginBg: 'Login screen background',
|
||||
@@ -1056,6 +1060,20 @@ export default {
|
||||
sysLoginBgInstruction: 'The background style of the system login interface is shown in the preview area, please refer to the actual display.',
|
||||
sysLoginBgInstruction1: 'Please select the appropriate image for uploading.',
|
||||
sysLoginBgInstruction2: 'Restore the background image to the initial system default background by clicking the Restore button.',
|
||||
sysHelpDoc: 'System User Documentation',
|
||||
sysHelpDocTipContentUpload: 'Are you sure you want to upload the system documentation?',
|
||||
sysHelpDocTipContent: 'Confirm that you want to submit system usage documentation for the current change?',
|
||||
sysHelpDocTipContentRevert: 'Are you sure you want to restore and clear the system usage files?',
|
||||
sysHelpDocNo: 'No Documentation',
|
||||
sysHelpDocOpen: 'Document Access',
|
||||
sysHelpDocInstruction: 'Description of system functions and use, PDF document manual',
|
||||
sysOfficialUrl: 'Official Link',
|
||||
sysOfficialUrlErrTip: 'Please fill in a valid link address http(s)://',
|
||||
sysOfficialUrlTipContent: 'Do you confirm that you want to submit the current change of the official website address?',
|
||||
sysOfficialUrlNo: 'No link address',
|
||||
sysOfficialUrlOpen: 'Open the official website.',
|
||||
sysOfficialUrlInstruction: 'Official website link address',
|
||||
sysOfficialUrlInstruction1: 'start, if you need to hide do not jump to fill in the',
|
||||
},
|
||||
role:{
|
||||
allScopeOptions:'All data permissions',
|
||||
|
||||
@@ -128,6 +128,7 @@ export default {
|
||||
register: '注册',
|
||||
page403: '没有访问权限',
|
||||
page404: '找不到匹配页面',
|
||||
helpDoc: '系统使用文档',
|
||||
account: {
|
||||
index: "个人中心",
|
||||
profile: "个人信息",
|
||||
@@ -155,8 +156,12 @@ export default {
|
||||
|
||||
// 布局
|
||||
loayouts: {
|
||||
basic: {
|
||||
officialUrl: '官网',
|
||||
helpDoc: '使用手册',
|
||||
},
|
||||
rightContent: {
|
||||
helpDoc: "帮助手册",
|
||||
helpDoc: "系统使用文档",
|
||||
fullscreen: "全屏显示",
|
||||
logout: "退出登录",
|
||||
profile: "个人中心",
|
||||
@@ -1025,8 +1030,9 @@ export default {
|
||||
saveSuccess: '提交保存成功',
|
||||
revert: '还原',
|
||||
revertSuccess: '还原成功',
|
||||
uploadFormat: '只支持上传图片格式({format})',
|
||||
uploadSize: '图片文件大小必须小于 {size}MB',
|
||||
uploadFile: '上传文件',
|
||||
uploadFormat: '只支持上传文件格式({format})',
|
||||
uploadSize: '文件大小必须小于 {size}MB',
|
||||
uploadSuccess: '文件上传成功,提交保存生效',
|
||||
sysLogo: '系统LOGO',
|
||||
sysLogoBrand: '全图',
|
||||
@@ -1040,11 +1046,9 @@ export default {
|
||||
sysLogoInstruction3: '以LOGO+系统名称的形式展示到系统LOGO区域。',
|
||||
sysLogoInstruction4: 'LOGO尺寸比例大小',
|
||||
sysName: '系统名称',
|
||||
sysNamePlease: '请输入系统名称',
|
||||
sysNameLimitation: '系统名称限制',
|
||||
sysNameTipContent: '确认要提交当前变更的系统名称吗?',
|
||||
sysCopyright: '版权声明',
|
||||
sysCopyrightPlease: '请输入版权声明',
|
||||
sysCopyrightLimitation: '版权声明限制',
|
||||
sysCopyrightTipContent: '确认要提交当前变更的版权声明吗?',
|
||||
sysLoginBg: '登录界面背景',
|
||||
@@ -1056,6 +1060,20 @@ export default {
|
||||
sysLoginBgInstruction: '系统登录界面背景样式如预览区域所示,请以实际显示为准',
|
||||
sysLoginBgInstruction1: '请将选择合适的图片进行进行上传。',
|
||||
sysLoginBgInstruction2: '通过点击《还原》按钮,将背景图还原到系统初始默认的背景。',
|
||||
sysHelpDoc: '系统使用文档',
|
||||
sysHelpDocTipContentUpload: '确认要上传系统使用文档吗?',
|
||||
sysHelpDocTipContent: '确认要提交当前变更的系统使用文档吗?',
|
||||
sysHelpDocTipContentRevert: '确认要还原清空系统使用文档吗?',
|
||||
sysHelpDocNo: '无文档',
|
||||
sysHelpDocOpen: '文档查阅',
|
||||
sysHelpDocInstruction: '系统功能及使用说明,PDF文档手册',
|
||||
sysOfficialUrl: '官网链接',
|
||||
sysOfficialUrlErrTip: '请填写有效的链接地址 http(s)://',
|
||||
sysOfficialUrlTipContent: '确认要提交当前变更的官网地址吗?',
|
||||
sysOfficialUrlNo: '无链接地址',
|
||||
sysOfficialUrlOpen: '打开官网',
|
||||
sysOfficialUrlInstruction: '官网链接地址',
|
||||
sysOfficialUrlInstruction1: '开头,如需隐藏不跳转填写',
|
||||
},
|
||||
role:{
|
||||
allScopeOptions:'全部数据权限',
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
import RightContent from './components/RightContent.vue';
|
||||
import Tabs from './components/Tabs.vue';
|
||||
import { scriptUrl } from '@/assets/js/icon_font_8d5l8fzk5b87iudi';
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import useLayoutStore from '@/store/modules/layout';
|
||||
import useRouterStore from '@/store/modules/router';
|
||||
import useTabsStore from '@/store/modules/tabs';
|
||||
@@ -268,16 +268,31 @@ document.addEventListener('visibilitychange', function () {
|
||||
<!--插槽-内容底部-->
|
||||
<template #footerRender="{ width }">
|
||||
<footer class="footer">
|
||||
|
||||
<div class="footer-fixed" :style="{ width }">
|
||||
<div>
|
||||
<span>{{ appStore.copyright }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="footer-time">
|
||||
<span id="serverTimeDom"></span> {{ serverTime.zone }}
|
||||
</span>
|
||||
</div>
|
||||
<a-space direction="horizontal" :size="8">
|
||||
<span id="serverTimeDom"></span>
|
||||
<a-button
|
||||
type="link"
|
||||
:href="appStore.officialUrl"
|
||||
target="_blank"
|
||||
size="small"
|
||||
v-if="appStore.officialUrl !== '#'"
|
||||
>
|
||||
{{ t('loayouts.basic.officialUrl') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="link"
|
||||
href="/help"
|
||||
target="_blank"
|
||||
size="small"
|
||||
v-if="appStore.getHelpDoc !== '#'"
|
||||
>
|
||||
{{ t('loayouts.basic.helpDoc') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
</footer>
|
||||
</template>
|
||||
@@ -313,8 +328,7 @@ document.addEventListener('visibilitychange', function () {
|
||||
z-index: 16;
|
||||
margin: 0px;
|
||||
width: auto;
|
||||
margin-top: 48px;
|
||||
padding: 4px 16px;
|
||||
margin-top: 52px;
|
||||
&-fixed {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
@@ -330,7 +344,7 @@ document.addEventListener('visibilitychange', function () {
|
||||
transition: background 0.3s, width 0.2s;
|
||||
}
|
||||
|
||||
&-time {
|
||||
& #serverTimeDom {
|
||||
color: #00000085;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { toggle, isFullscreen } from '@/utils/fullscreen-utils';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
import useAlarmStore from '@/store/modules/alarm';
|
||||
const { t, changeLocale } = useI18n();
|
||||
const userStore = useUserStore();
|
||||
const appStore = useAppStore();
|
||||
const router = useRouter();
|
||||
|
||||
/**头像展开项点击 */
|
||||
@@ -29,11 +31,6 @@ function fnClickAlarm() {
|
||||
router.push({ path: '/faultManage/active-alarm' });
|
||||
}
|
||||
|
||||
/**帮助手册按钮提示跳转 */
|
||||
function fnClickHelpDoc() {
|
||||
router.push({ name: 'Help_118' });
|
||||
}
|
||||
|
||||
/**改变多语言 */
|
||||
function fnChangeLocale(e: any) {
|
||||
changeLocale(e.key);
|
||||
@@ -54,16 +51,16 @@ function fnChangeLocale(e: any) {
|
||||
</template>
|
||||
</a-button>
|
||||
|
||||
<a-tooltip>
|
||||
<a-tooltip placement="bottom" v-if="appStore.getHelpDoc !== '#'">
|
||||
<template #title>{{ t('loayouts.rightContent.helpDoc') }}</template>
|
||||
<a-button type="text" @click="fnClickHelpDoc">
|
||||
<a-button type="text" href="/help" target="_blank">
|
||||
<template #icon>
|
||||
<QuestionCircleOutlined />
|
||||
</template>
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
|
||||
<a-tooltip>
|
||||
<a-tooltip placement="bottom">
|
||||
<template #title>{{ t('loayouts.rightContent.fullscreen') }}</template>
|
||||
<a-button type="text" @click="toggle">
|
||||
<template #icon>
|
||||
@@ -73,7 +70,7 @@ function fnChangeLocale(e: any) {
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
|
||||
<a-dropdown :trigger="['click', 'hover']">
|
||||
<a-dropdown placement="bottom" :trigger="['click', 'hover']">
|
||||
<a-button size="small" type="default">
|
||||
{{ t('i18n') }}
|
||||
<DownOutlined />
|
||||
|
||||
@@ -81,6 +81,12 @@ const constantRoutes: RouteRecordRaw[] = [
|
||||
meta: { title: 'router.page403' },
|
||||
component: () => import('@/views/error/403.vue'),
|
||||
},
|
||||
{
|
||||
path: '/help',
|
||||
name: 'HelpDoc',
|
||||
meta: { title: 'router.helpDoc' },
|
||||
component: () => import('@/views/tool/help/index.vue'),
|
||||
},
|
||||
{
|
||||
path: '/redirect',
|
||||
name: 'Redirect',
|
||||
@@ -130,7 +136,7 @@ router.afterEach((to, from, failure) => {
|
||||
});
|
||||
|
||||
/**无Token可访问页面地址白名单 */
|
||||
const WHITE_LIST: string[] = ['/login', '/auth-redirect', '/bind', '/register'];
|
||||
const WHITE_LIST: string[] = ['/login', '/auth-redirect', '/help', '/register'];
|
||||
|
||||
/**全局路由-前置守卫 */
|
||||
router.beforeEach((to, from, next) => {
|
||||
|
||||
@@ -25,6 +25,10 @@ type AppStore = {
|
||||
registerUser: boolean;
|
||||
/**登录界面背景 */
|
||||
loginBackground: string;
|
||||
/**系统使用手册 */
|
||||
helpDoc: string;
|
||||
/**官方网址 */
|
||||
officialUrl: string;
|
||||
};
|
||||
|
||||
const useAppStore = defineStore('app', {
|
||||
@@ -32,12 +36,14 @@ const useAppStore = defineStore('app', {
|
||||
appName: import.meta.env.VITE_APP_NAME,
|
||||
appCode: import.meta.env.VITE_APP_CODE,
|
||||
appVersion: import.meta.env.VITE_APP_VERSION,
|
||||
copyright: 'Copyright ©2023 For AGrandTech',
|
||||
copyright: `Copyright ©2023 For ${import.meta.env.VITE_APP_NAME}`,
|
||||
logoType: 'icon',
|
||||
filePathIcon: '',
|
||||
filePathBrand: '',
|
||||
registerUser: false,
|
||||
loginBackground: '',
|
||||
helpDoc: '',
|
||||
officialUrl: '',
|
||||
}),
|
||||
getters: {
|
||||
/**
|
||||
@@ -97,6 +103,25 @@ const useAppStore = defineStore('app', {
|
||||
: import.meta.env.VITE_API_BASE_URL;
|
||||
return `${baseUrl}${path}`;
|
||||
},
|
||||
/**
|
||||
* 获取正确使用手册地址
|
||||
* @param state 内部属性不用传入
|
||||
* @returns 手册地址url
|
||||
*/
|
||||
getHelpDoc(state) {
|
||||
const path = state.helpDoc;
|
||||
if (!path || path === '#') {
|
||||
return '#';
|
||||
}
|
||||
if (validHttp(path)) {
|
||||
return path;
|
||||
}
|
||||
// 兼容旧前端可改配置文件
|
||||
const baseUrl = import.meta.env.PROD
|
||||
? sessionGet('baseUrl') || import.meta.env.VITE_API_BASE_URL
|
||||
: import.meta.env.VITE_API_BASE_URL;
|
||||
return `${baseUrl}${path}`;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
/**设置网页标题 */
|
||||
@@ -125,26 +150,22 @@ const useAppStore = defineStore('app', {
|
||||
async fnSysConf() {
|
||||
const res = await getSysConf();
|
||||
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||
if (res.data.title) {
|
||||
this.appName = res.data.title;
|
||||
}
|
||||
if (res.data.copyright) {
|
||||
this.copyright = res.data.copyright;
|
||||
}
|
||||
this.appName = res.data.title;
|
||||
this.copyright = res.data.copyright;
|
||||
this.logoType = res.data.logoType;
|
||||
this.filePathIcon = res.data.filePathIcon;
|
||||
this.filePathBrand = res.data.filePathBrand;
|
||||
if (res.data.logoType) {
|
||||
this.logoType = res.data.logoType;
|
||||
// 修改html内容-小图当作favicon.ico
|
||||
// 修改html内容-小图当作favicon.ico
|
||||
if (this.logoType) {
|
||||
const iconDom = document.querySelector("link[rel~='icon']");
|
||||
if (iconDom) {
|
||||
iconDom.setAttribute('href', this.getLOGOIcon);
|
||||
}
|
||||
}
|
||||
this.registerUser = res.data.registerUser === 'true';
|
||||
if (res.data.loginBackground) {
|
||||
this.loginBackground = res.data.loginBackground;
|
||||
}
|
||||
this.loginBackground = res.data.loginBackground;
|
||||
this.helpDoc = res.data.helpDoc;
|
||||
this.officialUrl = res.data.officialUrl;
|
||||
}
|
||||
return res;
|
||||
},
|
||||
|
||||
@@ -72,14 +72,14 @@ onMounted(() => {
|
||||
v-model:value="state.copyright"
|
||||
allow-clear
|
||||
:maxlength="40"
|
||||
:placeholder="t('views.system.setting.sysCopyrightPlease')"
|
||||
:placeholder="t('common.ipnutPlease')"
|
||||
></a-input>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item>
|
||||
<a-button
|
||||
type="primary"
|
||||
:disabled="state.copyright === state.flag"
|
||||
:disabled="state.copyright === '' || state.copyright === state.flag"
|
||||
@click="fnSave"
|
||||
>
|
||||
{{ t('views.system.setting.saveSubmit') }}
|
||||
|
||||
204
src/views/system/setting/components/change-help-doc.vue
Normal file
204
src/views/system/setting/components/change-help-doc.vue
Normal file
@@ -0,0 +1,204 @@
|
||||
<script lang="ts" setup>
|
||||
import { Modal, message } from 'ant-design-vue/lib';
|
||||
import { onMounted, reactive } from 'vue';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import { changeValue } from '@/api/system/config';
|
||||
import { uploadFileChunk } from '@/api/tool/file';
|
||||
import { FileType } from 'ant-design-vue/lib/upload/interface';
|
||||
import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
|
||||
import { sessionGet } from '@/utils/cache-session-utils';
|
||||
import { useRouter } from 'vue-router';
|
||||
const appStore = useAppStore();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
|
||||
type StateType = {
|
||||
edite: boolean;
|
||||
loading: boolean;
|
||||
filePath: string;
|
||||
flag: string;
|
||||
};
|
||||
|
||||
let state: StateType = reactive({
|
||||
edite: false,
|
||||
loading: false,
|
||||
filePath: '',
|
||||
flag: '',
|
||||
});
|
||||
|
||||
/**上传前检查或转换压缩 */
|
||||
function fnBeforeUpload(file: FileType) {
|
||||
console.log(file.type);
|
||||
if (state.loading) return false;
|
||||
const isType = ['application/pdf'].includes(file.type);
|
||||
if (!isType) {
|
||||
message.error(t('views.system.setting.uploadFormat', { format: 'pdf' }), 3);
|
||||
}
|
||||
return isType;
|
||||
}
|
||||
|
||||
/**上传变更 */
|
||||
function fnUpload(up: UploadRequestOption) {
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: t('views.system.setting.sysHelpDocTipContentUpload'),
|
||||
onOk() {
|
||||
// 发送请求
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
state.loading = true;
|
||||
uploadFileChunk(up.file as File, 5, 'default').then(res => {
|
||||
state.loading = false;
|
||||
hide();
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success(t('views.system.setting.uploadSuccess'), 3);
|
||||
state.filePath = res.data.fileName;
|
||||
// 兼容旧前端可改配置文件
|
||||
const baseUrl = import.meta.env.PROD
|
||||
? sessionGet('baseUrl') || import.meta.env.VITE_API_BASE_URL
|
||||
: import.meta.env.VITE_API_BASE_URL;
|
||||
state.flag = `${baseUrl}${res.data.fileName}`;
|
||||
} else {
|
||||
message.error(res.msg, 3);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**进入可编辑 */
|
||||
function fnEdit(v: boolean) {
|
||||
state.edite = v;
|
||||
if (!v) {
|
||||
state.filePath = '#';
|
||||
state.flag = appStore.getHelpDoc;
|
||||
}
|
||||
}
|
||||
|
||||
/**提交保存 */
|
||||
function fnSave() {
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: t('views.system.setting.sysHelpDocTipContent'),
|
||||
onOk() {
|
||||
// 发送请求
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
state.loading = true;
|
||||
changeValue({ key: 'sys.helpDoc', value: state.filePath }).then(res => {
|
||||
state.loading = false;
|
||||
hide();
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success(t('views.system.setting.saveSuccess'), 3);
|
||||
appStore.helpDoc = state.filePath;
|
||||
fnEdit(false);
|
||||
} else {
|
||||
message.error(res.msg, 3);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**还原清空文件 */
|
||||
function fnRevert() {
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: t('views.system.setting.sysHelpDocTipContentRevert'),
|
||||
onOk() {
|
||||
// 发送请求
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
state.loading = true;
|
||||
state.filePath = '#';
|
||||
changeValue({ key: 'sys.helpDoc', value: state.filePath }).then(res => {
|
||||
state.loading = false;
|
||||
hide();
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success(t('views.system.setting.revertSuccess'), 3);
|
||||
appStore.helpDoc = state.filePath;
|
||||
fnEdit(false);
|
||||
} else {
|
||||
message.error(res.msg, 3);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
state.filePath = appStore.getHelpDoc;
|
||||
state.flag = appStore.getHelpDoc;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-row :gutter="16">
|
||||
<a-col :lg="12" :md="12" :xs="24" style="margin-bottom: 30px">
|
||||
<a-form layout="vertical" v-if="state.edite">
|
||||
<a-form-item>
|
||||
<a-upload
|
||||
name="file"
|
||||
list-type="text"
|
||||
accept=".pdf"
|
||||
:max-count="1"
|
||||
:show-upload-list="false"
|
||||
:before-upload="fnBeforeUpload"
|
||||
:custom-request="fnUpload"
|
||||
>
|
||||
<a-button type="link" :disabled="state.loading">
|
||||
{{ t('views.system.setting.uploadFile') }}
|
||||
</a-button>
|
||||
</a-upload>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item>
|
||||
<a-button
|
||||
type="primary"
|
||||
:disabled="state.filePath === state.flag"
|
||||
@click="fnSave"
|
||||
>
|
||||
{{ t('views.system.setting.saveSubmit') }}
|
||||
</a-button>
|
||||
<a-button style="margin-left: 10px" @click="fnEdit(false)">
|
||||
{{ t('common.cancel') }}
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
<template v-else>
|
||||
<a-form-item>
|
||||
<a-button type="text" v-if="state.flag === '#'">
|
||||
{{ t('views.system.setting.sysHelpDocNo') }}
|
||||
</a-button>
|
||||
<a-button type="link" href="/help" target="_blank" v-else>
|
||||
<template #icon>
|
||||
<QuestionCircleOutlined />
|
||||
{{ t('views.system.setting.sysHelpDocOpen') }}
|
||||
</template>
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
|
||||
<a-button type="default" @click="fnEdit(true)">
|
||||
{{ t('common.editText') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="text"
|
||||
danger
|
||||
style="margin-left: 10px"
|
||||
@click="fnRevert"
|
||||
>
|
||||
{{ t('views.system.setting.revert') }}
|
||||
</a-button>
|
||||
</template>
|
||||
</a-col>
|
||||
<a-col :lg="12" :md="12" :xs="24">
|
||||
<a-typography>
|
||||
<a-typography-paragraph>
|
||||
{{ t('views.system.setting.sysHelpDocInstruction') }}
|
||||
</a-typography-paragraph>
|
||||
</a-typography>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -169,7 +169,7 @@ onMounted(() => {
|
||||
:custom-request="fnUpload"
|
||||
>
|
||||
<a-button type="link" :disabled="state.loading">
|
||||
{{ t('views.system.setting.sysLoginBgUpload') }}
|
||||
{{ t('views.system.setting.uploadFile') }}
|
||||
</a-button>
|
||||
</a-upload>
|
||||
</a-form-item>
|
||||
|
||||
126
src/views/system/setting/components/change-official-url.vue
Normal file
126
src/views/system/setting/components/change-official-url.vue
Normal file
@@ -0,0 +1,126 @@
|
||||
<script lang="ts" setup>
|
||||
import { Modal, message } from 'ant-design-vue/lib';
|
||||
import { onMounted, reactive } from 'vue';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import { changeValue } from '@/api/system/config';
|
||||
import { validHttp } from '@/utils/regular-utils';
|
||||
const appStore = useAppStore();
|
||||
const { t } = useI18n();
|
||||
|
||||
type StateType = {
|
||||
edite: boolean;
|
||||
loading: boolean;
|
||||
url: string;
|
||||
flag: string;
|
||||
};
|
||||
|
||||
let state: StateType = reactive({
|
||||
edite: false,
|
||||
loading: false,
|
||||
url: '',
|
||||
flag: '',
|
||||
});
|
||||
|
||||
/**进入可编辑 */
|
||||
function fnEdit(v: boolean) {
|
||||
state.edite = v;
|
||||
if (!v) {
|
||||
state.url = appStore.officialUrl;
|
||||
state.flag = appStore.officialUrl;
|
||||
}
|
||||
}
|
||||
|
||||
/**提交保存 */
|
||||
function fnSave() {
|
||||
if (state.url !== '#' && !validHttp(state.url)) {
|
||||
message.info(t('views.system.setting.sysOfficialUrlErrTip'), 3);
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: t('views.system.setting.sysOfficialUrlTipContent'),
|
||||
onOk() {
|
||||
// 发送请求
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
state.loading = true;
|
||||
changeValue({ key: 'sys.officialUrl', value: state.url }).then(res => {
|
||||
state.loading = false;
|
||||
hide();
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success(t('views.system.setting.saveSuccess'), 3);
|
||||
appStore.officialUrl = state.url;
|
||||
fnEdit(false);
|
||||
} else {
|
||||
message.error(res.msg, 3);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
state.url = appStore.officialUrl;
|
||||
state.flag = appStore.officialUrl;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-row :gutter="16">
|
||||
<a-col :lg="12" :md="12" :xs="24" style="margin-bottom: 30px">
|
||||
<a-form layout="vertical" v-if="state.edite">
|
||||
<a-form-item>
|
||||
<a-input
|
||||
v-model:value="state.url"
|
||||
allow-clear
|
||||
:maxlength="255"
|
||||
:placeholder="t('common.ipnutPlease')"
|
||||
></a-input>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item>
|
||||
<a-button
|
||||
type="primary"
|
||||
:disabled="state.url === '' || state.url === state.flag"
|
||||
@click="fnSave"
|
||||
>
|
||||
{{ t('views.system.setting.saveSubmit') }}
|
||||
</a-button>
|
||||
<a-button style="margin-left: 10px" @click="fnEdit(false)">
|
||||
{{ t('common.cancel') }}
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
<template v-else>
|
||||
<a-form-item>
|
||||
<a-button type="text" v-if="state.flag === '#'">
|
||||
{{ t('views.system.setting.sysOfficialUrlNo') }}
|
||||
</a-button>
|
||||
<a-button type="link" :href="state.flag" target="_blank" v-else>
|
||||
<template #icon>
|
||||
<LinkOutlined />
|
||||
</template>
|
||||
{{ t('views.system.setting.sysOfficialUrlOpen') }}
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
<a-button type="dashed" @click="fnEdit(true)">
|
||||
{{ t('common.editText') }}
|
||||
</a-button>
|
||||
</template>
|
||||
</a-col>
|
||||
<a-col :lg="12" :md="12" :xs="24">
|
||||
<a-typography>
|
||||
<a-typography-paragraph>
|
||||
{{ t('views.system.setting.sysOfficialUrlInstruction') }}
|
||||
<a-typography-text mark>http(s)://</a-typography-text>
|
||||
{{ t('views.system.setting.sysOfficialUrlInstruction1') }}
|
||||
<a-typography-text mark>#</a-typography-text>
|
||||
</a-typography-paragraph>
|
||||
</a-typography>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -69,16 +69,15 @@ onMounted(() => {
|
||||
<a-input
|
||||
v-model:value="state.title"
|
||||
allow-clear
|
||||
:maxlength="11"
|
||||
style="width: 224px"
|
||||
:placeholder="t('views.system.setting.sysNamePlease')"
|
||||
:maxlength="11"
|
||||
:placeholder="t('common.ipnutPlease')"
|
||||
></a-input>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item>
|
||||
<a-button
|
||||
type="primary"
|
||||
:disabled="state.title === state.flag"
|
||||
:disabled="state.title === '' || state.title === state.flag"
|
||||
@click="fnSave"
|
||||
>
|
||||
{{ t('views.system.setting.saveSubmit') }}
|
||||
|
||||
@@ -4,6 +4,8 @@ import ChangeLogo from './components/change-logo.vue';
|
||||
import ChangeLogoBG from './components/change-login-bg.vue';
|
||||
import ChangeTitle from './components/change-title.vue';
|
||||
import ChangeCopyright from './components/change-copyright.vue';
|
||||
import ChangeHelpDoc from './components/change-help-doc.vue';
|
||||
import ChangeOfficialUrl from './components/change-official-url.vue';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
@@ -27,6 +29,14 @@ const { t } = useI18n();
|
||||
{{ t('views.system.setting.sysLoginBg') }}
|
||||
</a-divider>
|
||||
<ChangeLogoBG></ChangeLogoBG>
|
||||
<a-divider orientation="left">
|
||||
{{ t('views.system.setting.sysHelpDoc') }}
|
||||
</a-divider>
|
||||
<ChangeHelpDoc></ChangeHelpDoc>
|
||||
<a-divider orientation="left">
|
||||
{{ t('views.system.setting.sysOfficialUrl') }}
|
||||
</a-divider>
|
||||
<ChangeOfficialUrl></ChangeOfficialUrl>
|
||||
</a-card>
|
||||
</PageContainer>
|
||||
</template>
|
||||
|
||||
@@ -1,13 +1,38 @@
|
||||
<script lang="ts" setup>
|
||||
import LinkiFrame from '@/components/LinkiFrame/index.vue';
|
||||
import { ref } from 'vue';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
const { t } = useI18n();
|
||||
const appStore = useAppStore();
|
||||
const route = useRoute();
|
||||
const docUrl = appStore.getHelpDoc;
|
||||
const height = ref<string>(document.documentElement.clientHeight + 'px');
|
||||
/**
|
||||
* 国际化翻译转换
|
||||
*/
|
||||
function fnLocale() {
|
||||
let title = route.meta.title as string;
|
||||
if (title.indexOf('router.') !== -1) {
|
||||
title = t(title);
|
||||
}
|
||||
appStore.setTitle(title);
|
||||
}
|
||||
|
||||
const url = ref<string>('/omc_help_doc-v5.0.pdf');
|
||||
onMounted(() => {
|
||||
fnLocale();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<LinkiFrame :src="url"></LinkiFrame>
|
||||
<a-spin style="margin: 0 50%" v-if="docUrl === '#'" />
|
||||
<div :style="'height:' + height" v-else>
|
||||
<iframe
|
||||
:src="docUrl"
|
||||
frameborder="no"
|
||||
style="width: 100%; height: 100%"
|
||||
scrolling="auto"
|
||||
></iframe>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user