fix: 移除了所有extraFile相关组件的origin默认值,修复了在trigger中不支持的selection写法导致的崩溃

This commit is contained in:
Pan Qiancheng 2025-10-24 16:29:49 +08:00
parent 7beeb8afeb
commit 5c06cf0a7b
71 changed files with 114 additions and 253 deletions

View File

@ -5,7 +5,7 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
tocPosition: "none" | "left" | "right";
highlightBgColor: string;
onArticlePreview: (content?: string, title?: string) => void;
origin: string;
origin: null | EntityDict["extraFile"]["Schema"]["origin"];
scrollId: string;
height: number | "auto";
activeColor: string | undefined;

View File

@ -29,7 +29,7 @@ export default OakComponent({
tocPosition: 'none', //目录显示位置none为不显示目录
highlightBgColor: 'none', //点击目录时标题高亮背景色none为不显示高亮背景色
onArticlePreview: (content, title) => undefined, //预览文章
origin: 'qiniu', // 默认为七牛云
origin: null, // 默认为空,由系统决定
scrollId: '', // 滚动条所在容器id不传默认页面编辑器容器id
height: 600,
activeColor: undefined,

View File

@ -7,7 +7,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'article', f
name: string;
editor: any;
content?: string;
origin?: string;
origin?: null | EntityDict['extraFile']['Schema']['origin'];
contentTip: boolean;
articleMenuId: string;
oakId: string;

View File

@ -31,7 +31,7 @@ function customCheckImageFn(src, alt, url) {
export default function Render(props) {
const { methods, data } = props;
const { t, setEditor, check, uploadFile, update, setHtml, gotoPreview, clearContentTip, } = methods;
const { oakId, oakFullpath, id, name, content, editor, origin = 'qiniu', tocPosition = 'none', highlightBgColor, scrollId, tocWidth, tocHeight, height = 600, tocClosed = false, execuable, activeColor, } = data;
const { oakId, oakFullpath, id, name, content, editor, origin, tocPosition = 'none', highlightBgColor, scrollId, tocWidth, tocHeight, height = 600, tocClosed = false, execuable, activeColor, } = data;
const [articleId, setArticleId] = useState('');
const [toc, setToc] = useState([]);
const [showToc, setShowToc] = useState(false);

View File

@ -5,7 +5,7 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
tocPosition: "none" | "left" | "right";
highlightBgColor: string;
onArticlePreview: (content?: string, title?: string) => void;
origin: string;
origin: EntityDict["extraFile"]["Schema"]["origin"] | null;
scrollId: string;
height: number | "auto";
activeColor: string | undefined;

View File

@ -28,7 +28,7 @@ export default OakComponent({
tocPosition: 'none', //目录显示位置none为不显示目录
highlightBgColor: 'none', //点击目录时标题高亮背景色none为不显示高亮背景色
onArticlePreview: (content, title) => undefined, //预览文章
origin: 'qiniu', // 默认为七牛云
origin: null, // 默认为七牛云
scrollId: '', // 滚动条所在容器id不传默认页面编辑器容器id
height: 600,
activeColor: undefined,

View File

@ -7,7 +7,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'article', f
name: string;
editor: any;
content?: string;
origin?: string;
origin?: null | EntityDict['extraFile']['Schema']['origin'];
contentTip: boolean;
articleMenuId: string;
oakId: string;

View File

@ -31,7 +31,7 @@ function customCheckImageFn(src, alt, url) {
export default function Render(props) {
const { methods, data } = props;
const { t, setEditor, check, uploadFile, update, setHtml, gotoPreview, clearContentTip, } = methods;
const { oakId, oakFullpath, id, content, editor, origin = 'qiniu', tocPosition = 'none', highlightBgColor, activeColor, scrollId, tocWidth, tocHeight, height = 600 } = data;
const { oakId, oakFullpath, id, content, editor, origin, tocPosition = 'none', highlightBgColor, activeColor, scrollId, tocWidth, tocHeight, height = 600 } = data;
const [articleId, setArticleId] = useState('');
const [toc, setToc] = useState([]);
const [showToc, setShowToc] = useState(false);

View File

@ -4,7 +4,7 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
entity: string;
entityId: string;
title: string;
origin: string;
origin: null | EntityDict["extraFile"]["Schema"]["origin"];
menuEmpty: React.ReactNode | undefined;
articleEmpty: React.ReactNode | undefined;
generateUrl: GenerateUrlFn;

View File

@ -7,7 +7,7 @@ export default OakComponent({
entity: '',
entityId: '',
title: '',
origin: 'qiniu', // cos origin默认七牛云
origin: null, // cos origin默认由系统决定
menuEmpty: undefined,
articleEmpty: undefined,
generateUrl: ((mode, type, id) => { }), //构造文章显示路由

View File

@ -10,7 +10,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
id: string;
title: string;
}[];
origin: 'qiniu';
origin: null | EntityDict['extraFile']['Schema']['origin'];
menuEmpty: React.ReactNode | undefined;
articleEmpty: React.ReactNode | undefined;
parentId: string | undefined;

View File

@ -6,7 +6,7 @@ import MenuList from '../list';
import ArticleList from '../../article/list';
export default function Render(props) {
const { data, methods } = props;
const { oakFullpath, oakLoading, oakExecuting, entity, entityId, title, breadcrumbItems, origin = 'qiniu', menuEmpty, articleEmpty, parentId, articleMenuId, showAddArticle, showAddMenu, generateUrl, } = data;
const { oakFullpath, oakLoading, oakExecuting, entity, entityId, title, breadcrumbItems, origin, menuEmpty, articleEmpty, parentId, articleMenuId, showAddArticle, showAddMenu, generateUrl, } = data;
const { t, onBreadcrumItemClick, onMenuClick, onAddMenu, changeAddArticle, onAddArticle, menuCheck } = methods;
const [addMenuOpen, setAddMenuOpen] = useState(false);
const [menuName, setMenuName] = useState('');

View File

@ -1,9 +1,10 @@
import { GenerateUrlFn } from "../../../types/Article";
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "articleMenu", true, {
import { EntityDict } from "../../../oak-app-domain";
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "articleMenu", true, {
entity: string;
entityId: string;
parentId: string | undefined;
origin: string;
origin: EntityDict["extraFile"]["Schema"]["origin"] | null;
onMenuClick: (menuId: string, menuName: string, isArticle: boolean) => void;
onArticleClick: (atricleId: string) => void;
empty: React.ReactNode | undefined;

View File

@ -93,7 +93,7 @@ export default OakComponent({
entity: '',
entityId: '',
parentId: '',
origin: 'qiniu', // cos origin默认七牛云
origin: null, // cos origin默认由系统决定
onMenuClick: (menuId, menuName, isArticle) => undefined,
onArticleClick: (atricleId) => undefined,
empty: undefined,

View File

@ -7,7 +7,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
})[];
entity: string;
entityId: string;
origin: 'qiniu';
origin: null | EntityDict['extraFile']['Schema']['origin'];
onMenuClick: (menuId: string, menuName: string, isArticle: boolean) => void;
empty: React.ReactNode | undefined;
execuable: boolean;

View File

@ -7,7 +7,7 @@ import Pagination from 'oak-frontend-base/es/components/pagination';
const { confirm } = Modal;
export default function Render(props) {
const { data, methods } = props;
const { articleMenus, oakFullpath, oakPagination, oakLoading, oakExecuting, oakEntity, entity, entityId, origin = 'qiniu', onMenuClick, empty, execuable } = data;
const { articleMenus, oakFullpath, oakPagination, oakLoading, oakExecuting, oakEntity, entity, entityId, onMenuClick, empty, execuable } = data;
const { t, goDetail, onCopy } = props.methods;
const [editorId, setEditorId] = useState('');
const IconButton = (props) => {

View File

@ -1,4 +1,5 @@
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "articleMenu", false, {
import { EntityDict } from "../../../oak-app-domain";
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "articleMenu", false, {
onRemove: () => void;
onUpdateName: (name: string) => Promise<void>;
onChildEditArticleChange: (data: string) => void;
@ -24,6 +25,6 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
setCurrentArticle: (id: string) => void;
onMenuViewById: (articleMenuId: string) => void;
setCopyArticleUrl: (id: string) => string;
origin: string;
origin: null | EntityDict["extraFile"]["Schema"]["origin"];
}>) => React.ReactElement;
export default _default;

View File

@ -62,7 +62,7 @@ export default OakComponent({
setCurrentArticle: (id) => undefined,
onMenuViewById: (articleMenuId) => undefined,
setCopyArticleUrl: (id) => '',
origin: 'qiniu', // cos origin默认七牛云
origin: null, // cos origin默认由系统决定
},
formData({ data: row }) {
const { articleMenu$parent, article$articleMenu } = row || {};

View File

@ -32,7 +32,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
currentArticle: string;
setCurrentArticle: (id: string) => void;
setCopyArticleUrl: (id: string) => string;
origin: 'qiniu';
origin: null | EntityDict['extraFile']['Schema']['origin'];
}, {
createSubArticle: (name: string) => Promise<void>;
createSubArticleMenu: (name: string) => Promise<void>;

View File

@ -7,7 +7,7 @@ import ExtraFileUpload from '../../extraFile/upload';
import ExtraFileCommit from '../../extraFile/commit';
import Styles from './web.pc.module.less';
export default function Render(props) {
const { row, allowCreateSubArticle, allowCreateSubMenu, allowRemove, onRemove, onUpdateName, oakFullpath, logo, onChildEditArticleChange, editArticleId, show, getBreadcrumbItemsByParent, breadItems, drawerOpen, changeDrawerOpen, selectedArticleId, openArray, getTopInfo, articleId, articleMenuId, getSideInfo, currentArticle, setCurrentArticle, setCopyArticleUrl, oakEntity, origin = 'qiniu' } = props.data;
const { row, allowCreateSubArticle, allowCreateSubMenu, allowRemove, onRemove, onUpdateName, oakFullpath, logo, onChildEditArticleChange, editArticleId, show, getBreadcrumbItemsByParent, breadItems, drawerOpen, changeDrawerOpen, selectedArticleId, openArray, getTopInfo, articleId, articleMenuId, getSideInfo, currentArticle, setCurrentArticle, setCopyArticleUrl, oakEntity, origin } = props.data;
const { update, execute, createSubArticle, createSubArticleMenu, setMessage, gotoDoc } = props.methods;
useEffect(() => {
if (editArticleId) {

View File

@ -31,6 +31,6 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
setCurrentArticle: (id: string) => void;
onMenuViewById: (articleMenuId: string) => void;
setCopyArticleUrl: (id: string) => string;
origin: string;
origin: null | EntityDict["extraFile"]["Schema"]["origin"];
}>) => React.ReactElement;
export default _default;

View File

@ -26,7 +26,7 @@ export default OakComponent({
setCurrentArticle: (id) => undefined,
onMenuViewById: (articleMenuId) => undefined,
setCopyArticleUrl: (id) => '',
origin: 'qiniu', // cos origin默认七牛云
origin: null, // cos origin默认由系统决定
},
projection: {
id: 1,

View File

@ -32,7 +32,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
setCurrentArticle: (id: string) => void;
onMenuViewById: (articleMenuId: string) => void;
setCopyArticleUrl: (id: string) => string;
origin: 'qiniu';
origin: null | EntityDict['extraFile']['Schema']['origin'];
}, {
createOne: (name?: string) => Promise<void>;
getDefaultArticle: (rows: EntityDict['articleMenu']['OpSchema'][]) => void;

View File

@ -3,7 +3,7 @@ import { Divider, Modal, Input, Form, Empty } from 'antd';
import TreeCell from '../treeCell';
import Styles from './web.pc.module.less';
export default function Render(props) {
const { rows, oakFullpath, parentId, onGrandChildEditArticleChange, show, getBreadcrumbItems, breadcrumbItems, drawerOpen, changeDrawerOpen, addOpen, changeAddOpen, selectedArticleId, defaultOpen, changeDefaultOpen, openArray, getTopInfo, articleId, articleMenuId, getSearchOpen, getSideInfo, currentArticle, setCurrentArticle, onMenuViewById, setCopyArticleUrl, origin = 'qiniu' } = props.data;
const { rows, oakFullpath, parentId, onGrandChildEditArticleChange, show, getBreadcrumbItems, breadcrumbItems, drawerOpen, changeDrawerOpen, addOpen, changeAddOpen, selectedArticleId, defaultOpen, changeDefaultOpen, openArray, getTopInfo, articleId, articleMenuId, getSearchOpen, getSideInfo, currentArticle, setCurrentArticle, onMenuViewById, setCopyArticleUrl, origin } = props.data;
const { t, createOne, removeItem, updateItem, execute, setMessage, getDefaultArticle, getSearchArticle } = props.methods;
useEffect(() => {
if (rows && rows.length > 0 && defaultOpen && !articleId) {

View File

@ -1,4 +1,5 @@
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "articleMenu", true, {
import { EntityDict } from "../../../oak-app-domain/EntityDict";
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "articleMenu", true, {
entity: string;
entityId: string;
show: "edit" | "doc" | "preview";
@ -12,7 +13,7 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
onArticlePreview: (content?: string, title?: string) => void;
onArticleEdit: (articleId: string) => void;
setCopyArticleUrl: (articleId: string) => string;
origin: string;
origin: EntityDict["extraFile"]["Schema"]["origin"] | null;
scrollId: string;
activeColor: string | undefined;
}>) => React.ReactElement;

View File

@ -25,7 +25,7 @@ export default OakComponent({
onArticlePreview: (content, title) => undefined, //预览文章
onArticleEdit: (articleId) => undefined, //编辑文章
setCopyArticleUrl: (articleId) => '',
origin: 'qiniu', // cos origin默认七牛云
origin: null, // cos origin默认由系统决定
scrollId: '', // 滚动条所在容器id不传默认页面编辑器容器id
activeColor: undefined, //目录高亮颜色
},

View File

@ -9,7 +9,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
articleId: string;
tocPosition: 'none' | 'left' | 'right';
highlightBgColor: string;
origin: 'qiniu';
origin: null | EntityDict['extraFile']['Schema']['origin'];
onMenuViewById: (articleMenuId: string) => void;
onArticlePreview: (content?: string, title?: string) => void;
onArticleEdit: (oakId: string) => void;

View File

@ -12,5 +12,6 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
entityId: string;
tag1: string;
tag2: string;
origin: EntityDict["extraFile"]["Schema"]["origin"] | null;
}>) => React.ReactElement;
export default _default;

View File

@ -14,6 +14,7 @@ export default OakComponent({
entityId: '',
tag1: '',
tag2: '',
origin: null,
},
methods: {
onEditReady(e) {
@ -69,7 +70,7 @@ export default OakComponent({
const extension = tempFilePath.substring(tempFilePath.lastIndexOf('.') + 1);
const filename = tempFilePath.substring(0, tempFilePath.lastIndexOf('.'));
const extraFile = {
origin: 'qiniu',
origin: this.props.origin,
type: 'image',
tag1: this.props.tag1 || 'editorImg',
tag2: this.props.tag2,

View File

@ -4,5 +4,6 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
entity: keyof EntityDict;
entityId: string;
autoUpload: boolean;
origin: EntityDict["extraFile"]["Schema"]["origin"] | null;
}>) => React.ReactElement;
export default _default;

View File

@ -30,7 +30,6 @@ export default OakComponent({
};
},
data: {
origin: 'qiniu',
type: 'image',
tag1: 'avatar',
},
@ -43,6 +42,7 @@ export default OakComponent({
entity: '',
entityId: '',
autoUpload: false,
origin: null,
},
methods: {
async onPickByMp() {
@ -93,8 +93,8 @@ export default OakComponent({
}));
},
async pushExtraFile(options) {
const { origin, type, tag1, avatar } = this.state;
const { entityId, entity, autoUpload = false } = this.props;
const { type, tag1, avatar } = this.state;
const { entityId, entity, autoUpload = false, origin } = this.props;
const { name, extra1, fileType, size } = options;
const extension = name.substring(name.lastIndexOf('.') + 1);
const filename = name.substring(0, name.lastIndexOf('.'));

View File

@ -61,7 +61,7 @@ export default OakComponent({
disableAdd: false, // 上传按钮隐藏
disableDownload: false, // 下载按钮隐藏
type: 'image',
origin: 'qiniu',
origin: null,
tag1: '',
tag2: '',
entity: '',

View File

@ -17,7 +17,7 @@ export default function render(props: WebComponentProps<EntityDict, 'extraFile',
disableDownload: boolean;
disabled: boolean;
type: string;
origin: string;
origin: EntityDict['extraFile']['Schema']['origin'] | null;
tag1: string;
tag2: string;
entity: keyof EntityDict;

View File

@ -67,6 +67,7 @@ export default OakComponent({
entity: '',
entityId: '',
imgUrls: [],
origin: null,
},
lifetimes: {},
listeners: {
@ -154,7 +155,7 @@ export default OakComponent({
},
createExtraFileData(file) {
const { methodsType } = this.state;
const { tag1, tag2, entity, entityId } = this.props;
const { tag1, tag2, entity, entityId, origin } = this.props;
let extension = '';
let filename = '';
const applicationId = this.features.application.getApplicationId();
@ -177,7 +178,7 @@ export default OakComponent({
extension = name.substring(name.lastIndexOf('.') + 1);
filename = name.substring(0, name.lastIndexOf('.'));
Object.assign(createData, {
origin: 'qiniu',
origin,
extension,
filename,
size,
@ -207,7 +208,10 @@ export default OakComponent({
},
async myAddItem(createData) {
// 目前只支持七牛上传
if (createData.origin === 'qiniu') {
if (createData.origin === 'unknown') {
this.addItem(createData);
}
else {
const file = createData.extra1;
const id = this.addItem(Object.assign(createData, {
extra1: null,
@ -215,9 +219,6 @@ export default OakComponent({
}));
this.features.extraFile.addLocalFile(id, file);
}
else {
this.addItem(createData);
}
},
async myUpdateItem(params) {
const { file } = this.state;

View File

@ -32,7 +32,7 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
disableDownload: boolean;
disabled: boolean;
type: string;
origin: string;
origin: ED2["extraFile"]["Schema"]["origin"] | null;
tag1: string;
tag2: string;
entity: keyof ED2;

View File

@ -133,7 +133,7 @@ export default OakComponent({
this.features.extraFile.removeLocalFiles([file.id]);
},
async addExtraFileInner(options, file) {
const { type, origin = 'qiniu', // 默认qiniu
const { type, origin, // 默认由系统决定
tag1, tag2, entity, entityId, bucket, autoUpload, } = this.props;
const { name, fileType, size, sort } = options;
const extension = name.substring(name.lastIndexOf('.') + 1);

View File

@ -10,7 +10,6 @@ export default function render(props) {
const { methods, data } = props;
const { nickname, avatarUrl, name, showBack, sessionId, session } = data;
const { getName } = methods;
const defaultUrl = 'http://qiniu.gecomebox.com/static/defaultAvatar.png';
const features = useFeatures();
const width = useWidth();
return (<div className={classNames(Style.header, {

View File

@ -256,7 +256,7 @@ export default OakComponent({
let applicationId = this.features.application.getApplicationId();
const extension = name.substring(name.lastIndexOf('.') + 1);
const filename = name.substring(0, name.lastIndexOf('.'));
let origin = 'qiniu';
let origin = null;
//需要获取用户方回复的applicationId判断用户是否从微信公众号或小程序发起客服消息
if (isEntity && userLastMessage?.wechatUserId) {
applicationId = userLastMessage?.applicationId;
@ -295,72 +295,5 @@ export default OakComponent({
throw err;
}
},
// async createMessage() {
// const { text, wechatUserId } = this.state;
// const { sessionId, isEntity } = this.props;
// const userId = this.features.token.getUserId();
// const applicationId = this.features.application.getApplicationId();
// this.addItem({
// applicationId,
// text,
// userId,
// wechatUserId,
// sessionId: sessionId,
// type: 'text',
// createTime: Date.now(),
// aaoe: isEntity,
// } as EntityDict['sessionMessage']['CreateOperationData']);
// await this.execute(undefined, false);
// this.pageScroll('comment');
// },
// async customUpload(file: {
// name: string;
// size: number;
// type: string;
// originFileObj: File;
// }) {
// const { sessionId, isEntity } = this.props;
// const { name, size, type, originFileObj } = file;
// const applicationId = this.features.application.getApplicationId();
// const extension = name.substring(name.lastIndexOf('.') + 1);
// const filename = name.substring(0, name.lastIndexOf('.'));
// //需要获取用户方回复的applicationId
// const extraFile = {
// applicationId,
// origin: 'qiniu',
// type: 'image',
// tag1: 'image',
// filename,
// fileType: type,
// size,
// extension,
// entity: 'sessionMessage',
// id: generateNewId(),
// } as EntityDict['extraFile']['CreateOperationData'];
// try {
// this.addItem({
// applicationId,
// sessionId,
// createTime: Date.now(),
// aaoe: isEntity,
// type: 'image',
// extraFile$entity: [
// {
// id: generateNewId(),
// action: 'create',
// data: extraFile,
// },
// ],
// } as EntityDict['sessionMessage']['CreateOperationData']);
// this.features.extraFile.addLocalFile(
// extraFile?.id,
// originFileObj
// );
// await this.execute(undefined, false);
// this.features.extraFile.upload(extraFile?.id);
// } catch (err) {
// throw err;
// }
// },
},
});

View File

@ -1,6 +1,6 @@
import { EntityDict } from '../../../../oak-app-domain';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "extraFile", true, {
origin: string;
origin: EntityDict["extraFile"]["Schema"]["origin"] | null;
idCardType: string;
entityId: string;
entity: string;

View File

@ -45,7 +45,7 @@ export default OakComponent({
},
data: {},
properties: {
origin: 'qiniu',
origin: null,
idCardType: '',
entityId: '',
entity: 'user',
@ -92,7 +92,7 @@ export default OakComponent({
}
},
async pushExtraFile(options, tag2) {
const { entity, entityId, autoUpload = false, origin = 'qiniu', idCardType, } = this.props;
const { entity, entityId, autoUpload = false, origin, idCardType, } = this.props;
const { name, extra1, fileType, size } = options;
const extension = name.substring(name.lastIndexOf('.') + 1);
const filename = name.substring(0, name.lastIndexOf('.'));

View File

@ -1,6 +1,6 @@
import { EntityDict } from '../../../oak-app-domain';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "user", false, {
origin: string;
origin: EntityDict["extraFile"]["Schema"]["origin"] | null;
autoUpload: boolean;
onFinish: (() => void) | undefined;
needUploadPhotos: boolean;

View File

@ -63,7 +63,7 @@ export default OakComponent({
},
},
properties: {
origin: 'qiniu',
origin: null,
autoUpload: false,
onFinish: undefined,
needUploadPhotos: false, //是否上传照片

View File

@ -40,7 +40,9 @@ const triggers = [
filter: {
id: context.getApplicationId(),
},
}, {});
}, {
dontCollect: true
});
assert(application, `找不到 当前应用程序`);
cachedOrigin = application.config?.cos?.defaultOrigin ||
application.system?.config?.Cos?.defaultOrigin ||

View File

@ -43,7 +43,9 @@ const triggers = [
filter: {
id: context.getApplicationId(),
},
}, {});
}, {
dontCollect: true
});
(0, assert_1.default)(application, `找不到 当前应用程序`);
cachedOrigin = application.config?.cos?.defaultOrigin ||
application.system?.config?.Cos?.defaultOrigin ||

View File

@ -35,7 +35,6 @@ export default OakComponent({
const systemId = this.features.application.getApplication().systemId!;
const { data: [system] } = await this.features.cache.refresh("system", {
action: 'select',
data: {
config: {
Cos: {
@ -128,4 +127,4 @@ export default OakComponent({
)
},
},
})
}) as any

View File

@ -33,7 +33,7 @@ export default OakComponent({
tocPosition: 'none' as 'none' | 'left' | 'right', //目录显示位置none为不显示目录
highlightBgColor: 'none', //点击目录时标题高亮背景色none为不显示高亮背景色
onArticlePreview: (content?: string, title?: string) => undefined as void, //预览文章
origin: 'qiniu', // 默认为七牛云
origin: null as null | EntityDict['extraFile']['Schema']['origin'], // 默认为空,由系统决定
scrollId: '', // 滚动条所在容器id不传默认页面编辑器容器id
height: 600 as number | 'auto',
activeColor: undefined as string | undefined,

View File

@ -55,7 +55,7 @@ export default function Render(
name: string;
editor: any;
content?: string;
origin?: string;
origin?: null | EntityDict['extraFile']['Schema']['origin'];
contentTip: boolean;
articleMenuId: string;
oakId: string;
@ -100,7 +100,7 @@ export default function Render(
name,
content,
editor,
origin = 'qiniu',
origin,
tocPosition = 'none',
highlightBgColor,
scrollId,

View File

@ -133,7 +133,7 @@ export function TocView(
let currentHighlighted = '';
let isClick = false;
let clickTimeout: NodeJS.Timeout | undefined = undefined;
let clickTimeout: NodeJS.Timeout | undefined | number = undefined;
// 滚动目录以确保指定目录项可见
function scrollToTocItem(item: any) {

View File

@ -31,7 +31,7 @@ export default OakComponent({
tocPosition: 'none' as 'none' | 'left' | 'right', //目录显示位置none为不显示目录
highlightBgColor: 'none', //点击目录时标题高亮背景色none为不显示高亮背景色
onArticlePreview: (content?: string, title?: string) => undefined as void, //预览文章
origin: 'qiniu', // 默认为七牛云
origin: null as EntityDict['extraFile']['Schema']['origin'] | null, // 默认为七牛云
scrollId: '', // 滚动条所在容器id不传默认页面编辑器容器id
height: 600 as number | 'auto',
activeColor: undefined as string | undefined,

View File

@ -55,7 +55,7 @@ export default function Render(
name: string;
editor: any;
content?: string;
origin?: string;
origin?: null | EntityDict['extraFile']['Schema']['origin'];
contentTip: boolean;
articleMenuId: string;
oakId: string;
@ -97,7 +97,7 @@ export default function Render(
id,
content,
editor,
origin = 'qiniu',
origin,
tocPosition = 'none',
highlightBgColor,
activeColor,

View File

@ -13,7 +13,7 @@ export default OakComponent({
entity: '',
entityId: '',
title: '',
origin: 'qiniu', // cos origin默认七牛云
origin: null as null | EntityDict['extraFile']['Schema']['origin'], // cos origin默认由系统决定
menuEmpty: undefined as React.ReactNode | undefined,
articleEmpty: undefined as React.ReactNode | undefined,
generateUrl: ((mode: Mode, type: Action, id: string) => {}) as GenerateUrlFn, //构造文章显示路由

View File

@ -21,7 +21,7 @@ export default function Render(
id: string;
title: string;
}[];
origin: 'qiniu';
origin: null | EntityDict['extraFile']['Schema']['origin'];
menuEmpty: React.ReactNode | undefined;
articleEmpty: React.ReactNode | undefined;
parentId: string | undefined;
@ -41,7 +41,7 @@ export default function Render(
>
) {
const { data, methods } = props;
const { oakFullpath, oakLoading, oakExecuting, entity, entityId, title, breadcrumbItems, origin = 'qiniu', menuEmpty, articleEmpty, parentId, articleMenuId, showAddArticle, showAddMenu,
const { oakFullpath, oakLoading, oakExecuting, entity, entityId, title, breadcrumbItems, origin, menuEmpty, articleEmpty, parentId, articleMenuId, showAddArticle, showAddMenu,
generateUrl,
} = data;
const { t, onBreadcrumItemClick, onMenuClick, onAddMenu, changeAddArticle, onAddArticle, menuCheck } = methods;

View File

@ -3,6 +3,7 @@ import dayjs from "dayjs";
import copy from 'copy-to-clipboard';
import { DATA_SUBSCRIBER_KEYS } from "../../../config/constants";
import { GenerateUrlFn, Mode, Action } from "../../../types/Article";
import { EntityDict } from "../../../oak-app-domain";
export default OakComponent({
entity: 'articleMenu',
@ -97,7 +98,7 @@ export default OakComponent({
entity: '',
entityId: '',
parentId: '' as string | undefined,
origin: 'qiniu', // cos origin默认七牛云
origin: null as EntityDict['extraFile']['Schema']['origin'] | null, // cos origin默认由系统决定
onMenuClick: (menuId: string, menuName: string, isArticle: boolean) => undefined as void,
onArticleClick: (atricleId: string) => undefined as void,
empty: undefined as React.ReactNode | undefined,

View File

@ -20,7 +20,7 @@ export default function Render(
})[];
entity: string;
entityId: string;
origin: 'qiniu';
origin: null | EntityDict['extraFile']['Schema']['origin'];
onMenuClick: (menuId: string, menuName: string, isArticle: boolean) => void;
empty: React.ReactNode | undefined;
execuable: boolean;
@ -32,7 +32,7 @@ export default function Render(
>
) {
const { data, methods } = props;
const { articleMenus, oakFullpath, oakPagination, oakLoading, oakExecuting, oakEntity, entity, entityId, origin = 'qiniu', onMenuClick, empty, execuable } = data;
const { articleMenus, oakFullpath, oakPagination, oakLoading, oakExecuting, oakEntity, entity, entityId, onMenuClick, empty, execuable } = data;
const { t, goDetail, onCopy } = props.methods;
const [editorId, setEditorId] = useState('');

View File

@ -1,4 +1,5 @@
import { generateNewId, generateNewIdAsync } from "oak-domain/lib/utils/uuid";
import { EntityDict } from "../../../oak-app-domain";
export default OakComponent({
entity: 'articleMenu',
@ -63,7 +64,7 @@ export default OakComponent({
setCurrentArticle: (id: string) => undefined as void,
onMenuViewById: (articleMenuId: string) => undefined as void,
setCopyArticleUrl: (id: string) => '' as string,
origin: 'qiniu', // cos origin默认七牛云
origin: null as null | EntityDict['extraFile']['Schema']['origin'], // cos origin默认由系统决定
},
formData({ data: row }) {
const { articleMenu$parent, article$articleMenu } = row || {};

View File

@ -33,7 +33,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
currentArticle: string;
setCurrentArticle: (id: string) => void;
setCopyArticleUrl: (id: string) => string;
origin: 'qiniu';
origin: null | EntityDict['extraFile']['Schema']['origin'];
}, {
createSubArticle: (name: string) => Promise<void>;
createSubArticleMenu: (name: string) => Promise<void>;
@ -65,7 +65,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
setCurrentArticle,
setCopyArticleUrl,
oakEntity,
origin = 'qiniu'
origin
} = props.data;
const { update, execute, createSubArticle, createSubArticleMenu, setMessage, gotoDoc } = props.methods;
useEffect(() => {

View File

@ -29,7 +29,7 @@ export default OakComponent({
setCurrentArticle: (id: string) => undefined as void,
onMenuViewById: (articleMenuId: string) => undefined as void,
setCopyArticleUrl: (id: string) => '' as string,
origin: 'qiniu', // cos origin默认七牛云
origin: null as null | EntityDict['extraFile']['Schema']['origin'], // cos origin默认由系统决定
},
projection: {
id: 1,

View File

@ -28,7 +28,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
setCurrentArticle: (id: string) => void;
onMenuViewById: (articleMenuId: string) => void;
setCopyArticleUrl: (id: string) => string;
origin: 'qiniu';
origin: null | EntityDict['extraFile']['Schema']['origin'];
}, {
createOne: (name?: string) => Promise<void>;
getDefaultArticle: (rows: EntityDict['articleMenu']['OpSchema'][]) => void;
@ -59,7 +59,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
setCurrentArticle,
onMenuViewById,
setCopyArticleUrl,
origin = 'qiniu'
origin
} = props.data;
const { t, createOne, removeItem, updateItem, execute, setMessage, getDefaultArticle, getSearchArticle } = props.methods;
useEffect(() => {

View File

@ -1,3 +1,4 @@
import { EntityDict } from "../../../oak-app-domain/EntityDict";
export default OakComponent({
entity: 'articleMenu',
@ -26,7 +27,7 @@ export default OakComponent({
onArticlePreview: (content?: string, title?: string) => undefined as void, //预览文章
onArticleEdit: (articleId: string) => undefined as void, //编辑文章
setCopyArticleUrl: (articleId: string) => '' as string,
origin: 'qiniu', // cos origin默认七牛云
origin: null as EntityDict['extraFile']['Schema']['origin'] | null, // cos origin默认由系统决定
scrollId: '', // 滚动条所在容器id不传默认页面编辑器容器id
activeColor: undefined as string | undefined, //目录高亮颜色
},

View File

@ -44,7 +44,7 @@ export default function Render(
articleId: string,
tocPosition: 'none' | 'left' | 'right';
highlightBgColor: string;
origin: 'qiniu';
origin: null | EntityDict['extraFile']['Schema']['origin'];
onMenuViewById: (articleMenuId: string) => void;
onArticlePreview: (content?: string, title?: string) => void;
onArticleEdit: (oakId: string) => void;

View File

@ -16,6 +16,7 @@ export default OakComponent({
entityId: '',
tag1: '',
tag2: '',
origin: null as EntityDict['extraFile']['Schema']['origin'] | null,
},
methods: {
onEditReady(e: WechatMiniprogram.EventCallback) {
@ -76,7 +77,7 @@ export default OakComponent({
tempFilePath.lastIndexOf('.')
);
const extraFile = {
origin: 'qiniu',
origin: this.props.origin,
type: 'image',
tag1: this.props.tag1 || 'editorImg',
tag2: this.props.tag2,

View File

@ -36,7 +36,6 @@ export default OakComponent({
};
},
data: {
origin: 'qiniu',
type: 'image',
tag1: 'avatar',
},
@ -49,6 +48,7 @@ export default OakComponent({
entity: '' as keyof EntityDict,
entityId: '' as string,
autoUpload: false,
origin: null as EntityDict['extraFile']['Schema']['origin'] | null,
},
methods: {
async onPickByMp() {
@ -112,8 +112,8 @@ export default OakComponent({
fileType: string;
size: number;
}) {
const { origin, type, tag1, avatar } = this.state;
const { entityId, entity, autoUpload = false } = this.props;
const { type, tag1, avatar } = this.state;
const { entityId, entity, autoUpload = false, origin } = this.props;
const { name, extra1, fileType, size } = options;
const extension = name.substring(name.lastIndexOf('.') + 1);
const filename = name.substring(0, name.lastIndexOf('.'));

View File

@ -93,7 +93,7 @@ export default OakComponent({
disableAdd: false, // 上传按钮隐藏
disableDownload: false, // 下载按钮隐藏
type: 'image' as ExtraFile['type'],
origin: 'qiniu' as ExtraFile['origin'],
origin: null as ExtraFile['origin'] | null,
tag1: '',
tag2: '',
entity: '' as keyof EntityDict,

View File

@ -45,7 +45,7 @@ export default function render(
disableDownload: boolean;
disabled: boolean;
type: string;
origin: string;
origin: EntityDict['extraFile']['Schema']['origin'] | null;
tag1: string;
tag2: string;
entity: keyof EntityDict;

View File

@ -74,6 +74,7 @@ export default OakComponent({
entity: '' as keyof EntityDict,
entityId: '',
imgUrls: [] as string[],
origin: null as EntityDict['extraFile']['Schema']['origin'] | null,
},
lifetimes: {
},
@ -163,7 +164,7 @@ export default OakComponent({
createExtraFileData(file: File | string) {
const { methodsType } = this.state;
const { tag1, tag2, entity, entityId } = this.props;
const { tag1, tag2, entity, entityId, origin } = this.props;
let extension = '';
let filename = '';
const applicationId = this.features.application.getApplicationId();
@ -187,7 +188,7 @@ export default OakComponent({
extension = name.substring(name.lastIndexOf('.') + 1);
filename = name.substring(0, name.lastIndexOf('.'));
Object.assign(createData, {
origin: 'qiniu',
origin,
extension,
filename,
size,
@ -219,7 +220,9 @@ export default OakComponent({
async myAddItem(createData: EntityDict['extraFile']['CreateOperationData']) {
// 目前只支持七牛上传
if (createData.origin === 'qiniu') {
if (createData.origin === 'unknown') {
this.addItem(createData);
} else {
const file = createData.extra1;
const id = this.addItem(
Object.assign(createData, {
@ -229,9 +232,6 @@ export default OakComponent({
);
this.features.extraFile.addLocalFile(id, file as any);
}
else {
this.addItem(createData);
}
},
async myUpdateItem(params: File | string) {
const { file } = this.state;

View File

@ -184,7 +184,7 @@ export default OakComponent({
) {
const {
type,
origin = 'qiniu', // 默认qiniu
origin, // 默认由系统决定
tag1,
tag2,
entity,
@ -530,7 +530,7 @@ export default OakComponent({
disableDownload: boolean;
disabled: boolean;
type: string;
origin: string;
origin: ED2['extraFile']['Schema']['origin'] | null;
tag1: string;
tag2: string;
entity: keyof ED2;

View File

@ -28,7 +28,6 @@ export default function render(props: WebComponentProps<
const { methods, data } = props;
const { nickname, avatarUrl, name, showBack, sessionId, session } = data;
const { getName } = methods;
const defaultUrl = 'http://qiniu.gecomebox.com/static/defaultAvatar.png'
const features = useFeatures();
const width = useWidth();

View File

@ -64,7 +64,7 @@ export default OakComponent({
},
detached() {
const { unSub } = this.state;
unSub && unSub();
unSub && unSub();
},
},
listeners: {
@ -290,7 +290,7 @@ export default OakComponent({
const extension = name.substring(name.lastIndexOf('.') + 1);
const filename = name.substring(0, name.lastIndexOf('.'));
let origin: EntityDict['extraFile']['Schema']['origin'] = 'qiniu';
let origin: EntityDict['extraFile']['Schema']['origin'] | null = null;
//需要获取用户方回复的applicationId判断用户是否从微信公众号或小程序发起客服消息
if (isEntity && userLastMessage?.wechatUserId) {
applicationId = userLastMessage?.applicationId;
@ -337,79 +337,5 @@ export default OakComponent({
throw err;
}
},
// async createMessage() {
// const { text, wechatUserId } = this.state;
// const { sessionId, isEntity } = this.props;
// const userId = this.features.token.getUserId();
// const applicationId = this.features.application.getApplicationId();
// this.addItem({
// applicationId,
// text,
// userId,
// wechatUserId,
// sessionId: sessionId,
// type: 'text',
// createTime: Date.now(),
// aaoe: isEntity,
// } as EntityDict['sessionMessage']['CreateOperationData']);
// await this.execute(undefined, false);
// this.pageScroll('comment');
// },
// async customUpload(file: {
// name: string;
// size: number;
// type: string;
// originFileObj: File;
// }) {
// const { sessionId, isEntity } = this.props;
// const { name, size, type, originFileObj } = file;
// const applicationId = this.features.application.getApplicationId();
// const extension = name.substring(name.lastIndexOf('.') + 1);
// const filename = name.substring(0, name.lastIndexOf('.'));
// //需要获取用户方回复的applicationId
// const extraFile = {
// applicationId,
// origin: 'qiniu',
// type: 'image',
// tag1: 'image',
// filename,
// fileType: type,
// size,
// extension,
// entity: 'sessionMessage',
// id: generateNewId(),
// } as EntityDict['extraFile']['CreateOperationData'];
// try {
// this.addItem({
// applicationId,
// sessionId,
// createTime: Date.now(),
// aaoe: isEntity,
// type: 'image',
// extraFile$entity: [
// {
// id: generateNewId(),
// action: 'create',
// data: extraFile,
// },
// ],
// } as EntityDict['sessionMessage']['CreateOperationData']);
// this.features.extraFile.addLocalFile(
// extraFile?.id,
// originFileObj
// );
// await this.execute(undefined, false);
// this.features.extraFile.upload(extraFile?.id);
// } catch (err) {
// throw err;
// }
// },
},
});

View File

@ -61,7 +61,7 @@ export default OakComponent({
},
data: {},
properties: {
origin: 'qiniu',
origin: null as EntityDict['extraFile']['Schema']['origin'] | null,
idCardType: '',
entityId: '',
entity: 'user',
@ -130,7 +130,7 @@ export default OakComponent({
entity,
entityId,
autoUpload = false,
origin = 'qiniu',
origin,
idCardType,
} = this.props;
const { name, extra1, fileType, size } = options;

View File

@ -65,7 +65,7 @@ export default OakComponent({
},
},
properties: {
origin: 'qiniu',
origin: null as EntityDict['extraFile']['Schema']['origin'] | null,
autoUpload: false,
onFinish: undefined as (() => void) | undefined,

View File

@ -27,30 +27,20 @@ const triggers: Trigger<EntityDict, 'extraFile', BRC<EntityDict>>[] = [
const [application] = await context.select("application", {
data: {
config: {
cos: {
defaultOrigin: 1,
}
},
config: 1,
system: {
config: {
Cos: {
defaultOrigin: 1,
}
},
config: 1,
platform: {
config: {
Cos: {
defaultOrigin: 1,
}
}
config: 1
}
}
},
filter: {
id: context.getApplicationId()!,
},
}, {});
}, {
dontCollect: true
});
assert(application, `找不到 当前应用程序`);