diff --git a/vue/src/api/file/index.js b/vue/src/api/file/index.js new file mode 100644 index 0000000..0d46d26 --- /dev/null +++ b/vue/src/api/file/index.js @@ -0,0 +1,9 @@ +import {GetApi} from "@/api/request" + +export const getToken = new GetApi( + '/file/getToken', + null, + promise => promise.then(({data}) => data) +) + +export const deleteUpload = new GetApi('/file/delete', url => ({params: {url: encodeURIComponent(url)}})) diff --git a/vue/src/component/UploadFile/index.vue b/vue/src/component/UploadFile/index.vue index 452a5b7..36b6209 100644 --- a/vue/src/component/UploadFile/index.vue +++ b/vue/src/component/UploadFile/index.vue @@ -56,11 +56,12 @@ * success、remove事件中的file.url均不带七牛云外链前缀 * */ import axios from 'axios' -import {attachmentPrefix} from '@/config' +import {deleteUpload} from '@/api/file' +import {file as fileConfig} from '@/config' import {debounce, isEmpty} from '@/util' import {elError} from "@/util/message" import {isImage, isDoc, isPdf, isPpt, isRar, isXls, isTxt, isZip} from "@/util/validate" -import {preview, deleteUpload, download, upload, autoCompleteUrl} from "@/util/file" +import {preview, download, upload, autoCompleteUrl} from "@/util/file" const typeMapper = [ {test: isImage}, {test: isDoc, type: 'doc'}, {test: isPdf, type: 'pdf'}, {test: isPpt, type: 'ppt'}, @@ -159,9 +160,9 @@ export default { //区分是否为本次新上传,以及是否上传成功 //若不是新上传的 - if (!file.raw) this.$emit('remove', {url: file.downloadUrl.replace(attachmentPrefix, '')}) + if (!file.raw) this.$emit('remove', {url: file.downloadUrl.replace(fileConfig.storePrefix, '')}) //判断是否上传成功(有可能是正在上传) - else if (file.response && !file.response.err) deleteUpload(file.raw.key) + else if (file.response && !file.response.err) deleteUpload.request(file.raw.key) this.$refs.upload.handleRemove(file) const index = this.data.findIndex(i => i.downloadUrl === file.downloadUrl) diff --git a/vue/src/config/index.js b/vue/src/config/index.js index d228f6a..acb3cd4 100644 --- a/vue/src/config/index.js +++ b/vue/src/config/index.js @@ -14,12 +14,6 @@ module.exports = { //全局axios的baseUrl、devServer的路由前缀 apiPrefix: '/api', - //路由模式,['hash','history'] - routerMode: 'history', - - //是否使用由后端返回的数据作为路由 - useBackendRoute: false, - //是否在开发时使用mock,为true时不会启动websocket和代理 useMock: false, @@ -32,23 +26,36 @@ module.exports = { //是否使用错误日志捕捉,暂时没啥用 errorLog: true, - //storage的相关键名 - sessionUserKey: 'GCC-SESS-USER', - localResourceKey: 'GCC-LOCAL-PERM', - localPersonalSettingsKey: 'GCC-LOCAL-PERSONAL-SETTINGS', - - //路由切换时的过渡动画名称,关联transition.css - rightSideRouteTransition: 'left-out', - leftSideRouteTransition: 'right-out', - - //七牛云上传地址 - attachmentUploadUrl: 'https://upload.qiniup.com', - - //附件上传后的存储地址前缀 - attachmentPrefix: 'https://static.toesbieya.cn/', - - //文件预览接口前缀 - filePreviewPrefix: isDev ? 'http://localhost:8012' : 'https://preview.toesbieya.cn', + //路由配置 + route: { + //路由模式,['hash','history'] + mode: 'history', + + //是否使用由后端返回的数据作为路由 + useBackendDataAsRoute: false, + + //路由过渡动画设置,关联transition.css + animate: { + //当未启用多页签时的路由动画 + default: 'el-fade-in-linear', + //要访问的tab顺序高于上一个访问的tab时的路由动画 + next: 'left-out', + //要访问的tab顺序不高于上一个访问的tab时的路由动画 + prev: 'right-out', + } + }, + + //文件配置 + file: { + //上传地址 + uploadUrl:'https://upload.qiniup.com', + + //上传后的存储地址前缀 + storePrefix: 'https://static.toesbieya.cn/', + + //预览地址前缀 + previewPrefix: isDev ? 'http://localhost:8012' : 'https://preview.toesbieya.cn', + }, //省市地区json数据请求地址 regionDataUrl: `${contextPath}static/json/region-pca.json` diff --git a/vue/src/layout/component/TagsView/index.vue b/vue/src/layout/component/TagsView/index.vue index d3d3b2e..1dd6449 100644 --- a/vue/src/layout/component/TagsView/index.vue +++ b/vue/src/layout/component/TagsView/index.vue @@ -30,6 +30,7 @@