fix 修复ueditor 单图上传,修复刷新页面router警告,添加手动清缓存

This commit is contained in:
yxh 2023-02-02 11:55:04 +08:00
parent d77f88e0e6
commit a884c08fc7
5 changed files with 56 additions and 21 deletions

View File

@ -26853,25 +26853,33 @@ UE.plugin.register("simpleupload", function() {
function callback() {
try {
var link,
json,
loader,
body = (iframe.contentDocument || iframe.contentWindow.document)
.body,
result = body.innerText || body.textContent || "";
json = new Function("return " + result)();
link = me.options.imageUrlPrefix + json.url;
if (json.state == "SUCCESS" && json.url) {
loader = me.document.getElementById(loadingId);
domUtils.removeClasses(loader, "loadingclass");
loader.setAttribute("src", link);
loader.setAttribute("_src", link);
loader.setAttribute("alt", json.original || "");
loader.removeAttribute("id");
me.fireEvent("contentchange");
} else {
showErrorLoader && showErrorLoader(json.state);
}
var link,loader;
var imageActionUrl = me.getActionUrl(me.getOpt("imageActionName"));
var imageUrlPrefix = me.getOpt("imageUrlPrefix");
var allowFiles = me.getOpt("imageAllowFiles");
var formData = new FormData()
formData.append('upfile', input.files[0]);
// 替换你的URL
fetch(imageActionUrl,{
method: "post",
body: formData
}).then(p=>p.json()).then(json=>{
link = me.options.imageUrlPrefix + json.url;
if (json.state == "SUCCESS" && json.url) {
loader = me.document.getElementById(loadingId);
domUtils.removeClasses(loader, "loadingclass");
loader.setAttribute("src", link);
loader.setAttribute("_src", link);
loader.setAttribute("alt", json.original || "");
loader.removeAttribute("id");
me.fireEvent("contentchange");
} else {
showErrorLoader && showErrorLoader(json.state);
}
}).catch(e=>{
showErrorLoader &&
showErrorLoader(me.getLang("simpleupload.loadError"));
})
} catch (er) {
showErrorLoader &&
showErrorLoader(me.getLang("simpleupload.loadError"));

9
src/api/system/cache/index.ts vendored Normal file
View File

@ -0,0 +1,9 @@
import request from '/@/utils/request';
// 清除缓存
export function removeCache() {
return request({
url: '/api/v1/system/cache/remove',
method: 'delete'
})
}

View File

@ -32,6 +32,9 @@
<div class="layout-navbars-breadcrumb-user-icon" @click="onLayoutSetingClick">
<i class="icon-skin iconfont" :title="$t('message.user.title3')"></i>
</div>
<div class="layout-navbars-breadcrumb-user-icon" @click="removeCacheClick">
<i class="fa-trash fa" title="清除缓存"></i>
</div>
<div class="layout-navbars-breadcrumb-user-icon">
<el-popover placement="bottom" trigger="click" transition="el-zoom-in-top" :width="300" :persistent="false">
<template #reference>
@ -90,6 +93,7 @@ import { Session, Local } from '/@/utils/storage';
import UserNews from '/@/layout/navBars/breadcrumb/userNews.vue';
import Search from '/@/layout/navBars/breadcrumb/search.vue';
import {logout} from "/@/api/login";
import {removeCache} from "/@/api/system/cache";
export default defineComponent({
name: 'layoutBreadcrumbUser',
@ -133,6 +137,12 @@ export default defineComponent({
const onLayoutSetingClick = () => {
proxy.mittBus.emit('openSetingsDrawer');
};
//
const removeCacheClick = ()=>{
removeCache().then(()=>{
ElMessage.success('缓存清除成功');
})
};
//
const onHandleCommandClick = (path: string) => {
if (path === 'logOut') {
@ -171,7 +181,7 @@ export default defineComponent({
})
.catch(() => {});
} else if (path === 'wareHouse') {
window.open('https://gitee.com/lyt-top/vue-next-admin');
window.open('https://gitee.com/tiger1103/gfast');
} else {
router.push(path);
}
@ -247,6 +257,7 @@ export default defineComponent({
onSearchClick,
onComponentSizeChange,
onLanguageChange,
removeCacheClick,
searchRef,
layoutUserFlexNum,
...toRefs(state),

View File

@ -46,7 +46,7 @@ export default defineComponent({
};
//
const onGoToGiteeClick = () => {
window.open('https://gitee.com/lyt-top/vue-next-admin');
window.open('https://gitee.com/tiger1103/gfast');
};
return {
onAllReadClick,

View File

@ -1163,4 +1163,11 @@ export const staticRoutes: Array<RouteRecordRaw> = [
title: 'message.router.visualizingLinkDemo2',
},
},
{
path: '/:pathMatch(.*)*',
component: () => import('/@/layout/routerView/parent.vue'),
meta: {
title: '加载中',
},
}
];