Merge branch 'auth' of codeup.aliyun.com:61c14a7efa282c88e103c23f/oak-general-business into auth
This commit is contained in:
commit
b93b6000e8
|
|
@ -0,0 +1,4 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
/// <reference types="react" />
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../../general-app-domain").EntityDict, "articleMenu", false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
exports.default = OakComponent({
|
||||
entity: 'articleMenu',
|
||||
projection: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
parent: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
},
|
||||
},
|
||||
isList: false,
|
||||
formData: function (_a) {
|
||||
var _b, _c;
|
||||
var articleMenu = _a.data;
|
||||
console.log(articleMenu);
|
||||
return {
|
||||
name: articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.name,
|
||||
parentId: (_b = articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.parent) === null || _b === void 0 ? void 0 : _b.id,
|
||||
parentName: (_c = articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.parent) === null || _c === void 0 ? void 0 : _c.name,
|
||||
};
|
||||
},
|
||||
lifetimes: {
|
||||
ready: function () {
|
||||
var _a, _b, _c, _d, _e;
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var _f, parentId, id, articleMenu;
|
||||
return tslib_1.__generator(this, function (_g) {
|
||||
switch (_g.label) {
|
||||
case 0:
|
||||
_f = this.props, parentId = _f.parentId, id = _f.id;
|
||||
console.log(66666666, parentId, id);
|
||||
if (!id) return [3 /*break*/, 2];
|
||||
return [4 /*yield*/, this.features.cache.refresh('articleMenu', {
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
},
|
||||
filter: {
|
||||
id: id
|
||||
}
|
||||
})];
|
||||
case 1:
|
||||
articleMenu = (_g.sent()).data;
|
||||
console.log(articleMenu);
|
||||
if (articleMenu) {
|
||||
this.update({
|
||||
entity: (_a = articleMenu[0]) === null || _a === void 0 ? void 0 : _a.entity,
|
||||
entityId: (_b = articleMenu[0]) === null || _b === void 0 ? void 0 : _b.entityId,
|
||||
isLeaf: (_c = articleMenu[0]) === null || _c === void 0 ? void 0 : _c.isLeaf,
|
||||
isArticle: (_d = articleMenu[0]) === null || _d === void 0 ? void 0 : _d.isArticle,
|
||||
});
|
||||
}
|
||||
return [3 /*break*/, 3];
|
||||
case 2:
|
||||
this.update({
|
||||
entity: 'platformProvider',
|
||||
entityId: (_e = this.features.application.getApplication()) === null || _e === void 0 ? void 0 : _e.system,
|
||||
isArticle: false,
|
||||
isLeaf: false,
|
||||
});
|
||||
_g.label = 3;
|
||||
case 3: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onRemoveArticleMenu: function (id) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
this.removeItem(id);
|
||||
return [4 /*yield*/, this.execute()];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
check: function () {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
if (!this.state.name) {
|
||||
this.setMessage({
|
||||
type: 'error',
|
||||
content: '请输入文章分类名称',
|
||||
});
|
||||
return [2 /*return*/];
|
||||
}
|
||||
return [4 /*yield*/, this.execute()];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
reset: function () {
|
||||
this.clean();
|
||||
},
|
||||
}
|
||||
});
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from "../../../../general-app-domain";
|
||||
export default function render(props: WebComponentProps<EntityDict, 'articleMenu', false, {
|
||||
name: string;
|
||||
parentId: string;
|
||||
parentName: string;
|
||||
}, {
|
||||
check: () => void;
|
||||
reset: () => void;
|
||||
onRemoveArticleMenu: (id: string) => void;
|
||||
}>): import("react/jsx-runtime").JSX.Element;
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var antd_1 = require("antd");
|
||||
var confirm = antd_1.Modal.confirm;
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
function render(props) {
|
||||
var _this = this;
|
||||
var data = props.data, methods = props.methods;
|
||||
var t = methods.t, update = methods.update, reset = methods.reset, check = methods.check, onRemoveArticleMenu = methods.onRemoveArticleMenu;
|
||||
var name = data.name, parentId = data.parentId, parentName = data.parentName;
|
||||
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)(antd_1.Row, { children: (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ xs: 24, sm: 16 }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 4 }, wrapperCol: { span: 20 } }, { children: [parentId ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('articleMenu:attr.parent'), name: "parent" }, { children: (0, jsx_runtime_1.jsx)(antd_1.Tooltip, { children: parentName }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('articleMenu:attr.name'), name: "name", rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '文章分类名称必填',
|
||||
},
|
||||
] }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165\u6587\u7AE0\u5206\u7C7B\u540D\u79F0", onChange: function (e) {
|
||||
update({
|
||||
name: e.target.value,
|
||||
});
|
||||
}, value: name }) }) }))] })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('articleMenu:attr.name'), name: "name", rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '文章分类名称必填',
|
||||
},
|
||||
] }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165\u6587\u7AE0\u5206\u7C7B\u540D\u79F0", onChange: function (e) {
|
||||
update({
|
||||
name: e.target.value,
|
||||
});
|
||||
}, value: name }) }) })) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 4 } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {
|
||||
check();
|
||||
} }, { children: "\u63D0\u4EA4" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () {
|
||||
reset();
|
||||
} }, { children: "\u91CD\u7F6E" })), (0, jsx_runtime_1.jsx)(antd_1.Button, { children: "\u6DFB\u52A0\u5B50\u8282\u70B9" }), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function () {
|
||||
var modal = confirm({
|
||||
title: '确定删除该文章分类吗?',
|
||||
content: '删除后不可恢复',
|
||||
okText: '确定',
|
||||
cancelText: '取消',
|
||||
onOk: function (e) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, onRemoveArticleMenu(id)];
|
||||
case 1:
|
||||
_a.sent();
|
||||
modal.destroy();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); },
|
||||
});
|
||||
} }, { children: "\u5220\u9664" }))] }) }))] })) })) }) })));
|
||||
}
|
||||
exports.default = render;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
/// <reference types="react" />
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../general-app-domain").EntityDict, "article", false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
exports.default = OakComponent({
|
||||
entity: 'article',
|
||||
isList: false,
|
||||
projection: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenu: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
},
|
||||
},
|
||||
formData: function (_a) {
|
||||
var article = _a.data;
|
||||
return {
|
||||
content: article === null || article === void 0 ? void 0 : article.content,
|
||||
name: article === null || article === void 0 ? void 0 : article.name,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
onRemoveArticle: function (id) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
this.remove();
|
||||
return [4 /*yield*/, this.execute()];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
gotoArticleEdit: function (articleId) {
|
||||
this.navigateTo({
|
||||
url: '/article/upsert',
|
||||
oakId: articleId,
|
||||
});
|
||||
},
|
||||
gotoPreview: function (content, title, articleId) {
|
||||
this.save('article_html', JSON.stringify({
|
||||
content: content,
|
||||
title: title,
|
||||
articleId: articleId,
|
||||
}));
|
||||
window.open("/article/preview?oakId=".concat(articleId));
|
||||
},
|
||||
copy: function (articleId) {
|
||||
var _this = this;
|
||||
var url = "".concat(window.location.host, "/article/detail?oakId=").concat(articleId);
|
||||
navigator.clipboard.writeText(url).then(function () {
|
||||
_this.setMessage({
|
||||
content: '复制链接成功',
|
||||
type: 'success',
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import '@wangeditor/editor/dist/css/style.css';
|
||||
import { EntityDict } from '../../../general-app-domain';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'article', false, {
|
||||
oakId: string;
|
||||
content: string;
|
||||
name: string;
|
||||
}, {
|
||||
gotoArticleEdit: (articleId: string) => void;
|
||||
onRemoveArticle: () => void;
|
||||
gotoPreview: (content: string, name: string, articleId: string) => void;
|
||||
}>): JSX.Element;
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var antd_1 = require("antd");
|
||||
require("@wangeditor/editor/dist/css/style.css"); // 引入 css
|
||||
var editor_for_react_1 = require("@wangeditor/editor-for-react");
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
var icons_1 = require("@ant-design/icons");
|
||||
var copy_to_clipboard_1 = tslib_1.__importDefault(require("copy-to-clipboard"));
|
||||
var editorConfig = {
|
||||
readOnly: true,
|
||||
autoFocus: true,
|
||||
scroll: false,
|
||||
};
|
||||
function Render(props) {
|
||||
var methods = props.methods, data = props.data;
|
||||
var content = data.content, oakId = data.oakId, name = data.name;
|
||||
var t = methods.t, onRemoveArticle = methods.onRemoveArticle, gotoArticleEdit = methods.gotoArticleEdit, gotoPreview = methods.gotoPreview;
|
||||
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { display: 'flex', justifyContent: 'flex-end' } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsxs)(antd_1.Button, tslib_1.__assign({ onClick: function () {
|
||||
var url = "".concat(window.location.host, "/article/detail?oakId=").concat(oakId);
|
||||
(0, copy_to_clipboard_1.default)(url);
|
||||
methods.setMessage({
|
||||
content: '复制链接成功',
|
||||
type: 'success',
|
||||
});
|
||||
} }, { children: [(0, jsx_runtime_1.jsx)(icons_1.CopyOutlined, {}), "\u590D\u5236\u94FE\u63A5"] })), (0, jsx_runtime_1.jsxs)(antd_1.Button, tslib_1.__assign({ onClick: function () {
|
||||
gotoPreview(content, name, oakId);
|
||||
} }, { children: [(0, jsx_runtime_1.jsx)(icons_1.EyeOutlined, {}), "\u67E5\u770B"] }))] }) })), (0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 4 }, wrapperCol: { span: 20 } }, { children: [(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Form.Item, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: content ? ((0, jsx_runtime_1.jsx)(editor_for_react_1.Editor, { defaultConfig: editorConfig, value: content, mode: "default", style: {
|
||||
width: 750,
|
||||
} })) : null }) }) }), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 4 } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {
|
||||
gotoArticleEdit(oakId);
|
||||
} }, { children: "\u7F16\u8F91" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function () {
|
||||
var modal = antd_1.Modal.confirm({
|
||||
title: '确定删除该文章吗?',
|
||||
content: '删除后不可恢复',
|
||||
okText: '确定',
|
||||
cancelText: '取消',
|
||||
onOk: function (e) {
|
||||
onRemoveArticle();
|
||||
modal.destroy();
|
||||
},
|
||||
});
|
||||
} }, { children: "\u5220\u9664" }))] }) }))] }))] })));
|
||||
}
|
||||
exports.default = Render;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
/// <reference types="react" />
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../general-app-domain").EntityDict, "article", false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = OakComponent({
|
||||
entity: 'article',
|
||||
isList: false,
|
||||
projection: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenu: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
},
|
||||
},
|
||||
formData: function (_a) {
|
||||
var article = _a.data;
|
||||
return {
|
||||
content: article === null || article === void 0 ? void 0 : article.content,
|
||||
name: article === null || article === void 0 ? void 0 : article.name,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
copy: function (articleId) {
|
||||
var _this = this;
|
||||
var url = "".concat(window.location.host, "/article/detail?oakId=").concat(articleId);
|
||||
navigator.clipboard.writeText(url).then(function () {
|
||||
_this.setMessage({
|
||||
content: '复制链接成功',
|
||||
type: 'success',
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
import '@wangeditor/editor/dist/css/style.css';
|
||||
import { EntityDict } from '../../../general-app-domain';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'article', false, {
|
||||
oakId: string;
|
||||
content: string;
|
||||
name: string;
|
||||
}, {}>): JSX.Element;
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var react_1 = require("react");
|
||||
var antd_1 = require("antd");
|
||||
var confirm = antd_1.Modal.confirm;
|
||||
require("@wangeditor/editor/dist/css/style.css"); // 引入 css
|
||||
var editor_for_react_1 = require("@wangeditor/editor-for-react");
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
function Render(props) {
|
||||
var methods = props.methods, data = props.data;
|
||||
var _a = props.data, content = _a.content, name = _a.name, oakId = _a.oakId;
|
||||
var t = methods.t;
|
||||
var editorConfig = {
|
||||
readOnly: true,
|
||||
autoFocus: true,
|
||||
scroll: false,
|
||||
};
|
||||
var _b = tslib_1.__read((0, react_1.useState)(''), 2), value = _b[0], setValue = _b[1];
|
||||
(0, react_1.useEffect)(function () {
|
||||
if (content) {
|
||||
setValue(content);
|
||||
}
|
||||
}, [content]);
|
||||
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.rightContainer }, { children: (0, jsx_runtime_1.jsx)(antd_1.Row, { children: (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ xs: 24, sm: 16 }, { children: (0, jsx_runtime_1.jsx)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 4 }, wrapperCol: { span: 20 } }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Form.Item, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(editor_for_react_1.Editor, { defaultConfig: editorConfig, value: value, mode: "default", style: {
|
||||
width: 750,
|
||||
} }) }) }) }) })) })) }) })));
|
||||
}
|
||||
exports.default = Render;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
/// <reference types="react" />
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../general-app-domain").EntityDict, "article", false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = OakComponent({
|
||||
entity: 'article',
|
||||
isList: false,
|
||||
projection: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenu: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
},
|
||||
},
|
||||
formData: function (_a) {
|
||||
var article = _a.data;
|
||||
return {
|
||||
content: article === null || article === void 0 ? void 0 : article.content,
|
||||
name: article === null || article === void 0 ? void 0 : article.name,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
copy: function (articleId) {
|
||||
var _this = this;
|
||||
var url = "".concat(window.location.host, "/article/preview?oakId=").concat(articleId);
|
||||
navigator.clipboard.writeText(url).then(function () {
|
||||
_this.setMessage({
|
||||
content: '复制链接成功',
|
||||
type: 'success',
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import '@wangeditor/editor/dist/css/style.css';
|
||||
import { EntityDict } from '../../../general-app-domain';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'article', false, {
|
||||
oakId: string;
|
||||
content: string;
|
||||
name: string;
|
||||
width: string;
|
||||
}, {
|
||||
gotoArticleEdit: (articleId: string) => void;
|
||||
onRemoveArticle: (id: string) => void;
|
||||
copy: (id: string) => void;
|
||||
}>): JSX.Element;
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var react_1 = require("react");
|
||||
var antd_1 = require("antd");
|
||||
var confirm = antd_1.Modal.confirm;
|
||||
require("@wangeditor/editor/dist/css/style.css"); // 引入 css
|
||||
var editor_for_react_1 = require("@wangeditor/editor-for-react");
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
function Render(props) {
|
||||
var method = props.methods, data = props.data;
|
||||
var _a = props.data, content = _a.content, name = _a.name, oakId = _a.oakId, width = _a.width;
|
||||
var t = method.t, onRemoveArticle = method.onRemoveArticle, gotoArticleEdit = method.gotoArticleEdit, copy = method.copy;
|
||||
var editorConfig = {
|
||||
readOnly: true,
|
||||
autoFocus: true,
|
||||
scroll: false,
|
||||
};
|
||||
var _b = tslib_1.__read((0, react_1.useState)(''), 2), value = _b[0], setValue = _b[1];
|
||||
(0, react_1.useEffect)(function () {
|
||||
if (content) {
|
||||
setValue(content);
|
||||
}
|
||||
}, [content]);
|
||||
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)(antd_1.Row, { children: (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ xs: 24, sm: 16 }, { children: (0, jsx_runtime_1.jsx)(editor_for_react_1.Editor, { defaultConfig: editorConfig, value: value, mode: "default", style: {
|
||||
width: width === 'xs' ? '100vw' : 750,
|
||||
} }) })) }) })));
|
||||
}
|
||||
exports.default = Render;
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
.container {
|
||||
// display: flex;
|
||||
// flex-direction: column;
|
||||
// flex: 1;
|
||||
width: 100%;
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
/// <reference types="react" />
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../general-app-domain").EntityDict, "article", false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
exports.default = OakComponent({
|
||||
entity: 'article',
|
||||
isList: false,
|
||||
methods: {
|
||||
onRemoveArticle: function (id) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
this.removeItem(id);
|
||||
return [4 /*yield*/, this.execute()];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
gotoArticleEdit: function (articleId) {
|
||||
this.navigateTo({
|
||||
url: '/article2/upsert',
|
||||
oakId: articleId
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import '@wangeditor/editor/dist/css/style.css';
|
||||
import { EntityDict } from '../../../general-app-domain';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'article', false, {
|
||||
articleId: string;
|
||||
content: string;
|
||||
}, {
|
||||
gotoArticleEdit: (articleId: string) => void;
|
||||
onRemoveArticle: (id: string) => void;
|
||||
}>): import("react/jsx-runtime").JSX.Element;
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var antd_1 = require("antd");
|
||||
var confirm = antd_1.Modal.confirm;
|
||||
require("@wangeditor/editor/dist/css/style.css"); // 引入 css
|
||||
var editor_for_react_1 = require("@wangeditor/editor-for-react");
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
function Render(props) {
|
||||
var method = props.methods, data = props.data;
|
||||
var _a = props.data, content = _a.content, articleId = _a.articleId;
|
||||
var t = method.t, onRemoveArticle = method.onRemoveArticle, gotoArticleEdit = method.gotoArticleEdit;
|
||||
var editorConfig = {
|
||||
readOnly: true,
|
||||
autoFocus: true,
|
||||
scroll: false,
|
||||
};
|
||||
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.rightContainer }, { children: (0, jsx_runtime_1.jsx)(antd_1.Row, { children: (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ xs: 24, sm: 16 }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 4 }, wrapperCol: { span: 20 } }, { children: [(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Form.Item, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(editor_for_react_1.Editor, { defaultConfig: editorConfig, value: content, mode: "default", style: {
|
||||
width: 750
|
||||
} }) }) }) }), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 4 } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {
|
||||
gotoArticleEdit(articleId);
|
||||
} }, { children: "\u7F16\u8F91" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function () {
|
||||
var modal = confirm({
|
||||
title: "确定删除该文章吗?",
|
||||
content: "删除后不可恢复",
|
||||
okText: "确定",
|
||||
cancelText: "取消",
|
||||
onOk: function (e) {
|
||||
onRemoveArticle(articleId);
|
||||
modal.destroy();
|
||||
},
|
||||
});
|
||||
} }, { children: "\u5220\u9664" }))] }) }))] })) })) }) })));
|
||||
}
|
||||
exports.default = Render;
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
/// <reference types="react" />
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../general-app-domain").EntityDict, "articleMenu", false, {
|
||||
entity: string;
|
||||
entityId: string;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
exports.default = OakComponent({
|
||||
entity: 'articleMenu',
|
||||
projection: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
parent: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
},
|
||||
extraFile$entity: {
|
||||
$entity: 'extraFile',
|
||||
data: {
|
||||
id: 1,
|
||||
tag1: 1,
|
||||
origin: 1,
|
||||
bucket: 1,
|
||||
objectId: 1,
|
||||
filename: 1,
|
||||
extra1: 1,
|
||||
extension: 1,
|
||||
type: 1,
|
||||
entity: 1,
|
||||
},
|
||||
filter: {
|
||||
tag1: {
|
||||
$in: ['logo'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
isList: false,
|
||||
formData: function (_a) {
|
||||
var _b, _c, _d;
|
||||
var articleMenu = _a.data, features = _a.features;
|
||||
return {
|
||||
isArticle: articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.isArticle,
|
||||
isLeaf: articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.isLeaf,
|
||||
name: articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.name,
|
||||
parentId: (_b = articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.parent) === null || _b === void 0 ? void 0 : _b.id,
|
||||
parentName: (_c = articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.parent) === null || _c === void 0 ? void 0 : _c.name,
|
||||
logo: features.extraFile.getUrl((_d = articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.extraFile$entity) === null || _d === void 0 ? void 0 : _d.find(function (ele) { return ele.tag1 === 'logo'; })),
|
||||
};
|
||||
},
|
||||
filters: [],
|
||||
lifetimes: {},
|
||||
properties: {
|
||||
entity: '',
|
||||
entityId: ''
|
||||
},
|
||||
methods: {
|
||||
goUpsert: function (id) {
|
||||
this.navigateTo({
|
||||
url: '/articleMenu/upsert',
|
||||
oakId: id,
|
||||
});
|
||||
},
|
||||
gotoEditByParentId: function (parentId) {
|
||||
var _a = this.props, entity = _a.entity, entityId = _a.entityId;
|
||||
this.navigateTo({
|
||||
url: '/articleMenu/upsert',
|
||||
parentId: parentId,
|
||||
entity: entity,
|
||||
entityId: entityId
|
||||
});
|
||||
},
|
||||
gotoArticleEdit: function (articleId) {
|
||||
this.navigateTo({
|
||||
url: '/article/upsert',
|
||||
oakId: articleId,
|
||||
});
|
||||
},
|
||||
gotoArticleEditByArticleMenuId: function (articleMenuId) {
|
||||
this.navigateTo({
|
||||
url: '/article/upsert',
|
||||
articleMenuId: articleMenuId,
|
||||
});
|
||||
},
|
||||
onRemoveArticleMenu: function (id) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, this.execute('remove')];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
import { WebComponentProps } from "oak-frontend-base";
|
||||
import { EntityDict } from "../../../general-app-domain";
|
||||
export default function render(props: WebComponentProps<EntityDict, 'articleMenu', false, {
|
||||
oakId: string;
|
||||
name: string;
|
||||
parentId: string;
|
||||
parentName: string;
|
||||
isArticle: boolean;
|
||||
isLeaf: boolean;
|
||||
logo: string;
|
||||
}, {
|
||||
goUpsert: (id?: string) => void;
|
||||
gotoEditByParentId: (parentId: string) => void;
|
||||
gotoArticleEditByArticleMenuId: (articleMenuId: string) => void;
|
||||
onRemoveArticleMenu: (id: string) => void;
|
||||
}>): JSX.Element;
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var antd_1 = require("antd");
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
function render(props) {
|
||||
var data = props.data, methods = props.methods;
|
||||
var t = methods.t, update = methods.update, goUpsert = methods.goUpsert, gotoEditByParentId = methods.gotoEditByParentId, gotoArticleEditByArticleMenuId = methods.gotoArticleEditByArticleMenuId, onRemoveArticleMenu = methods.onRemoveArticleMenu;
|
||||
var name = data.name, parentId = data.parentId, parentName = data.parentName, isArticle = data.isArticle, logo = data.logo, isLeaf = data.isLeaf, oakId = data.oakId;
|
||||
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 4 }, wrapperCol: { span: 12 } }, { children: [(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: '分类标题', name: "name" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "".concat(name) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "LOGO", name: "extraFile$entity" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: logo ? ((0, jsx_runtime_1.jsx)(antd_1.Image, { src: logo, width: 100, height: 100 })) : ('暂无图片') }) }))] }), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: {
|
||||
offset: 4,
|
||||
} }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {
|
||||
goUpsert(oakId);
|
||||
} }, { children: "\u7F16\u8F91" })), !isArticle && ((0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () {
|
||||
gotoEditByParentId(oakId);
|
||||
} }, { children: "\u6DFB\u52A0\u5B50\u8282\u70B9" }))), (isArticle || !isLeaf) && ((0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () {
|
||||
gotoArticleEditByArticleMenuId(oakId);
|
||||
} }, { children: "\u6DFB\u52A0\u6587\u7AE0" }))), (isArticle || isLeaf) ? ('') : ((0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function () {
|
||||
var modal = antd_1.Modal.confirm({
|
||||
title: '确定删除该文章分类吗?',
|
||||
content: '删除后不可恢复',
|
||||
okText: '确定',
|
||||
cancelText: '取消',
|
||||
onOk: function (e) {
|
||||
onRemoveArticleMenu(oakId);
|
||||
modal.destroy();
|
||||
},
|
||||
});
|
||||
} }, { children: "\u5220\u9664" })))] }) }))] })) })));
|
||||
}
|
||||
exports.default = render;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ exports.ECode = void 0;
|
|||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var antd_1 = require("antd");
|
||||
// @ts-ignore
|
||||
var react_router_dom_1 = require("react-router-dom");
|
||||
var assets_result_403_svg_1 = require("./assets/svg/assets-result-403.svg");
|
||||
var assets_result_404_svg_1 = require("./assets/svg/assets-result-404.svg");
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var react_1 = require("react");
|
||||
// @ts-ignore
|
||||
var react_router_dom_1 = require("react-router-dom");
|
||||
var antd_1 = require("antd");
|
||||
var icons_1 = require("@ant-design/icons");
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
import { String, Text } from 'oak-domain/lib/types/DataType';
|
||||
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||
import { Schema as ExtraFile } from './ExtraFile';
|
||||
import { Schema as ArticleMenu } from './ArticleMenu';
|
||||
export interface Schema extends EntityShape {
|
||||
entity?: String<32>;
|
||||
entityId?: String<64>;
|
||||
title: String<128>;
|
||||
author: String<32>;
|
||||
abstract?: Text;
|
||||
content?: Text;
|
||||
url?: Text;
|
||||
files: Array<ExtraFile>;
|
||||
sign: String<32>;
|
||||
name: String<32>;
|
||||
content: Text;
|
||||
articleMenu: ArticleMenu;
|
||||
files?: Array<ExtraFile>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,40 +1,14 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var IActionDef = {
|
||||
stm: {
|
||||
online: ['offline', 'online'],
|
||||
offline: ['online', 'offline'],
|
||||
disabled: [['online', 'offline'], 'disabled'],
|
||||
},
|
||||
is: 'offline',
|
||||
};
|
||||
var entityDesc = {
|
||||
locales: {
|
||||
zh_CN: {
|
||||
name: '文章',
|
||||
attr: {
|
||||
title: '标题',
|
||||
author: '作者',
|
||||
abstract: '简介',
|
||||
content: '正文',
|
||||
files: '封面图',
|
||||
iState: '状态',
|
||||
url: '外部链接',
|
||||
entity: '关联对象',
|
||||
entityId: '关联对象id',
|
||||
sign: '唯一标志',
|
||||
},
|
||||
action: {
|
||||
online: '上架',
|
||||
offline: '下架',
|
||||
disabled: '禁用',
|
||||
},
|
||||
v: {
|
||||
iState: {
|
||||
online: '已上架',
|
||||
offline: '已下架',
|
||||
disabled: '已禁用',
|
||||
},
|
||||
name: '文章标题',
|
||||
content: '请输入正文内容',
|
||||
articleMenu: '文章菜单',
|
||||
files: '文件'
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
import { String } from 'oak-domain/lib/types/DataType';
|
||||
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||
import { Schema as ExtraFile } from './ExtraFile';
|
||||
export interface Schema extends EntityShape {
|
||||
name: String<32>;
|
||||
isArticle: Boolean;
|
||||
parent?: Schema;
|
||||
isLeaf: Boolean;
|
||||
entity: String<32>;
|
||||
entityId: String<64>;
|
||||
files?: Array<ExtraFile>;
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var locale = {
|
||||
zh_CN: {
|
||||
name: '文章分类',
|
||||
attr: {
|
||||
name: '分类标题',
|
||||
isArticle: '是否存在文章',
|
||||
parent: '所属分类',
|
||||
entity: '对象',
|
||||
entityId: '对象Id',
|
||||
isLeaf: '结点下是否存在叶子结点',
|
||||
files: '图片',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
@ -13,34 +13,49 @@ var indexes = [
|
|||
],
|
||||
},
|
||||
];
|
||||
var locale = {
|
||||
zh_CN: {
|
||||
name: '绑定微信号',
|
||||
attr: {
|
||||
user: '用户',
|
||||
type: '类型',
|
||||
successed: '是否成功',
|
||||
remark: '备注',
|
||||
codes: '微信码',
|
||||
expired: '是否过期',
|
||||
expiresAt: '过期时间',
|
||||
qrCodeType: '二维码类型',
|
||||
var entityDesc = {
|
||||
indexes: [
|
||||
{
|
||||
name: 'index_uuid',
|
||||
attributes: [
|
||||
{
|
||||
name: 'expired',
|
||||
},
|
||||
{
|
||||
name: 'expiresAt',
|
||||
}
|
||||
],
|
||||
},
|
||||
action: {
|
||||
success: '成功',
|
||||
},
|
||||
v: {
|
||||
type: {
|
||||
bind: '绑定',
|
||||
login: '登录',
|
||||
],
|
||||
locales: {
|
||||
zh_CN: {
|
||||
name: '绑定微信号',
|
||||
attr: {
|
||||
user: '用户',
|
||||
type: '类型',
|
||||
successed: '是否成功',
|
||||
remark: '备注',
|
||||
codes: '微信码',
|
||||
expired: '是否过期',
|
||||
expiresAt: '过期时间',
|
||||
qrCodeType: '二维码类型',
|
||||
},
|
||||
qrCodeType: {
|
||||
webForWechatPublic: '网站引流到公众号',
|
||||
wechatMpDomainUrl: '小程序url码',
|
||||
wechatMpWxaCode: '小程序码',
|
||||
wechatPublic: '公众号关注码',
|
||||
wechatPublicForMp: '公众号跳转小程序码',
|
||||
action: {
|
||||
success: '成功',
|
||||
},
|
||||
v: {
|
||||
type: {
|
||||
bind: '绑定',
|
||||
login: '登录',
|
||||
},
|
||||
qrCodeType: {
|
||||
webForWechatPublic: '网站引流到公众号',
|
||||
wechatMpDomainUrl: '小程序url码',
|
||||
wechatMpWxaCode: '小程序码',
|
||||
wechatPublic: '公众号关注码',
|
||||
wechatPublicForMp: '公众号跳转小程序码',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,9 +2,6 @@ export declare const ActionDefDict: {
|
|||
modi: {
|
||||
iState: import("oak-domain/lib/types").ActionDef<string, string>;
|
||||
};
|
||||
article: {
|
||||
iState: import("oak-domain/lib/types").ActionDef<string, string>;
|
||||
};
|
||||
captcha: {
|
||||
iState: import("oak-domain/lib/types").ActionDef<string, string>;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,26 +2,24 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ActionDefDict = void 0;
|
||||
var Action_1 = require("./Modi/Action");
|
||||
var Action_2 = require("./Article/Action");
|
||||
var Action_3 = require("./Captcha/Action");
|
||||
var Action_4 = require("./Email/Action");
|
||||
var Action_5 = require("./Message/Action");
|
||||
var Action_6 = require("./Mobile/Action");
|
||||
var Action_7 = require("./Notification/Action");
|
||||
var Action_8 = require("./Token/Action");
|
||||
var Action_9 = require("./User/Action");
|
||||
var Action_10 = require("./UserEntityGrant/Action");
|
||||
var Action_11 = require("./WechatLogin/Action");
|
||||
var Action_2 = require("./Captcha/Action");
|
||||
var Action_3 = require("./Email/Action");
|
||||
var Action_4 = require("./Message/Action");
|
||||
var Action_5 = require("./Mobile/Action");
|
||||
var Action_6 = require("./Notification/Action");
|
||||
var Action_7 = require("./Token/Action");
|
||||
var Action_8 = require("./User/Action");
|
||||
var Action_9 = require("./UserEntityGrant/Action");
|
||||
var Action_10 = require("./WechatLogin/Action");
|
||||
exports.ActionDefDict = {
|
||||
modi: Action_1.ActionDefDict,
|
||||
article: Action_2.ActionDefDict,
|
||||
captcha: Action_3.ActionDefDict,
|
||||
email: Action_4.ActionDefDict,
|
||||
message: Action_5.ActionDefDict,
|
||||
mobile: Action_6.ActionDefDict,
|
||||
notification: Action_7.ActionDefDict,
|
||||
token: Action_8.ActionDefDict,
|
||||
user: Action_9.ActionDefDict,
|
||||
userEntityGrant: Action_10.ActionDefDict,
|
||||
wechatLogin: Action_11.ActionDefDict
|
||||
captcha: Action_2.ActionDefDict,
|
||||
email: Action_3.ActionDefDict,
|
||||
message: Action_4.ActionDefDict,
|
||||
mobile: Action_5.ActionDefDict,
|
||||
notification: Action_6.ActionDefDict,
|
||||
token: Action_7.ActionDefDict,
|
||||
user: Action_8.ActionDefDict,
|
||||
userEntityGrant: Action_9.ActionDefDict,
|
||||
wechatLogin: Action_10.ActionDefDict
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,32 +1,22 @@
|
|||
import { String, Text } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand";
|
||||
import { String, Text, ForeignKey } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf } from "oak-domain/lib/types/Polyfill";
|
||||
import * as SubQuery from "../_SubQuery";
|
||||
import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "oak-domain/lib/types/Entity";
|
||||
import { Action, ParticularAction, IState } from "./Action";
|
||||
import { GenericAction } from "oak-domain/lib/actions/action";
|
||||
import * as ArticleMenu from "../ArticleMenu/Schema";
|
||||
import * as ExtraFile from "../ExtraFile/Schema";
|
||||
export declare type OpSchema = EntityShape & {
|
||||
entity?: String<32> | null;
|
||||
entityId?: String<64> | null;
|
||||
title: String<128>;
|
||||
author: String<32>;
|
||||
abstract?: Text | null;
|
||||
content?: Text | null;
|
||||
url?: Text | null;
|
||||
sign: String<32>;
|
||||
iState?: IState | null;
|
||||
name: String<32>;
|
||||
content: Text;
|
||||
articleMenuId: ForeignKey<"articleMenu">;
|
||||
};
|
||||
export declare type OpAttr = keyof OpSchema;
|
||||
export declare type Schema = EntityShape & {
|
||||
entity?: String<32> | null;
|
||||
entityId?: String<64> | null;
|
||||
title: String<128>;
|
||||
author: String<32>;
|
||||
abstract?: Text | null;
|
||||
content?: Text | null;
|
||||
url?: Text | null;
|
||||
sign: String<32>;
|
||||
iState?: IState | null;
|
||||
name: String<32>;
|
||||
content: Text;
|
||||
articleMenuId: ForeignKey<"articleMenu">;
|
||||
articleMenu: ArticleMenu.Schema;
|
||||
extraFile$entity?: Array<ExtraFile.Schema>;
|
||||
extraFile$entity$$aggr?: AggregationResult<ExtraFile.Schema>;
|
||||
} & {
|
||||
|
|
@ -37,15 +27,10 @@ declare type AttrFilter = {
|
|||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_StringValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
entity: Q_StringValue;
|
||||
entityId: Q_StringValue;
|
||||
title: Q_StringValue;
|
||||
author: Q_StringValue;
|
||||
abstract: Q_StringValue;
|
||||
name: Q_StringValue;
|
||||
content: Q_StringValue;
|
||||
url: Q_StringValue;
|
||||
sign: Q_StringValue;
|
||||
iState: Q_EnumValue<IState>;
|
||||
articleMenuId: Q_StringValue | SubQuery.ArticleMenuIdSubQuery;
|
||||
articleMenu: ArticleMenu.Filter;
|
||||
};
|
||||
export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
||||
export declare type Projection = {
|
||||
|
|
@ -55,15 +40,10 @@ export declare type Projection = {
|
|||
$$createAt$$?: number;
|
||||
$$updateAt$$?: number;
|
||||
$$seq$$?: number;
|
||||
entity?: number;
|
||||
entityId?: number;
|
||||
title?: number;
|
||||
author?: number;
|
||||
abstract?: number;
|
||||
name?: number;
|
||||
content?: number;
|
||||
url?: number;
|
||||
sign?: number;
|
||||
iState?: number;
|
||||
articleMenuId?: number;
|
||||
articleMenu?: ArticleMenu.Projection;
|
||||
extraFile$entity?: ExtraFile.Selection & {
|
||||
$entity: "extraFile";
|
||||
};
|
||||
|
|
@ -74,6 +54,9 @@ export declare type Projection = {
|
|||
declare type ArticleIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
declare type ArticleMenuIdProjection = OneOf<{
|
||||
articleMenuId: number;
|
||||
}>;
|
||||
export declare type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
|
|
@ -83,23 +66,13 @@ export declare type SortAttr = {
|
|||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
entity: number;
|
||||
} | {
|
||||
entityId: number;
|
||||
} | {
|
||||
title: number;
|
||||
} | {
|
||||
author: number;
|
||||
} | {
|
||||
abstract: number;
|
||||
name: number;
|
||||
} | {
|
||||
content: number;
|
||||
} | {
|
||||
url: number;
|
||||
articleMenuId: number;
|
||||
} | {
|
||||
sign: number;
|
||||
} | {
|
||||
iState: number;
|
||||
articleMenu: ArticleMenu.SortAttr;
|
||||
} | {
|
||||
[k: string]: any;
|
||||
} | OneOf<ExprOp<OpAttr | string>>;
|
||||
|
|
@ -111,29 +84,48 @@ export declare type Sorter = SortNode[];
|
|||
export declare type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
|
||||
export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
|
||||
export declare type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
|
||||
export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId">> & ({
|
||||
entity?: string;
|
||||
entityId?: string;
|
||||
[K: string]: any;
|
||||
}) & {
|
||||
export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "articleMenuId">> & (({
|
||||
articleMenuId?: never;
|
||||
articleMenu: ArticleMenu.CreateSingleOperation;
|
||||
} | {
|
||||
articleMenuId: String<64>;
|
||||
articleMenu?: ArticleMenu.UpdateOperation;
|
||||
} | {
|
||||
articleMenuId: String<64>;
|
||||
})) & {
|
||||
extraFile$entity?: OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "entity" | "entityId">, ExtraFile.Filter> | OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">> | OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "entity" | "entityId">, ExtraFile.Filter>>;
|
||||
};
|
||||
export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
||||
export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
||||
export declare type UpdateOperationData = FormUpdateData<OpSchema> & {
|
||||
export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "articleMenuId">> & (({
|
||||
articleMenu: ArticleMenu.CreateSingleOperation;
|
||||
articleMenuId?: never;
|
||||
} | {
|
||||
articleMenu: ArticleMenu.UpdateOperation;
|
||||
articleMenuId?: never;
|
||||
} | {
|
||||
articleMenu: ArticleMenu.RemoveOperation;
|
||||
articleMenuId?: never;
|
||||
} | {
|
||||
articleMenu?: never;
|
||||
articleMenuId?: String<64> | null;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
extraFile$entity?: ExtraFile.UpdateOperation | ExtraFile.RemoveOperation | OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">> | ExtraFile.UpdateOperation | ExtraFile.RemoveOperation>;
|
||||
};
|
||||
export declare type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>;
|
||||
export declare type RemoveOperationData = {};
|
||||
export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export declare type RemoveOperationData = {} & (({
|
||||
articleMenu?: ArticleMenu.UpdateOperation | ArticleMenu.RemoveOperation;
|
||||
}));
|
||||
export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export declare type ArticleMenuIdSubQuery = Selection<ArticleMenuIdProjection>;
|
||||
export declare type ArticleIdSubQuery = Selection<ArticleIdProjection>;
|
||||
export declare type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<Action> | string;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
|
|
@ -142,6 +134,5 @@ export declare type EntityDef = {
|
|||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
ParticularAction: ParticularAction;
|
||||
};
|
||||
export {};
|
||||
|
|
|
|||
|
|
@ -1,56 +1,26 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.desc = void 0;
|
||||
var Action_1 = require("./Action");
|
||||
var action_1 = require("oak-domain/lib/actions/action");
|
||||
exports.desc = {
|
||||
attributes: {
|
||||
entity: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
entityId: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
title: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 128
|
||||
}
|
||||
},
|
||||
author: {
|
||||
name: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
abstract: {
|
||||
type: "text"
|
||||
},
|
||||
content: {
|
||||
type: "text"
|
||||
},
|
||||
url: {
|
||||
type: "text"
|
||||
},
|
||||
sign: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
type: "text"
|
||||
},
|
||||
iState: {
|
||||
type: "enum",
|
||||
enumeration: ["online", "offline", "disabled"]
|
||||
articleMenuId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "articleMenu"
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions: Action_1.actions
|
||||
actions: action_1.genericActions
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{ "name": "文章", "attr": { "title": "标题", "author": "作者", "abstract": "简介", "content": "正文", "files": "封面图", "iState": "状态", "url": "外部链接", "entity": "关联对象", "entityId": "关联对象id", "sign": "唯一标志" }, "action": { "online": "上架", "offline": "下架", "disabled": "禁用" }, "v": { "iState": { "online": "已上架", "offline": "已下架", "disabled": "已禁用" } } }
|
||||
{ "name": "文章", "attr": { "name": "文章标题", "content": "请输入正文内容", "articleMenu": "文章菜单", "files": "文件" } }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,177 @@
|
|||
import { String, Boolean, ForeignKey } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf } from "oak-domain/lib/types/Polyfill";
|
||||
import * as SubQuery from "../_SubQuery";
|
||||
import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "oak-domain/lib/types/Entity";
|
||||
import { GenericAction } from "oak-domain/lib/actions/action";
|
||||
import * as Article from "../Article/Schema";
|
||||
import * as ExtraFile from "../ExtraFile/Schema";
|
||||
export declare type OpSchema = EntityShape & {
|
||||
name: String<32>;
|
||||
isArticle: Boolean;
|
||||
parentId?: ForeignKey<"articleMenu"> | null;
|
||||
isLeaf: Boolean;
|
||||
entity: String<32>;
|
||||
entityId: String<64>;
|
||||
};
|
||||
export declare type OpAttr = keyof OpSchema;
|
||||
export declare type Schema = EntityShape & {
|
||||
name: String<32>;
|
||||
isArticle: Boolean;
|
||||
parentId?: ForeignKey<"articleMenu"> | null;
|
||||
isLeaf: Boolean;
|
||||
entity: String<32>;
|
||||
entityId: String<64>;
|
||||
parent?: Schema | null;
|
||||
article$articleMenu?: Array<Article.Schema>;
|
||||
article$articleMenu$$aggr?: AggregationResult<Article.Schema>;
|
||||
articleMenu$parent?: Array<Schema>;
|
||||
articleMenu$parent$$aggr?: AggregationResult<Schema>;
|
||||
extraFile$entity?: Array<ExtraFile.Schema>;
|
||||
extraFile$entity$$aggr?: AggregationResult<ExtraFile.Schema>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
declare type AttrFilter = {
|
||||
id: Q_StringValue | SubQuery.ArticleMenuIdSubQuery;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_StringValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
name: Q_StringValue;
|
||||
isArticle: Q_BooleanValue;
|
||||
parentId: Q_StringValue | SubQuery.ArticleMenuIdSubQuery;
|
||||
parent: Filter;
|
||||
isLeaf: Q_BooleanValue;
|
||||
entity: Q_StringValue;
|
||||
entityId: Q_StringValue;
|
||||
};
|
||||
export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
||||
export declare type Projection = {
|
||||
"#id"?: NodeId;
|
||||
[k: string]: any;
|
||||
id?: number;
|
||||
$$createAt$$?: number;
|
||||
$$updateAt$$?: number;
|
||||
$$seq$$?: number;
|
||||
name?: number;
|
||||
isArticle?: number;
|
||||
parentId?: number;
|
||||
parent?: Projection;
|
||||
isLeaf?: number;
|
||||
entity?: number;
|
||||
entityId?: number;
|
||||
article$articleMenu?: Article.Selection & {
|
||||
$entity: "article";
|
||||
};
|
||||
article$articleMenu$$aggr?: Article.Aggregation & {
|
||||
$entity: "article";
|
||||
};
|
||||
articleMenu$parent?: Selection & {
|
||||
$entity: "articleMenu";
|
||||
};
|
||||
articleMenu$parent$$aggr?: Aggregation & {
|
||||
$entity: "articleMenu";
|
||||
};
|
||||
extraFile$entity?: ExtraFile.Selection & {
|
||||
$entity: "extraFile";
|
||||
};
|
||||
extraFile$entity$$aggr?: ExtraFile.Aggregation & {
|
||||
$entity: "extraFile";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
declare type ArticleMenuIdProjection = OneOf<{
|
||||
id: number;
|
||||
parentId: number;
|
||||
}>;
|
||||
export declare type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
name: number;
|
||||
} | {
|
||||
isArticle: number;
|
||||
} | {
|
||||
parentId: number;
|
||||
} | {
|
||||
parent: SortAttr;
|
||||
} | {
|
||||
isLeaf: number;
|
||||
} | {
|
||||
entity: number;
|
||||
} | {
|
||||
entityId: number;
|
||||
} | {
|
||||
[k: string]: any;
|
||||
} | OneOf<ExprOp<OpAttr | string>>;
|
||||
export declare type SortNode = {
|
||||
$attr: SortAttr;
|
||||
$direction?: "asc" | "desc";
|
||||
};
|
||||
export declare type Sorter = SortNode[];
|
||||
export declare type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
|
||||
export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
|
||||
export declare type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
|
||||
export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId" | "parentId">> & (({
|
||||
parentId?: never;
|
||||
parent?: CreateSingleOperation;
|
||||
} | {
|
||||
parentId: String<64>;
|
||||
parent?: UpdateOperation;
|
||||
} | {
|
||||
parentId?: String<64>;
|
||||
})) & ({
|
||||
entity?: string;
|
||||
entityId?: string;
|
||||
[K: string]: any;
|
||||
}) & {
|
||||
article$articleMenu?: OakOperation<Article.UpdateOperation["action"], Omit<Article.UpdateOperationData, "articleMenu" | "articleMenuId">, Article.Filter> | OakOperation<"create", Omit<Article.CreateOperationData, "articleMenu" | "articleMenuId">[]> | Array<OakOperation<"create", Omit<Article.CreateOperationData, "articleMenu" | "articleMenuId">> | OakOperation<Article.UpdateOperation["action"], Omit<Article.UpdateOperationData, "articleMenu" | "articleMenuId">, Article.Filter>>;
|
||||
articleMenu$parent?: OakOperation<UpdateOperation["action"], Omit<UpdateOperationData, "parent" | "parentId">, Filter> | OakOperation<"create", Omit<CreateOperationData, "parent" | "parentId">[]> | Array<OakOperation<"create", Omit<CreateOperationData, "parent" | "parentId">> | OakOperation<UpdateOperation["action"], Omit<UpdateOperationData, "parent" | "parentId">, Filter>>;
|
||||
extraFile$entity?: OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "entity" | "entityId">, ExtraFile.Filter> | OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">> | OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "entity" | "entityId">, ExtraFile.Filter>>;
|
||||
};
|
||||
export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
||||
export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
||||
export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "parentId">> & (({
|
||||
parent: CreateSingleOperation;
|
||||
parentId?: never;
|
||||
} | {
|
||||
parent: UpdateOperation;
|
||||
parentId?: never;
|
||||
} | {
|
||||
parent: RemoveOperation;
|
||||
parentId?: never;
|
||||
} | {
|
||||
parent?: never;
|
||||
parentId?: String<64> | null;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
article$articleMenu?: Article.UpdateOperation | Article.RemoveOperation | OakOperation<"create", Omit<Article.CreateOperationData, "articleMenu" | "articleMenuId">[]> | Array<OakOperation<"create", Omit<Article.CreateOperationData, "articleMenu" | "articleMenuId">> | Article.UpdateOperation | Article.RemoveOperation>;
|
||||
articleMenu$parent?: UpdateOperation | RemoveOperation | OakOperation<"create", Omit<CreateOperationData, "parent" | "parentId">[]> | Array<OakOperation<"create", Omit<CreateOperationData, "parent" | "parentId">> | UpdateOperation | RemoveOperation>;
|
||||
extraFile$entity?: ExtraFile.UpdateOperation | ExtraFile.RemoveOperation | OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">> | ExtraFile.UpdateOperation | ExtraFile.RemoveOperation>;
|
||||
};
|
||||
export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export declare type RemoveOperationData = {} & (({
|
||||
parent?: UpdateOperation | RemoveOperation;
|
||||
}));
|
||||
export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export declare type ArticleMenuIdSubQuery = Selection<ArticleMenuIdProjection>;
|
||||
export declare type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
export {};
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
export declare const desc: StorageDesc<OpSchema>;
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.desc = void 0;
|
||||
var action_1 = require("oak-domain/lib/actions/action");
|
||||
exports.desc = {
|
||||
attributes: {
|
||||
name: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
isArticle: {
|
||||
notNull: true,
|
||||
type: "boolean"
|
||||
},
|
||||
parentId: {
|
||||
type: "ref",
|
||||
ref: "articleMenu"
|
||||
},
|
||||
isLeaf: {
|
||||
notNull: true,
|
||||
type: "boolean"
|
||||
},
|
||||
entity: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
entityId: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions: action_1.genericActions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{ "name": "文章分类", "attr": { "name": "分类标题", "isArticle": "是否存在文章", "parent": "所属分类", "entity": "对象", "entityId": "对象Id", "isLeaf": "结点下是否存在叶子结点", "files": "图片" } }
|
||||
|
|
@ -12,6 +12,7 @@ import { EntityDef as Address } from "./Address/Schema";
|
|||
import { EntityDef as Application } from "./Application/Schema";
|
||||
import { EntityDef as Area } from "./Area/Schema";
|
||||
import { EntityDef as Article } from "./Article/Schema";
|
||||
import { EntityDef as ArticleMenu } from "./ArticleMenu/Schema";
|
||||
import { EntityDef as Captcha } from "./Captcha/Schema";
|
||||
import { EntityDef as Domain } from "./Domain/Schema";
|
||||
import { EntityDef as Email } from "./Email/Schema";
|
||||
|
|
@ -51,6 +52,7 @@ export declare type EntityDict = {
|
|||
application: Application;
|
||||
area: Area;
|
||||
article: Article;
|
||||
articleMenu: ArticleMenu;
|
||||
captcha: Captcha;
|
||||
domain: Domain;
|
||||
email: Email;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import * as SubQuery from "../_SubQuery";
|
|||
import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { GenericAction } from "oak-domain/lib/actions/action";
|
||||
import * as Article from "../Article/Schema";
|
||||
import * as ArticleMenu from "../ArticleMenu/Schema";
|
||||
import * as User from "../User/Schema";
|
||||
export declare type OpSchema = EntityShape & {
|
||||
origin: 'qiniu' | 'unknown';
|
||||
|
|
@ -15,7 +16,7 @@ export declare type OpSchema = EntityShape & {
|
|||
tag2?: String<32> | null;
|
||||
filename: String<256>;
|
||||
md5?: Text | null;
|
||||
entity: "article" | "user" | string;
|
||||
entity: "article" | "articleMenu" | "user" | string;
|
||||
entityId: String<64>;
|
||||
extra1?: Text | null;
|
||||
extension: String<16>;
|
||||
|
|
@ -34,7 +35,7 @@ export declare type Schema = EntityShape & {
|
|||
tag2?: String<32> | null;
|
||||
filename: String<256>;
|
||||
md5?: Text | null;
|
||||
entity: "article" | "user" | string;
|
||||
entity: "article" | "articleMenu" | "user" | string;
|
||||
entityId: String<64>;
|
||||
extra1?: Text | null;
|
||||
extension: String<16>;
|
||||
|
|
@ -43,6 +44,7 @@ export declare type Schema = EntityShape & {
|
|||
fileType?: String<128> | null;
|
||||
isBridge?: Boolean | null;
|
||||
article?: Article.Schema;
|
||||
articleMenu?: ArticleMenu.Schema;
|
||||
user?: User.Schema;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
|
|
@ -69,9 +71,10 @@ declare type AttrFilter<E> = {
|
|||
fileType: Q_StringValue;
|
||||
isBridge: Q_BooleanValue;
|
||||
article: Article.Filter;
|
||||
articleMenu: ArticleMenu.Filter;
|
||||
user: User.Filter;
|
||||
};
|
||||
export declare type Filter<E = Q_EnumValue<"article" | "user" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
|
||||
export declare type Filter<E = Q_EnumValue<"article" | "articleMenu" | "user" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
|
||||
export declare type Projection = {
|
||||
"#id"?: NodeId;
|
||||
[k: string]: any;
|
||||
|
|
@ -96,6 +99,7 @@ export declare type Projection = {
|
|||
fileType?: number;
|
||||
isBridge?: number;
|
||||
article?: Article.Projection;
|
||||
articleMenu?: ArticleMenu.Projection;
|
||||
user?: User.Projection;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
declare type ExtraFileIdProjection = OneOf<{
|
||||
|
|
@ -104,6 +108,9 @@ declare type ExtraFileIdProjection = OneOf<{
|
|||
declare type ArticleIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
declare type ArticleMenuIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
declare type UserIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
|
|
@ -149,6 +156,8 @@ export declare type SortAttr = {
|
|||
isBridge: number;
|
||||
} | {
|
||||
article: Article.SortAttr;
|
||||
} | {
|
||||
articleMenu: ArticleMenu.SortAttr;
|
||||
} | {
|
||||
user: User.SortAttr;
|
||||
} | {
|
||||
|
|
@ -173,6 +182,17 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
|
|||
} | {
|
||||
entity: "article";
|
||||
entityId: String<64>;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
articleMenu: ArticleMenu.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "articleMenu";
|
||||
entityId: String<64>;
|
||||
articleMenu: ArticleMenu.UpdateOperation;
|
||||
} | {
|
||||
entity: "articleMenu";
|
||||
entityId: String<64>;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
|
|
@ -196,12 +216,16 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity"
|
|||
article?: Article.CreateSingleOperation | Article.UpdateOperation | Article.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
articleMenu?: ArticleMenu.CreateSingleOperation | ArticleMenu.UpdateOperation | ArticleMenu.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
user?: User.CreateSingleOperation | User.UpdateOperation | User.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
entity?: ("article" | "user" | string) | null;
|
||||
entity?: ("article" | "articleMenu" | "user" | string) | null;
|
||||
entityId?: String<64> | null;
|
||||
}) & {
|
||||
[k: string]: any;
|
||||
|
|
@ -209,6 +233,8 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity"
|
|||
export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export declare type RemoveOperationData = {} & ({
|
||||
article?: Article.UpdateOperation | Article.RemoveOperation;
|
||||
} | {
|
||||
articleMenu?: ArticleMenu.UpdateOperation | ArticleMenu.RemoveOperation;
|
||||
} | {
|
||||
user?: User.UpdateOperation | User.RemoveOperation;
|
||||
} | {
|
||||
|
|
@ -217,6 +243,7 @@ export declare type RemoveOperationData = {} & ({
|
|||
export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export declare type ArticleIdSubQuery = Selection<ArticleIdProjection>;
|
||||
export declare type ArticleMenuIdSubQuery = Selection<ArticleMenuIdProjection>;
|
||||
export declare type UserIdSubQuery = Selection<UserIdProjection>;
|
||||
export declare type ExtraFileIdSubQuery = Selection<ExtraFileIdProjection>;
|
||||
export declare type EntityDef = {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ exports.desc = {
|
|||
params: {
|
||||
length: 32
|
||||
},
|
||||
ref: ["article", "user"]
|
||||
ref: ["article", "articleMenu", "user"]
|
||||
},
|
||||
entityId: {
|
||||
notNull: true,
|
||||
|
|
|
|||
|
|
@ -15,30 +15,31 @@ var Storage_11 = require("./Address/Storage");
|
|||
var Storage_12 = require("./Application/Storage");
|
||||
var Storage_13 = require("./Area/Storage");
|
||||
var Storage_14 = require("./Article/Storage");
|
||||
var Storage_15 = require("./Captcha/Storage");
|
||||
var Storage_16 = require("./Domain/Storage");
|
||||
var Storage_17 = require("./Email/Storage");
|
||||
var Storage_18 = require("./ExtraFile/Storage");
|
||||
var Storage_19 = require("./Livestream/Storage");
|
||||
var Storage_20 = require("./Message/Storage");
|
||||
var Storage_21 = require("./MessageSystem/Storage");
|
||||
var Storage_22 = require("./MessageType/Storage");
|
||||
var Storage_23 = require("./MessageTypeTemplateId/Storage");
|
||||
var Storage_24 = require("./Mobile/Storage");
|
||||
var Storage_25 = require("./Notification/Storage");
|
||||
var Storage_26 = require("./Platform/Storage");
|
||||
var Storage_27 = require("./Station/Storage");
|
||||
var Storage_28 = require("./Subscription/Storage");
|
||||
var Storage_29 = require("./Subway/Storage");
|
||||
var Storage_30 = require("./SubwayStation/Storage");
|
||||
var Storage_31 = require("./System/Storage");
|
||||
var Storage_32 = require("./Token/Storage");
|
||||
var Storage_33 = require("./UserSystem/Storage");
|
||||
var Storage_34 = require("./UserWechatPublicTag/Storage");
|
||||
var Storage_35 = require("./WechatLogin/Storage");
|
||||
var Storage_36 = require("./WechatPublicTag/Storage");
|
||||
var Storage_37 = require("./WechatQrCode/Storage");
|
||||
var Storage_38 = require("./WechatUser/Storage");
|
||||
var Storage_15 = require("./ArticleMenu/Storage");
|
||||
var Storage_16 = require("./Captcha/Storage");
|
||||
var Storage_17 = require("./Domain/Storage");
|
||||
var Storage_18 = require("./Email/Storage");
|
||||
var Storage_19 = require("./ExtraFile/Storage");
|
||||
var Storage_20 = require("./Livestream/Storage");
|
||||
var Storage_21 = require("./Message/Storage");
|
||||
var Storage_22 = require("./MessageSystem/Storage");
|
||||
var Storage_23 = require("./MessageType/Storage");
|
||||
var Storage_24 = require("./MessageTypeTemplateId/Storage");
|
||||
var Storage_25 = require("./Mobile/Storage");
|
||||
var Storage_26 = require("./Notification/Storage");
|
||||
var Storage_27 = require("./Platform/Storage");
|
||||
var Storage_28 = require("./Station/Storage");
|
||||
var Storage_29 = require("./Subscription/Storage");
|
||||
var Storage_30 = require("./Subway/Storage");
|
||||
var Storage_31 = require("./SubwayStation/Storage");
|
||||
var Storage_32 = require("./System/Storage");
|
||||
var Storage_33 = require("./Token/Storage");
|
||||
var Storage_34 = require("./UserSystem/Storage");
|
||||
var Storage_35 = require("./UserWechatPublicTag/Storage");
|
||||
var Storage_36 = require("./WechatLogin/Storage");
|
||||
var Storage_37 = require("./WechatPublicTag/Storage");
|
||||
var Storage_38 = require("./WechatQrCode/Storage");
|
||||
var Storage_39 = require("./WechatUser/Storage");
|
||||
exports.storageSchema = {
|
||||
actionAuth: Storage_1.desc,
|
||||
modi: Storage_2.desc,
|
||||
|
|
@ -54,28 +55,29 @@ exports.storageSchema = {
|
|||
application: Storage_12.desc,
|
||||
area: Storage_13.desc,
|
||||
article: Storage_14.desc,
|
||||
captcha: Storage_15.desc,
|
||||
domain: Storage_16.desc,
|
||||
email: Storage_17.desc,
|
||||
extraFile: Storage_18.desc,
|
||||
livestream: Storage_19.desc,
|
||||
message: Storage_20.desc,
|
||||
messageSystem: Storage_21.desc,
|
||||
messageType: Storage_22.desc,
|
||||
messageTypeTemplateId: Storage_23.desc,
|
||||
mobile: Storage_24.desc,
|
||||
notification: Storage_25.desc,
|
||||
platform: Storage_26.desc,
|
||||
station: Storage_27.desc,
|
||||
subscription: Storage_28.desc,
|
||||
subway: Storage_29.desc,
|
||||
subwayStation: Storage_30.desc,
|
||||
system: Storage_31.desc,
|
||||
token: Storage_32.desc,
|
||||
userSystem: Storage_33.desc,
|
||||
userWechatPublicTag: Storage_34.desc,
|
||||
wechatLogin: Storage_35.desc,
|
||||
wechatPublicTag: Storage_36.desc,
|
||||
wechatQrCode: Storage_37.desc,
|
||||
wechatUser: Storage_38.desc
|
||||
articleMenu: Storage_15.desc,
|
||||
captcha: Storage_16.desc,
|
||||
domain: Storage_17.desc,
|
||||
email: Storage_18.desc,
|
||||
extraFile: Storage_19.desc,
|
||||
livestream: Storage_20.desc,
|
||||
message: Storage_21.desc,
|
||||
messageSystem: Storage_22.desc,
|
||||
messageType: Storage_23.desc,
|
||||
messageTypeTemplateId: Storage_24.desc,
|
||||
mobile: Storage_25.desc,
|
||||
notification: Storage_26.desc,
|
||||
platform: Storage_27.desc,
|
||||
station: Storage_28.desc,
|
||||
subscription: Storage_29.desc,
|
||||
subway: Storage_30.desc,
|
||||
subwayStation: Storage_31.desc,
|
||||
system: Storage_32.desc,
|
||||
token: Storage_33.desc,
|
||||
userSystem: Storage_34.desc,
|
||||
userWechatPublicTag: Storage_35.desc,
|
||||
wechatLogin: Storage_36.desc,
|
||||
wechatPublicTag: Storage_37.desc,
|
||||
wechatQrCode: Storage_38.desc,
|
||||
wechatUser: Storage_39.desc
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import * as Address from "./Address/Schema";
|
|||
import * as Application from "./Application/Schema";
|
||||
import * as Area from "./Area/Schema";
|
||||
import * as Article from "./Article/Schema";
|
||||
import * as ArticleMenu from "./ArticleMenu/Schema";
|
||||
import * as Captcha from "./Captcha/Schema";
|
||||
import * as Domain from "./Domain/Schema";
|
||||
import * as Email from "./Email/Schema";
|
||||
|
|
@ -178,6 +179,17 @@ export declare type ArticleIdSubQuery = {
|
|||
entity: "article";
|
||||
}) | any;
|
||||
};
|
||||
export declare type ArticleMenuIdSubQuery = {
|
||||
[K in "$in" | "$nin"]?: (Article.ArticleMenuIdSubQuery & {
|
||||
entity: "article";
|
||||
}) | (ArticleMenu.ArticleMenuIdSubQuery & {
|
||||
entity: "articleMenu";
|
||||
}) | (ExtraFile.ArticleMenuIdSubQuery & {
|
||||
entity: "extraFile";
|
||||
}) | (ArticleMenu.ArticleMenuIdSubQuery & {
|
||||
entity: "articleMenu";
|
||||
}) | any;
|
||||
};
|
||||
export declare type CaptchaIdSubQuery = {
|
||||
[K in "$in" | "$nin"]?: (Captcha.CaptchaIdSubQuery & {
|
||||
entity: "captcha";
|
||||
|
|
|
|||
|
|
@ -1,42 +1,57 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
exports.default = OakComponent({
|
||||
isList: false,
|
||||
entity: 'article',
|
||||
projection: {
|
||||
id: 1,
|
||||
iState: 1,
|
||||
title: 1,
|
||||
author: 1,
|
||||
abstract: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
articleMenu: {
|
||||
id: 1,
|
||||
}
|
||||
},
|
||||
isList: false,
|
||||
formData: function (_a) {
|
||||
var article = _a.data, features = _a.features;
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_b) {
|
||||
return [2 /*return*/, {
|
||||
id: article === null || article === void 0 ? void 0 : article.id,
|
||||
iState: article === null || article === void 0 ? void 0 : article.iState,
|
||||
title: article === null || article === void 0 ? void 0 : article.title,
|
||||
abstract: article === null || article === void 0 ? void 0 : article.abstract,
|
||||
author: article === null || article === void 0 ? void 0 : article.author,
|
||||
content: article === null || article === void 0 ? void 0 : article.content,
|
||||
}];
|
||||
});
|
||||
});
|
||||
return {
|
||||
id: article === null || article === void 0 ? void 0 : article.id,
|
||||
content: article === null || article === void 0 ? void 0 : article.content,
|
||||
name: article === null || article === void 0 ? void 0 : article.name,
|
||||
// entity: article?.entity,
|
||||
// entityId: article?.entityId,
|
||||
};
|
||||
},
|
||||
listeners: {
|
||||
content: function (prev, next) {
|
||||
if (prev.content !== next.content) {
|
||||
var ac = window.document.getElementById('article-content');
|
||||
if (ac) {
|
||||
ac.innerHTML = next.content;
|
||||
}
|
||||
}
|
||||
},
|
||||
// listeners: {
|
||||
// content(prev, next) {
|
||||
// if(this.props.oakId) {
|
||||
// } else {
|
||||
// if (prev.content !== next.content) {
|
||||
// const ac = window.document.getElementById('article-content');
|
||||
// if (ac) {
|
||||
// ac.innerHTML = next.content;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// },
|
||||
data: {
|
||||
content: '',
|
||||
title: '',
|
||||
author: '',
|
||||
},
|
||||
lifetimes: {
|
||||
// attached() {
|
||||
// const data = this.load('article_html') || '{}';
|
||||
// const data2 = typeof data === 'string' ? JSON.parse(data) : data;
|
||||
// this.setState({
|
||||
// content: data2?.content,
|
||||
// title: data2?.title,
|
||||
// author: data2?.author,
|
||||
// });
|
||||
// },
|
||||
// detached() {
|
||||
// this.save('article_html', '{}');
|
||||
// },
|
||||
},
|
||||
methods: {},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
import { EntityDict } from './../../../general-app-domain';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
export default function render(props: WebComponentProps<EntityDict, 'article', false, {
|
||||
import { EntityDict } from '../../../general-app-domain';
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'article', false, {
|
||||
id: string;
|
||||
name: string;
|
||||
editor: any;
|
||||
title?: string;
|
||||
author?: string;
|
||||
abstract?: string;
|
||||
content?: string;
|
||||
html?: string;
|
||||
origin?: string;
|
||||
}, {}>): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -3,10 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
function render(props) {
|
||||
var methods = props.methods, data = props.data;
|
||||
var t = methods.t;
|
||||
var title = data.title, author = data.author, abstract = data.abstract, content = data.content;
|
||||
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.content }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.editorContainer }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.titleContainer }, { children: (0, jsx_runtime_1.jsx)("span", tslib_1.__assign({ className: web_module_less_1.default.title }, { children: title })) })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.authorContainer }, { children: (0, jsx_runtime_1.jsx)("span", tslib_1.__assign({ className: web_module_less_1.default.author }, { children: author })) })), (0, jsx_runtime_1.jsx)("div", { id: "article-content" })] })) })) })));
|
||||
var editor_for_react_1 = require("@wangeditor/editor-for-react");
|
||||
var react_1 = require("react");
|
||||
function Render(props) {
|
||||
var _a = props.data, id = _a.id, name = _a.name, editor = _a.editor, title = _a.title, content = _a.content;
|
||||
console.log(title, content);
|
||||
var editorConfig = {
|
||||
readOnly: true,
|
||||
autoFocus: true,
|
||||
scroll: false,
|
||||
};
|
||||
var _b = tslib_1.__read((0, react_1.useState)(''), 2), value = _b[0], setValue = _b[1];
|
||||
(0, react_1.useEffect)(function () {
|
||||
if (content) {
|
||||
setValue(content);
|
||||
}
|
||||
}, [content]);
|
||||
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.content }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.editorContainer }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.titleContainer }, { children: (0, jsx_runtime_1.jsx)("span", tslib_1.__assign({ className: web_module_less_1.default.title }, { children: name })) })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ id: "article-content", style: { width: "100%" } }, { children: (0, jsx_runtime_1.jsx)(editor_for_react_1.Editor, { defaultConfig: editorConfig, value: value, mode: "default", style: {
|
||||
width: '100%'
|
||||
} }) }))] })) })) })));
|
||||
}
|
||||
exports.default = render;
|
||||
exports.default = Render;
|
||||
|
|
|
|||
|
|
@ -1,24 +1,31 @@
|
|||
.container {
|
||||
background-color: var(--oak-bg-color-page);
|
||||
// padding: 30px 32px;
|
||||
background-color: #f3f5f7;
|
||||
padding: 30px 300px;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
|
||||
.content {
|
||||
background-color: var(--oak-bg-color-page);
|
||||
position: relative;
|
||||
width: 100%
|
||||
display: flex;
|
||||
background-color: #f3f5f7;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.editorContainer {
|
||||
// width: 100%;
|
||||
margin: 30px auto 50px auto;
|
||||
// margin: 30px auto 50px auto;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--oak-bg-color-container);
|
||||
padding: 20px 50px 50px 50px;
|
||||
box-shadow: 0 2px 10px rgb(0 0 0 / 12%);
|
||||
}
|
||||
|
||||
.titleContainer {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 5px 0 10px 0;
|
||||
}
|
||||
|
||||
|
|
@ -27,7 +34,7 @@
|
|||
}
|
||||
|
||||
.title {
|
||||
font-size: 18px !important;
|
||||
font-size: 32px !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
/// <reference types="react" />
|
||||
import { EntityDict } from '../../../general-app-domain';
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "articleMenu", true, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
@ -0,0 +1,475 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
;
|
||||
exports.default = OakComponent({
|
||||
entity: 'articleMenu',
|
||||
projection: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
parent: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
},
|
||||
article$articleMenu: {
|
||||
$entity: 'article',
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenuId: 1,
|
||||
}
|
||||
},
|
||||
extraFile$entity: {
|
||||
$entity: 'extraFile',
|
||||
data: {
|
||||
id: 1,
|
||||
tag1: 1,
|
||||
origin: 1,
|
||||
bucket: 1,
|
||||
objectId: 1,
|
||||
filename: 1,
|
||||
extra1: 1,
|
||||
extension: 1,
|
||||
type: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
},
|
||||
filter: {
|
||||
tag1: {
|
||||
$in: ['logo', 'introduce'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
pagination: {
|
||||
currentPage: 1,
|
||||
pageSize: 200,
|
||||
more: true,
|
||||
},
|
||||
isList: true,
|
||||
formData: function (_a) {
|
||||
var _this = this;
|
||||
var rows = _a.data;
|
||||
var articleMenus = this.getArticleMenus();
|
||||
var treeData = articleMenus === null || articleMenus === void 0 ? void 0 : articleMenus.map(function (articleMenu) {
|
||||
var _a, _b;
|
||||
return {
|
||||
label: articleMenu.name,
|
||||
key: (_a = articleMenu.id) === null || _a === void 0 ? void 0 : _a.toString(),
|
||||
isArticle: articleMenu.isArticle,
|
||||
logo: _this.features.extraFile.getUrl((_b = articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.extraFile$entity) === null || _b === void 0 ? void 0 : _b.find(function (ele) { return ele.tag1 === 'logo'; })),
|
||||
parentKey: articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.parentId,
|
||||
children: _this.buildTreeData(articleMenu.id, articleMenu.isArticle),
|
||||
};
|
||||
});
|
||||
return {
|
||||
treeData: treeData,
|
||||
};
|
||||
},
|
||||
filters: [],
|
||||
lifetimes: {},
|
||||
data: {
|
||||
selectedArticleId: '',
|
||||
openKeys: [],
|
||||
selectedKeys: [],
|
||||
treeData: [],
|
||||
parentId: '',
|
||||
articleMenuId: '',
|
||||
id: '',
|
||||
name: '',
|
||||
isArticle: false,
|
||||
isChildren: false,
|
||||
logo: '',
|
||||
breadcrumbItems: [],
|
||||
},
|
||||
methods: {
|
||||
getArticleMenus: function (parentId) {
|
||||
var articleMenus = this.features.cache.get('articleMenu', {
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
parent: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
},
|
||||
article$articleMenu: {
|
||||
$entity: 'article',
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenuId: 1,
|
||||
}
|
||||
},
|
||||
extraFile$entity: {
|
||||
$entity: 'extraFile',
|
||||
data: {
|
||||
id: 1,
|
||||
tag1: 1,
|
||||
origin: 1,
|
||||
bucket: 1,
|
||||
objectId: 1,
|
||||
filename: 1,
|
||||
extra1: 1,
|
||||
extension: 1,
|
||||
type: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
},
|
||||
filter: {
|
||||
tag1: {
|
||||
$in: ['logo', 'introduce'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
filter: {
|
||||
parentId: parentId ? parentId : {
|
||||
$exists: false
|
||||
}
|
||||
},
|
||||
sorter: [
|
||||
{
|
||||
$attr: {
|
||||
$$createAt$$: 1,
|
||||
},
|
||||
$direction: 'asc',
|
||||
},
|
||||
],
|
||||
});
|
||||
return articleMenus;
|
||||
},
|
||||
loadArticleMenus: function (parentId) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var articleMenus;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, this.features.cache.refresh('articleMenu', {
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
parent: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
},
|
||||
article$articleMenu: {
|
||||
$entity: 'article',
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenuId: 1,
|
||||
}
|
||||
},
|
||||
extraFile$entity: {
|
||||
$entity: 'extraFile',
|
||||
data: {
|
||||
id: 1,
|
||||
tag1: 1,
|
||||
origin: 1,
|
||||
bucket: 1,
|
||||
objectId: 1,
|
||||
filename: 1,
|
||||
extra1: 1,
|
||||
extension: 1,
|
||||
type: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
},
|
||||
filter: {
|
||||
tag1: {
|
||||
$in: ['logo', 'introduce'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
filter: {
|
||||
parentId: parentId ? parentId : {
|
||||
$exists: false
|
||||
}
|
||||
},
|
||||
sorter: [
|
||||
{
|
||||
$attr: {
|
||||
$$createAt$$: 1,
|
||||
},
|
||||
$direction: 'asc',
|
||||
},
|
||||
],
|
||||
})];
|
||||
case 1:
|
||||
articleMenus = _a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
getArticles: function (articleMenuId) {
|
||||
var articleMenus = this.features.cache.get('article', {
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenuId: 1,
|
||||
},
|
||||
filter: {
|
||||
articleMenuId: articleMenuId
|
||||
},
|
||||
sorter: [
|
||||
{
|
||||
$attr: {
|
||||
$$createAt$$: 1,
|
||||
},
|
||||
$direction: 'asc',
|
||||
},
|
||||
],
|
||||
});
|
||||
return articleMenus;
|
||||
},
|
||||
loadArticles: function (articleMenuId) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var articles;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, this.features.cache.refresh('article', {
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenuId: 1,
|
||||
},
|
||||
filter: {
|
||||
articleMenuId: articleMenuId
|
||||
},
|
||||
sorter: [
|
||||
{
|
||||
$attr: {
|
||||
$$createAt$$: 1,
|
||||
},
|
||||
$direction: 'asc',
|
||||
},
|
||||
],
|
||||
})];
|
||||
case 1:
|
||||
articles = _a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
getOpenKeys: function (targetKey, treeData, openKeys) {
|
||||
var _this = this;
|
||||
if (openKeys === void 0) { openKeys = []; }
|
||||
var selectedKeys = [];
|
||||
var toggleOpenKeys = function (nodes, parentOpen) {
|
||||
var e_1, _a;
|
||||
var _loop_1 = function (node) {
|
||||
if (node.key === targetKey) {
|
||||
var isOpen = openKeys.includes(node.key);
|
||||
if (isOpen) {
|
||||
// 当前子菜单已展开,收起当前子菜单及其所有子菜单
|
||||
openKeys = openKeys.filter(function (key) {
|
||||
return key !== node.key &&
|
||||
!key.startsWith("".concat(node.key, "-"));
|
||||
});
|
||||
}
|
||||
else {
|
||||
// 当前子菜单已收起,展开当前子菜单及其所有子菜单
|
||||
openKeys.push(node.key);
|
||||
openKeys.push.apply(openKeys, tslib_1.__spreadArray([], tslib_1.__read(getAllChildKeys(node)), false));
|
||||
var leafNode = findLeafNode(node);
|
||||
if (leafNode && leafNode.type === 'article') {
|
||||
var parentKeys = getParentKeys(leafNode);
|
||||
selectedKeys.push.apply(selectedKeys, tslib_1.__spreadArray([], tslib_1.__read(parentKeys), false));
|
||||
_this.gotoArticleUpsert(leafNode.key);
|
||||
}
|
||||
}
|
||||
// 存储第一个没有子节点的节点及其全部父节点到 selectedKeys
|
||||
}
|
||||
else if (node.children) {
|
||||
toggleOpenKeys(node.children, openKeys.includes(node.key) || parentOpen); // 递归处理子菜单的展开和收起
|
||||
}
|
||||
};
|
||||
try {
|
||||
for (var nodes_1 = tslib_1.__values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) {
|
||||
var node = nodes_1_1.value;
|
||||
_loop_1(node);
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
};
|
||||
var getAllChildKeys = function (node) {
|
||||
var e_2, _a;
|
||||
var childKeys = [];
|
||||
if (node.children) {
|
||||
try {
|
||||
for (var _b = tslib_1.__values(node.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var child = _c.value;
|
||||
childKeys.push(child.key);
|
||||
childKeys.push.apply(childKeys, tslib_1.__spreadArray([], tslib_1.__read(getAllChildKeys(child)), false));
|
||||
}
|
||||
}
|
||||
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_2) throw e_2.error; }
|
||||
}
|
||||
}
|
||||
return childKeys;
|
||||
};
|
||||
var findLeafNode = function (node) {
|
||||
var e_3, _a;
|
||||
if (!node.children || node.children.length === 0) {
|
||||
return node;
|
||||
}
|
||||
try {
|
||||
for (var _b = tslib_1.__values(node.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var child = _c.value;
|
||||
var leafNode = findLeafNode(child);
|
||||
if (leafNode) {
|
||||
return leafNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_3) throw e_3.error; }
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
var getParentKeys = function (node) {
|
||||
var parentKeys = [];
|
||||
var currentNode = node;
|
||||
while (currentNode) {
|
||||
parentKeys.unshift(currentNode.key);
|
||||
currentNode = findParentNode(currentNode);
|
||||
}
|
||||
return parentKeys;
|
||||
};
|
||||
var findParentNode = function (node) {
|
||||
if (!node.parentKey) {
|
||||
return undefined;
|
||||
}
|
||||
var parentNode = treeData.find(function (ele) { return ele.key === node.parentKey; });
|
||||
return parentNode;
|
||||
};
|
||||
toggleOpenKeys(treeData, false);
|
||||
this.setState({
|
||||
openKeys: tslib_1.__spreadArray([], tslib_1.__read(new Set(openKeys)), false),
|
||||
selectedKeys: tslib_1.__spreadArray([], tslib_1.__read(new Set(selectedKeys)), false), // 去重并更新 selectedKeys
|
||||
});
|
||||
return openKeys;
|
||||
},
|
||||
buildTreeData: function (parentId, isArticle) {
|
||||
var _this = this;
|
||||
var children = [];
|
||||
if (isArticle) {
|
||||
var articles = this.getArticles(parentId);
|
||||
children = articles === null || articles === void 0 ? void 0 : articles.map(function (article) {
|
||||
return {
|
||||
label: article.name,
|
||||
key: article.id,
|
||||
type: 'article',
|
||||
parentKey: article.articleMenuId,
|
||||
};
|
||||
});
|
||||
}
|
||||
else {
|
||||
var articleMenus = this.getArticleMenus(parentId);
|
||||
children = articleMenus === null || articleMenus === void 0 ? void 0 : articleMenus.map(function (articleMenu) {
|
||||
var _a, _b;
|
||||
return {
|
||||
label: articleMenu.name,
|
||||
key: (_a = articleMenu.id) === null || _a === void 0 ? void 0 : _a.toString(),
|
||||
isArticle: articleMenu.isArticle,
|
||||
logo: _this.features.extraFile.getUrl((_b = articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.extraFile$entity) === null || _b === void 0 ? void 0 : _b.find(function (ele) { return ele.tag1 === 'logo'; })),
|
||||
parentKey: articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.parentId,
|
||||
children: _this.buildTreeData(articleMenu.id, articleMenu.isArticle),
|
||||
};
|
||||
});
|
||||
}
|
||||
return children;
|
||||
},
|
||||
findParentNodes: function (treeData, targetKey) {
|
||||
for (var i = 0; i < treeData.length; i++) {
|
||||
var node = treeData[i];
|
||||
if (node.key === targetKey) {
|
||||
return [node];
|
||||
}
|
||||
if (node.children) {
|
||||
var parentNodes = this.findParentNodes(node.children, targetKey);
|
||||
if (parentNodes.length > 0) {
|
||||
return tslib_1.__spreadArray([node], tslib_1.__read(parentNodes), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return [];
|
||||
},
|
||||
findFirstArticle: function (treeData) {
|
||||
for (var i = 0; i < treeData.length; i++) {
|
||||
var node = treeData[i];
|
||||
if (node.type === 'article') {
|
||||
var parentNode = this.findParentNodes(this.state.treeData, node.key)[0];
|
||||
return parentNode;
|
||||
}
|
||||
if (node.children && node.children.length > 0) {
|
||||
var childNode = this.findFirstArticle(node.children);
|
||||
if (childNode) {
|
||||
return childNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
return {};
|
||||
},
|
||||
gotoArticleUpsert: function (articleId, selectedKeys) {
|
||||
var _a;
|
||||
if (selectedKeys === void 0) { selectedKeys = []; }
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var parentNodes;
|
||||
return tslib_1.__generator(this, function (_b) {
|
||||
if (selectedKeys.includes(articleId)) {
|
||||
}
|
||||
else {
|
||||
parentNodes = (_a = this.findParentNodes(this.state.treeData, articleId)) === null || _a === void 0 ? void 0 : _a.map(function (ele) {
|
||||
return { title: ele.label };
|
||||
});
|
||||
this.setState({
|
||||
breadcrumbItems: parentNodes,
|
||||
});
|
||||
this.setState({
|
||||
selectedKeys: [articleId],
|
||||
selectedArticleId: articleId,
|
||||
id: '',
|
||||
parentId: '',
|
||||
});
|
||||
}
|
||||
return [2 /*return*/];
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"navigationBarTitleText": "帮助文档",
|
||||
"oakDisablePulldownRefresh": true
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
import { WebComponentProps } from "oak-frontend-base";
|
||||
import { EntityDict } from "../../../general-app-domain";
|
||||
interface DataNode {
|
||||
label: string;
|
||||
title: string;
|
||||
key: string;
|
||||
isArticle?: boolean;
|
||||
children?: DataNode[];
|
||||
}
|
||||
export default function render(props: WebComponentProps<EntityDict, "articleMenu", true, {
|
||||
treeData: DataNode[];
|
||||
openKeys: string[];
|
||||
selectedKeys: string[];
|
||||
selectedArticleId: string;
|
||||
width: string;
|
||||
breadcrumbItems: {
|
||||
title: string;
|
||||
}[];
|
||||
}, {
|
||||
gotoArticleUpsert: (articleId: string, selectedKeys?: string[]) => void;
|
||||
getOpenKeys: (targetKey: string, treeData: DataNode[], openKeys: string[]) => void;
|
||||
loadArticles: (articleMenuId: string) => void;
|
||||
findFirstArticle: (treeData: DataNode[]) => {
|
||||
label: string;
|
||||
title: string;
|
||||
key: string;
|
||||
isArticle?: boolean;
|
||||
children?: DataNode[];
|
||||
};
|
||||
}>): JSX.Element;
|
||||
export {};
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var antd_1 = require("antd");
|
||||
var react_1 = require("react");
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
var useFeatures_1 = tslib_1.__importDefault(require("../../../hooks/useFeatures"));
|
||||
var detail3_1 = tslib_1.__importDefault(require("../../../components/article/detail3"));
|
||||
var Sider = antd_1.Layout.Sider;
|
||||
var icons_1 = require("@ant-design/icons");
|
||||
function render(props) {
|
||||
var _a = props.data, treeData = _a.treeData, openKeys = _a.openKeys, selectedKeys = _a.selectedKeys, selectedArticleId = _a.selectedArticleId, width = _a.width, breadcrumbItems = _a.breadcrumbItems;
|
||||
var _b = props.methods, t = _b.t, gotoArticleUpsert = _b.gotoArticleUpsert, getOpenKeys = _b.getOpenKeys, loadArticles = _b.loadArticles, findFirstArticle = _b.findFirstArticle;
|
||||
var _c = tslib_1.__read((0, react_1.useState)(false), 2), executed = _c[0], setExecuted = _c[1];
|
||||
(0, react_1.useEffect)(function () {
|
||||
if (!executed && treeData.length > 0) {
|
||||
var node = findFirstArticle(treeData);
|
||||
getOpenKeys(node.key, treeData, openKeys);
|
||||
setExecuted(true);
|
||||
}
|
||||
}, [treeData, executed]);
|
||||
var features = (0, useFeatures_1.default)();
|
||||
var _d = tslib_1.__read((0, react_1.useState)(false), 2), open = _d[0], setOpen = _d[1];
|
||||
var renderMenuItems = function (data, callback) {
|
||||
return data === null || data === void 0 ? void 0 : data.map(function (menuItem) {
|
||||
if (menuItem.children) {
|
||||
return ((0, jsx_runtime_1.jsx)(antd_1.Menu.SubMenu, tslib_1.__assign({ icon: menuItem.logo ? ((0, jsx_runtime_1.jsx)(antd_1.Image, { height: 26, width: 26, src: menuItem.logo, preview: false })) : null, title: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { marginLeft: 8 } }, { children: menuItem.label })), onTitleClick: function (e) {
|
||||
if (menuItem.isArticle) {
|
||||
loadArticles(e.key);
|
||||
}
|
||||
getOpenKeys(e.key, treeData, openKeys);
|
||||
} }, { children: renderMenuItems(menuItem.children, callback) }), menuItem.key));
|
||||
}
|
||||
return ((0, jsx_runtime_1.jsx)(antd_1.Menu.Item, tslib_1.__assign({ onClick: function (e) {
|
||||
if (menuItem.type === 'article') {
|
||||
gotoArticleUpsert(e.key, selectedKeys);
|
||||
if (typeof callback === 'function') {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
} }, { children: menuItem.label }), menuItem.key));
|
||||
});
|
||||
};
|
||||
if ((treeData === null || treeData === void 0 ? void 0 : treeData.length) === 0) {
|
||||
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)(antd_1.Empty, { image: antd_1.Empty.PRESENTED_IMAGE_SIMPLE }) })));
|
||||
}
|
||||
if (width === 'xs') {
|
||||
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.article_v }, { children: [(0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.topBar }, { children: [(0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.menuHeader, onClick: function () {
|
||||
setOpen(true);
|
||||
} }, { children: [(0, jsx_runtime_1.jsx)("div", { children: "\u5E2E\u52A9\u6587\u6863" }), open ? ((0, jsx_runtime_1.jsx)(icons_1.MenuFoldOutlined, { style: {
|
||||
fontSize: 18,
|
||||
} })) : ((0, jsx_runtime_1.jsx)(icons_1.MenuUnfoldOutlined, { style: {
|
||||
fontSize: 18,
|
||||
} }))] })), (0, jsx_runtime_1.jsx)(antd_1.Divider, { style: { margin: 0 } })] })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.editor }, { children: (selectedArticleId === null || selectedArticleId === void 0 ? void 0 : selectedArticleId.length) > 0 ? ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(antd_1.Breadcrumb, { style: { padding: '10px 10px' }, items: breadcrumbItems }), (0, jsx_runtime_1.jsx)(detail3_1.default, { oakAutoUnmount: true, oakId: selectedArticleId, oakPath: "$article-detail2-".concat(selectedArticleId) })] })) : null }))] })), (0, jsx_runtime_1.jsx)(antd_1.Drawer, tslib_1.__assign({ className: web_module_less_1.default.drawerPanel, open: open, onClose: function () {
|
||||
setOpen(false);
|
||||
}, width: 256, placement: "left" }, { children: (0, jsx_runtime_1.jsx)(Sider, tslib_1.__assign({ theme: "light", width: 256, className: web_module_less_1.default.siderPanel }, { children: (0, jsx_runtime_1.jsx)(antd_1.Menu, tslib_1.__assign({ openKeys: openKeys, selectedKeys: selectedKeys, style: { width: 256 }, mode: "inline" }, { children: renderMenuItems(treeData, function () {
|
||||
setOpen(false);
|
||||
}) })) })) }))] })));
|
||||
}
|
||||
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.article }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.menu }, { children: (0, jsx_runtime_1.jsx)(Sider, tslib_1.__assign({ theme: "light", width: 275, className: web_module_less_1.default.siderPanel }, { children: (0, jsx_runtime_1.jsx)(antd_1.Menu, tslib_1.__assign({ openKeys: openKeys, selectedKeys: selectedKeys, style: { width: 256 }, mode: "inline" }, { children: renderMenuItems(treeData) })) })) })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.editor, style: {
|
||||
marginLeft: 300,
|
||||
} }, { children: (selectedArticleId === null || selectedArticleId === void 0 ? void 0 : selectedArticleId.length) > 0 ? ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(antd_1.Breadcrumb, { style: { padding: '10px 10px' }, items: breadcrumbItems }), (0, jsx_runtime_1.jsx)(detail3_1.default, { oakAutoUnmount: true, oakId: selectedArticleId, oakPath: "$article-detail2-".concat(selectedArticleId) })] })) : null }))] })) })));
|
||||
}
|
||||
exports.default = render;
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
.container {
|
||||
background: var(--oak-bg-color-container);
|
||||
min-height: 100vh;
|
||||
max-width: 100vw;
|
||||
|
||||
.article {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
.menu {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.editor {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
.article_v {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.topBar {
|
||||
position: fixed;
|
||||
z-index: 99;
|
||||
background: var(--oak-bg-color-container);
|
||||
.menuHeader {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 10px;
|
||||
height: 50px;
|
||||
width: 100vw;
|
||||
|
||||
}
|
||||
}
|
||||
.editor {
|
||||
margin-top: 50px;
|
||||
display: flex;
|
||||
z-index: 98;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.space {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.tree {
|
||||
:global {
|
||||
.ant-tree-title {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.siderPanel {
|
||||
flex-shrink: 0;
|
||||
height: 100%;
|
||||
// border-right: 1px solid var(--oak-border-color);
|
||||
overflow-y: hidden;
|
||||
overflow-x: hidden;
|
||||
position: fixed;
|
||||
|
||||
.icon {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
:global {
|
||||
.ant-layout-sider-children {
|
||||
// height: calc(100% - 48px);
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.drawerPanel {
|
||||
:global {
|
||||
.ant-drawer-body {
|
||||
padding: 0 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
/// <reference types="react" />
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../general-app-domain").EntityDict, "article", true, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
import { EntityDict } from '../../../general-app-domain';
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "articleMenu", true, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -1,133 +1,472 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
;
|
||||
exports.default = OakComponent({
|
||||
entity: 'article',
|
||||
entity: 'articleMenu',
|
||||
projection: {
|
||||
id: 1,
|
||||
iState: 1,
|
||||
title: 1,
|
||||
author: 1,
|
||||
abstract: 1,
|
||||
content: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
parent: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
},
|
||||
article$articleMenu: {
|
||||
$entity: 'article',
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenuId: 1,
|
||||
}
|
||||
},
|
||||
extraFile$entity: {
|
||||
$entity: 'extraFile',
|
||||
data: {
|
||||
id: 1,
|
||||
tag1: 1,
|
||||
origin: 1,
|
||||
bucket: 1,
|
||||
objectId: 1,
|
||||
filename: 1,
|
||||
extra1: 1,
|
||||
extension: 1,
|
||||
type: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
},
|
||||
filter: {
|
||||
tag1: {
|
||||
$in: ['logo', 'introduce'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
pagination: {
|
||||
currentPage: 1,
|
||||
pageSize: 200,
|
||||
more: true,
|
||||
},
|
||||
isList: true,
|
||||
formData: function (_a) {
|
||||
var _b;
|
||||
var articles = _a.data, features = _a.features;
|
||||
var filter = this.getFilterByName('title');
|
||||
var pagination = this.getPagination();
|
||||
var _this = this;
|
||||
var rows = _a.data;
|
||||
var articleMenus = this.getArticleMenus();
|
||||
var treeData = articleMenus === null || articleMenus === void 0 ? void 0 : articleMenus.map(function (articleMenu) {
|
||||
var _a, _b;
|
||||
return {
|
||||
label: articleMenu.name,
|
||||
key: (_a = articleMenu.id) === null || _a === void 0 ? void 0 : _a.toString(),
|
||||
isArticle: articleMenu.isArticle,
|
||||
logo: _this.features.extraFile.getUrl((_b = articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.extraFile$entity) === null || _b === void 0 ? void 0 : _b.find(function (ele) { return ele.tag1 === 'logo'; })),
|
||||
parentKey: articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.parentId,
|
||||
children: _this.buildTreeData(articleMenu.id, articleMenu.isArticle),
|
||||
};
|
||||
});
|
||||
return {
|
||||
articles: articles === null || articles === void 0 ? void 0 : articles.map(function (article, index) {
|
||||
return {
|
||||
id: article === null || article === void 0 ? void 0 : article.id,
|
||||
iState: article === null || article === void 0 ? void 0 : article.iState,
|
||||
title: article === null || article === void 0 ? void 0 : article.title,
|
||||
abstract: article === null || article === void 0 ? void 0 : article.abstract,
|
||||
author: article === null || article === void 0 ? void 0 : article.author,
|
||||
content: article === null || article === void 0 ? void 0 : article.content,
|
||||
entity: article === null || article === void 0 ? void 0 : article.entity,
|
||||
entityId: article === null || article === void 0 ? void 0 : article.entityId,
|
||||
};
|
||||
}),
|
||||
pagination: pagination,
|
||||
searchValue: (_b = filter === null || filter === void 0 ? void 0 : filter.title) === null || _b === void 0 ? void 0 : _b.$includes,
|
||||
treeData: treeData,
|
||||
};
|
||||
},
|
||||
filters: [
|
||||
// 由调用者注入oakFilter
|
||||
{
|
||||
filter: function () {
|
||||
var _a = this.props, entityId = _a.entityId, entity = _a.entity;
|
||||
return {
|
||||
entityId: entityId,
|
||||
entity: entity,
|
||||
};
|
||||
},
|
||||
},
|
||||
],
|
||||
// sorters: [],
|
||||
filters: [],
|
||||
lifetimes: {},
|
||||
data: {
|
||||
selectedArticleId: '',
|
||||
openKeys: [],
|
||||
selectedKeys: [],
|
||||
treeData: [],
|
||||
parentId: '',
|
||||
articleMenuId: '',
|
||||
id: '',
|
||||
name: '',
|
||||
isArticle: false,
|
||||
isChildren: false,
|
||||
logo: '',
|
||||
breadcrumbItems: [],
|
||||
},
|
||||
methods: {
|
||||
goUpsert: function () {
|
||||
var _a = this.props, entityId = _a.entityId, entity = _a.entity;
|
||||
this.navigateTo({
|
||||
url: '/article/upsert',
|
||||
entityId: entityId,
|
||||
entity: entity,
|
||||
getArticleMenus: function (parentId) {
|
||||
var articleMenus = this.features.cache.get('articleMenu', {
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
parent: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
},
|
||||
article$articleMenu: {
|
||||
$entity: 'article',
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenuId: 1,
|
||||
}
|
||||
},
|
||||
extraFile$entity: {
|
||||
$entity: 'extraFile',
|
||||
data: {
|
||||
id: 1,
|
||||
tag1: 1,
|
||||
origin: 1,
|
||||
bucket: 1,
|
||||
objectId: 1,
|
||||
filename: 1,
|
||||
extra1: 1,
|
||||
extension: 1,
|
||||
type: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
},
|
||||
filter: {
|
||||
tag1: {
|
||||
$in: ['logo', 'introduce'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
filter: {
|
||||
parentId: parentId ? parentId : {
|
||||
$exists: false
|
||||
}
|
||||
},
|
||||
sorter: [
|
||||
{
|
||||
$attr: {
|
||||
$$createAt$$: 1,
|
||||
},
|
||||
$direction: 'asc',
|
||||
},
|
||||
],
|
||||
});
|
||||
return articleMenus;
|
||||
},
|
||||
goUpsertById: function (id) {
|
||||
this.navigateTo({
|
||||
url: '/article/upsert',
|
||||
oakId: id,
|
||||
});
|
||||
},
|
||||
goDetailById: function (id) {
|
||||
this.navigateTo({
|
||||
url: '/article/detail',
|
||||
oakId: id,
|
||||
});
|
||||
},
|
||||
onRemove: function (id) {
|
||||
loadArticleMenus: function (parentId) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var articleMenus;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, this.addOperation({
|
||||
action: 'remove',
|
||||
data: {},
|
||||
filter: {
|
||||
id: id,
|
||||
case 0: return [4 /*yield*/, this.features.cache.refresh('articleMenu', {
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
parent: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
},
|
||||
article$articleMenu: {
|
||||
$entity: 'article',
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenuId: 1,
|
||||
}
|
||||
},
|
||||
extraFile$entity: {
|
||||
$entity: 'extraFile',
|
||||
data: {
|
||||
id: 1,
|
||||
tag1: 1,
|
||||
origin: 1,
|
||||
bucket: 1,
|
||||
objectId: 1,
|
||||
filename: 1,
|
||||
extra1: 1,
|
||||
extension: 1,
|
||||
type: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
},
|
||||
filter: {
|
||||
tag1: {
|
||||
$in: ['logo', 'introduce'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
filter: {
|
||||
parentId: parentId ? parentId : {
|
||||
$exists: false
|
||||
}
|
||||
},
|
||||
sorter: [
|
||||
{
|
||||
$attr: {
|
||||
$$createAt$$: 1,
|
||||
},
|
||||
$direction: 'asc',
|
||||
},
|
||||
],
|
||||
})];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [4 /*yield*/, this.execute()];
|
||||
case 2:
|
||||
_a.sent();
|
||||
articleMenus = _a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
searchChange: function (event) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var value;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
value = this.resolveInput(event).value;
|
||||
this.searchValueChange(value);
|
||||
return [2 /*return*/];
|
||||
});
|
||||
});
|
||||
},
|
||||
searchValueChange: function (value) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
this.addNamedFilter({
|
||||
filter: {
|
||||
title: {
|
||||
$includes: value,
|
||||
},
|
||||
getArticles: function (articleMenuId) {
|
||||
var articleMenus = this.features.cache.get('article', {
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenuId: 1,
|
||||
},
|
||||
filter: {
|
||||
articleMenuId: articleMenuId
|
||||
},
|
||||
sorter: [
|
||||
{
|
||||
$attr: {
|
||||
$$createAt$$: 1,
|
||||
},
|
||||
'#name': 'title',
|
||||
});
|
||||
return [2 /*return*/];
|
||||
$direction: 'asc',
|
||||
},
|
||||
],
|
||||
});
|
||||
return articleMenus;
|
||||
},
|
||||
loadArticles: function (articleMenuId) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var articles;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, this.features.cache.refresh('article', {
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenuId: 1,
|
||||
},
|
||||
filter: {
|
||||
articleMenuId: articleMenuId
|
||||
},
|
||||
sorter: [
|
||||
{
|
||||
$attr: {
|
||||
$$createAt$$: 1,
|
||||
},
|
||||
$direction: 'asc',
|
||||
},
|
||||
],
|
||||
})];
|
||||
case 1:
|
||||
articles = _a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
searchCancel: function () {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
this.removeNamedFilterByName('title');
|
||||
return [2 /*return*/];
|
||||
});
|
||||
getOpenKeys: function (targetKey, treeData, openKeys) {
|
||||
var _this = this;
|
||||
if (openKeys === void 0) { openKeys = []; }
|
||||
var selectedKeys = [];
|
||||
var toggleOpenKeys = function (nodes, parentOpen) {
|
||||
var e_1, _a;
|
||||
var _loop_1 = function (node) {
|
||||
if (node.key === targetKey) {
|
||||
var isOpen = openKeys.includes(node.key);
|
||||
if (isOpen) {
|
||||
// 当前子菜单已展开,收起当前子菜单及其所有子菜单
|
||||
openKeys = openKeys.filter(function (key) {
|
||||
return key !== node.key &&
|
||||
!key.startsWith("".concat(node.key, "-"));
|
||||
});
|
||||
}
|
||||
else {
|
||||
// 当前子菜单已收起,展开当前子菜单及其所有子菜单
|
||||
openKeys.push(node.key);
|
||||
openKeys.push.apply(openKeys, tslib_1.__spreadArray([], tslib_1.__read(getAllChildKeys(node)), false));
|
||||
var leafNode = findLeafNode(node);
|
||||
if (leafNode && leafNode.type === 'article') {
|
||||
var parentKeys = getParentKeys(leafNode);
|
||||
selectedKeys.push.apply(selectedKeys, tslib_1.__spreadArray([], tslib_1.__read(parentKeys), false));
|
||||
_this.gotoArticleUpsert(leafNode.key);
|
||||
}
|
||||
}
|
||||
// 存储第一个没有子节点的节点及其全部父节点到 selectedKeys
|
||||
}
|
||||
else if (node.children) {
|
||||
toggleOpenKeys(node.children, openKeys.includes(node.key) || parentOpen); // 递归处理子菜单的展开和收起
|
||||
}
|
||||
};
|
||||
try {
|
||||
for (var nodes_1 = tslib_1.__values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) {
|
||||
var node = nodes_1_1.value;
|
||||
_loop_1(node);
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
};
|
||||
var getAllChildKeys = function (node) {
|
||||
var e_2, _a;
|
||||
var childKeys = [];
|
||||
if (node.children) {
|
||||
try {
|
||||
for (var _b = tslib_1.__values(node.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var child = _c.value;
|
||||
childKeys.push(child.key);
|
||||
childKeys.push.apply(childKeys, tslib_1.__spreadArray([], tslib_1.__read(getAllChildKeys(child)), false));
|
||||
}
|
||||
}
|
||||
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_2) throw e_2.error; }
|
||||
}
|
||||
}
|
||||
return childKeys;
|
||||
};
|
||||
var findLeafNode = function (node) {
|
||||
var e_3, _a;
|
||||
if (!node.children || node.children.length === 0) {
|
||||
return node;
|
||||
}
|
||||
try {
|
||||
for (var _b = tslib_1.__values(node.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var child = _c.value;
|
||||
var leafNode = findLeafNode(child);
|
||||
if (leafNode) {
|
||||
return leafNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_3) throw e_3.error; }
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
var getParentKeys = function (node) {
|
||||
var parentKeys = [];
|
||||
var currentNode = node;
|
||||
while (currentNode) {
|
||||
parentKeys.unshift(currentNode.key);
|
||||
currentNode = findParentNode(currentNode);
|
||||
}
|
||||
return parentKeys;
|
||||
};
|
||||
var findParentNode = function (node) {
|
||||
if (!node.parentKey) {
|
||||
return undefined;
|
||||
}
|
||||
var parentNode = treeData.find(function (ele) { return ele.key === node.parentKey; });
|
||||
return parentNode;
|
||||
};
|
||||
toggleOpenKeys(treeData, false);
|
||||
this.setState({
|
||||
openKeys: tslib_1.__spreadArray([], tslib_1.__read(new Set(openKeys)), false),
|
||||
selectedKeys: tslib_1.__spreadArray([], tslib_1.__read(new Set(selectedKeys)), false), // 去重并更新 selectedKeys
|
||||
});
|
||||
return openKeys;
|
||||
},
|
||||
searchConfirm: function () {
|
||||
buildTreeData: function (parentId, isArticle) {
|
||||
var _this = this;
|
||||
var children = [];
|
||||
if (isArticle) {
|
||||
var articles = this.getArticles(parentId);
|
||||
children = articles === null || articles === void 0 ? void 0 : articles.map(function (article) {
|
||||
return {
|
||||
label: article.name,
|
||||
key: article.id,
|
||||
type: 'article',
|
||||
parentKey: article.articleMenuId,
|
||||
};
|
||||
});
|
||||
}
|
||||
else {
|
||||
var articleMenus = this.getArticleMenus(parentId);
|
||||
children = articleMenus === null || articleMenus === void 0 ? void 0 : articleMenus.map(function (articleMenu) {
|
||||
var _a, _b;
|
||||
return {
|
||||
label: articleMenu.name,
|
||||
key: (_a = articleMenu.id) === null || _a === void 0 ? void 0 : _a.toString(),
|
||||
isArticle: articleMenu.isArticle,
|
||||
logo: _this.features.extraFile.getUrl((_b = articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.extraFile$entity) === null || _b === void 0 ? void 0 : _b.find(function (ele) { return ele.tag1 === 'logo'; })),
|
||||
parentKey: articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.parentId,
|
||||
children: _this.buildTreeData(articleMenu.id, articleMenu.isArticle),
|
||||
};
|
||||
});
|
||||
}
|
||||
return children;
|
||||
},
|
||||
findParentNodes: function (treeData, targetKey) {
|
||||
for (var i = 0; i < treeData.length; i++) {
|
||||
var node = treeData[i];
|
||||
if (node.key === targetKey) {
|
||||
return [node];
|
||||
}
|
||||
if (node.children) {
|
||||
var parentNodes = this.findParentNodes(node.children, targetKey);
|
||||
if (parentNodes.length > 0) {
|
||||
return tslib_1.__spreadArray([node], tslib_1.__read(parentNodes), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return [];
|
||||
},
|
||||
findFirstArticle: function (treeData) {
|
||||
for (var i = 0; i < treeData.length; i++) {
|
||||
var node = treeData[i];
|
||||
if (node.type === 'article') {
|
||||
var parentNode = this.findParentNodes(this.state.treeData, node.key)[0];
|
||||
return parentNode;
|
||||
}
|
||||
if (node.children && node.children.length > 0) {
|
||||
var childNode = this.findFirstArticle(node.children);
|
||||
if (childNode) {
|
||||
return childNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
return {};
|
||||
},
|
||||
gotoArticleUpsert: function (articleId, selectedKeys) {
|
||||
var _a;
|
||||
if (selectedKeys === void 0) { selectedKeys = []; }
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
this.refresh();
|
||||
var parentNodes;
|
||||
return tslib_1.__generator(this, function (_b) {
|
||||
if (selectedKeys.includes(articleId)) {
|
||||
}
|
||||
else {
|
||||
parentNodes = (_a = this.findParentNodes(this.state.treeData, articleId)) === null || _a === void 0 ? void 0 : _a.map(function (ele) {
|
||||
return { title: ele.label };
|
||||
});
|
||||
this.setState({
|
||||
breadcrumbItems: parentNodes,
|
||||
});
|
||||
this.setState({
|
||||
selectedKeys: [articleId],
|
||||
selectedArticleId: articleId,
|
||||
id: '',
|
||||
parentId: '',
|
||||
});
|
||||
}
|
||||
return [2 /*return*/];
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,16 +1,30 @@
|
|||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from '../../../general-app-domain';
|
||||
export default function render(props: WebComponentProps<EntityDict, 'article', true, {
|
||||
searchValue: string;
|
||||
articles: EntityDict['article']['Schema'][];
|
||||
pagination: any;
|
||||
title?: string;
|
||||
showBack?: boolean;
|
||||
import { WebComponentProps } from "oak-frontend-base";
|
||||
import { EntityDict } from "../../../general-app-domain";
|
||||
interface DataNode {
|
||||
label: string;
|
||||
title: string;
|
||||
key: string;
|
||||
isArticle?: boolean;
|
||||
children?: DataNode[];
|
||||
}
|
||||
export default function render(props: WebComponentProps<EntityDict, "articleMenu", true, {
|
||||
treeData: DataNode[];
|
||||
openKeys: string[];
|
||||
selectedKeys: string[];
|
||||
selectedArticleId: string;
|
||||
breadcrumbItems: {
|
||||
title: string;
|
||||
}[];
|
||||
}, {
|
||||
goUpsert: () => Promise<void>;
|
||||
goDetailById: (id: string) => Promise<void>;
|
||||
goUpsertById: (id: string) => Promise<void>;
|
||||
searchValueChange: (v: string) => Promise<void>;
|
||||
searchConfirm: () => Promise<void>;
|
||||
onRemove: (id: string) => Promise<void>;
|
||||
gotoArticleUpsert: (articleId: string, selectedKeys?: string[]) => void;
|
||||
getOpenKeys: (targetKey: string, treeData: DataNode[], openKeys: string[]) => void;
|
||||
loadArticles: (articleMenuId: string) => void;
|
||||
findFirstArticle: (treeData: DataNode[]) => {
|
||||
label: string;
|
||||
title: string;
|
||||
key: string;
|
||||
isArticle?: boolean;
|
||||
children?: DataNode[];
|
||||
};
|
||||
}>): JSX.Element;
|
||||
export {};
|
||||
|
|
|
|||
|
|
@ -5,87 +5,52 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|||
var antd_1 = require("antd");
|
||||
var icons_1 = require("@ant-design/icons");
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
var useFeatures_1 = tslib_1.__importDefault(require("../../../hooks/useFeatures"));
|
||||
var pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader"));
|
||||
var detail2_1 = tslib_1.__importDefault(require("../../../components/article/detail2"));
|
||||
var copy_to_clipboard_1 = tslib_1.__importDefault(require("copy-to-clipboard"));
|
||||
var react_1 = require("react");
|
||||
var SubMenu = antd_1.Menu.SubMenu;
|
||||
function render(props) {
|
||||
var _this = this;
|
||||
var _a = props.data, pagination = _a.pagination, _b = _a.articles, articles = _b === void 0 ? [] : _b, oakLoading = _a.oakLoading, searchValue = _a.searchValue, title = _a.title, _c = _a.showBack, showBack = _c === void 0 ? false : _c;
|
||||
var _d = pagination || {}, pageSize = _d.pageSize, total = _d.total, currentPage = _d.currentPage;
|
||||
var _e = props.methods, t = _e.t, goUpsert = _e.goUpsert, goDetailById = _e.goDetailById, goUpsertById = _e.goUpsertById, searchConfirm = _e.searchConfirm, searchValueChange = _e.searchValueChange, setCurrentPage = _e.setCurrentPage, setPageSize = _e.setPageSize, onRemove = _e.onRemove;
|
||||
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ title: title || '文章管理', showBack: showBack }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsxs)(antd_1.Row, { children: [(0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ flex: "auto" }, { children: (0, jsx_runtime_1.jsx)(antd_1.Space, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {
|
||||
goUpsert();
|
||||
} }, { children: t('action.add') })) }) })), (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ flex: "none" }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165\u6807\u9898", value: searchValue, allowClear: true, onChange: function (e) {
|
||||
searchValueChange(e.target.value);
|
||||
}, suffix: (0, jsx_runtime_1.jsx)(icons_1.SearchOutlined, {}), onPressEnter: function (e) {
|
||||
searchConfirm();
|
||||
} }) }))] }), (0, jsx_runtime_1.jsx)(antd_1.Table, { loading: oakLoading, dataSource: articles, rowKey: "index", columns: [
|
||||
{
|
||||
align: 'center',
|
||||
dataIndex: 'serial-number',
|
||||
title: '序号',
|
||||
render: function (value, record, index) {
|
||||
return index + 1;
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'iState',
|
||||
title: t('book:attr.iState'),
|
||||
render: function (value, record, index) {
|
||||
return ((0, jsx_runtime_1.jsx)(antd_1.Tag, tslib_1.__assign({ color: "processing" }, { children: t("book:v.iState.".concat(value)) })));
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'title',
|
||||
title: t('article:attr.title'),
|
||||
},
|
||||
{
|
||||
dataIndex: 'author',
|
||||
title: t('article:attr.author'),
|
||||
},
|
||||
{
|
||||
dataIndex: 'abstract',
|
||||
title: t('article:attr.abstract'),
|
||||
},
|
||||
{
|
||||
dataIndex: 'op',
|
||||
width: 300,
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
render: function (value, record, index) {
|
||||
return ((0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function () {
|
||||
goDetailById(record.id);
|
||||
} }, { children: "\u8BE6\u60C5" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function () {
|
||||
goUpsertById(record.id);
|
||||
} }, { children: "\u7F16\u8F91" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function () {
|
||||
var modal = antd_1.Modal.confirm({
|
||||
title: '确认删除该文章吗?',
|
||||
content: '删除后,文章不可恢复',
|
||||
okText: '确定',
|
||||
cancelText: '取消',
|
||||
onOk: function (e) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
onRemove(record.id);
|
||||
modal.destroy();
|
||||
return [2 /*return*/];
|
||||
});
|
||||
}); },
|
||||
onCancel: function (e) {
|
||||
modal.destroy();
|
||||
},
|
||||
var _a = props.data, treeData = _a.treeData, openKeys = _a.openKeys, selectedKeys = _a.selectedKeys, selectedArticleId = _a.selectedArticleId, breadcrumbItems = _a.breadcrumbItems;
|
||||
var _b = props.methods, t = _b.t, gotoArticleUpsert = _b.gotoArticleUpsert, getOpenKeys = _b.getOpenKeys, loadArticles = _b.loadArticles, setMessage = _b.setMessage, findFirstArticle = _b.findFirstArticle;
|
||||
var features = (0, useFeatures_1.default)();
|
||||
var _c = tslib_1.__read((0, react_1.useState)(false), 2), executed = _c[0], setExecuted = _c[1];
|
||||
(0, react_1.useEffect)(function () {
|
||||
if (!executed && treeData.length > 0) {
|
||||
var node = findFirstArticle(treeData);
|
||||
getOpenKeys(node.key, treeData, openKeys);
|
||||
setExecuted(true);
|
||||
}
|
||||
}, [treeData, executed]);
|
||||
var renderMenuItems = function (data) {
|
||||
return data === null || data === void 0 ? void 0 : data.map(function (menuItem) {
|
||||
if (menuItem.children) {
|
||||
return ((0, jsx_runtime_1.jsx)(antd_1.Menu.SubMenu, tslib_1.__assign({ icon: menuItem.logo ? ((0, jsx_runtime_1.jsx)(antd_1.Image, { height: 26, width: 26, src: menuItem.logo, preview: false })) : null, title: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { marginLeft: 8 } }, { children: menuItem.label })), onTitleClick: function (e) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
if (menuItem.isArticle) {
|
||||
loadArticles(e.key);
|
||||
}
|
||||
getOpenKeys(e.key, treeData, openKeys);
|
||||
return [2 /*return*/];
|
||||
});
|
||||
}); } }, { children: renderMenuItems(menuItem.children) }), menuItem.key));
|
||||
}
|
||||
return ((0, jsx_runtime_1.jsx)(antd_1.Menu.Item, tslib_1.__assign({ onClick: function (e) {
|
||||
if (menuItem.type === 'article') {
|
||||
gotoArticleUpsert(e.key, selectedKeys);
|
||||
}
|
||||
} }, { children: menuItem.label }), menuItem.key));
|
||||
});
|
||||
};
|
||||
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ title: "\u5E2E\u52A9\u6587\u6863" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (treeData === null || treeData === void 0 ? void 0 : treeData.length) === 0 ? ((0, jsx_runtime_1.jsx)(antd_1.Empty, { image: antd_1.Empty.PRESENTED_IMAGE_SIMPLE })) : ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.article }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.menu }, { children: (0, jsx_runtime_1.jsx)(antd_1.Menu, tslib_1.__assign({ openKeys: openKeys, selectedKeys: selectedKeys, style: { width: 256 }, mode: "inline" }, { children: renderMenuItems(treeData) })) })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.editor }, { children: (selectedArticleId === null || selectedArticleId === void 0 ? void 0 : selectedArticleId.length) > 0 ? ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { display: 'flex', justifyContent: 'flex-end' } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Space, { children: (0, jsx_runtime_1.jsxs)(antd_1.Button, tslib_1.__assign({ onClick: function () {
|
||||
var url = "".concat(window.location.host, "/article/detail?oakId=").concat(selectedArticleId);
|
||||
(0, copy_to_clipboard_1.default)(url);
|
||||
setMessage({
|
||||
content: '复制链接成功',
|
||||
type: 'success',
|
||||
});
|
||||
} }, { children: "\u5220\u9664" }))] }));
|
||||
},
|
||||
fixed: 'right',
|
||||
},
|
||||
], pagination: {
|
||||
total: total,
|
||||
pageSize: pageSize,
|
||||
current: currentPage,
|
||||
onShowSizeChange: function (current, pageSize) {
|
||||
setPageSize(pageSize);
|
||||
},
|
||||
onChange: function (current) {
|
||||
setCurrentPage(current);
|
||||
},
|
||||
} })] })) })));
|
||||
} }, { children: [(0, jsx_runtime_1.jsx)(icons_1.CopyOutlined, {}), "\u590D\u5236\u94FE\u63A5"] })) }) })), (0, jsx_runtime_1.jsx)(antd_1.Breadcrumb, { style: { padding: '10px 10px' }, items: breadcrumbItems }), (0, jsx_runtime_1.jsx)(detail2_1.default, { oakAutoUnmount: true, oakId: selectedArticleId, oakPath: "$article-detail2-".concat(selectedArticleId) })] })) : null }))] }))) })) })));
|
||||
}
|
||||
exports.default = render;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,39 @@
|
|||
.container {
|
||||
background: var(--oak-bg-color-container);
|
||||
box-shadow: 0 2px 3px #0000001a;
|
||||
border-radius: 3px;
|
||||
padding: 30px 32px;
|
||||
background: var(--oak-bg-color-container);
|
||||
box-shadow: 0 2px 3px #0000001a;
|
||||
border-radius: 3px;
|
||||
padding: 30px 32px;
|
||||
min-height: 450px;
|
||||
|
||||
.article {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
.menu {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.editor {
|
||||
display: flex;
|
||||
margin-left: 20px;
|
||||
|
||||
.rightContainer {
|
||||
width: 950px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.space {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.tree {
|
||||
:global {
|
||||
.ant-tree-title {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
/// <reference types="react" />
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../general-app-domain").EntityDict, keyof import("../../../general-app-domain").EntityDict, false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../general-app-domain").EntityDict, "article", false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -1,25 +1,23 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
exports.default = OakComponent({
|
||||
isList: false,
|
||||
formData: function (_a) {
|
||||
var features = _a.features;
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_b) {
|
||||
return [2 /*return*/, {}];
|
||||
});
|
||||
});
|
||||
entity: 'article',
|
||||
projection: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenu: {
|
||||
id: 1,
|
||||
}
|
||||
},
|
||||
listeners: {
|
||||
content: function (prev, next) {
|
||||
if (prev.content !== next.content) {
|
||||
var ac = window.document.getElementById('article-content');
|
||||
if (ac) {
|
||||
ac.innerHTML = next.content;
|
||||
}
|
||||
}
|
||||
},
|
||||
formData: function (_a) {
|
||||
var article = _a.data, features = _a.features;
|
||||
return {
|
||||
id: article === null || article === void 0 ? void 0 : article.id,
|
||||
content: article === null || article === void 0 ? void 0 : article.content,
|
||||
name: article === null || article === void 0 ? void 0 : article.name,
|
||||
};
|
||||
},
|
||||
data: {
|
||||
content: '',
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from '../../../general-app-domain';
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'article', false, {
|
||||
id: string;
|
||||
name: string;
|
||||
editor: any;
|
||||
title?: string;
|
||||
author?: string;
|
||||
abstract?: string;
|
||||
content?: string;
|
||||
html?: string;
|
||||
origin?: string;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
var editor_for_react_1 = require("@wangeditor/editor-for-react");
|
||||
var react_1 = require("react");
|
||||
function Render(props) {
|
||||
var _a = props.data, editor = _a.editor, title = _a.title, author = _a.author, abstract = _a.abstract, content = _a.content;
|
||||
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.content }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.editorContainer }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.titleContainer }, { children: (0, jsx_runtime_1.jsx)("span", tslib_1.__assign({ className: web_module_less_1.default.title }, { children: title })) })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.authorContainer }, { children: (0, jsx_runtime_1.jsx)("span", tslib_1.__assign({ className: web_module_less_1.default.author }, { children: author })) })), (0, jsx_runtime_1.jsx)("div", { id: "article-content" })] })) })) })));
|
||||
var _a = props.data, id = _a.id, name = _a.name, editor = _a.editor, title = _a.title, content = _a.content;
|
||||
console.log(title, content);
|
||||
var editorConfig = {
|
||||
readOnly: true,
|
||||
autoFocus: true,
|
||||
scroll: false,
|
||||
};
|
||||
var _b = tslib_1.__read((0, react_1.useState)(''), 2), value = _b[0], setValue = _b[1];
|
||||
(0, react_1.useEffect)(function () {
|
||||
if (content) {
|
||||
setValue(content);
|
||||
}
|
||||
}, [content]);
|
||||
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.content }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.editorContainer }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.titleContainer }, { children: (0, jsx_runtime_1.jsx)("span", tslib_1.__assign({ className: web_module_less_1.default.title }, { children: title })) })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ id: "article-content", style: { width: '100%' } }, { children: (0, jsx_runtime_1.jsx)(editor_for_react_1.Editor, { defaultConfig: editorConfig, value: value, mode: "default", style: {
|
||||
width: '100%',
|
||||
} }) }))] })) })) })));
|
||||
}
|
||||
exports.default = Render;
|
||||
|
|
|
|||
|
|
@ -1,24 +1,31 @@
|
|||
.container {
|
||||
background-color: var(--oak-bg-color-page);
|
||||
padding: 30px 32px;
|
||||
height: 100%;
|
||||
background-color: #f3f5f7;
|
||||
padding: 30px 300px;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
|
||||
.content {
|
||||
background-color: var(--oak-bg-color-page);
|
||||
width: 100%
|
||||
display: flex;
|
||||
background-color: #f3f5f7;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.editorContainer {
|
||||
// width: 100%;
|
||||
margin: 30px auto 50px auto;
|
||||
// margin: 30px auto 50px auto;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--oak-bg-color-container);
|
||||
padding: 20px 50px 50px 50px;
|
||||
box-shadow: 0 2px 10px rgb(0 0 0 / 12%);
|
||||
}
|
||||
|
||||
.titleContainer {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 5px 0 10px 0;
|
||||
}
|
||||
|
||||
|
|
@ -27,7 +34,7 @@
|
|||
}
|
||||
|
||||
.title {
|
||||
font-size: 18px !important;
|
||||
font-size: 32px !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
/// <reference types="react" />
|
||||
import { EntityDict } from '../../../general-app-domain';
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "article", false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "article", false, {
|
||||
articleMenuId: string;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -6,32 +6,30 @@ exports.default = OakComponent({
|
|||
entity: 'article',
|
||||
projection: {
|
||||
id: 1,
|
||||
iState: 1,
|
||||
title: 1,
|
||||
author: 1,
|
||||
abstract: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
articleMenu: {
|
||||
id: 1,
|
||||
},
|
||||
},
|
||||
isList: false,
|
||||
formData: function (_a) {
|
||||
var article = _a.data, features = _a.features;
|
||||
return {
|
||||
id: article === null || article === void 0 ? void 0 : article.id,
|
||||
iState: article === null || article === void 0 ? void 0 : article.iState,
|
||||
title: article === null || article === void 0 ? void 0 : article.title,
|
||||
abstract: article === null || article === void 0 ? void 0 : article.abstract,
|
||||
author: article === null || article === void 0 ? void 0 : article.author,
|
||||
content: article === null || article === void 0 ? void 0 : article.content,
|
||||
name: article === null || article === void 0 ? void 0 : article.name,
|
||||
};
|
||||
},
|
||||
data: {
|
||||
editor: null,
|
||||
html: '',
|
||||
origin: 'qiniu',
|
||||
origin1: 'qiniu',
|
||||
contentTip: false,
|
||||
},
|
||||
properties: {
|
||||
articleMenuId: '',
|
||||
},
|
||||
listeners: {
|
||||
'editor,content': function (prev, next) {
|
||||
if (next.editor && next.content) {
|
||||
|
|
@ -41,13 +39,20 @@ exports.default = OakComponent({
|
|||
},
|
||||
lifetimes: {
|
||||
ready: function () {
|
||||
var _a = this.props, entityId = _a.entityId, entity = _a.entity, oakId = _a.oakId;
|
||||
if (!oakId) {
|
||||
this.update({
|
||||
entityId: entityId,
|
||||
entity: entity,
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var _a, oakId, articleMenuId;
|
||||
return tslib_1.__generator(this, function (_b) {
|
||||
_a = this.props, oakId = _a.oakId, articleMenuId = _a.articleMenuId;
|
||||
if (!oakId) {
|
||||
if (articleMenuId) {
|
||||
this.update({
|
||||
articleMenuId: articleMenuId,
|
||||
});
|
||||
}
|
||||
}
|
||||
return [2 /*return*/];
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
detached: function () {
|
||||
var editor = this.state.editor;
|
||||
|
|
@ -58,38 +63,34 @@ exports.default = OakComponent({
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
addExtraFile: function (extraFile) {
|
||||
onRemoveArticle: function (id) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var result, error_1;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
_a.trys.push([0, 2, , 3]);
|
||||
return [4 /*yield*/, this.features.cache.operate('extraFile', {
|
||||
action: 'create',
|
||||
data: extraFile,
|
||||
id: (0, uuid_1.generateNewId)(),
|
||||
})];
|
||||
this.removeItem(id);
|
||||
return [4 /*yield*/, this.execute()];
|
||||
case 1:
|
||||
_a.sent();
|
||||
this.navigateBack();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
addExtraFile: function (extraFile) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var result;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, this.features.cache.operate('extraFile', {
|
||||
action: 'create',
|
||||
data: extraFile,
|
||||
id: (0, uuid_1.generateNewId)(),
|
||||
})];
|
||||
case 1:
|
||||
result = _a.sent();
|
||||
return [2 /*return*/, result];
|
||||
case 2:
|
||||
error_1 = _a.sent();
|
||||
// if (
|
||||
// (<OakException>error).constructor.name ===
|
||||
// OakUnloggedInException.name
|
||||
// ) {
|
||||
// this.navigateTo(
|
||||
// {
|
||||
// url: '/login',
|
||||
// },
|
||||
// undefined,
|
||||
// true
|
||||
// );
|
||||
// return;
|
||||
// }
|
||||
throw error_1;
|
||||
case 3: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -107,15 +108,24 @@ exports.default = OakComponent({
|
|||
contentTip: false,
|
||||
});
|
||||
},
|
||||
confirm: function () {
|
||||
check: function () {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, this.execute()];
|
||||
case 0:
|
||||
if (!(this.state.name && this.state.name.length > 0)) return [3 /*break*/, 2];
|
||||
return [4 /*yield*/, this.execute()];
|
||||
case 1:
|
||||
_a.sent();
|
||||
this.navigateBack();
|
||||
return [2 /*return*/];
|
||||
return [3 /*break*/, 3];
|
||||
case 2:
|
||||
this.setMessage({
|
||||
content: '请填写文章标题!',
|
||||
type: 'warning',
|
||||
});
|
||||
_a.label = 3;
|
||||
case 3: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -129,16 +139,29 @@ exports.default = OakComponent({
|
|||
});
|
||||
});
|
||||
},
|
||||
setHtml: function (content) {
|
||||
this.update({ content: content });
|
||||
this.setState({ html: content });
|
||||
setHtml: function (html) {
|
||||
this.setState({
|
||||
html: html,
|
||||
});
|
||||
if (html && html !== '<p><br></p>' && this.state.oakFullpath) {
|
||||
this.update({ content: html });
|
||||
}
|
||||
},
|
||||
preview: function () {
|
||||
var _a = this.state, html = _a.html, title = _a.title, author = _a.author;
|
||||
var html = this.state.html;
|
||||
this.save('article_html', JSON.stringify({
|
||||
content: html,
|
||||
author: author,
|
||||
// author,
|
||||
// title,
|
||||
}));
|
||||
window.open('/article/preview');
|
||||
},
|
||||
gotoPreview: function (content, title) {
|
||||
this.save('article_html', JSON.stringify({
|
||||
content: content,
|
||||
title: title,
|
||||
// author,
|
||||
// title,
|
||||
}));
|
||||
window.open('/article/preview');
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,24 +1,27 @@
|
|||
import '@wangeditor/editor/dist/css/style.css';
|
||||
import { EntityDict } from './../../../general-app-domain';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'article', false, {
|
||||
import "@wangeditor/editor/dist/css/style.css";
|
||||
import { EntityDict } from "./../../../general-app-domain";
|
||||
import { WebComponentProps } from "oak-frontend-base";
|
||||
export default function Render(props: WebComponentProps<EntityDict, "article", false, {
|
||||
id: string;
|
||||
name: string;
|
||||
editor: any;
|
||||
title?: string;
|
||||
author?: string;
|
||||
abstract?: string;
|
||||
content?: string;
|
||||
html?: string;
|
||||
origin?: string;
|
||||
contentTip: boolean;
|
||||
origin1: string;
|
||||
}, {
|
||||
setHtml: (content: string) => void;
|
||||
setEditor: (editor: any) => void;
|
||||
confirm: () => void;
|
||||
check: () => void;
|
||||
preview: () => void;
|
||||
addExtraFile: (file: EntityDict['extraFile']['CreateSingle']['data']) => Promise<void>;
|
||||
uploadFile: (file: EntityDict['extraFile']['CreateSingle']['data']) => Promise<{
|
||||
addExtraFile: (file: EntityDict["extraFile"]["CreateSingle"]["data"]) => Promise<void>;
|
||||
uploadFile: (file: EntityDict["extraFile"]["CreateSingle"]["data"]) => Promise<{
|
||||
bucket: string;
|
||||
url: string;
|
||||
}>;
|
||||
clearContentTip: () => void;
|
||||
onRemoveArticle: (id: string) => void;
|
||||
gotoPreview: (content?: string, title?: string) => void;
|
||||
}>): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -3,14 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var uuid_1 = require("oak-domain/lib/utils/uuid");
|
||||
var react_1 = require("react");
|
||||
var antd_1 = require("antd");
|
||||
var confirm = antd_1.Modal.confirm;
|
||||
require("@wangeditor/editor/dist/css/style.css"); // 引入 css
|
||||
var editor_for_react_1 = require("@wangeditor/editor-for-react");
|
||||
var gallery_1 = tslib_1.__importDefault(require("./../../../components/extraFile/gallery"));
|
||||
var pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader"));
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
var useFeatures_1 = tslib_1.__importDefault(require("../../../hooks/useFeatures"));
|
||||
var icons_1 = require("@ant-design/icons");
|
||||
// 工具栏配置
|
||||
var toolbarConfig = {
|
||||
excludeKeys: ['fullScreen'],
|
||||
excludeKeys: ["fullScreen"],
|
||||
}; // TS 语法
|
||||
// 自定义校验图片
|
||||
function customCheckImageFn(src, alt, url) {
|
||||
|
|
@ -18,8 +22,8 @@ function customCheckImageFn(src, alt, url) {
|
|||
if (!src) {
|
||||
return;
|
||||
}
|
||||
if (src.indexOf('http') !== 0) {
|
||||
return '图片网址必须以 http/https 开头';
|
||||
if (src.indexOf("http") !== 0) {
|
||||
return "图片网址必须以 http/https 开头";
|
||||
}
|
||||
return true;
|
||||
// 返回值有三种选择:
|
||||
|
|
@ -29,139 +33,125 @@ function customCheckImageFn(src, alt, url) {
|
|||
}
|
||||
function Render(props) {
|
||||
var method = props.methods, data = props.data;
|
||||
var t = method.t, setEditor = method.setEditor, confirm = method.confirm, preview = method.preview, addExtraFile = method.addExtraFile, uploadFile = method.uploadFile, update = method.update, setHtml = method.setHtml;
|
||||
var editor = data.editor, origin = data.origin, oakFullpath = data.oakFullpath;
|
||||
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Affix, tslib_1.__assign({ offsetTop: 64 }, { children: (0, jsx_runtime_1.jsx)(editor_for_react_1.Toolbar, { editor: editor, defaultConfig: toolbarConfig, mode: "default" }) })), (0, jsx_runtime_1.jsxs)(antd_1.Row, { children: [(0, jsx_runtime_1.jsx)(antd_1.Col, { flex: 4 }), (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ flex: 16 }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.content }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.editorContainer }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.titleContainer }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (e) {
|
||||
return update({ title: e.target.value });
|
||||
}, value: data.title, placeholder: t('placeholder.title'), size: "large", maxLength: 64, suffix: "".concat(tslib_1.__spreadArray([], tslib_1.__read((data.title || '')), false).length, "/64"), className: web_module_less_1.default.titleInput }) })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.authorContainer }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (e) {
|
||||
return update({ author: e.target.value });
|
||||
}, value: data.author, placeholder: t('placeholder.author'), className: web_module_less_1.default.input, maxLength: 16 }) })), data.contentTip && ((0, jsx_runtime_1.jsx)(antd_1.Alert, { type: "info", message: t('tips.content'), closable: true, onClose: function () { return method.clearContentTip(); } })), (0, jsx_runtime_1.jsx)(editor_for_react_1.Editor, { defaultConfig: {
|
||||
// TS 语法
|
||||
placeholder: t('placeholder.content'),
|
||||
MENU_CONF: {
|
||||
// fontSize: {
|
||||
// fontSizeList: [
|
||||
// '12px',
|
||||
// '16px',
|
||||
// '24px',
|
||||
// '40px',
|
||||
// ],
|
||||
// },
|
||||
checkImage: customCheckImageFn,
|
||||
uploadImage: {
|
||||
// 自定义上传
|
||||
customUpload: function (file, insertFn) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var name, size, type, extension, filename, extraFile, _a, url, bucket, err_1;
|
||||
return tslib_1.__generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
name = file.name, size = file.size, type = file.type;
|
||||
extension = name.substring(name.lastIndexOf('.') +
|
||||
1);
|
||||
filename = name.substring(0, name.lastIndexOf('.'));
|
||||
extraFile = {
|
||||
extra1: file,
|
||||
origin: origin,
|
||||
type: 'image',
|
||||
tag1: 'source',
|
||||
objectId: (0, uuid_1.generateNewId)(),
|
||||
filename: filename,
|
||||
size: size,
|
||||
extension: extension,
|
||||
bucket: '',
|
||||
id: (0, uuid_1.generateNewId)(),
|
||||
};
|
||||
_b.label = 1;
|
||||
case 1:
|
||||
_b.trys.push([1, 4, , 5]);
|
||||
return [4 /*yield*/, uploadFile(extraFile)];
|
||||
case 2:
|
||||
_a = _b.sent(), url = _a.url, bucket = _a.bucket;
|
||||
extraFile.bucket = bucket;
|
||||
extraFile.extra1 = null;
|
||||
return [4 /*yield*/, addExtraFile(extraFile)];
|
||||
case 3:
|
||||
_b.sent();
|
||||
// 最后插入图片
|
||||
insertFn('http://' + url, extraFile.filename);
|
||||
return [3 /*break*/, 5];
|
||||
case 4:
|
||||
err_1 = _b.sent();
|
||||
return [3 /*break*/, 5];
|
||||
case 5: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
uploadVideo: {
|
||||
// 自定义上传
|
||||
customUpload: function (file, insertFn) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var name, size, type, extension, filename, extraFile, _a, url, bucket, err_2;
|
||||
return tslib_1.__generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
name = file.name, size = file.size, type = file.type;
|
||||
extension = name.substring(name.lastIndexOf('.') +
|
||||
1);
|
||||
filename = name.substring(0, name.lastIndexOf('.'));
|
||||
extraFile = {
|
||||
extra1: file,
|
||||
origin: origin,
|
||||
type: 'video',
|
||||
tag1: 'source',
|
||||
objectId: (0, uuid_1.generateNewId)(),
|
||||
filename: filename,
|
||||
size: size,
|
||||
extension: extension,
|
||||
bucket: '',
|
||||
id: (0, uuid_1.generateNewId)(),
|
||||
};
|
||||
_b.label = 1;
|
||||
case 1:
|
||||
_b.trys.push([1, 4, , 5]);
|
||||
return [4 /*yield*/, uploadFile(extraFile)];
|
||||
case 2:
|
||||
_a = _b.sent(), url = _a.url, bucket = _a.bucket;
|
||||
extraFile.bucket = bucket;
|
||||
extraFile.extra1 = null;
|
||||
return [4 /*yield*/, addExtraFile(extraFile)];
|
||||
case 3:
|
||||
_b.sent();
|
||||
// 最后插入图片
|
||||
insertFn('http://' + url, 'http://' +
|
||||
url +
|
||||
'?vframe/jpg/offset/0');
|
||||
return [3 /*break*/, 5];
|
||||
case 4:
|
||||
err_2 = _b.sent();
|
||||
return [3 /*break*/, 5];
|
||||
case 5: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
}, value: data.content, onCreated: setEditor, onChange: function (editor) {
|
||||
setHtml(editor.getHtml());
|
||||
}, mode: "default", style: {
|
||||
minHeight: '520px',
|
||||
overflowY: 'hidden',
|
||||
} }), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.abstract }, { children: (0, jsx_runtime_1.jsx)(antd_1.Card, tslib_1.__assign({ title: "\u5C01\u9762\u53CA\u6458\u8981", bordered: false, className: web_module_less_1.default.card }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Row, { children: [(0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ flex: "none" }, { children: (0, jsx_runtime_1.jsx)(gallery_1.default, { maxNumber: 1, oakPath: oakFullpath
|
||||
? "".concat(oakFullpath, ".extraFile$entity")
|
||||
: undefined, type: "image", origin: "qiniu", tag1: "cover", entity: "article" }) })), (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ flex: "auto" }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input.TextArea, { autoSize: {
|
||||
minRows: 4,
|
||||
}, maxLength: 120, placeholder: t('placeholder.abstract'), onChange: function (e) {
|
||||
return update({
|
||||
abstract: e.target.value,
|
||||
var t = method.t, setEditor = method.setEditor, check = method.check, preview = method.preview, addExtraFile = method.addExtraFile, uploadFile = method.uploadFile, update = method.update, setHtml = method.setHtml, onRemoveArticle = method.onRemoveArticle, gotoPreview = method.gotoPreview;
|
||||
var id = data.id, content = data.content, editor = data.editor, origin1 = data.origin1, oakFullpath = data.oakFullpath, html = data.html;
|
||||
var features = (0, useFeatures_1.default)();
|
||||
var _a = tslib_1.__read((0, react_1.useState)(""), 2), articleId = _a[0], setArticleId = _a[1];
|
||||
(0, react_1.useEffect)(function () {
|
||||
if (id) {
|
||||
setArticleId(id);
|
||||
}
|
||||
}, [id]);
|
||||
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ showBack: true, title: "\u6DFB\u52A0\u6587\u7AE0" }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Affix, tslib_1.__assign({ offsetTop: 64 }, { children: (0, jsx_runtime_1.jsx)(editor_for_react_1.Toolbar, { editor: editor, defaultConfig: toolbarConfig, mode: "default" }) })), (0, jsx_runtime_1.jsxs)(antd_1.Row, { children: [(0, jsx_runtime_1.jsx)(antd_1.Col, { flex: 4 }), (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ flex: 16 }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.content }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.editorContainer }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.titleContainer }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (e) { return update({ name: e.target.value }); }, value: data.name, placeholder: "请输入文章标题", size: "large", maxLength: 64, suffix: "".concat(tslib_1.__spreadArray([], tslib_1.__read((data.name || "")), false).length, "/64"), className: web_module_less_1.default.titleInput }) })), data.contentTip && ((0, jsx_runtime_1.jsx)(antd_1.Alert, { type: "info", message: t("tips.content"), closable: true, onClose: function () { return method.clearContentTip(); } })), (0, jsx_runtime_1.jsx)(editor_for_react_1.Editor, { defaultConfig: {
|
||||
placeholder: "请输入文章内容...",
|
||||
MENU_CONF: {
|
||||
checkImage: customCheckImageFn,
|
||||
uploadImage: {
|
||||
// 自定义上传
|
||||
customUpload: function (file, insertFn) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var name, size, type, extension, filename, extraFile, _a, url, bucket, err_1;
|
||||
return tslib_1.__generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
name = file.name, size = file.size, type = file.type;
|
||||
extension = name.substring(name.lastIndexOf(".") + 1);
|
||||
filename = name.substring(0, name.lastIndexOf("."));
|
||||
extraFile = {
|
||||
entity: "article",
|
||||
entityId: articleId,
|
||||
extra1: file,
|
||||
origin: origin1,
|
||||
type: "image",
|
||||
tag1: "source",
|
||||
objectId: (0, uuid_1.generateNewId)(),
|
||||
filename: filename,
|
||||
size: size,
|
||||
extension: extension,
|
||||
bucket: "",
|
||||
id: (0, uuid_1.generateNewId)(),
|
||||
};
|
||||
_b.label = 1;
|
||||
case 1:
|
||||
_b.trys.push([1, 4, , 5]);
|
||||
return [4 /*yield*/, features.extraFile.upload(extraFile)];
|
||||
case 2:
|
||||
_a = _b.sent(), url = _a.url, bucket = _a.bucket;
|
||||
extraFile.bucket = bucket;
|
||||
extraFile.extra1 = null;
|
||||
return [4 /*yield*/, addExtraFile(extraFile)];
|
||||
case 3:
|
||||
_b.sent();
|
||||
// 最后插入图片
|
||||
insertFn("http://" + url, extraFile.filename);
|
||||
return [3 /*break*/, 5];
|
||||
case 4:
|
||||
err_1 = _b.sent();
|
||||
console.log(err_1);
|
||||
return [3 /*break*/, 5];
|
||||
case 5: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}, value: data.abstract || '' }) }))] }) })) })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.footer }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Row, tslib_1.__assign({ align: "middle" }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ flex: "auto" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.contentNumber }, { children: (0, jsx_runtime_1.jsx)("span", { children: "\u6B63\u6587\u5B57\u6570 0" }) })) })), (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ flex: "none" }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {
|
||||
confirm();
|
||||
} }, { children: "\u4FDD\u5B58" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () {
|
||||
preview();
|
||||
} }, { children: "\u9884\u89C8" }))] }) }))] })) }))] })) })) })), (0, jsx_runtime_1.jsx)(antd_1.Col, { flex: 4 })] })] })));
|
||||
});
|
||||
},
|
||||
},
|
||||
uploadVideo: {
|
||||
// 自定义上传
|
||||
customUpload: function (file, insertFn) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var name, size, type, extension, filename, extraFile, _a, url, bucket, err_2;
|
||||
return tslib_1.__generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
name = file.name, size = file.size, type = file.type;
|
||||
extension = name.substring(name.lastIndexOf(".") + 1);
|
||||
filename = name.substring(0, name.lastIndexOf("."));
|
||||
extraFile = {
|
||||
entity: "article",
|
||||
entityId: articleId,
|
||||
extra1: file,
|
||||
origin: origin1,
|
||||
type: "video",
|
||||
tag1: "source",
|
||||
objectId: (0, uuid_1.generateNewId)(),
|
||||
filename: filename,
|
||||
size: size,
|
||||
extension: extension,
|
||||
bucket: "",
|
||||
id: (0, uuid_1.generateNewId)(),
|
||||
};
|
||||
_b.label = 1;
|
||||
case 1:
|
||||
_b.trys.push([1, 4, , 5]);
|
||||
return [4 /*yield*/, features.extraFile.upload(extraFile)];
|
||||
case 2:
|
||||
_a = _b.sent(), url = _a.url, bucket = _a.bucket;
|
||||
extraFile.bucket = bucket;
|
||||
extraFile.extra1 = null;
|
||||
return [4 /*yield*/, addExtraFile(extraFile)];
|
||||
case 3:
|
||||
_b.sent();
|
||||
// 最后插入图片
|
||||
insertFn("http://" + url, "http://" + url + "?vframe/jpg/offset/0");
|
||||
return [3 /*break*/, 5];
|
||||
case 4:
|
||||
err_2 = _b.sent();
|
||||
return [3 /*break*/, 5];
|
||||
case 5: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
}, value: html, onCreated: setEditor, onChange: function (editorDom) {
|
||||
setHtml(editorDom.getHtml());
|
||||
}, style: {
|
||||
minHeight: 440,
|
||||
}, mode: "default" }), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.footer }, { children: (0, jsx_runtime_1.jsx)(antd_1.Row, tslib_1.__assign({ align: "middle" }, { children: (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ flex: "none" }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {
|
||||
check();
|
||||
} }, { children: "\u4FDD\u5B58" })), (0, jsx_runtime_1.jsxs)(antd_1.Button, tslib_1.__assign({ onClick: function () {
|
||||
gotoPreview(content, data.name);
|
||||
} }, { children: [(0, jsx_runtime_1.jsx)(icons_1.EyeOutlined, {}), "\u9884\u89C8"] }))] }) })) })) }))] })) })) })), (0, jsx_runtime_1.jsx)(antd_1.Col, { flex: 4 })] })] })) })));
|
||||
}
|
||||
exports.default = Render;
|
||||
|
|
|
|||
|
|
@ -1,73 +1,74 @@
|
|||
.container {
|
||||
background-color: var(--oak-bg-color-page);
|
||||
// padding: 30px 32px;
|
||||
background-color: var(--oak-bg-color-page);
|
||||
// padding: 30px 32px;
|
||||
}
|
||||
|
||||
|
||||
.content {
|
||||
background-color: var(--oak-bg-color-page);
|
||||
// height: calc(100% - 40px);
|
||||
//overflow-y: auto;
|
||||
position: relative;
|
||||
background-color: var(--oak-bg-color-page);
|
||||
// height: calc(100% - 40px);
|
||||
//overflow-y: auto;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.editorContainer {
|
||||
width: 850px;
|
||||
margin: 30px auto 50px auto;
|
||||
background: var(--oak-bg-color-container);
|
||||
padding: 20px 50px 50px 50px;
|
||||
box-shadow: 0 2px 10px rgb(0 0 0 / 12%);
|
||||
width: 850px;
|
||||
margin: 30px auto 50px auto;
|
||||
background: var(--oak-bg-color-container);
|
||||
padding: 20px 60px 50px 60px;
|
||||
box-shadow: 0 2px 10px rgb(0 0 0 / 12%);
|
||||
}
|
||||
|
||||
.titleContainer {
|
||||
padding: 5px 0;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
padding: 5px 0;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
}
|
||||
|
||||
.authorContainer {
|
||||
padding: 5px 0;
|
||||
//border-bottom: 1px solid #e8e8e8;
|
||||
padding: 5px 0;
|
||||
//border-bottom: 1px solid #e8e8e8;
|
||||
}
|
||||
|
||||
.input {
|
||||
border: unset !important;
|
||||
box-shadow: none !important;
|
||||
border: unset !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.titleInput {
|
||||
border: unset !important;
|
||||
box-shadow: none !important;
|
||||
font-size: 18px !important;
|
||||
font-weight: bold !important;
|
||||
border: unset !important;
|
||||
box-shadow: none !important;
|
||||
font-size: 18px !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.input:hover {
|
||||
border: unset !important;
|
||||
border: unset !important;
|
||||
}
|
||||
|
||||
.abstract {
|
||||
width: 100%;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
width: 100%;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
}
|
||||
|
||||
.card {
|
||||
:global {
|
||||
.ant-card-head {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
:global {
|
||||
.ant-card-head {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
// position: absolute;
|
||||
bottom: 0;
|
||||
height: 50px;
|
||||
// position: absolute;
|
||||
bottom: 0;
|
||||
height: 50px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.contentNumber {
|
||||
display: flex;
|
||||
min-height: 32px;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
color: var(--oak-text-color-secondary);
|
||||
display: flex;
|
||||
min-height: 32px;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
color: var(--oak-text-color-secondary);
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
/// <reference types="react" />
|
||||
import { EntityDict } from '../../../general-app-domain';
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "articleMenu", true, {
|
||||
entity: string;
|
||||
entityId: string;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
@ -0,0 +1,362 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
exports.default = OakComponent({
|
||||
entity: 'articleMenu',
|
||||
projection: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
parent: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
},
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
article$articleMenu: {
|
||||
$entity: 'article',
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenuId: 1,
|
||||
}
|
||||
},
|
||||
extraFile$entity: {
|
||||
$entity: 'extraFile',
|
||||
data: {
|
||||
id: 1,
|
||||
tag1: 1,
|
||||
origin: 1,
|
||||
bucket: 1,
|
||||
objectId: 1,
|
||||
filename: 1,
|
||||
extra1: 1,
|
||||
extension: 1,
|
||||
type: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
},
|
||||
filter: {
|
||||
tag1: {
|
||||
$in: ['logo', 'introduce'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
sorters: [
|
||||
{
|
||||
sorter: {
|
||||
$attr: {
|
||||
$$createAt$$: 1,
|
||||
},
|
||||
$direction: 'asc',
|
||||
},
|
||||
},
|
||||
],
|
||||
isList: true,
|
||||
pagination: {
|
||||
currentPage: 1,
|
||||
pageSize: 200,
|
||||
more: true,
|
||||
},
|
||||
formData: function (_a) {
|
||||
var _this = this;
|
||||
var rows = _a.data;
|
||||
var articleMenus = this.getArticleMenus();
|
||||
var treeData = articleMenus === null || articleMenus === void 0 ? void 0 : articleMenus.map(function (articleMenu) {
|
||||
var _a, _b;
|
||||
return {
|
||||
label: articleMenu.name,
|
||||
key: (_a = articleMenu.id) === null || _a === void 0 ? void 0 : _a.toString(),
|
||||
isArticle: articleMenu.isArticle,
|
||||
logo: _this.features.extraFile.getUrl((_b = articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.extraFile$entity) === null || _b === void 0 ? void 0 : _b.find(function (ele) { return ele.tag1 === 'logo'; })),
|
||||
parentKey: articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.parentId,
|
||||
children: _this.buildTreeData(articleMenu.id, articleMenu.isArticle),
|
||||
};
|
||||
});
|
||||
return {
|
||||
treeData: treeData,
|
||||
};
|
||||
},
|
||||
filters: [],
|
||||
lifetimes: {},
|
||||
data: {
|
||||
selectArticleMenuId: '',
|
||||
selectArticleId: '',
|
||||
treeData: [],
|
||||
},
|
||||
properties: {
|
||||
entity: '',
|
||||
entityId: '',
|
||||
},
|
||||
actions: ['create', 'update', 'remove'],
|
||||
methods: {
|
||||
getArticleMenus: function (parentId) {
|
||||
var articleMenus = this.features.cache.get('articleMenu', {
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
parent: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
},
|
||||
article$articleMenu: {
|
||||
$entity: 'article',
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenuId: 1,
|
||||
}
|
||||
},
|
||||
extraFile$entity: {
|
||||
$entity: 'extraFile',
|
||||
data: {
|
||||
id: 1,
|
||||
tag1: 1,
|
||||
origin: 1,
|
||||
bucket: 1,
|
||||
objectId: 1,
|
||||
filename: 1,
|
||||
extra1: 1,
|
||||
extension: 1,
|
||||
type: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
},
|
||||
filter: {
|
||||
tag1: {
|
||||
$in: ['logo', 'introduce'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
filter: {
|
||||
parentId: parentId ? parentId : {
|
||||
$exists: false
|
||||
}
|
||||
},
|
||||
sorter: [
|
||||
{
|
||||
$attr: {
|
||||
$$createAt$$: 1,
|
||||
},
|
||||
$direction: 'asc',
|
||||
},
|
||||
],
|
||||
});
|
||||
return articleMenus;
|
||||
},
|
||||
loadArticleMenus: function (parentId) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var articleMenus;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, this.features.cache.refresh('articleMenu', {
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
parent: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
},
|
||||
article$articleMenu: {
|
||||
$entity: 'article',
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenuId: 1,
|
||||
}
|
||||
},
|
||||
extraFile$entity: {
|
||||
$entity: 'extraFile',
|
||||
data: {
|
||||
id: 1,
|
||||
tag1: 1,
|
||||
origin: 1,
|
||||
bucket: 1,
|
||||
objectId: 1,
|
||||
filename: 1,
|
||||
extra1: 1,
|
||||
extension: 1,
|
||||
type: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
},
|
||||
filter: {
|
||||
tag1: {
|
||||
$in: ['logo', 'introduce'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
filter: {
|
||||
parentId: parentId ? parentId : {
|
||||
$exists: false
|
||||
}
|
||||
},
|
||||
sorter: [
|
||||
{
|
||||
$attr: {
|
||||
$$createAt$$: 1,
|
||||
},
|
||||
$direction: 'asc',
|
||||
},
|
||||
],
|
||||
})];
|
||||
case 1:
|
||||
articleMenus = _a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
getArticles: function (articleMenuId) {
|
||||
var articleMenus = this.features.cache.get('article', {
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenuId: 1,
|
||||
},
|
||||
filter: {
|
||||
articleMenuId: articleMenuId
|
||||
},
|
||||
sorter: [
|
||||
{
|
||||
$attr: {
|
||||
$$createAt$$: 1,
|
||||
},
|
||||
$direction: 'asc',
|
||||
},
|
||||
],
|
||||
});
|
||||
return articleMenus;
|
||||
},
|
||||
loadArticles: function (articleMenuId) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var articles;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, this.features.cache.refresh('article', {
|
||||
data: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
content: 1,
|
||||
articleMenuId: 1,
|
||||
},
|
||||
filter: {
|
||||
articleMenuId: articleMenuId
|
||||
},
|
||||
sorter: [
|
||||
{
|
||||
$attr: {
|
||||
$$createAt$$: 1,
|
||||
},
|
||||
$direction: 'asc',
|
||||
},
|
||||
],
|
||||
})];
|
||||
case 1:
|
||||
articles = _a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
buildTreeData: function (parentId, isArticle) {
|
||||
var _this = this;
|
||||
var children = [];
|
||||
if (isArticle) {
|
||||
var articles = this.getArticles(parentId);
|
||||
children = articles === null || articles === void 0 ? void 0 : articles.map(function (article) {
|
||||
return {
|
||||
label: article.name,
|
||||
key: article.id,
|
||||
type: 'article'
|
||||
};
|
||||
});
|
||||
}
|
||||
else {
|
||||
var articleMenus = this.getArticleMenus(parentId);
|
||||
children = articleMenus === null || articleMenus === void 0 ? void 0 : articleMenus.map(function (articleMenu) {
|
||||
var _a, _b;
|
||||
return {
|
||||
label: articleMenu.name,
|
||||
key: (_a = articleMenu.id) === null || _a === void 0 ? void 0 : _a.toString(),
|
||||
isArticle: articleMenu.isArticle,
|
||||
logo: _this.features.extraFile.getUrl((_b = articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.extraFile$entity) === null || _b === void 0 ? void 0 : _b.find(function (ele) { return ele.tag1 === 'logo'; })),
|
||||
parentKey: articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.parentId,
|
||||
children: _this.buildTreeData(articleMenu.id, articleMenu.isArticle),
|
||||
};
|
||||
});
|
||||
}
|
||||
return children;
|
||||
},
|
||||
gotoUpsertById: function (id) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
this.setState({
|
||||
selectArticleMenuId: id,
|
||||
selectArticleId: '',
|
||||
});
|
||||
return [2 /*return*/];
|
||||
});
|
||||
});
|
||||
},
|
||||
gotoArticleUpsert: function (articleId) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
this.setState({
|
||||
selectArticleId: articleId,
|
||||
selectArticleMenuId: '',
|
||||
});
|
||||
return [2 /*return*/];
|
||||
});
|
||||
});
|
||||
},
|
||||
gotoEdit: function (id) {
|
||||
if (id) {
|
||||
this.navigateTo({
|
||||
url: '/articleMenu/upsert',
|
||||
oakId: id,
|
||||
});
|
||||
}
|
||||
else {
|
||||
var _a = this.props, entity = _a.entity, entityId = _a.entityId;
|
||||
this.navigateTo({
|
||||
url: '/articleMenu/upsert',
|
||||
entity: entity,
|
||||
entityId: entityId,
|
||||
});
|
||||
}
|
||||
},
|
||||
onRemoveArticleMenu: function (id) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
this.removeItem(id);
|
||||
return [4 /*yield*/, this.execute()];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
import { WebComponentProps } from "oak-frontend-base";
|
||||
import { EntityDict } from "../../../general-app-domain";
|
||||
interface DataNode {
|
||||
label: string;
|
||||
title: string;
|
||||
key: string;
|
||||
isArticle?: boolean;
|
||||
children?: DataNode[];
|
||||
}
|
||||
export default function render(props: WebComponentProps<EntityDict, 'articleMenu', true, {
|
||||
treeData: DataNode[];
|
||||
selectArticleMenuId: string;
|
||||
selectArticleId: string;
|
||||
entity: string;
|
||||
entityId: string;
|
||||
}, {
|
||||
gotoUpsertById: (id: string) => void;
|
||||
gotoArticleUpsert: (articleId: string) => void;
|
||||
gotoEdit: (id?: string) => void;
|
||||
loadArticles: (articleMenuId: string) => void;
|
||||
}>): JSX.Element;
|
||||
export {};
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var antd_1 = require("antd");
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
var pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader"));
|
||||
var detail_1 = tslib_1.__importDefault(require("../../../components/article/detail"));
|
||||
var cell_1 = tslib_1.__importDefault(require("../../../components/articleMenu/cell"));
|
||||
function render(props) {
|
||||
var _a = props.data, entity = _a.entity, entityId = _a.entityId, treeData = _a.treeData, selectArticleMenuId = _a.selectArticleMenuId, selectArticleId = _a.selectArticleId;
|
||||
var _b = props.methods, t = _b.t, gotoUpsertById = _b.gotoUpsertById, gotoArticleUpsert = _b.gotoArticleUpsert, gotoEdit = _b.gotoEdit, loadArticles = _b.loadArticles;
|
||||
var renderMenuItems = function (data) {
|
||||
return data === null || data === void 0 ? void 0 : data.map(function (menuItem) {
|
||||
if (menuItem.children) {
|
||||
return ((0, jsx_runtime_1.jsx)(antd_1.Menu.SubMenu, tslib_1.__assign({ icon: menuItem.logo ? ((0, jsx_runtime_1.jsx)(antd_1.Image, { height: 26, width: 26, src: menuItem.logo, preview: false })) : null, title: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { marginLeft: 8 } }, { children: menuItem.label })), onTitleClick: function (e) {
|
||||
if (menuItem.isArticle) {
|
||||
loadArticles(e.key);
|
||||
}
|
||||
gotoUpsertById(e.key);
|
||||
} }, { children: renderMenuItems(menuItem.children) }), menuItem.key));
|
||||
}
|
||||
return ((0, jsx_runtime_1.jsx)(antd_1.Menu.Item, tslib_1.__assign({ onClick: function (e) {
|
||||
if (menuItem.type === 'article') {
|
||||
gotoArticleUpsert(e.key);
|
||||
}
|
||||
else {
|
||||
gotoUpsertById(e.key);
|
||||
}
|
||||
} }, { children: menuItem.label }), menuItem.key));
|
||||
});
|
||||
};
|
||||
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ title: "\u5206\u7C7B\u7BA1\u7406" }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Space, tslib_1.__assign({ style: { marginBottom: 16 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {
|
||||
gotoEdit();
|
||||
} }, { children: "\u65B0\u589E" })) })), (treeData === null || treeData === void 0 ? void 0 : treeData.length) === 0 ? ((0, jsx_runtime_1.jsx)(antd_1.Empty, { image: antd_1.Empty.PRESENTED_IMAGE_SIMPLE })) : ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.rightContent }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.article }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.menu }, { children: (0, jsx_runtime_1.jsx)(antd_1.Menu, tslib_1.__assign({ style: { width: 256 }, mode: "inline" }, { children: renderMenuItems(treeData) })) })), (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.editor }, { children: [selectArticleMenuId ? ((0, jsx_runtime_1.jsx)(cell_1.default, { oakAutoUnmount: true, oakId: selectArticleMenuId, oakPath: "$articleMenu-cell-".concat(selectArticleMenuId), entity: entity, entityId: entityId })) : null, selectArticleId ? ((0, jsx_runtime_1.jsx)(detail_1.default, { oakAutoUnmount: true, oakId: selectArticleId, oakPath: "$article-detail-".concat(selectArticleId) })) : null] }))] })) })))] })) })));
|
||||
}
|
||||
exports.default = render;
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
.container {
|
||||
background: var(--oak-bg-color-container);
|
||||
box-shadow: 0 2px 3px #0000001a;
|
||||
border-radius: 3px;
|
||||
padding: 30px 32px;
|
||||
.rightContent {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.article {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex: 1;
|
||||
|
||||
.menu {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.editor {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
margin-left: 20px;
|
||||
|
||||
.rightContainer {
|
||||
// width: 950px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
.pagination {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
.space {
|
||||
margin-bottom: 15px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.tree {
|
||||
:global {
|
||||
.ant-tree-title {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
/// <reference types="react" />
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../general-app-domain").EntityDict, "articleMenu", false, {
|
||||
entity: string;
|
||||
entityId: string;
|
||||
parentId: string;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
exports.default = OakComponent({
|
||||
entity: 'articleMenu',
|
||||
projection: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
isArticle: 1,
|
||||
isLeaf: 1,
|
||||
parent: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
},
|
||||
extraFile$entity: {
|
||||
$entity: 'extraFile',
|
||||
data: {
|
||||
id: 1,
|
||||
tag1: 1,
|
||||
origin: 1,
|
||||
bucket: 1,
|
||||
objectId: 1,
|
||||
filename: 1,
|
||||
extra1: 1,
|
||||
extension: 1,
|
||||
type: 1,
|
||||
entity: 1,
|
||||
},
|
||||
filter: {
|
||||
tag1: {
|
||||
$in: ['logo'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
isList: false,
|
||||
formData: function (_a) {
|
||||
var _b, _c;
|
||||
var articleMenu = _a.data;
|
||||
return {
|
||||
name: articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.name,
|
||||
parentId: (_b = articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.parent) === null || _b === void 0 ? void 0 : _b.id,
|
||||
parentName: (_c = articleMenu === null || articleMenu === void 0 ? void 0 : articleMenu.parent) === null || _c === void 0 ? void 0 : _c.name,
|
||||
};
|
||||
},
|
||||
filters: [],
|
||||
properties: {
|
||||
entity: '',
|
||||
entityId: '',
|
||||
parentId: '',
|
||||
},
|
||||
lifetimes: {
|
||||
ready: function () {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var _a, parentId, oakId, entity, entityId;
|
||||
return tslib_1.__generator(this, function (_b) {
|
||||
_a = this.props, parentId = _a.parentId, oakId = _a.oakId, entity = _a.entity, entityId = _a.entityId;
|
||||
if (!oakId) {
|
||||
if (parentId) {
|
||||
this.update({
|
||||
parentId: parentId,
|
||||
entity: entity,
|
||||
entityId: entityId,
|
||||
isArticle: false,
|
||||
isLeaf: false,
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.update({
|
||||
entity: entity,
|
||||
entityId: entityId,
|
||||
isArticle: false,
|
||||
isLeaf: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
return [2 /*return*/];
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
confirm: function () {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
if (!this.state.name) {
|
||||
this.setMessage({
|
||||
type: 'error',
|
||||
content: '请输入文章分类名称',
|
||||
});
|
||||
return [2 /*return*/];
|
||||
}
|
||||
return [4 /*yield*/, this.execute()];
|
||||
case 1:
|
||||
_a.sent();
|
||||
this.navigateBack();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
reset: function () {
|
||||
this.clean();
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { WebComponentProps } from "oak-frontend-base";
|
||||
import { EntityDict } from "../../../general-app-domain";
|
||||
export default function render(props: WebComponentProps<EntityDict, "articleMenu", false, {
|
||||
name: string;
|
||||
parentId: string;
|
||||
parentName: string;
|
||||
}, {
|
||||
confirm: () => void;
|
||||
reset: () => void;
|
||||
}>): JSX.Element;
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var antd_1 = require("antd");
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
var pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader"));
|
||||
var common_module_less_1 = tslib_1.__importDefault(require("@project/config/styles/web/common.module.less"));
|
||||
var classnames_1 = tslib_1.__importDefault(require("classnames"));
|
||||
var gallery_1 = tslib_1.__importDefault(require("../../../components/extraFile/gallery"));
|
||||
function render(props) {
|
||||
var data = props.data, methods = props.methods;
|
||||
var t = methods.t, update = methods.update, reset = methods.reset, confirm = methods.confirm;
|
||||
var name = data.name, parentId = data.parentId, parentName = data.parentName, oakFullpath = data.oakFullpath;
|
||||
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ showBack: true, title: "\u6DFB\u52A0\u6587\u7AE0\u5206\u7C7B" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: (0, classnames_1.default)(common_module_less_1.default.pageWithPadding, common_module_less_1.default.pageWithColor) }, { children: (0, jsx_runtime_1.jsx)(antd_1.Row, { children: (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ xs: 24, sm: 16 }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 4 }, wrapperCol: { span: 20 } }, { children: [parentId ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t("articleMenu:attr.parent"), name: "parent" }, { children: (0, jsx_runtime_1.jsx)(antd_1.Tooltip, { children: parentName }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "分类名称", name: "name", rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "分类名称必填",
|
||||
},
|
||||
] }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165\u5206\u7C7B\u540D\u79F0", onChange: function (e) {
|
||||
update({
|
||||
name: e.target.value,
|
||||
});
|
||||
}, value: name }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "LOGO", name: "extraFile$entity", help: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.help }, { children: [(0, jsx_runtime_1.jsx)("span", { children: "\u8BF7\u4E0A\u4F20LOGO\u9AD8\u6E05\u56FE\u7247\uFF0C" }), (0, jsx_runtime_1.jsx)("span", { children: "108*108\u50CF\u7D20\uFF0C\u4EC5\u652F\u6301PNG\u3001JPG\u683C\u5F0F\uFF0C\u5927\u5C0F\u4E0D\u8D85\u8FC7300KB\u3002" })] })) }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(gallery_1.default, { oakPath: oakFullpath
|
||||
? "".concat(oakFullpath, ".extraFile$entity$1")
|
||||
: undefined, type: "image", origin: "qiniu", tag1: "logo", entity: "articleMenu", accept: ".PNG, .JPG", maxNumber: 1 }) }) }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "分类名称", name: "name", rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "分类名称必填",
|
||||
},
|
||||
] }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165\u5206\u7C7B\u540D\u79F0", onChange: function (e) {
|
||||
update({
|
||||
name: e.target.value,
|
||||
});
|
||||
}, value: name }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "LOGO", name: "extraFile$entity", help: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.help }, { children: [(0, jsx_runtime_1.jsx)("span", { children: "\u8BF7\u4E0A\u4F20LOGO\u9AD8\u6E05\u56FE\u7247\uFF0C" }), (0, jsx_runtime_1.jsx)("span", { children: "108*108\u50CF\u7D20\uFF0C\u4EC5\u652F\u6301PNG\u3001JPG\u683C\u5F0F\uFF0C\u5927\u5C0F\u4E0D\u8D85\u8FC7300KB\u3002" })] })) }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(gallery_1.default, { oakPath: oakFullpath
|
||||
? "".concat(oakFullpath, ".extraFile$entity$1")
|
||||
: undefined, type: "image", origin: "qiniu", tag1: "logo", entity: "articleMenu", accept: ".PNG, .JPG", maxNumber: 1 }) }) }))] })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 4 } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {
|
||||
confirm();
|
||||
} }, { children: "\u63D0\u4EA4" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () {
|
||||
reset();
|
||||
} }, { children: "\u91CD\u7F6E" }))] }) }))] })) })) }) })) })));
|
||||
}
|
||||
exports.default = render;
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
.container {
|
||||
background: var(--oak-bg-color-container);
|
||||
box-shadow: 0 2px 3px #0000001a;
|
||||
border-radius: 3px;
|
||||
padding: 30px 32px;
|
||||
}
|
||||
|
||||
.help {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
/// <reference types="react" />
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../general-app-domain").EntityDict, "article", false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
exports.default = OakComponent({
|
||||
entity: 'article',
|
||||
projection: {
|
||||
id: 1,
|
||||
// iState: 1,
|
||||
// title: 1,
|
||||
// author: 1,
|
||||
// abstract: 1,
|
||||
content: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
},
|
||||
isList: false,
|
||||
formData: function (_a) {
|
||||
var article = _a.data, features = _a.features;
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_b) {
|
||||
return [2 /*return*/, {
|
||||
id: article === null || article === void 0 ? void 0 : article.id,
|
||||
// iState: article?.iState,
|
||||
// title: article?.title,
|
||||
// abstract: article?.abstract,
|
||||
// author: article?.author,
|
||||
content: article === null || article === void 0 ? void 0 : article.content,
|
||||
}];
|
||||
});
|
||||
});
|
||||
},
|
||||
listeners: {
|
||||
content: function (prev, next) {
|
||||
if (prev.content !== next.content) {
|
||||
var ac = window.document.getElementById('article-content');
|
||||
if (ac) {
|
||||
ac.innerHTML = next.content;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
import { EntityDict } from './../../../general-app-domain';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
export default function render(props: WebComponentProps<EntityDict, 'article', false, {
|
||||
title?: string;
|
||||
author?: string;
|
||||
abstract?: string;
|
||||
content?: string;
|
||||
html?: string;
|
||||
}, {}>): JSX.Element;
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
function render(props) {
|
||||
var methods = props.methods, data = props.data;
|
||||
var t = methods.t;
|
||||
var title = data.title, author = data.author, abstract = data.abstract, content = data.content;
|
||||
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.content }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.editorContainer }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.titleContainer }, { children: (0, jsx_runtime_1.jsx)("span", tslib_1.__assign({ className: web_module_less_1.default.title }, { children: title })) })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.authorContainer }, { children: (0, jsx_runtime_1.jsx)("span", tslib_1.__assign({ className: web_module_less_1.default.author }, { children: author })) })), (0, jsx_runtime_1.jsx)("div", { id: "article-content" })] })) })) })));
|
||||
}
|
||||
exports.default = render;
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
.container {
|
||||
background-color: var(--oak-bg-color-page);
|
||||
// padding: 30px 32px;
|
||||
}
|
||||
|
||||
|
||||
.content {
|
||||
background-color: var(--oak-bg-color-page);
|
||||
position: relative;
|
||||
width: 100%
|
||||
}
|
||||
|
||||
.editorContainer {
|
||||
// width: 100%;
|
||||
margin: 30px auto 50px auto;
|
||||
background: var(--oak-bg-color-container);
|
||||
padding: 20px 50px 50px 50px;
|
||||
box-shadow: 0 2px 10px rgb(0 0 0 / 12%);
|
||||
}
|
||||
|
||||
.titleContainer {
|
||||
padding: 5px 0 10px 0;
|
||||
}
|
||||
|
||||
.authorContainer {
|
||||
padding: 5px 0 10px 0;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 18px !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.author {
|
||||
color: var(--oak-text-color-brand);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.abstract {
|
||||
width: 100%;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
/// <reference types="react" />
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../general-app-domain").EntityDict, "article", true, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
exports.default = OakComponent({
|
||||
entity: 'article',
|
||||
projection: {
|
||||
id: 1,
|
||||
iState: 1,
|
||||
title: 1,
|
||||
author: 1,
|
||||
abstract: 1,
|
||||
content: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
},
|
||||
isList: true,
|
||||
formData: function (_a) {
|
||||
var articles = _a.data, features = _a.features;
|
||||
var filter = this.getFilterByName('title');
|
||||
var pagination = this.getPagination();
|
||||
return {
|
||||
articles: articles === null || articles === void 0 ? void 0 : articles.map(function (article, index) {
|
||||
return {
|
||||
id: article === null || article === void 0 ? void 0 : article.id,
|
||||
// iState: article?.iState,
|
||||
// title: article?.title,
|
||||
// abstract: article?.abstract,
|
||||
// author: article?.author,
|
||||
content: article === null || article === void 0 ? void 0 : article.content,
|
||||
// entity: article?.entity,
|
||||
// entityId: article?.entityId,
|
||||
};
|
||||
}),
|
||||
pagination: pagination,
|
||||
// searchValue: (filter?.title as { $includes: string })?.$includes,
|
||||
};
|
||||
},
|
||||
filters: [
|
||||
// 由调用者注入oakFilter
|
||||
// {
|
||||
// filter() {
|
||||
// const { entityId, entity } = this.props;
|
||||
// return {
|
||||
// entityId,
|
||||
// entity,
|
||||
// };
|
||||
// },
|
||||
// },
|
||||
],
|
||||
// sorters: [],
|
||||
methods: {
|
||||
goUpsert: function () {
|
||||
var _a = this.props, entityId = _a.entityId, entity = _a.entity;
|
||||
this.navigateTo({
|
||||
url: '/article/upsert',
|
||||
entityId: entityId,
|
||||
entity: entity,
|
||||
});
|
||||
},
|
||||
goUpsertById: function (id) {
|
||||
this.navigateTo({
|
||||
url: '/article/upsert',
|
||||
oakId: id,
|
||||
});
|
||||
},
|
||||
goDetailById: function (id) {
|
||||
this.navigateTo({
|
||||
url: '/article/detail',
|
||||
oakId: id,
|
||||
});
|
||||
},
|
||||
onRemove: function (id) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, this.addOperation({
|
||||
action: 'remove',
|
||||
data: {},
|
||||
filter: {
|
||||
id: id,
|
||||
},
|
||||
})];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [4 /*yield*/, this.execute()];
|
||||
case 2:
|
||||
_a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
searchChange: function (event) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var value;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
value = this.resolveInput(event).value;
|
||||
this.searchValueChange(value);
|
||||
return [2 /*return*/];
|
||||
});
|
||||
});
|
||||
},
|
||||
searchValueChange: function (value) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
return [2 /*return*/];
|
||||
});
|
||||
});
|
||||
},
|
||||
searchCancel: function () {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
this.removeNamedFilterByName('title');
|
||||
return [2 /*return*/];
|
||||
});
|
||||
});
|
||||
},
|
||||
searchConfirm: function () {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
this.refresh();
|
||||
return [2 /*return*/];
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue