diff --git a/web/.env.development b/web/.env.development index 2b35a9a..dc35c7f 100644 --- a/web/.env.development +++ b/web/.env.development @@ -6,4 +6,6 @@ VUE_APP_TITLE=企业级后台管理系统 VUE_APP_PM_ENABLED = true # 后端接口地址及端口(域名) VUE_APP_API = "http://127.0.0.1:8000" - +VUE_APP_VERSION = '2.0.4' +# 文件存储引擎 +VUE_APP_FILE_ENGINE = 'local' # oss、cos、local diff --git a/web/.env.preview b/web/.env.preview index 1855d20..854e006 100644 --- a/web/.env.preview +++ b/web/.env.preview @@ -13,3 +13,5 @@ VUE_APP_SCOURCE_LINK=FALSE VUE_APP_PUBLIC_PATH=/ # 启用权限管理 VUE_APP_PM_ENABLED = true +# 文件存储引擎 +VUE_APP_FILE_ENGINE = 'local' # oss、cos、local diff --git a/web/.env.production b/web/.env.production index 8b3fa56..d6ba836 100644 --- a/web/.env.production +++ b/web/.env.production @@ -13,3 +13,5 @@ VUE_APP_SCOURCE_LINK=FALSE VUE_APP_PUBLIC_PATH=/ # 启用权限管理 VUE_APP_PM_ENABLED = true +# 文件存储引擎 +VUE_APP_FILE_ENGINE = 'local' # oss、cos、local diff --git a/web/src/components/foreign-key-crud-form/foreign-key-crud-form.vue b/web/src/components/foreign-key-crud-form/foreign-key-crud-form.vue index 27ed6f8..b3b96b5 100644 --- a/web/src/components/foreign-key-crud-form/foreign-key-crud-form.vue +++ b/web/src/components/foreign-key-crud-form/foreign-key-crud-form.vue @@ -219,21 +219,21 @@ export default { ueditorConfig: { serverUrl: util.baseURL() + 'api/system/file/ueditor/', headers: { Authorization: 'JWT ' + util.cookies.get('token') }, - imageUrlPrefix: util.baseURL(), + imageUrlPrefix: util.baseFileURL(), // 涂鸦图片上传 - scrawlUrlPrefix: util.baseURL(), + scrawlUrlPrefix: util.baseFileURL(), // 截图工具上传 - snapscreenUrlPrefix: util.baseURL(), + snapscreenUrlPrefix: util.baseFileURL(), // 抓取远程图片路径前缀 - catcherUrlPrefix: util.baseURL(), + catcherUrlPrefix: util.baseFileURL(), // 视频访问路径前缀 - videoUrlPrefix: util.baseURL(), + videoUrlPrefix: util.baseFileURL(), // 文件访问路径前缀 - fileUrlPrefix: util.baseURL(), + fileUrlPrefix: util.baseFileURL(), // 列出指定目录下的图片 - imageManagerUrlPrefix: util.baseURL(), + imageManagerUrlPrefix: util.baseFileURL(), // 列出指定目录下的文件 - fileManagerUrlPrefix: util.baseURL() + fileManagerUrlPrefix: util.baseFileURL() // 传入ueditor的配置 // 文档参考: http://fex.baidu.com/ueditor/#start-config }, diff --git a/web/src/config/d2p-extends/types.js b/web/src/config/d2p-extends/types.js index 4937abe..65ea99a 100644 --- a/web/src/config/d2p-extends/types.js +++ b/web/src/config/d2p-extends/types.js @@ -1,4 +1,5 @@ import util from '@/libs/util.js' + export default { 'image-uploader': { form: { component: { name: 'd2p-file-uploader', props: { elProps: { listType: 'picture-card', accept: '.png,.jpeg,.jpg,.ico,.bmp,.gif' } } } }, @@ -244,21 +245,21 @@ export default { config: { serverUrl: util.baseURL() + 'api/system/file/ueditor/', headers: { Authorization: 'JWT ' + util.cookies.get('token') }, - imageUrlPrefix: util.baseURL(), + imageUrlPrefix: util.baseFileURL(), // 涂鸦图片上传 - scrawlUrlPrefix: util.baseURL(), + scrawlUrlPrefix: util.baseFileURL(), // 截图工具上传 - snapscreenUrlPrefix: util.baseURL(), + snapscreenUrlPrefix: util.baseFileURL(), // 抓取远程图片路径前缀 - catcherUrlPrefix: util.baseURL(), + catcherUrlPrefix: util.baseFileURL(), // 视频访问路径前缀 - videoUrlPrefix: util.baseURL(), + videoUrlPrefix: util.baseFileURL(), // 文件访问路径前缀 - fileUrlPrefix: util.baseURL(), + fileUrlPrefix: util.baseFileURL(), // 列出指定目录下的图片 - imageManagerUrlPrefix: util.baseURL(), + imageManagerUrlPrefix: util.baseFileURL(), // 列出指定目录下的文件 - fileManagerUrlPrefix: util.baseURL() + fileManagerUrlPrefix: util.baseFileURL() // 传入ueditor的配置 // 文档参考: http://fex.baidu.com/ueditor/#start-config } diff --git a/web/src/libs/util.js b/web/src/libs/util.js index 8c65c12..aa181e2 100644 --- a/web/src/libs/util.js +++ b/web/src/libs/util.js @@ -3,7 +3,6 @@ import db from './util.db' import log from './util.log' import dayjs from 'dayjs' import filterParams from './util.params' - const util = { cookies, db, @@ -63,6 +62,12 @@ util.baseURL = function () { return baseURL } +util.baseFileURL = function () { + if (process.env.VUE_APP_FILE_ENGINE && (process.env.VUE_APP_FILE_ENGINE === 'oss' || process.env.VUE_APP_FILE_ENGINE === 'cos')) { + return '' + } + return util.baseURL() +} util.wsBaseURL = function () { var baseURL = process.env.VUE_APP_API var param = baseURL.split('/')[3] || ''