diff --git a/lib/aspects/AspectDict.d.ts b/lib/aspects/AspectDict.d.ts index 77fd4771e..436acbde5 100644 --- a/lib/aspects/AspectDict.d.ts +++ b/lib/aspects/AspectDict.d.ts @@ -44,6 +44,11 @@ declare type GeneralAspectDict Promise; + updateApplicationConfig: (params: { + entity: 'application'; + entityId: string; + config: EntityDict['application']['Schema']['config']; + }, context: Cxt) => Promise; }; export declare type AspectDict> = GeneralAspectDict; export {}; diff --git a/lib/aspects/config.d.ts b/lib/aspects/config.d.ts index 8cf2822a1..8c4c993a8 100644 --- a/lib/aspects/config.d.ts +++ b/lib/aspects/config.d.ts @@ -6,3 +6,8 @@ export declare function updateConfig; +export declare function updateApplicationConfig>(params: { + entity: 'application'; + entityId: string; + config: EntityDict['application']['Schema']['config']; +}, context: Cxt): Promise; diff --git a/lib/aspects/config.js b/lib/aspects/config.js index 309863772..6d05f41b1 100644 --- a/lib/aspects/config.js +++ b/lib/aspects/config.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.updateConfig = void 0; +exports.updateApplicationConfig = exports.updateConfig = void 0; var tslib_1 = require("tslib"); var uuid_1 = require("oak-domain/lib/utils/uuid"); function updateConfig(params, context) { @@ -28,3 +28,28 @@ function updateConfig(params, context) { }); } exports.updateConfig = updateConfig; +function updateApplicationConfig(params, context) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var entity, entityId, config; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: + entity = params.entity, entityId = params.entityId, config = params.config; + return [4 /*yield*/, context.operate(entity, { + id: (0, uuid_1.generateNewId)(), + action: 'update', + data: { + config: config, + }, + filter: { + id: entityId, + }, + }, {})]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }); +} +exports.updateApplicationConfig = updateApplicationConfig; diff --git a/lib/aspects/index.d.ts b/lib/aspects/index.d.ts index 3060b2856..0792c2feb 100644 --- a/lib/aspects/index.d.ts +++ b/lib/aspects/index.d.ts @@ -1,7 +1,7 @@ import { loginByMobile, loginWechat, loginWechatMp, syncUserInfoWechatMp, sendCaptcha } from './token'; import { getUploadInfo } from './extraFile'; import { getApplication } from './application'; -import { updateConfig } from './config'; +import { updateConfig, updateApplicationConfig } from './config'; export declare const aspectDict: { loginByMobile: typeof loginByMobile; loginWechat: typeof loginWechat; @@ -11,4 +11,5 @@ export declare const aspectDict: { sendCaptcha: typeof sendCaptcha; getApplication: typeof getApplication; updateConfig: typeof updateConfig; + updateApplicationConfig: typeof updateApplicationConfig; }; diff --git a/lib/aspects/index.js b/lib/aspects/index.js index 22643d992..48812e998 100644 --- a/lib/aspects/index.js +++ b/lib/aspects/index.js @@ -5,7 +5,6 @@ var token_1 = require("./token"); var extraFile_1 = require("./extraFile"); var application_1 = require("./application"); var config_1 = require("./config"); -// import commonAspectDict from 'oak-common-aspect'; exports.aspectDict = { loginByMobile: token_1.loginByMobile, loginWechat: token_1.loginWechat, @@ -15,5 +14,5 @@ exports.aspectDict = { sendCaptcha: token_1.sendCaptcha, getApplication: application_1.getApplication, updateConfig: config_1.updateConfig, + updateApplicationConfig: config_1.updateApplicationConfig, }; -// export type AspectDict = TokenAD & CrudAD; diff --git a/lib/components/common/empty/empty.d.ts b/lib/components/common/empty/empty.d.ts index a67bcf109..5ad33b8bc 100644 --- a/lib/components/common/empty/empty.d.ts +++ b/lib/components/common/empty/empty.d.ts @@ -1,4 +1,3 @@ -/// import './index.less'; declare const Empty: () => JSX.Element; export default Empty; diff --git a/lib/components/common/empty/simple.d.ts b/lib/components/common/empty/simple.d.ts index a67bcf109..5ad33b8bc 100644 --- a/lib/components/common/empty/simple.d.ts +++ b/lib/components/common/empty/simple.d.ts @@ -1,4 +1,3 @@ -/// import './index.less'; declare const Empty: () => JSX.Element; export default Empty; diff --git a/lib/components/common/weChatLoginQrCode/index.d.ts b/lib/components/common/weChatLoginQrCode/index.d.ts index 54e2e93ee..261b368ef 100644 --- a/lib/components/common/weChatLoginQrCode/index.d.ts +++ b/lib/components/common/weChatLoginQrCode/index.d.ts @@ -1,4 +1,3 @@ -/// import './index.less'; interface QrCodeProps { id?: string; diff --git a/lib/components/config/application/index.js b/lib/components/config/application/index.js index bfedc9a63..54497f070 100644 --- a/lib/components/config/application/index.js +++ b/lib/components/config/application/index.js @@ -77,7 +77,7 @@ exports.default = OakComponent({ case 0: currentConfig = this.state.currentConfig; _a = this.props, entity = _a.entity, entityId = _a.entityId; - return [4 /*yield*/, this.features.config.updateConfig(entity, entityId, currentConfig)]; + return [4 /*yield*/, this.features.config.updateApplicationConfig(entity, entityId, currentConfig)]; case 1: _b.sent(); this.setMessage({ diff --git a/lib/components/config/application/web.pc.d.ts b/lib/components/config/application/web.pc.d.ts index 0dd74c034..caa53b0c0 100644 --- a/lib/components/config/application/web.pc.d.ts +++ b/lib/components/config/application/web.pc.d.ts @@ -1,4 +1,3 @@ -/// import { AppType, WebConfig, WechatPublicConfig, WechatMpConfig } from '../../../general-app-domain/Application/Schema'; import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; @@ -9,6 +8,7 @@ export default function render(props: WebComponentProps void; updateConfig: () => void; diff --git a/lib/components/config/application/web.pc.js b/lib/components/config/application/web.pc.js index 2fde580a4..257d24522 100644 --- a/lib/components/config/application/web.pc.js +++ b/lib/components/config/application/web.pc.js @@ -8,7 +8,7 @@ var index_1 = tslib_1.__importDefault(require("./web/index")); var index_2 = tslib_1.__importDefault(require("./wechatMp/index")); var index_3 = tslib_1.__importDefault(require("./wechatPublic/index")); function AppView(props) { - var type = props.type, config = props.config, setValue = props.setValue, removeItem = props.removeItem, cleanKey = props.cleanKey; + var type = props.type, config = props.config, setValue = props.setValue, removeItem = props.removeItem, cleanKey = props.cleanKey, isService = props.isService; if (type === 'web') { return ((0, jsx_runtime_1.jsx)(index_1.default, { config: config || {}, setValue: function (path, value) { return setValue(path, value); }, removeItem: function (path, index) { return removeItem(path, index); }, cleanKey: function (path, key) { return cleanKey(path, key); } })); } @@ -16,20 +16,20 @@ function AppView(props) { return ((0, jsx_runtime_1.jsx)(index_2.default, { config: config || {}, setValue: function (path, value) { return setValue(path, value); }, removeItem: function (path, index) { return removeItem(path, index); }, cleanKey: function (path, key) { return cleanKey(path, key); } })); } if (type === 'wechatPublic') { - return ((0, jsx_runtime_1.jsx)(index_3.default, { config: config || {}, setValue: function (path, value) { return setValue(path, value); }, removeItem: function (path, index) { return removeItem(path, index); }, cleanKey: function (path, key) { return cleanKey(path, key); } })); + return ((0, jsx_runtime_1.jsx)(index_3.default, { isService: isService, config: config || {}, setValue: function (path, value) { return setValue(path, value); }, removeItem: function (path, index) { return removeItem(path, index); }, cleanKey: function (path, key) { return cleanKey(path, key); } })); } return null; } function render(props) { - var _a = props.data, entity = _a.entity, name = _a.name, type = _a.type, currentConfig = _a.currentConfig, dirty = _a.dirty; - var _b = props.methods, resetConfig = _b.resetConfig, updateConfig = _b.updateConfig, setValue = _b.setValue, removeItem = _b.removeItem, cleanKey = _b.cleanKey; + var _a = props.data, entity = _a.entity, name = _a.name, type = _a.type, currentConfig = _a.currentConfig, dirty = _a.dirty, _b = _a.isService, isService = _b === void 0 ? true : _b; + var _c = props.methods, resetConfig = _c.resetConfig, updateConfig = _c.updateConfig, setValue = _c.setValue, removeItem = _c.removeItem, cleanKey = _c.cleanKey; return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Affix, tslib_1.__assign({ offsetTop: 64 }, { children: (0, jsx_runtime_1.jsx)(antd_1.Alert, { message: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("text", { children: ["\u60A8\u6B63\u5728\u66F4\u65B0", (0, jsx_runtime_1.jsx)(antd_1.Typography.Text, tslib_1.__assign({ keyboard: true, className: web_module_less_1.default.weight }, { children: entity })), "\u5BF9\u8C61", (0, jsx_runtime_1.jsx)(antd_1.Typography.Text, tslib_1.__assign({ keyboard: true, className: web_module_less_1.default.weight }, { children: name })), "\u7684\u914D\u7F6E\uFF0C\u8BF7\u8C28\u614E\u64CD\u4F5C"] }) }), type: "info", showIcon: true, action: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ disabled: !dirty, type: "primary", danger: true, onClick: function () { return resetConfig(); }, style: { marginRight: 10, } }, { children: "\u91CD\u7F6E" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ disabled: !dirty, type: "primary", onClick: function () { return updateConfig(); } }, { children: "\u786E\u5B9A" }))] }) }) })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)(antd_1.Tabs, { tabPosition: "left", items: [ { key: '参数设置', label: '参数设置', - children: ((0, jsx_runtime_1.jsx)(AppView, { type: type, config: currentConfig || {}, setValue: function (path, value) { + children: ((0, jsx_runtime_1.jsx)(AppView, { isService: isService, type: type, config: currentConfig || {}, setValue: function (path, value) { return setValue(path, value); }, removeItem: function (path, index) { return removeItem(path, index); diff --git a/lib/components/config/application/web/index.d.ts b/lib/components/config/application/web/index.d.ts index 90b02d1c5..b7f7da3d0 100644 --- a/lib/components/config/application/web/index.d.ts +++ b/lib/components/config/application/web/index.d.ts @@ -1,4 +1,3 @@ -/// import { WebConfig } from '../../../../general-app-domain/Application/Schema'; export default function Web(props: { config: WebConfig; diff --git a/lib/components/config/application/wechatMp/index.d.ts b/lib/components/config/application/wechatMp/index.d.ts index e70206643..cad38df4f 100644 --- a/lib/components/config/application/wechatMp/index.d.ts +++ b/lib/components/config/application/wechatMp/index.d.ts @@ -1,4 +1,3 @@ -/// import { WechatMpConfig } from '../../../../general-app-domain/Application/Schema'; export default function WechatMp(props: { config: WechatMpConfig; diff --git a/lib/components/config/application/wechatPublic/index.d.ts b/lib/components/config/application/wechatPublic/index.d.ts index c9c21655c..10f5a622e 100644 --- a/lib/components/config/application/wechatPublic/index.d.ts +++ b/lib/components/config/application/wechatPublic/index.d.ts @@ -1,6 +1,6 @@ -/// import { WechatPublicConfig } from '../../../../general-app-domain/Application/Schema'; export default function WechatPublic(props: { + isService?: boolean; config: WechatPublicConfig; setValue: (path: string, value: any) => void; removeItem: (path: string, index: number) => void; diff --git a/lib/components/config/application/wechatPublic/index.js b/lib/components/config/application/wechatPublic/index.js index 44fbc0beb..940374e56 100644 --- a/lib/components/config/application/wechatPublic/index.js +++ b/lib/components/config/application/wechatPublic/index.js @@ -8,7 +8,7 @@ var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); function WechatPublic(props) { var _a = tslib_1.__read((0, react_1.useState)(false), 2), open = _a[0], setModal = _a[1]; var _b = tslib_1.__read((0, react_1.useState)(''), 2), messageType = _b[0], setMessageType = _b[1]; - var config = props.config, setValue = props.setValue, cleanKey = props.cleanKey, removeItem = props.removeItem; + var config = props.config, setValue = props.setValue, cleanKey = props.cleanKey, removeItem = props.removeItem, _c = props.isService, isService = _c === void 0 ? true : _c; var templateMsgs = (config === null || config === void 0 ? void 0 : config.templateMsgs) || {}; return ((0, jsx_runtime_1.jsxs)(antd_1.Space, tslib_1.__assign({ direction: "vertical", size: "middle", style: { display: 'flex' } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Row, { children: (0, jsx_runtime_1.jsx)(antd_1.Card, tslib_1.__assign({ className: web_module_less_1.default.tips }, { children: "\u6BCF\u79CD\u5747\u53EF\u914D\u7F6E\u4E00\u4E2A\uFF0C\u76F8\u5E94\u7684\u670D\u52A1\u6240\u4F7F\u7528\u7684\u5E10\u53F7\u8BF7\u51C6\u786E\u5BF9\u5E94" })) }), (0, jsx_runtime_1.jsxs)(antd_1.Col, tslib_1.__assign({ flex: "auto" }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Divider, tslib_1.__assign({ orientation: "left", className: web_module_less_1.default.title }, { children: "\u5FAE\u4FE1\u516C\u4F17\u53F7-\u57FA\u7840" })), (0, jsx_runtime_1.jsx)(antd_1.Tabs, { tabPosition: 'top', size: 'middle', type: "card", items: [ { @@ -18,11 +18,11 @@ function WechatPublic(props) { return setValue("appId", e.target.value); } }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "appSecret", name: "appSecret" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165appSecret", type: "text", value: config === null || config === void 0 ? void 0 : config.appSecret, onChange: function (e) { return setValue("appSecret", e.target.value); - } }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u662F\u5426\u4E3A\u670D\u52A1\u53F7", name: "isService" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Switch, { checkedChildren: "\u662F", unCheckedChildren: "\u5426", checked: config === null || config === void 0 ? void 0 : config.isService, onChange: function (checked) { + } }) }) })), isService && ((0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u662F\u5426\u4E3A\u670D\u52A1\u53F7", name: "isService" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Switch, { checkedChildren: "\u662F", unCheckedChildren: "\u5426", checked: config === null || config === void 0 ? void 0 : config.isService, onChange: function (checked) { return setValue("isService", checked); - } }) }) }))] }))), + } }) }) })))] }))), }, - ] })] })), (0, jsx_runtime_1.jsxs)(antd_1.Col, tslib_1.__assign({ flex: "auto" }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Divider, tslib_1.__assign({ orientation: "left", className: web_module_less_1.default.title }, { children: "\u5FAE\u4FE1\u516C\u4F17\u53F7-\u6A21\u7248" })), (0, jsx_runtime_1.jsx)(antd_1.Tabs, { tabPosition: 'top', size: 'middle', type: "editable-card", + ] })] })), isService && ((0, jsx_runtime_1.jsxs)(antd_1.Col, tslib_1.__assign({ flex: "auto" }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Divider, tslib_1.__assign({ orientation: "left", className: web_module_less_1.default.title }, { children: "\u5FAE\u4FE1\u516C\u4F17\u53F7-\u6A21\u7248" })), (0, jsx_runtime_1.jsx)(antd_1.Tabs, { tabPosition: 'top', size: 'middle', type: "editable-card", // hideAdd={!(Object.keys(templateMsgs).length > 0)} onEdit: function (targetKey, action) { if (action === 'add') { @@ -38,7 +38,8 @@ function WechatPublic(props) { key: "".concat(name), label: "".concat(name), children: ((0, jsx_runtime_1.jsx)(antd_1.Form, tslib_1.__assign({ colon: true, labelAlign: "left", layout: "vertical", style: { marginTop: 10 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "templateId", name: "templateId" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165templateId", type: "text", value: templateId, onChange: function (e) { - return setValue("templateMsgs.".concat(name), e.target.value); + return setValue("templateMsgs.".concat(name), e.target + .value); } }) }) })) }))), }; }) @@ -63,6 +64,6 @@ function WechatPublic(props) { setMessageType(''); }, open: open, cancelText: "\u53D6\u6D88", okText: "\u786E\u5B9A", destroyOnClose: true }, { children: (0, jsx_runtime_1.jsx)(antd_1.Form, tslib_1.__assign({ colon: true, labelAlign: "left", layout: "vertical", style: { marginTop: 10 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u6807\u7B7E\u540D\u79F0", name: "messageType", help: "\u53EA\u80FD\u8F93\u5165\u82F1\u6587\u548C\u4E2D\u6587" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165\u6807\u7B7E\u540D\u79F0", type: "text", value: messageType, onChange: function (e) { return setMessageType(e.target.value.replace(/[0-9-.]/g, '')); - } }) }) })) })) }))] }))] }))); + } }) }) })) })) }))] })))] }))); } exports.default = WechatPublic; diff --git a/lib/components/config/style/index.d.ts b/lib/components/config/style/index.d.ts new file mode 100644 index 000000000..2469d4262 --- /dev/null +++ b/lib/components/config/style/index.d.ts @@ -0,0 +1,7 @@ +import { Style as StyleType } from '../../../types/Style'; +declare type StyleProps = { + value?: StyleType | null; + onChange: (value: StyleType) => void; +}; +export default function Render(props: StyleProps): JSX.Element; +export {}; diff --git a/lib/components/config/style/index.js b/lib/components/config/style/index.js new file mode 100644 index 000000000..8d855d03f --- /dev/null +++ b/lib/components/config/style/index.js @@ -0,0 +1,42 @@ +"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 lodash_1 = require("oak-domain/lib/utils/lodash"); +var Colors = ['primary', 'success', 'error', 'warning', 'info']; +function Color(props) { + var _a = props.value, value = _a === void 0 ? {} : _a, setValue = props.setValue; + ; + return ((0, jsx_runtime_1.jsx)(antd_1.Form, { children: Colors.map(function (ele) { return ((0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: ele, requiredMark: true, name: "folder", tooltip: "\u8BBE\u7F6E\u7CFB\u7EDF\u3010".concat(ele, "\u3011\u989C\u8272"), rules: [ + { + required: true, + }, + ] }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (e) { + setValue(ele, e.target.value); + }, value: (0, lodash_1.get)(value, ele) }) }) }), ele)); }) })); +} +function Render(props) { + var styleValue = props.value, onChange = props.onChange; + var setStyle = function (path, value) { + var newStyle = (0, lodash_1.set)(styleValue || {}, path, value); + onChange(newStyle); + }; + return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(antd_1.Tabs, { onChange: function () { }, type: "card", items: [ + { + label: '颜色', + key: 'color', + component: Color, + }, + ].map(function (ele, i) { + var ItemComponent = ele.component; + return { + label: ele.label, + key: ele.key, + children: ((0, jsx_runtime_1.jsx)(ItemComponent, { value: (0, lodash_1.get)(styleValue, ele.key), setValue: function (path, value) { + setStyle("".concat(ele.key, ".").concat(path), value); + } })), + }; + }) }) })); +} +exports.default = Render; diff --git a/lib/components/config/style/index.module.less b/lib/components/config/style/index.module.less new file mode 100644 index 000000000..7c0f8675f --- /dev/null +++ b/lib/components/config/style/index.module.less @@ -0,0 +1,5 @@ + + +.box { + display: block; +} \ No newline at end of file diff --git a/lib/components/config/upsert/account/index.d.ts b/lib/components/config/upsert/account/index.d.ts index ed8ae19c5..d12966ca5 100644 --- a/lib/components/config/upsert/account/index.d.ts +++ b/lib/components/config/upsert/account/index.d.ts @@ -1,4 +1,3 @@ -/// import { Config } from '../../../../types/Config'; export default function Account(props: { account: Required['Account']; diff --git a/lib/components/config/upsert/cos/index.d.ts b/lib/components/config/upsert/cos/index.d.ts index 1be008bf7..e597fb133 100644 --- a/lib/components/config/upsert/cos/index.d.ts +++ b/lib/components/config/upsert/cos/index.d.ts @@ -1,4 +1,3 @@ -/// import { Config } from '../../../../types/Config'; export default function Cos(props: { cos: Required['Cos']; diff --git a/lib/components/config/upsert/live/index.d.ts b/lib/components/config/upsert/live/index.d.ts index 35e0ce993..e6e06424f 100644 --- a/lib/components/config/upsert/live/index.d.ts +++ b/lib/components/config/upsert/live/index.d.ts @@ -1,4 +1,3 @@ -/// import { Config } from '../../../../types/Config'; export default function Cos(props: { live: Required['Live']; diff --git a/lib/components/config/upsert/map/index.d.ts b/lib/components/config/upsert/map/index.d.ts index 7b865bc39..84db02c1b 100644 --- a/lib/components/config/upsert/map/index.d.ts +++ b/lib/components/config/upsert/map/index.d.ts @@ -1,4 +1,3 @@ -/// import { Config } from '../../../../types/Config'; export default function Cos(props: { map: Required['Map']; diff --git a/lib/components/config/upsert/web.pc.d.ts b/lib/components/config/upsert/web.pc.d.ts index 55df3262a..529956e31 100644 --- a/lib/components/config/upsert/web.pc.d.ts +++ b/lib/components/config/upsert/web.pc.d.ts @@ -1,4 +1,3 @@ -/// import { Config } from '../../../types/Config'; import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; diff --git a/lib/components/extraFile/display/web.d.ts b/lib/components/extraFile/display/web.d.ts index 5eaeadcc2..cfaabf286 100644 --- a/lib/components/extraFile/display/web.d.ts +++ b/lib/components/extraFile/display/web.d.ts @@ -1,2 +1 @@ -/// export default function render(): JSX.Element; diff --git a/lib/components/extraFile/gallery/index.json b/lib/components/extraFile/gallery/index.json index aff4724a6..94c8fb3a5 100644 --- a/lib/components/extraFile/gallery/index.json +++ b/lib/components/extraFile/gallery/index.json @@ -1,7 +1,7 @@ { "component": true, "usingComponents": { - "t-icon": "../../../miniprogram_npm/tdesign/icon/icon" + "l-icon": "../../../miniprogram_npm/lin-ui/icon/index" }, "componentGenerics": { "item": true diff --git a/lib/components/extraFile/gallery/index.xml b/lib/components/extraFile/gallery/index.xml index 205a2decf..02ba6827f 100644 --- a/lib/components/extraFile/gallery/index.xml +++ b/lib/components/extraFile/gallery/index.xml @@ -14,7 +14,7 @@ - + \ No newline at end of file diff --git a/lib/components/extraFile/gallery/web.d.ts b/lib/components/extraFile/gallery/web.d.ts index e0125b1e0..99a59a462 100644 --- a/lib/components/extraFile/gallery/web.d.ts +++ b/lib/components/extraFile/gallery/web.d.ts @@ -1,4 +1,3 @@ -/// import { UploadFile } from 'antd'; import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../general-app-domain'; diff --git a/lib/components/func/actionPanel/web.d.ts b/lib/components/func/actionPanel/web.d.ts index bdf44b412..2ae338d31 100644 --- a/lib/components/func/actionPanel/web.d.ts +++ b/lib/components/func/actionPanel/web.d.ts @@ -1,4 +1,3 @@ -/// import { WebComponentProps } from "oak-frontend-base"; import { EntityDict } from "../../../general-app-domain"; export default function Render(props: WebComponentProps import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../general-app-domain'; export default function render(props: WebComponentProps import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../general-app-domain'; import './web.less'; diff --git a/lib/components/message/cell/index.d.ts b/lib/components/message/cell/index.d.ts new file mode 100644 index 000000000..42765aac1 --- /dev/null +++ b/lib/components/message/cell/index.d.ts @@ -0,0 +1,3 @@ +/// +declare const _default: import("react").ComponentType; +export default _default; diff --git a/lib/components/message/cell/index.js b/lib/components/message/cell/index.js new file mode 100644 index 000000000..f484b5152 --- /dev/null +++ b/lib/components/message/cell/index.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = OakComponent({ + isList: false, + entity: 'message', + projection: { + id: 1, + $$createAt$$: 1, + type: 1, + title: 1, + content: 1, + visitState: 1, + userId: 1, + user: { + id: 1, + name: 1, + }, + params: 1, + props: 1, + }, + formData: function (_a) { + var message = _a.data, features = _a.features, props = _a.props; + return message || {}; + }, + methods: {}, + actions: ['visit'], +}); diff --git a/lib/components/message/cell/web.d.ts b/lib/components/message/cell/web.d.ts new file mode 100644 index 000000000..cd388ec18 --- /dev/null +++ b/lib/components/message/cell/web.d.ts @@ -0,0 +1,14 @@ +import { WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../general-app-domain'; +export default function Render(props: WebComponentProps void; + $$createAt$$: number; + type: string; + title: string; + params: EntityDict['message']['Schema']['params']; + visitState: EntityDict['message']['Schema']['visitState']; + id: string; +}, {}>): JSX.Element; diff --git a/lib/components/message/cell/web.js b/lib/components/message/cell/web.js new file mode 100644 index 000000000..48993f5c0 --- /dev/null +++ b/lib/components/message/cell/web.js @@ -0,0 +1,33 @@ +"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 dayjs_1 = tslib_1.__importDefault(require("dayjs")); +var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); +var MessageType = { + adminNotification: '系统通知', + conversationMessage: '客服消息', +}; +// success、 processing、error、default、warning +var MessageTypeToColor = { + adminNotification: 'processing', + conversationMessage: 'warning', +}; +function Render(props) { + var data = props.data, methods = props.methods; + var id = data.id, params = data.params, title = data.title, type = data.type, $$createAt$$ = data.$$createAt$$, visitState = data.visitState, _a = data.oakLegalActions, oakLegalActions = _a === void 0 ? [] : _a, onItemClicked = data.onItemClicked; + var navigateTo = methods.navigateTo, execute = methods.execute; + return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.list, onClick: onItemClicked + ? function () { + onItemClicked({ + id: id, + params: params, + }); + } + : undefined }, { children: [(0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.list__notify }, { children: [visitState === 'unvisited' && ((0, jsx_runtime_1.jsx)(antd_1.Badge, { style: { marginRight: 5 }, status: "processing" })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.notify_deadline }, { children: title })), oakLegalActions.includes('visit') && ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.notify_mask, onClick: function (event) { + execute('visit', false); + event.stopPropagation(); + } }, { children: "\u6807\u8BB0\u5DF2\u8BFB" })))] })), (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.list__info }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.tags }, { children: (0, jsx_runtime_1.jsx)(antd_1.Tag, tslib_1.__assign({ color: MessageTypeToColor[type] }, { children: MessageType[type] })) })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.create_time }, { children: (0, dayjs_1.default)($$createAt$$).format('YYYY-MM-DD HH:mm:ss') }))] }))] }))); +} +exports.default = Render; diff --git a/lib/components/message/cell/web.module.less b/lib/components/message/cell/web.module.less new file mode 100644 index 000000000..8e3a0e282 --- /dev/null +++ b/lib/components/message/cell/web.module.less @@ -0,0 +1,46 @@ +.list { + padding: 10px 20px 10px 31px; + border-bottom: 1px solid #ddd; + cursor: pointer; + position: relative; +} + +.list__notify { + margin-bottom: 5px; + display: flex; + flex-direction: row; + justify-content: space-between; + + .notify_mask { + // display: none; + color: var(--oak-color-primary); + flex-grow: 0; + flex-shrink: 0; + white-space: nowrap; + font-size: 12px; + } + + .notify_deadline { + color: #000; + font-weight: 600; + line-height: 20px; + flex: 1 1 auto; + min-width: 20px; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + } +} + +.list__info { + display: flex; + flex-direction: row; + justify-content: space-between; + + + .create_time { + color: rgba(0, 0, 0, .4); + line-height: 20px; + font-size: 12px; + } +} \ No newline at end of file diff --git a/lib/components/message/cellButton/index.d.ts b/lib/components/message/cellButton/index.d.ts new file mode 100644 index 000000000..42765aac1 --- /dev/null +++ b/lib/components/message/cellButton/index.d.ts @@ -0,0 +1,3 @@ +/// +declare const _default: import("react").ComponentType; +export default _default; diff --git a/lib/components/message/cellButton/index.js b/lib/components/message/cellButton/index.js new file mode 100644 index 000000000..0b552b395 --- /dev/null +++ b/lib/components/message/cellButton/index.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +exports.default = OakComponent({ + entity: 'message', + isList: false, + formData: function (_a) { + var data = _a.data; + return {}; + }, + actions: ['visit'], + methods: { + tapAction: function (action) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var id; + return tslib_1.__generator(this, function (_a) { + id = this.props.oakId; + switch (action) { + case 'visit': { + this.execute('visit', false); + break; + } + default: { + break; + } + } + return [2 /*return*/]; + }); + }); + }, + }, +}); diff --git a/lib/components/message/cellButton/web.d.ts b/lib/components/message/cellButton/web.d.ts new file mode 100644 index 000000000..416690e8d --- /dev/null +++ b/lib/components/message/cellButton/web.d.ts @@ -0,0 +1,5 @@ +import { WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../general-app-domain'; +export default function Render(props: WebComponentProps void; +}>): JSX.Element[] | null; diff --git a/lib/components/message/cellButton/web.js b/lib/components/message/cellButton/web.js new file mode 100644 index 000000000..110bfedfa --- /dev/null +++ b/lib/components/message/cellButton/web.js @@ -0,0 +1,29 @@ +"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"); +function Render(props) { + var data = props.data, methods = props.methods; + var t = methods.t, tapAction = methods.tapAction; + var oakLegalActions = data.oakLegalActions; + return oakLegalActions && (oakLegalActions === null || oakLegalActions === void 0 ? void 0 : oakLegalActions.length) > 0 + ? oakLegalActions.map(function (ele) { + return ((0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function (event) { + var modal = antd_1.Modal.confirm({ + title: "\u786E\u8BA4\u8BE5\u6D88\u606F\u6807\u4E3A\u5DF2\u8BFB\u5417\uFF1F", + okText: '确定', + cancelText: '取消', + onOk: function (e) { + tapAction(ele); + modal.destroy(); + }, + onCancel: function (e) { + modal.destroy(); + }, + }); + } }, { children: "\u6807\u4E3A\u5DF2\u8BFB" }))); + }) + : null; +} +exports.default = Render; diff --git a/lib/components/message/cellButton/web.module.less b/lib/components/message/cellButton/web.module.less new file mode 100644 index 000000000..e69de29bb diff --git a/lib/components/message/index.xml b/lib/components/message/index.xml index e523fe35b..f0536c57d 100644 --- a/lib/components/message/index.xml +++ b/lib/components/message/index.xml @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/lib/components/message/web.d.ts b/lib/components/message/web.d.ts index ee53e17bd..2ee2d0046 100644 --- a/lib/components/message/web.d.ts +++ b/lib/components/message/web.d.ts @@ -1,4 +1,3 @@ -/// import { MessageProps } from 'oak-frontend-base/lib/types/Message'; export default function render(props: { data: { diff --git a/lib/components/my/avatar/web.d.ts b/lib/components/my/avatar/web.d.ts index b6d4120e5..14968938d 100644 --- a/lib/components/my/avatar/web.d.ts +++ b/lib/components/my/avatar/web.d.ts @@ -1,4 +1,3 @@ -/// import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; import { AvatarSize } from 'antd/es/avatar/SizeContext'; diff --git a/lib/components/my/info/web.d.ts b/lib/components/my/info/web.d.ts index 7a0240a16..b5bc0e9c6 100644 --- a/lib/components/my/info/web.d.ts +++ b/lib/components/my/info/web.d.ts @@ -1,4 +1,3 @@ -/// import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../general-app-domain'; export default function Render(props: WebComponentProps import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../general-app-domain'; export default function Render(props: WebComponentProps +declare const _default: import("react").ComponentType; +export default _default; diff --git a/lib/components/my/message/index.js b/lib/components/my/message/index.js new file mode 100644 index 000000000..ca5aa503c --- /dev/null +++ b/lib/components/my/message/index.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +exports.default = OakComponent({ + isList: false, + lifetimes: { + attached: function () { + this.getMessageCount(); + }, + }, + data: { + count: undefined, + }, + methods: { + goMessageList: function () { + this.navigateTo({ + url: '/message/list', + }); + }, + getMessageCount: function () { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var userId, application, systemId, result; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: + userId = this.features.token.getUserId(true); + application = this.features.application.getApplication(); + systemId = application.systemId; + if (!userId) return [3 /*break*/, 2]; + return [4 /*yield*/, this.features.cache.count('message', { + data: { + id: 1, + }, + filter: { + userId: userId, + systemId: systemId, + visitState: 'unvisited', + }, + })]; + case 1: + result = _a.sent(); + this.setState({ + count: result, + }); + _a.label = 2; + case 2: return [2 /*return*/]; + } + }); + }); + }, + }, +}); diff --git a/lib/components/my/message/mobile.module.less b/lib/components/my/message/mobile.module.less new file mode 100644 index 000000000..9594d0233 --- /dev/null +++ b/lib/components/my/message/mobile.module.less @@ -0,0 +1,4 @@ + .icon { + font-size: 20px; + color: var(--oak-color-primary); + } \ No newline at end of file diff --git a/lib/components/my/message/web.d.ts b/lib/components/my/message/web.d.ts new file mode 100644 index 000000000..6be12245f --- /dev/null +++ b/lib/components/my/message/web.d.ts @@ -0,0 +1,7 @@ +import { WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../general-app-domain'; +export default function Render(props: WebComponentProps void; +}>): JSX.Element; diff --git a/lib/components/my/message/web.js b/lib/components/my/message/web.js new file mode 100644 index 000000000..13733ff45 --- /dev/null +++ b/lib/components/my/message/web.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var jsx_runtime_1 = require("react/jsx-runtime"); +var antd_mobile_1 = require("antd-mobile"); +var icons_1 = require("@ant-design/icons"); +var mobile_module_less_1 = tslib_1.__importDefault(require("./mobile.module.less")); +function Render(props) { + var data = props.data, methods = props.methods; + var count = data.count; + var goMessageList = methods.goMessageList; + return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_mobile_1.Badge, tslib_1.__assign({ content: count || '' }, { children: (0, jsx_runtime_1.jsx)(icons_1.BellOutlined, { className: mobile_module_less_1.default.icon, onClick: function () { + goMessageList(); + } }) })) })); +} +exports.default = Render; diff --git a/lib/components/my/message/web.module.less b/lib/components/my/message/web.module.less new file mode 100644 index 000000000..42071e75e --- /dev/null +++ b/lib/components/my/message/web.module.less @@ -0,0 +1,8 @@ +.btn { + padding-inline-start: 5px; + padding-inline-end: 5px; +} + +.icon { + font-size: 20px; +} \ No newline at end of file diff --git a/lib/components/my/message/web.pc.d.ts b/lib/components/my/message/web.pc.d.ts new file mode 100644 index 000000000..6be12245f --- /dev/null +++ b/lib/components/my/message/web.pc.d.ts @@ -0,0 +1,7 @@ +import { WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../general-app-domain'; +export default function Render(props: WebComponentProps void; +}>): JSX.Element; diff --git a/lib/components/my/message/web.pc.js b/lib/components/my/message/web.pc.js new file mode 100644 index 000000000..14f86f4e8 --- /dev/null +++ b/lib/components/my/message/web.pc.js @@ -0,0 +1,20 @@ +"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 icons_1 = require("@ant-design/icons"); +var drawerList_1 = tslib_1.__importDefault(require("../../../pages/message/drawerList")); +var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); +function Render(props) { + var data = props.data; + var count = data.count; + var _a = tslib_1.__read((0, react_1.useState)(false), 2), open = _a[0], setOpen = _a[1]; + return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Badge, tslib_1.__assign({ count: count }, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, { className: web_module_less_1.default.btn, type: "text", shape: "circle", icon: (0, jsx_runtime_1.jsx)(icons_1.BellOutlined, {}), onClick: function () { + setOpen(true); + } }) })), (0, jsx_runtime_1.jsx)(drawerList_1.default, { open: open, onClose: function () { + setOpen(false); + } })] })); +} +exports.default = Render; diff --git a/lib/components/userEntityGrant/cellButton/web.d.ts b/lib/components/userEntityGrant/cellButton/web.d.ts index bb58a50b0..4e2281385 100644 --- a/lib/components/userEntityGrant/cellButton/web.d.ts +++ b/lib/components/userEntityGrant/cellButton/web.d.ts @@ -1,4 +1,3 @@ -/// import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function Render(props: WebComponentProps; description: Text; config: WechatPublicConfig; + offset: Int<4>; } diff --git a/lib/entities/Subscription.js b/lib/entities/Subscription.js index 79a51660e..77d028e4c 100644 --- a/lib/entities/Subscription.js +++ b/lib/entities/Subscription.js @@ -31,6 +31,7 @@ var locale = { entityId: '对象Id', description: '描述', config: '配置', + offset: '已同步素材位置', }, }, }; diff --git a/lib/features/config.d.ts b/lib/features/config.d.ts index f3e1c4576..1f976a97d 100644 --- a/lib/features/config.d.ts +++ b/lib/features/config.d.ts @@ -10,4 +10,5 @@ export declare class Config>); updateConfig(entity: 'platform' | 'system', entityId: string, config: ConfigDef): Promise; + updateApplicationConfig(entity: 'application', entityId: string, config: EntityDict['application']['Schema']['config']): Promise; } diff --git a/lib/features/config.js b/lib/features/config.js index 54e9cc549..783dccf38 100644 --- a/lib/features/config.js +++ b/lib/features/config.js @@ -17,7 +17,24 @@ var Config = /** @class */ (function (_super) { case 0: return [4 /*yield*/, this.cache.exec('updateConfig', { entity: entity, entityId: entityId, - config: config + config: config, + })]; + case 1: + _a.sent(); + this.publish(); + return [2 /*return*/]; + } + }); + }); + }; + Config.prototype.updateApplicationConfig = function (entity, entityId, config) { + 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.cache.exec('updateApplicationConfig', { + entity: entity, + entityId: entityId, + config: config, })]; case 1: _a.sent(); diff --git a/lib/general-app-domain/Article/Schema.d.ts b/lib/general-app-domain/Article/Schema.d.ts index 52ee1fd3f..a1c622c21 100644 --- a/lib/general-app-domain/Article/Schema.d.ts +++ b/lib/general-app-domain/Article/Schema.d.ts @@ -12,6 +12,7 @@ export declare type OpSchema = EntityShape & { author: String<32>; abstract?: Text | null; content?: Text | null; + url?: Text | null; sign: String<32>; iState?: IState | null; }; @@ -23,6 +24,7 @@ export declare type Schema = EntityShape & { author: String<32>; abstract?: Text | null; content?: Text | null; + url?: Text | null; sign: String<32>; iState?: IState | null; extraFile$entity?: Array; @@ -40,6 +42,7 @@ declare type AttrFilter = { author: Q_StringValue; abstract: Q_StringValue; content: Q_StringValue; + url: Q_StringValue; sign: Q_StringValue; iState: Q_EnumValue; }; @@ -57,6 +60,7 @@ export declare type Projection = { author?: number; abstract?: number; content?: number; + url?: number; sign?: number; iState?: number; extraFile$entity?: ExtraFile.Selection & { @@ -76,6 +80,7 @@ export declare type ExportProjection = { author?: string; abstract?: string; content?: string; + url?: string; sign?: string; iState?: string; extraFile$entity?: ExtraFile.Exportation & { @@ -105,6 +110,8 @@ export declare type SortAttr = { abstract: number; } | { content: number; +} | { + url: number; } | { sign: number; } | { diff --git a/lib/general-app-domain/Article/Storage.js b/lib/general-app-domain/Article/Storage.js index a5f010a66..9f075b09d 100644 --- a/lib/general-app-domain/Article/Storage.js +++ b/lib/general-app-domain/Article/Storage.js @@ -34,6 +34,9 @@ exports.desc = { content: { type: "text" }, + url: { + type: "text" + }, sign: { type: "varchar", params: { diff --git a/lib/general-app-domain/Article/locales/zh_CN.json b/lib/general-app-domain/Article/locales/zh_CN.json index 0a56bdcea..55e0aca25 100644 --- a/lib/general-app-domain/Article/locales/zh_CN.json +++ b/lib/general-app-domain/Article/locales/zh_CN.json @@ -1 +1 @@ -{ "attr": { "title": "标题", "author": "作者", "abstract": "简介", "content": "正文", "files": "封面图", "iState": "状态", "entity": "关联对象", "entityId": "关联对象id", "sign": "唯一标志" }, "action": { "online": "上架", "offline": "下架", "disabled": "禁用" }, "v": { "iState": { "online": "已上架", "offline": "已下架", "disabled": "已禁用" } } } +{ "attr": { "title": "标题", "author": "作者", "abstract": "简介", "content": "正文", "files": "封面图", "iState": "状态", "url": "外部链接", "entity": "关联对象", "entityId": "关联对象id", "sign": "唯一标志" }, "action": { "online": "上架", "offline": "下架", "disabled": "禁用" }, "v": { "iState": { "online": "已上架", "offline": "已下架", "disabled": "已禁用" } } } diff --git a/lib/general-app-domain/EntityDict.d.ts b/lib/general-app-domain/EntityDict.d.ts index 440c346a5..a659656ae 100644 --- a/lib/general-app-domain/EntityDict.d.ts +++ b/lib/general-app-domain/EntityDict.d.ts @@ -18,6 +18,7 @@ import { EntityDef as Mobile } from "./Mobile/Schema"; import { EntityDef as Platform } from "./Platform/Schema"; import { EntityDef as UserRole } from "./UserRole/Schema"; import { EntityDef as Role } from "./Role/Schema"; +import { EntityDef as Subscription } from "./Subscription/Schema"; import { EntityDef as System } from "./System/Schema"; import { EntityDef as Token } from "./Token/Schema"; import { EntityDef as UserEntityGrant } from "./UserEntityGrant/Schema"; @@ -45,6 +46,7 @@ export declare type EntityDict = { platform: Platform; userRole: UserRole; role: Role; + subscription: Subscription; system: System; token: Token; userEntityGrant: UserEntityGrant; diff --git a/lib/general-app-domain/MessageSent/Schema.d.ts b/lib/general-app-domain/MessageSent/Schema.d.ts index 10e7b4ea2..f8768b0f9 100644 --- a/lib/general-app-domain/MessageSent/Schema.d.ts +++ b/lib/general-app-domain/MessageSent/Schema.d.ts @@ -6,7 +6,7 @@ import { FormCreateData, FormUpdateData, Operation as OakOperation, MakeAction a import { Action, ParticularAction, IState } from "./Action"; import * as Message from "../Message/Schema"; export declare type OpSchema = EntityShape & { - channel: 'public' | 'jPush' | 'jim' | 'mp' | 'gsm'; + channel: 'wechat' | 'jPush' | 'jim' | 'mp' | 'sms'; data: Object; messageId: ForeignKey<"message">; data1: Object; @@ -15,7 +15,7 @@ export declare type OpSchema = EntityShape & { }; export declare type OpAttr = keyof OpSchema; export declare type Schema = EntityShape & { - channel: 'public' | 'jPush' | 'jim' | 'mp' | 'gsm'; + channel: 'wechat' | 'jPush' | 'jim' | 'mp' | 'sms'; data: Object; messageId: ForeignKey<"message">; data1: Object; @@ -30,7 +30,7 @@ declare type AttrFilter = { $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; $$updateAt$$: Q_DateValue; - channel: Q_EnumValue<'public' | 'jPush' | 'jim' | 'mp' | 'gsm'>; + channel: Q_EnumValue<'wechat' | 'jPush' | 'jim' | 'mp' | 'sms'>; data: Object; messageId: Q_StringValue | SubQuery.MessageIdSubQuery; message: Message.Filter; diff --git a/lib/general-app-domain/MessageSent/locales/zh_CN.json b/lib/general-app-domain/MessageSent/locales/zh_CN.json index acb42b335..d4b3d5504 100644 --- a/lib/general-app-domain/MessageSent/locales/zh_CN.json +++ b/lib/general-app-domain/MessageSent/locales/zh_CN.json @@ -1 +1 @@ -{ "attr": { "channel": "消息渠道", "data": "消息数据", "message": "消息", "data1": "数据1", "data2": "数据2", "iState": "状态" }, "action": { "succeed": "成功", "fail": "失败" }, "v": { "iState": { "sending": "发送中", "success": "发送成功", "failure": "发送失败" }, "channel": { "public": "公众号", "jPush": "极光推送", "jim": "极光消息", "mp": "小程序", "gsm": "短信" } } } +{ "attr": { "channel": "消息渠道", "data": "消息数据", "message": "消息", "data1": "数据1", "data2": "数据2", "iState": "状态" }, "action": { "succeed": "成功", "fail": "失败" }, "v": { "iState": { "sending": "发送中", "success": "发送成功", "failure": "发送失败" }, "channel": { "wechat": "公众号", "jPush": "极光推送", "jim": "极光消息", "mp": "小程序", "sms": "短信" } } } diff --git a/lib/general-app-domain/Storage.js b/lib/general-app-domain/Storage.js index 6ac23f207..f5fd11d5c 100644 --- a/lib/general-app-domain/Storage.js +++ b/lib/general-app-domain/Storage.js @@ -21,12 +21,13 @@ var Storage_17 = require("./Mobile/Storage"); var Storage_18 = require("./Platform/Storage"); var Storage_19 = require("./UserRole/Storage"); var Storage_20 = require("./Role/Storage"); -var Storage_21 = require("./System/Storage"); -var Storage_22 = require("./Token/Storage"); -var Storage_23 = require("./UserEntityGrant/Storage"); -var Storage_24 = require("./UserSystem/Storage"); -var Storage_25 = require("./WechatQrCode/Storage"); -var Storage_26 = require("./WechatUser/Storage"); +var Storage_21 = require("./Subscription/Storage"); +var Storage_22 = require("./System/Storage"); +var Storage_23 = require("./Token/Storage"); +var Storage_24 = require("./UserEntityGrant/Storage"); +var Storage_25 = require("./UserSystem/Storage"); +var Storage_26 = require("./WechatQrCode/Storage"); +var Storage_27 = require("./WechatUser/Storage"); exports.storageSchema = { modi: Storage_1.desc, modiEntity: Storage_2.desc, @@ -48,10 +49,11 @@ exports.storageSchema = { platform: Storage_18.desc, userRole: Storage_19.desc, role: Storage_20.desc, - system: Storage_21.desc, - token: Storage_22.desc, - userEntityGrant: Storage_23.desc, - userSystem: Storage_24.desc, - wechatQrCode: Storage_25.desc, - wechatUser: Storage_26.desc + subscription: Storage_21.desc, + system: Storage_22.desc, + token: Storage_23.desc, + userEntityGrant: Storage_24.desc, + userSystem: Storage_25.desc, + wechatQrCode: Storage_26.desc, + wechatUser: Storage_27.desc }; diff --git a/lib/general-app-domain/Subscription/Schema.d.ts b/lib/general-app-domain/Subscription/Schema.d.ts new file mode 100644 index 000000000..0418709f4 --- /dev/null +++ b/lib/general-app-domain/Subscription/Schema.d.ts @@ -0,0 +1,129 @@ +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 { OneOf } from "oak-domain/lib/types/Polyfill"; +import * as SubQuery from "../_SubQuery"; +import { FormCreateData, FormUpdateData, Operation as OakOperation, MakeAction as OakMakeAction, EntityShape } from "oak-domain/lib/types/Entity"; +import { GenericAction } from "oak-domain/lib/actions/action"; +export declare type WechatPublicConfig = { + type: 'wechatPublic'; + appId: string; + appSecret: string; +}; +export declare type OpSchema = EntityShape & { + entity: String<32>; + entityId: String<64>; + name: String<32>; + description: Text; + config: WechatPublicConfig; +}; +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { + entity: String<32>; + entityId: String<64>; + name: String<32>; + description: Text; + config: WechatPublicConfig; +} & { + [A in ExpressionKey]?: any; +}; +declare type AttrFilter = { + id: Q_StringValue | SubQuery.SubscriptionIdSubQuery; + $$createAt$$: Q_DateValue; + $$seq$$: Q_StringValue; + $$updateAt$$: Q_DateValue; + entity: Q_StringValue; + entityId: Q_StringValue; + name: Q_StringValue; + description: Q_StringValue; + config: Q_EnumValue; +}; +export declare type Filter = MakeFilter>; +export declare type Projection = { + "#id"?: NodeId; + [k: string]: any; + id: number; + $$createAt$$?: number; + $$updateAt$$?: number; + $$seq$$?: number; + entity?: number; + entityId?: number; + name?: number; + description?: number; + config?: number; +} & Partial>; +export declare type ExportProjection = { + "#id"?: NodeId; + [k: string]: any; + id?: string; + $$createAt$$?: string; + $$updateAt$$?: string; + $$seq$$?: string; + entity?: string; + entityId?: string; + name?: string; + description?: string; + config?: string; +} & Partial>; +declare type SubscriptionIdProjection = OneOf<{ + id: number; +}>; +export declare type SortAttr = { + id: number; +} | { + $$createAt$$: number; +} | { + $$seq$$: number; +} | { + $$updateAt$$: number; +} | { + entity: number; +} | { + entityId: number; +} | { + name: number; +} | { + description: number; +} | { + config: number; +} | { + [k: string]: any; +} | OneOf>; +export declare type SortNode = { + $attr: SortAttr; + $direction?: "asc" | "desc"; +}; +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= Omit, "id">; +export declare type Selection

= Omit, "action">; +export declare type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>; +export declare type CreateOperationData = FormCreateData> & ({ + entity?: string; + entityId?: string; + [K: string]: any; +}); +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData & { + [k: string]: any; +}; +export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {}; +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation; +export declare type SubscriptionIdSubQuery = Selection; +export declare type NativeAttr = OpAttr; +export declare type FullAttr = NativeAttr; +export declare type EntityDef = { + Schema: Schema; + OpSchema: OpSchema; + Action: OakMakeAction | string; + Selection: Selection; + Operation: Operation; + Create: CreateOperation; + Update: UpdateOperation; + Remove: RemoveOperation; + CreateSingle: CreateSingleOperation; + CreateMulti: CreateMultipleOperation; +}; +export {}; diff --git a/lib/general-app-domain/Subscription/Schema.js b/lib/general-app-domain/Subscription/Schema.js new file mode 100644 index 000000000..c8ad2e549 --- /dev/null +++ b/lib/general-app-domain/Subscription/Schema.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/general-app-domain/Subscription/Storage.d.ts b/lib/general-app-domain/Subscription/Storage.d.ts new file mode 100644 index 000000000..a3f0fbbb0 --- /dev/null +++ b/lib/general-app-domain/Subscription/Storage.d.ts @@ -0,0 +1,3 @@ +import { StorageDesc } from "oak-domain/lib/types/Storage"; +import { OpSchema } from "./Schema"; +export declare const desc: StorageDesc; diff --git a/lib/general-app-domain/Subscription/Storage.js b/lib/general-app-domain/Subscription/Storage.js new file mode 100644 index 000000000..233cb5c00 --- /dev/null +++ b/lib/general-app-domain/Subscription/Storage.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.desc = void 0; +var action_1 = require("oak-domain/lib/actions/action"); +exports.desc = { + attributes: { + entity: { + type: "varchar", + params: { + length: 32 + } + }, + entityId: { + type: "varchar", + params: { + length: 64 + } + }, + name: { + type: "varchar", + params: { + length: 32 + } + }, + description: { + type: "text" + }, + config: { + type: "object" + } + }, + actionType: "crud", + actions: action_1.genericActions, + indexes: [ + //索引 + { + name: 'index_name', + attributes: [ + { + name: 'name' + }, + ] + }, + { + name: 'index_entity', + attributes: [ + { + name: 'entity' + }, + { + name: 'entityId' + } + ] + } + ] +}; diff --git a/lib/general-app-domain/Subscription/locales/zh_CN.json b/lib/general-app-domain/Subscription/locales/zh_CN.json new file mode 100644 index 000000000..c19190e92 --- /dev/null +++ b/lib/general-app-domain/Subscription/locales/zh_CN.json @@ -0,0 +1 @@ +{ "attr": { "name": "名称", "entity": "对象名称", "entityId": "对象Id", "description": "描述", "config": "配置" } } diff --git a/lib/general-app-domain/_SubQuery.d.ts b/lib/general-app-domain/_SubQuery.d.ts index aec8dd2ff..4a9298815 100644 --- a/lib/general-app-domain/_SubQuery.d.ts +++ b/lib/general-app-domain/_SubQuery.d.ts @@ -18,6 +18,7 @@ import * as Mobile from "./Mobile/Schema"; import * as Platform from "./Platform/Schema"; import * as UserRole from "./UserRole/Schema"; import * as Role from "./Role/Schema"; +import * as Subscription from "./Subscription/Schema"; import * as System from "./System/Schema"; import * as Token from "./Token/Schema"; import * as UserEntityGrant from "./UserEntityGrant/Schema"; @@ -164,6 +165,11 @@ export declare type RoleIdSubQuery = { entity: "role"; }) | any; }; +export declare type SubscriptionIdSubQuery = { + [K in "$in" | "$nin"]?: (Subscription.SubscriptionIdSubQuery & { + entity: "subscription"; + }) | any; +}; export declare type SystemIdSubQuery = { [K in "$in" | "$nin"]?: (Application.SystemIdSubQuery & { entity: "application"; diff --git a/lib/pages/address/list/web.d.ts b/lib/pages/address/list/web.d.ts index 931b1c0f9..151352c32 100644 --- a/lib/pages/address/list/web.d.ts +++ b/lib/pages/address/list/web.d.ts @@ -1,4 +1,3 @@ -/// import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../general-app-domain'; export default function Render(props: WebComponentProps import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../general-app-domain'; export default function Render(props: WebComponentProps import { AppType, WebConfig, WechatPublicConfig, WechatMpConfig } from '../../../../general-app-domain/Application/Schema'; import { EntityDict } from '../../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; diff --git a/lib/pages/application/detail/web.d.ts b/lib/pages/application/detail/web.d.ts index 466f965ed..abf9578b3 100644 --- a/lib/pages/application/detail/web.d.ts +++ b/lib/pages/application/detail/web.d.ts @@ -1,4 +1,3 @@ -/// import { WebConfig, WechatPublicConfig, WechatMpConfig } from '../../../general-app-domain/Application/Schema'; import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; diff --git a/lib/pages/application/detail/web.js b/lib/pages/application/detail/web.js index 19a59693d..f8d0e7e3a 100644 --- a/lib/pages/application/detail/web.js +++ b/lib/pages/application/detail/web.js @@ -12,7 +12,7 @@ function Render(props) { { label: '应用概览', key: 'detail', - children: ((0, jsx_runtime_1.jsxs)(antd_1.Descriptions, tslib_1.__assign({ column: 1, bordered: true }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: "id" }, { children: oakId })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('application:attr.name') }, { children: name })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('application:attr.description') }, { children: description })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('application:attr.type') }, { children: t("application:v.type.".concat(type)) })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('application:attr.system') + + children: ((0, jsx_runtime_1.jsxs)(antd_1.Descriptions, tslib_1.__assign({ column: 1, bordered: true }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: "id" }, { children: (0, jsx_runtime_1.jsx)(antd_1.Typography.Paragraph, tslib_1.__assign({ copyable: true }, { children: oakId })) })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('application:attr.name') }, { children: name })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('application:attr.description') }, { children: description })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('application:attr.type') }, { children: t("application:v.type.".concat(type)) })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('application:attr.system') + t('system:attr.name') }, { children: system === null || system === void 0 ? void 0 : system.name }))] }))), }, ] }) })) })) }))); diff --git a/lib/pages/application/list/web.pc.d.ts b/lib/pages/application/list/web.pc.d.ts index 7d9c794d6..f83736a11 100644 --- a/lib/pages/application/list/web.pc.d.ts +++ b/lib/pages/application/list/web.pc.d.ts @@ -1,4 +1,3 @@ -/// import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function Render(props: WebComponentProps import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function Render(props: WebComponentProps; systemId: string; oakId: string; + style: EntityDict['system']['Schema']['style']; }, { confirm: () => void; }>): JSX.Element; diff --git a/lib/pages/application/upsert/web.pc.js b/lib/pages/application/upsert/web.pc.js index 3beb53385..527a4ea7c 100644 --- a/lib/pages/application/upsert/web.pc.js +++ b/lib/pages/application/upsert/web.pc.js @@ -4,9 +4,10 @@ var tslib_1 = require("tslib"); var jsx_runtime_1 = require("react/jsx-runtime"); var antd_1 = require("antd"); var pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader")); +var style_1 = tslib_1.__importDefault(require("../../../components/config/style")); var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); function Render(props) { - var _a = props.data, name = _a.name, description = _a.description, type = _a.type, typeArr = _a.typeArr, variant = _a.variant, _b = _a.showBack, showBack = _b === void 0 ? true : _b, systemId = _a.systemId, oakId = _a.oakId; + var _a = props.data, name = _a.name, description = _a.description, type = _a.type, typeArr = _a.typeArr, variant = _a.variant, _b = _a.showBack, showBack = _b === void 0 ? true : _b, systemId = _a.systemId, oakId = _a.oakId, style = _a.style; var _c = props.methods, t = _c.t, update = _c.update, navigateBack = _c.navigateBack, confirm = _c.confirm; return ((0, jsx_runtime_1.jsx)(Container, tslib_1.__assign({ variant: variant, showBack: showBack }, { children: (0, jsx_runtime_1.jsx)(antd_1.Row, { children: (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ xs: 24, sm: 12 }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 6 }, wrapperCol: { span: 16 } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u540D\u79F0", requiredMark: true, name: "name", rules: [ { @@ -31,7 +32,11 @@ function Render(props) { update({ type: value, }); - } }) }) })), (0, jsx_runtime_1.jsx)(Action, tslib_1.__assign({ variant: variant }, { children: (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 6 } }, { 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 () { + } }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u6837\u5F0F", requiredMark: true, name: "style" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(style_1.default, { onChange: function (value) { + update({ + style: value, + }); + }, value: style }) }) })), (0, jsx_runtime_1.jsx)(Action, tslib_1.__assign({ variant: variant }, { children: (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 6 } }, { 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: "\u786E\u5B9A" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () { navigateBack(); diff --git a/lib/pages/article/detail/web.d.ts b/lib/pages/article/detail/web.d.ts index b1511e988..11103bf7c 100644 --- a/lib/pages/article/detail/web.d.ts +++ b/lib/pages/article/detail/web.d.ts @@ -1,4 +1,3 @@ -/// import { EntityDict } from './../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function render(props: WebComponentProps import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../general-app-domain'; export default function render(props: WebComponentProps import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../general-app-domain'; export default function Render(props: WebComponentProps import '@wangeditor/editor/dist/css/style.css'; import { EntityDict } from './../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; diff --git a/lib/pages/domain/detail/index.js b/lib/pages/domain/detail/index.js index 854279906..51809af30 100644 --- a/lib/pages/domain/detail/index.js +++ b/lib/pages/domain/detail/index.js @@ -6,6 +6,10 @@ exports.default = OakComponent({ projection: { id: 1, systemId: 1, + system: { + id: 1, + name: 1, + }, url: 1, apiPath: 1, port: 1, diff --git a/lib/pages/domain/detail/web.d.ts b/lib/pages/domain/detail/web.d.ts index 54de6e3ae..8703ed615 100644 --- a/lib/pages/domain/detail/web.d.ts +++ b/lib/pages/domain/detail/web.d.ts @@ -1,4 +1,3 @@ -/// import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function Render(props: WebComponentProps void; }>): JSX.Element; diff --git a/lib/pages/domain/detail/web.js b/lib/pages/domain/detail/web.js index edea38d8f..e5d1dc467 100644 --- a/lib/pages/domain/detail/web.js +++ b/lib/pages/domain/detail/web.js @@ -6,7 +6,7 @@ var antd_1 = require("antd"); var pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader")); var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); function Render(props) { - var _a = props.data, oakId = _a.oakId, url = _a.url, tabValue = _a.tabValue; + var _a = props.data, oakId = _a.oakId, url = _a.url, tabValue = _a.tabValue, system = _a.system, apiPath = _a.apiPath, protocol = _a.protocol, port = _a.port; var _b = props.methods, t = _b.t, navigateBack = _b.navigateBack, onTabClick = _b.onTabClick; return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ showBack: true, title: "\u57DF\u540D\u6982\u89C8" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)(antd_1.Card, tslib_1.__assign({ title: url, bordered: false }, { children: (0, jsx_runtime_1.jsx)(antd_1.Tabs, { activeKey: tabValue, onTabClick: function (key) { onTabClick(key); @@ -14,7 +14,8 @@ function Render(props) { { label: '域名概览', key: 'detail', - children: (0, jsx_runtime_1.jsx)("div", { children: "\u8BE6\u60C5" }), + children: ((0, jsx_runtime_1.jsxs)(antd_1.Descriptions, tslib_1.__assign({ column: 1, bordered: true }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: "id" }, { children: (0, jsx_runtime_1.jsx)(antd_1.Typography.Paragraph, tslib_1.__assign({ copyable: true }, { children: oakId })) })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('domain:attr.url') }, { children: url })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('domain:attr.apiPath') }, { children: apiPath })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('domain:attr.port') }, { children: port })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('domain:attr.protocol') }, { children: protocol })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('domain:attr.system') + + t('system:attr.name') }, { children: system === null || system === void 0 ? void 0 : system.name }))] }))), }, ] }) })) })) }))); } diff --git a/lib/pages/domain/list/web.pc.d.ts b/lib/pages/domain/list/web.pc.d.ts index 6d3e9b15c..f61bd95c9 100644 --- a/lib/pages/domain/list/web.pc.d.ts +++ b/lib/pages/domain/list/web.pc.d.ts @@ -1,4 +1,3 @@ -/// import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function Render(props: WebComponentProps import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function Render(props: WebComponentProps import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../general-app-domain'; export default function render(props: WebComponentProps +declare const _default: import("react").ComponentType; +export default _default; diff --git a/lib/pages/message/detail/index.js b/lib/pages/message/detail/index.js new file mode 100644 index 000000000..222257bf2 --- /dev/null +++ b/lib/pages/message/detail/index.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +exports.default = OakComponent({ + entity: 'message', + projection: { + id: 1, + $$createAt$$: 1, + type: 1, + title: 1, + content: 1, + visitState: 1, + userId: 1, + user: { + id: 1, + name: 1, + }, + params: 1, + props: 1, + }, + isList: false, + formData: function (_a) { + var message = _a.data; + return message || {}; + }, + observers: { + 'visitState,userId': function (visitState, userId) { + var userId2 = this.features.token.getUserId(true); + if (userId === userId2) { + if (visitState === 'unvisited') { + this.execute('visit', false); + } + } + }, + }, + methods: { + goPage: function () { + var params = this.state.params; + var pathname = params === null || params === void 0 ? void 0 : params.pathname; + var props = (params === null || params === void 0 ? void 0 : params.props) || {}; + var state = params === null || params === void 0 ? void 0 : params.state; + if (!pathname) { + return; + } + this.redirectTo(tslib_1.__assign({ url: pathname }, props), state); + }, + }, +}); diff --git a/lib/pages/message/detail/index.json b/lib/pages/message/detail/index.json new file mode 100644 index 000000000..2b99d3cf1 --- /dev/null +++ b/lib/pages/message/detail/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "消息详情", + "usingComponents": {} +} diff --git a/lib/pages/message/detail/mobile.module.less b/lib/pages/message/detail/mobile.module.less new file mode 100644 index 000000000..0db2cfa99 --- /dev/null +++ b/lib/pages/message/detail/mobile.module.less @@ -0,0 +1,32 @@ +/** index.wxss **/ +.container { + background: var(--oak-bg-color-container); + box-shadow: 0 2px 3px #0000001a; + border-radius: 3px; + padding: 30px 32px; + + margin: 20px; +} + + +.title { + font-family: "helvetica neue", PingFangSC-Light, arial, "hiragino sans gb", "microsoft yahei ui", "microsoft yahei", simsun, sans-serif; + font-size: 20px; + line-height: 36px; + margin: 0px 0px 22px; +} + +.content { + font-family: "helvetica neue", PingFangSC-Light, arial, "hiragino sans gb", "microsoft yahei ui", "microsoft yahei", simsun, sans-serif; + font-size: 14px; + color: rgb(51, 51, 51); + line-height: 24px; + margin: 6px 0px 0px; + overflow-wrap: break-word; + word-break: break-all; + font-size: 14px; +} + +.btn { + margin-top: 30px; +} \ No newline at end of file diff --git a/lib/pages/message/detail/web.d.ts b/lib/pages/message/detail/web.d.ts new file mode 100644 index 000000000..096610138 --- /dev/null +++ b/lib/pages/message/detail/web.d.ts @@ -0,0 +1,13 @@ +import { EntityDict } from '../../../general-app-domain'; +import { WebComponentProps } from 'oak-frontend-base'; +export default function Render(props: WebComponentProps void; +}>): JSX.Element; diff --git a/lib/pages/message/detail/web.js b/lib/pages/message/detail/web.js new file mode 100644 index 000000000..c0d1144d5 --- /dev/null +++ b/lib/pages/message/detail/web.js @@ -0,0 +1,16 @@ +"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 mobile_module_less_1 = tslib_1.__importDefault(require("./mobile.module.less")); +function Render(props) { + var data = props.data, methods = props.methods; + var title = data.title, content = data.content, params = data.params; + var t = methods.t, goPage = methods.goPage; + var pathname = params === null || params === void 0 ? void 0 : params.pathname; + return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: mobile_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsx)("h1", tslib_1.__assign({ className: mobile_module_less_1.default.title }, { children: title })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: mobile_module_less_1.default.content }, { children: content })), pathname && ((0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ className: mobile_module_less_1.default.btn, block: true, type: "primary", onClick: function () { + goPage(); + } }, { children: "\u524D\u5F80" })))] }))); +} +exports.default = Render; diff --git a/lib/pages/message/detail/web.module.less b/lib/pages/message/detail/web.module.less new file mode 100644 index 000000000..1338af954 --- /dev/null +++ b/lib/pages/message/detail/web.module.less @@ -0,0 +1,46 @@ +/** index.wxss **/ +.container { + background: var(--oak-bg-color-container); + box-shadow: 0 2px 3px #0000001a; + border-radius: 3px; + padding: 30px 32px; +} + +.warp { + word-break: break-all; + min-width: 320px; + max-width: 600px; + border: 1px solid rgb(246, 246, 246); + background-color: rgb(247, 248, 250); + margin: auto; + padding: 30px; +} + +.inner { + background-color: rgb(255, 255, 255); + padding: 30px; + box-shadow: rgb(122 55 55 / 20%) 0px 1px 1px 0px; +} + + +.title { + // font-family: "helvetica neue", PingFangSC-Light, arial, "hiragino sans gb", "microsoft yahei ui", "microsoft yahei", simsun, sans-serif; + font-size: 20px; + line-height: 36px; + margin: 0px 0px 22px; +} + +.content { + // font-family: "helvetica neue", PingFangSC-Light, arial, "hiragino sans gb", "microsoft yahei ui", "microsoft yahei", simsun, sans-serif; + font-size: 14px; + color: rgb(51, 51, 51); + line-height: 24px; + margin: 6px 0px 0px; + overflow-wrap: break-word; + word-break: break-all; + font-size: 14px; +} + +.btn { + margin-top: 30px; +} \ No newline at end of file diff --git a/lib/pages/message/detail/web.pc.d.ts b/lib/pages/message/detail/web.pc.d.ts new file mode 100644 index 000000000..096610138 --- /dev/null +++ b/lib/pages/message/detail/web.pc.d.ts @@ -0,0 +1,13 @@ +import { EntityDict } from '../../../general-app-domain'; +import { WebComponentProps } from 'oak-frontend-base'; +export default function Render(props: WebComponentProps void; +}>): JSX.Element; diff --git a/lib/pages/message/detail/web.pc.js b/lib/pages/message/detail/web.pc.js new file mode 100644 index 000000000..64c710684 --- /dev/null +++ b/lib/pages/message/detail/web.pc.js @@ -0,0 +1,17 @@ +"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 pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader")); +var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); +function Render(props) { + var data = props.data, methods = props.methods; + var title = data.title, content = data.content, params = data.params; + var t = methods.t, goPage = methods.goPage; + var pathname = params === null || params === void 0 ? void 0 : params.pathname; + return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ title: "\u6D88\u606F\u8BE6\u60C5", showBack: true }, { children: (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.warp }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.inner }, { children: [(0, jsx_runtime_1.jsx)("h1", 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.content }, { children: content })), pathname && ((0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ className: web_module_less_1.default.btn, block: true, type: "primary", onClick: function () { + goPage(); + } }, { children: "\u524D\u5F80" })))] })) })) })) }))); +} +exports.default = Render; diff --git a/lib/pages/message/drawerList/index.d.ts b/lib/pages/message/drawerList/index.d.ts new file mode 100644 index 000000000..42765aac1 --- /dev/null +++ b/lib/pages/message/drawerList/index.d.ts @@ -0,0 +1,3 @@ +/// +declare const _default: import("react").ComponentType; +export default _default; diff --git a/lib/pages/message/drawerList/index.js b/lib/pages/message/drawerList/index.js new file mode 100644 index 000000000..9601b0595 --- /dev/null +++ b/lib/pages/message/drawerList/index.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = OakComponent({ + entity: 'message', + isList: true, + projection: { + id: 1, + $$createAt$$: 1, + type: 1, + title: 1, + content: 1, + visitState: 1, + userId: 1, + user: { + id: 1, + name: 1, + }, + params: 1, + props: 1, + }, + filters: [ + { + filter: function (_a) { + var features = _a.features, props = _a.props; + var userId = features.token.getUserId(true); + var application = features.application.getApplication(); + var systemId = application.systemId; + return { + userId: userId, + // systemId, + // visitState: 'unvisited', + }; + }, + }, + ], + sorters: [ + { + sorter: function () { + return { + $attr: { + $$createAt$$: 1, + }, + $direction: 'desc', + }; + }, + }, + ], + formData: function (_a) { + var messages = _a.data, features = _a.features, props = _a.props; + var pagination = this.getPagination(); + return { + messages: messages, + pagination: pagination, + }; + }, + methods: { + goDetailById: function (id) { + this.navigateTo({ + url: "/message/detail", + oakId: id, + }); + }, + goMessageList: function () { + this.navigateTo({ + url: '/message/list', + }); + }, + }, +}); diff --git a/lib/pages/message/drawerList/index.json b/lib/pages/message/drawerList/index.json new file mode 100644 index 000000000..a07c620d3 --- /dev/null +++ b/lib/pages/message/drawerList/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "消息", + "oakDisablePulldownRefresh": true +} diff --git a/lib/pages/message/drawerList/web.d.ts b/lib/pages/message/drawerList/web.d.ts new file mode 100644 index 000000000..942f0fbde --- /dev/null +++ b/lib/pages/message/drawerList/web.d.ts @@ -0,0 +1,10 @@ +import { WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../general-app-domain'; +export default function Render(props: WebComponentProps void; + open: boolean; +}, { + goDetailById: (id: string) => void; + goMessageList: () => void; +}>): JSX.Element; diff --git a/lib/pages/message/drawerList/web.js b/lib/pages/message/drawerList/web.js new file mode 100644 index 000000000..986988cf8 --- /dev/null +++ b/lib/pages/message/drawerList/web.js @@ -0,0 +1,26 @@ +"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 cell_1 = tslib_1.__importDefault(require("../../../components/message/cell")); +var empty_1 = tslib_1.__importDefault(require("../../../components/common/empty")); +function Render(props) { + var data = props.data, methods = props.methods; + var messages = data.messages, open = data.open, onClose = data.onClose, oakFullpath = data.oakFullpath; + var goDetailById = methods.goDetailById, goMessageList = methods.goMessageList; + return ((0, jsx_runtime_1.jsx)(antd_1.Drawer, tslib_1.__assign({ title: "\u6D88\u606F", placement: "right", onClose: onClose, open: open, extra: (0, jsx_runtime_1.jsx)(antd_1.Space, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ size: "small", type: "text", onClick: function () { + onClose && onClose(); + goMessageList(); + } }, { children: "\u67E5\u770B\u66F4\u591A" })) }), bodyStyle: { + padding: 0, + }, destroyOnClose: true }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (messages === null || messages === void 0 ? void 0 : messages.length) > 0 ? ((0, jsx_runtime_1.jsx)("div", { children: messages === null || messages === void 0 ? void 0 : messages.map(function (message, index) { return ((0, jsx_runtime_1.jsx)(cell_1.default, { oakId: message.id, oakPath: oakFullpath + ? "".concat(oakFullpath, ".").concat(message.id) + : '', onItemClicked: function (item) { + var params = item.params, id = item.id; + onClose && onClose(); + goDetailById(id); + } }, message.id)); }) })) : ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.noData }, { children: (0, jsx_runtime_1.jsx)(empty_1.default, { description: "\u6682\u65E0\u6D88\u606F", image: empty_1.default.PRESENTED_IMAGE_SIMPLE }) }))) })) }))); +} +exports.default = Render; diff --git a/lib/pages/message/drawerList/web.module.less b/lib/pages/message/drawerList/web.module.less new file mode 100644 index 000000000..ea50e8b2c --- /dev/null +++ b/lib/pages/message/drawerList/web.module.less @@ -0,0 +1,6 @@ +/** index.wxss **/ +.container { + display: flex; + flex-direction: column; + background-color: var(--oak-bg-color-page); +} \ No newline at end of file diff --git a/lib/pages/message/list/index.d.ts b/lib/pages/message/list/index.d.ts new file mode 100644 index 000000000..42765aac1 --- /dev/null +++ b/lib/pages/message/list/index.d.ts @@ -0,0 +1,3 @@ +/// +declare const _default: import("react").ComponentType; +export default _default; diff --git a/lib/pages/message/list/index.js b/lib/pages/message/list/index.js new file mode 100644 index 000000000..39a12994e --- /dev/null +++ b/lib/pages/message/list/index.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = OakComponent({ + entity: 'message', + isList: true, + projection: { + id: 1, + $$createAt$$: 1, + type: 1, + title: 1, + content: 1, + visitState: 1, + userId: 1, + user: { + id: 1, + name: 1, + }, + params: 1, + props: 1, + }, + filters: [ + { + filter: function (_a) { + var features = _a.features, props = _a.props; + var userId = features.token.getUserId(true); + var application = features.application.getApplication(); + var systemId = application.systemId; + return { + userId: userId, + // systemId, + // visitState: 'unvisited', + }; + }, + }, + ], + sorters: [ + { + sorter: function () { + return { + $attr: { + $$createAt$$: 1, + }, + $direction: 'desc', + }; + }, + }, + ], + formData: function (_a) { + var messages = _a.data, features = _a.features, props = _a.props; + var pagination = this.getPagination(); + return { + messages: messages, + pagination: pagination, + }; + }, + methods: { + goDetailById: function (id) { + this.navigateTo({ + url: "/message/detail", + oakId: id, + }); + }, + }, +}); diff --git a/lib/pages/message/list/index.json b/lib/pages/message/list/index.json new file mode 100644 index 000000000..23ae42df6 --- /dev/null +++ b/lib/pages/message/list/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "消息通知", + "usingComponents": {} +} diff --git a/lib/pages/message/list/mobile.module.less b/lib/pages/message/list/mobile.module.less new file mode 100644 index 000000000..ea50e8b2c --- /dev/null +++ b/lib/pages/message/list/mobile.module.less @@ -0,0 +1,6 @@ +/** index.wxss **/ +.container { + display: flex; + flex-direction: column; + background-color: var(--oak-bg-color-page); +} \ No newline at end of file diff --git a/lib/pages/message/list/web.d.ts b/lib/pages/message/list/web.d.ts new file mode 100644 index 000000000..1ae79b66a --- /dev/null +++ b/lib/pages/message/list/web.d.ts @@ -0,0 +1,7 @@ +import { WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../general-app-domain'; +export default function Render(props: WebComponentProps void; +}>): JSX.Element; diff --git a/lib/pages/message/list/web.js b/lib/pages/message/list/web.js new file mode 100644 index 000000000..87e52feab --- /dev/null +++ b/lib/pages/message/list/web.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var jsx_runtime_1 = require("react/jsx-runtime"); +var mobile_module_less_1 = tslib_1.__importDefault(require("./mobile.module.less")); +var cell_1 = tslib_1.__importDefault(require("../../../components/message/cell")); +var empty_1 = tslib_1.__importDefault(require("../../../components/common/empty")); +function Render(props) { + var data = props.data, methods = props.methods; + var messages = data.messages, oakFullpath = data.oakFullpath; + var goDetailById = methods.goDetailById; + return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: mobile_module_less_1.default.container }, { children: (messages === null || messages === void 0 ? void 0 : messages.length) > 0 ? ((0, jsx_runtime_1.jsx)("div", { children: messages === null || messages === void 0 ? void 0 : messages.map(function (message, index) { return ((0, jsx_runtime_1.jsx)(cell_1.default, { oakId: message.id, oakPath: oakFullpath + ? "".concat(oakFullpath, ".").concat(message.id) + : '', onItemClicked: function (item) { + goDetailById(item.id); + } }, message.id)); }) })) : ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: mobile_module_less_1.default.noData }, { children: (0, jsx_runtime_1.jsx)(empty_1.default, { description: "\u6682\u65E0\u6D88\u606F", image: empty_1.default.PRESENTED_IMAGE_SIMPLE }) }))) }))); +} +exports.default = Render; diff --git a/lib/pages/message/list/web.module.less b/lib/pages/message/list/web.module.less new file mode 100644 index 000000000..b8e6934cf --- /dev/null +++ b/lib/pages/message/list/web.module.less @@ -0,0 +1,7 @@ +/** index.wxss **/ +.container { + background: var(--oak-bg-color-container); + box-shadow: 0 2px 3px #0000001a; + border-radius: 3px; + padding: 30px 32px; +} \ No newline at end of file diff --git a/lib/pages/message/list/web.pc.d.ts b/lib/pages/message/list/web.pc.d.ts new file mode 100644 index 000000000..03c6b10fc --- /dev/null +++ b/lib/pages/message/list/web.pc.d.ts @@ -0,0 +1,12 @@ +import { WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../general-app-domain'; +export default function Render(props: WebComponentProps void; +}>): JSX.Element; diff --git a/lib/pages/message/list/web.pc.js b/lib/pages/message/list/web.pc.js new file mode 100644 index 000000000..956c54b3b --- /dev/null +++ b/lib/pages/message/list/web.pc.js @@ -0,0 +1,88 @@ +"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 dayjs_1 = tslib_1.__importDefault(require("dayjs")); +var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); +var pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader")); +var cellButton_1 = tslib_1.__importDefault(require("../../../components/message/cellButton")); +var MessageType = { + adminNotification: '系统通知', + conversationMessage: '客服消息', +}; +function Render(props) { + var data = props.data, methods = props.methods; + var t = methods.t, setPageSize = methods.setPageSize, setCurrentPage = methods.setCurrentPage, goDetailById = methods.goDetailById; + var messages = data.messages, oakFullpath = data.oakFullpath, oakLoading = data.oakLoading, pagination = data.pagination; + var _a = pagination || {}, pageSize = _a.pageSize, total = _a.total, currentPage = _a.currentPage; + return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ title: "\u6D88\u606F\u901A\u77E5" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)(antd_1.Table, { loading: oakLoading, dataSource: messages || [], rowKey: "id", + // scroll={{ x: 1200 }} + columns: [ + // { + // dataIndex: 'serial-number', + // title: '序号', + // render: (value, record, index) => { + // return index + 1; + // }, + // }, + { + dataIndex: 'title', + title: '消息内容', + render: function (value, record, index) { + if (record.visitState === 'unvisited') { + return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Badge, { style: { marginRight: 5 }, status: "processing" }), (0, jsx_runtime_1.jsx)(antd_1.Typography.Link, tslib_1.__assign({ onClick: function () { + goDetailById(record.id); + } }, { children: value }))] })); + } + return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Text, tslib_1.__assign({ onClick: function () { + goDetailById(record.id); + } }, { children: value }))); + }, + }, + { + dataIndex: 'type', + title: '类型', + render: function (value, record, index) { + return MessageType[value]; + }, + }, + { + dataIndex: 'visitState', + title: '是否已读', + render: function (value, record, index) { + return value === 'unvisited' ? '未读' : '已读'; + }, + }, + { + dataIndex: '$$createAt$$', + title: '接收时间', + render: function (value, record, index) { + return ((0, jsx_runtime_1.jsx)("div", { children: (0, dayjs_1.default)(value).format('YYYY-MM-DD HH:mm:ss') })); + }, + }, + { + dataIndex: 'op', + width: 300, + title: '操作', + align: 'center', + render: function (value, record, index) { + return ((0, jsx_runtime_1.jsxs)(antd_1.Space, tslib_1.__assign({ wrap: true }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function () { + goDetailById(record === null || record === void 0 ? void 0 : record.id); + } }, { children: "\u8BE6\u60C5" })), (0, jsx_runtime_1.jsx)(cellButton_1.default, { oakId: record.id, oakPath: "".concat(oakFullpath, ".").concat(record.id) })] }))); + }, + fixed: 'right', + }, + ], pagination: { + total: total, + pageSize: pageSize, + current: currentPage, + onShowSizeChange: function (current, pageSize) { + setPageSize(pageSize); + }, + onChange: function (page, pageSize) { + setCurrentPage(page); + }, + } }) })) }))); +} +exports.default = Render; diff --git a/lib/pages/mobile/login/web.d.ts b/lib/pages/mobile/login/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/mobile/login/web.d.ts +++ b/lib/pages/mobile/login/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/mobile/me/web.d.ts b/lib/pages/mobile/me/web.d.ts index bcd7e916b..90d439ce1 100644 --- a/lib/pages/mobile/me/web.d.ts +++ b/lib/pages/mobile/me/web.d.ts @@ -1,4 +1,3 @@ -/// import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../general-app-domain'; export default function render(props: WebComponentProps export default function Render(): JSX.Element; diff --git a/lib/pages/personal/web.pc.d.ts b/lib/pages/personal/web.pc.d.ts index aa9c8f0b9..baca2f3aa 100644 --- a/lib/pages/personal/web.pc.d.ts +++ b/lib/pages/personal/web.pc.d.ts @@ -1,2 +1 @@ -/// export default function Render(): JSX.Element; diff --git a/lib/pages/pickers/area/web.d.ts b/lib/pages/pickers/area/web.d.ts index 402dea2d5..96962c2b8 100644 --- a/lib/pages/pickers/area/web.d.ts +++ b/lib/pages/pickers/area/web.d.ts @@ -1,4 +1,3 @@ -/// import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function render(props: WebComponentProps import { Config } from '../../../../types/Config'; import { EntityDict } from '../../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; diff --git a/lib/pages/platform/detail/index.js b/lib/pages/platform/detail/index.js index 014f67765..f7631038b 100644 --- a/lib/pages/platform/detail/index.js +++ b/lib/pages/platform/detail/index.js @@ -8,6 +8,7 @@ exports.default = OakComponent({ name: 1, config: 1, description: 1, + style: 1, }, formData: function (_a) { var data = _a.data; diff --git a/lib/pages/platform/detail/web.d.ts b/lib/pages/platform/detail/web.d.ts index 5cf6f9d31..e934cc279 100644 --- a/lib/pages/platform/detail/web.d.ts +++ b/lib/pages/platform/detail/web.d.ts @@ -1,4 +1,3 @@ -/// import { EntityDict } from '../../../general-app-domain'; import { Config } from '../../../types/Config'; import { WebComponentProps } from 'oak-frontend-base'; diff --git a/lib/pages/platform/detail/web.js b/lib/pages/platform/detail/web.js index b03ae07f0..5b461918a 100644 --- a/lib/pages/platform/detail/web.js +++ b/lib/pages/platform/detail/web.js @@ -15,7 +15,7 @@ function Render(props) { { label: '平台信息', key: 'detail', - children: (0, jsx_runtime_1.jsxs)(antd_1.Descriptions, tslib_1.__assign({ column: 1, bordered: true }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: "id" }, { children: oakId })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('platform:attr.name') }, { children: name })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('platform:attr.description') }, { children: description }))] })), + children: ((0, jsx_runtime_1.jsxs)(antd_1.Descriptions, tslib_1.__assign({ column: 1, bordered: true }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: "id" }, { children: (0, jsx_runtime_1.jsx)(antd_1.Typography.Paragraph, tslib_1.__assign({ copyable: true }, { children: oakId })) })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('platform:attr.name') }, { children: name })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('platform:attr.description') }, { children: description }))] }))), }, { label: '系统管理', diff --git a/lib/pages/platform/list/web.pc.d.ts b/lib/pages/platform/list/web.pc.d.ts index 938411724..34feac623 100644 --- a/lib/pages/platform/list/web.pc.d.ts +++ b/lib/pages/platform/list/web.pc.d.ts @@ -1,4 +1,3 @@ -/// import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function Render(props: WebComponentProps import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function Render(props: WebComponentProps void; }>): JSX.Element; diff --git a/lib/pages/platform/upsert/web.pc.js b/lib/pages/platform/upsert/web.pc.js index 52e0f4b14..55fd2b2b4 100644 --- a/lib/pages/platform/upsert/web.pc.js +++ b/lib/pages/platform/upsert/web.pc.js @@ -4,9 +4,10 @@ var tslib_1 = require("tslib"); var jsx_runtime_1 = require("react/jsx-runtime"); var antd_1 = require("antd"); var pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader")); +var style_1 = tslib_1.__importDefault(require("../../../components/config/style")); var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); function Render(props) { - var _a = props.data, name = _a.name, description = _a.description; + var _a = props.data, name = _a.name, description = _a.description, style = _a.style; var _b = props.methods, t = _b.t, update = _b.update, navigateBack = _b.navigateBack, confirm = _b.confirm; return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ showBack: true, title: "\u5E73\u53F0\u7F16\u8F91" }, { children: (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: 12 }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 4 }, wrapperCol: { span: 16 } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u540D\u79F0", requiredMark: true, name: "name", rules: [ { @@ -20,7 +21,11 @@ function Render(props) { update({ description: e.target.value, }); - }, value: description }) }) })), (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 () { + }, value: description }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u6837\u5F0F", requiredMark: true, name: "style" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(style_1.default, { onChange: function (value) { + update({ + style: value, + }); + }, value: style }) }) })), (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: "\u786E\u5B9A" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () { navigateBack(); diff --git a/lib/pages/subscription/config/upsert/index.d.ts b/lib/pages/subscription/config/upsert/index.d.ts new file mode 100644 index 000000000..42765aac1 --- /dev/null +++ b/lib/pages/subscription/config/upsert/index.d.ts @@ -0,0 +1,3 @@ +/// +declare const _default: import("react").ComponentType; +export default _default; diff --git a/lib/pages/subscription/config/upsert/index.js b/lib/pages/subscription/config/upsert/index.js new file mode 100644 index 000000000..c838759be --- /dev/null +++ b/lib/pages/subscription/config/upsert/index.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = OakComponent({ + isList: false, + entity: 'subscription', + projection: { + id: 1, + name: 1, + config: 1, + }, + formData: function (_a) { + var data = _a.data; + return data || {}; + }, + methods: {}, +}); diff --git a/lib/pages/subscription/config/upsert/web.module.less b/lib/pages/subscription/config/upsert/web.module.less new file mode 100644 index 000000000..9f3d17c7f --- /dev/null +++ b/lib/pages/subscription/config/upsert/web.module.less @@ -0,0 +1,6 @@ +.container { + background: var(--oak-bg-color-container); + box-shadow: 0 2px 3px #0000001a; + border-radius: 3px; + padding: 30px 32px; +} \ No newline at end of file diff --git a/lib/pages/subscription/config/upsert/web.pc.d.ts b/lib/pages/subscription/config/upsert/web.pc.d.ts new file mode 100644 index 000000000..40fe3752c --- /dev/null +++ b/lib/pages/subscription/config/upsert/web.pc.d.ts @@ -0,0 +1,11 @@ +import { WechatPublicConfig } from '../../../../general-app-domain/Application/Schema'; +import { EntityDict } from '../../../../general-app-domain'; +import { WebComponentProps } from 'oak-frontend-base'; +declare type Config = WechatPublicConfig; +export default function render(props: WebComponentProps): JSX.Element; +export {}; diff --git a/lib/pages/subscription/config/upsert/web.pc.js b/lib/pages/subscription/config/upsert/web.pc.js new file mode 100644 index 000000000..e225d1f54 --- /dev/null +++ b/lib/pages/subscription/config/upsert/web.pc.js @@ -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 application_1 = tslib_1.__importDefault(require("../../../../components/config/application")); +var pageHeader_1 = tslib_1.__importDefault(require("../../../../components/common/pageHeader")); +var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); +function render(props) { + var _a = props.data, oakId = _a.oakId, config = _a.config, name = _a.name; + return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ showBack: true, title: "\u8BA2\u9605\u53F7\u914D\u7F6E" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)(application_1.default, { isService: false, type: "wechatPublic", config: config, entity: "subscription", entityId: oakId, name: name }) })) }))); +} +exports.default = render; diff --git a/lib/pages/subscription/detail/index.d.ts b/lib/pages/subscription/detail/index.d.ts new file mode 100644 index 000000000..42765aac1 --- /dev/null +++ b/lib/pages/subscription/detail/index.d.ts @@ -0,0 +1,3 @@ +/// +declare const _default: import("react").ComponentType; +export default _default; diff --git a/lib/pages/subscription/detail/index.js b/lib/pages/subscription/detail/index.js new file mode 100644 index 000000000..9b7ceb6c3 --- /dev/null +++ b/lib/pages/subscription/detail/index.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = OakComponent({ + isList: false, + entity: 'subscription', + projection: { + id: 1, + name: 1, + config: 1, + description: 1, + entity: 1, + entityId: 1, + }, + formData: function (_a) { + var data = _a.data; + return data || {}; + }, + methods: {}, +}); diff --git a/lib/pages/subscription/detail/web.d.ts b/lib/pages/subscription/detail/web.d.ts new file mode 100644 index 000000000..858e76969 --- /dev/null +++ b/lib/pages/subscription/detail/web.d.ts @@ -0,0 +1,16 @@ +import { WechatPublicConfig } from '../../../general-app-domain/Application/Schema'; +import { EntityDict } from '../../../general-app-domain'; +import { WebComponentProps } from 'oak-frontend-base'; +declare type Config = WechatPublicConfig; +export default function Render(props: WebComponentProps void; +}>): JSX.Element; +export {}; diff --git a/lib/pages/subscription/detail/web.js b/lib/pages/subscription/detail/web.js new file mode 100644 index 000000000..ee63eb67f --- /dev/null +++ b/lib/pages/subscription/detail/web.js @@ -0,0 +1,19 @@ +"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 pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader")); +var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); +function Render(props) { + var _a = props.data, oakId = _a.oakId, tabValue = _a.tabValue, config = _a.config, name = _a.name, description = _a.description, entity = _a.entity, entityId = _a.entityId; + var _b = props.methods, t = _b.t, navigateBack = _b.navigateBack, onTabClick = _b.onTabClick; + return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ showBack: true, title: "\u8BA2\u9605\u53F7\u6982\u89C8" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)(antd_1.Card, tslib_1.__assign({ title: name, bordered: false }, { children: (0, jsx_runtime_1.jsx)(antd_1.Tabs, { items: [ + { + label: '订阅号概览', + key: 'detail', + children: ((0, jsx_runtime_1.jsxs)(antd_1.Descriptions, tslib_1.__assign({ column: 1, bordered: true }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: "id" }, { children: (0, jsx_runtime_1.jsx)(antd_1.Typography.Paragraph, tslib_1.__assign({ copyable: true }, { children: oakId })) })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('subscription:attr.name') }, { children: name })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('subscription:attr.description') }, { children: description }))] }))), + }, + ] }) })) })) }))); +} +exports.default = Render; diff --git a/lib/pages/subscription/detail/web.module.less b/lib/pages/subscription/detail/web.module.less new file mode 100644 index 000000000..9f3d17c7f --- /dev/null +++ b/lib/pages/subscription/detail/web.module.less @@ -0,0 +1,6 @@ +.container { + background: var(--oak-bg-color-container); + box-shadow: 0 2px 3px #0000001a; + border-radius: 3px; + padding: 30px 32px; +} \ No newline at end of file diff --git a/lib/pages/subscription/list/index.d.ts b/lib/pages/subscription/list/index.d.ts new file mode 100644 index 000000000..42765aac1 --- /dev/null +++ b/lib/pages/subscription/list/index.d.ts @@ -0,0 +1,3 @@ +/// +declare const _default: import("react").ComponentType; +export default _default; diff --git a/lib/pages/subscription/list/index.js b/lib/pages/subscription/list/index.js new file mode 100644 index 000000000..6f25a97be --- /dev/null +++ b/lib/pages/subscription/list/index.js @@ -0,0 +1,68 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = OakComponent({ + isList: true, + entity: 'subscription', + projection: { + id: 1, + name: 1, + description: 1, + config: 1, + entity: 1, + entityId: 1, + }, + filters: [ + { + filter: function (_a) { + var props = _a.props; + return { + entityId: props.entityId, + entity: props.entity, + }; + }, + }, + ], + formData: function (_a) { + var data = _a.data; + var pagination = this.getPagination(); + return { + list: data, + pagination: pagination, + }; + }, + data: { + open: false, + }, + methods: { + goDetail: function (id) { + this.navigateTo({ + url: '/subscription/detail', + oakId: id, + }); + }, + goUpdate: function (id) { + this.navigateTo({ + url: '/subscription/upsert', + oakId: id, + }); + }, + goSetConfig: function (id) { + this.navigateTo({ + url: '/subscription/config/upsert', + oakId: id, + }); + }, + goCreate: function () { + var _a = this.props, width = _a.width, entityId = _a.entityId, entity = _a.entity; + this.navigateTo({ + url: '/subscription/upsert', + entityId: entityId, + entity: entity, + }); + }, + remove: function (id) { + this.removeItem(id); + this.execute(); + }, + }, +}); diff --git a/lib/pages/subscription/list/web.module.less b/lib/pages/subscription/list/web.module.less new file mode 100644 index 000000000..9f3d17c7f --- /dev/null +++ b/lib/pages/subscription/list/web.module.less @@ -0,0 +1,6 @@ +.container { + background: var(--oak-bg-color-container); + box-shadow: 0 2px 3px #0000001a; + border-radius: 3px; + padding: 30px 32px; +} \ No newline at end of file diff --git a/lib/pages/subscription/list/web.pc.d.ts b/lib/pages/subscription/list/web.pc.d.ts new file mode 100644 index 000000000..dbad0b381 --- /dev/null +++ b/lib/pages/subscription/list/web.pc.d.ts @@ -0,0 +1,15 @@ +import { EntityDict } from '../../../general-app-domain'; +import { WebComponentProps } from 'oak-frontend-base'; +export default function Render(props: WebComponentProps void; + goCreate: () => void; + goSetConfig: (id: string) => void; + goUpdate: (id: string) => void; + remove: (id: string) => void; +}>): JSX.Element; diff --git a/lib/pages/subscription/list/web.pc.js b/lib/pages/subscription/list/web.pc.js new file mode 100644 index 000000000..80a9480d6 --- /dev/null +++ b/lib/pages/subscription/list/web.pc.js @@ -0,0 +1,83 @@ +"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 pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader")); +var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); +function Render(props) { + var _a = props.data, pagination = _a.pagination, _b = _a.list, list = _b === void 0 ? [] : _b, oakLoading = _a.oakLoading, showBack = _a.showBack, variant = _a.variant, oakFullpath = _a.oakFullpath; + var _c = pagination || {}, pageSize = _c.pageSize, total = _c.total, currentPage = _c.currentPage; + var _d = props.methods, t = _d.t, setPageSize = _d.setPageSize, setCurrentPage = _d.setCurrentPage, goCreate = _d.goCreate, goDetail = _d.goDetail, goSetConfig = _d.goSetConfig, goUpdate = _d.goUpdate, remove = _d.remove; + return ((0, jsx_runtime_1.jsxs)(Container, tslib_1.__assign({ variant: variant }, { 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 () { + goCreate(); + } }, { children: "\u6DFB\u52A0\u8BA2\u9605\u53F7" })) }), (0, jsx_runtime_1.jsx)(antd_1.Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [ + // { + // dataIndex: 'id', + // title: '序号', + // render: (value, record, index) => { + // return index + 1; + // }, + // }, + { + dataIndex: 'name', + title: '订阅号名称', + width: 300, + render: function (value, record, index) { + return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Link, tslib_1.__assign({ onClick: function () { + goDetail(record.id); + } }, { children: value }))); + }, + }, + { + dataIndex: 'description', + title: '描述', + width: 200, + ellipsis: true, + }, + { + dataIndex: 'config', + title: '配置', + align: 'center', + render: function (value, record, index) { + return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function () { + goSetConfig(record.id); + } }, { children: "\u914D\u7F6E" })) })); + }, + }, + { + dataIndex: 'op', + width: 200, + title: '操作', + align: 'center', + render: function (value, record, index) { + return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function () { + goDetail(record.id); + } }, { children: "\u8BE6\u60C5" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function () { + goUpdate(record.id); + } }, { children: "\u66F4\u65B0" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function () { + remove(record.id); + } }, { children: "\u5220\u9664" }))] })); + }, + fixed: 'right', + }, + ], pagination: { + total: total, + pageSize: pageSize, + current: currentPage, + onShowSizeChange: function (pageSize) { + setPageSize(pageSize); + }, + onChange: function (current) { + setCurrentPage(current); + }, + } })] }))); +} +exports.default = Render; +function Container(props) { + var children = props.children, _a = props.variant, variant = _a === void 0 ? 'alone' : _a, showBack = props.showBack; + if (['inline', 'dialog'].includes(variant)) { + return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }); + } + return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ showBack: showBack, title: "\u5E94\u7528\u7BA1\u7406" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: children })) }))); +} diff --git a/lib/pages/subscription/upsert/index.d.ts b/lib/pages/subscription/upsert/index.d.ts new file mode 100644 index 000000000..42765aac1 --- /dev/null +++ b/lib/pages/subscription/upsert/index.d.ts @@ -0,0 +1,3 @@ +/// +declare const _default: import("react").ComponentType; +export default _default; diff --git a/lib/pages/subscription/upsert/index.js b/lib/pages/subscription/upsert/index.js new file mode 100644 index 000000000..2594de17e --- /dev/null +++ b/lib/pages/subscription/upsert/index.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +exports.default = OakComponent({ + isList: false, + entity: 'subscription', + projection: { + id: 1, + name: 1, + config: 1, + description: 1, + entity: 1, + entityId: 1, + }, + formData: function (_a) { + var data = _a.data; + return data || {}; + }, + data: {}, + lifetimes: { + ready: function () { + var _a = this.props, entityId = _a.entityId, entity = _a.entity, oakId = _a.oakId; + if (!oakId) { + if (entityId) { + this.update({ + entityId: entityId, + entity: entity, + }); + } + } + }, + }, + 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: return [4 /*yield*/, this.execute()]; + case 1: + _a.sent(); + this.navigateBack(); + return [2 /*return*/]; + } + }); + }); + }, + }, +}); diff --git a/lib/pages/subscription/upsert/web.module.less b/lib/pages/subscription/upsert/web.module.less new file mode 100644 index 000000000..9f3d17c7f --- /dev/null +++ b/lib/pages/subscription/upsert/web.module.less @@ -0,0 +1,6 @@ +.container { + background: var(--oak-bg-color-container); + box-shadow: 0 2px 3px #0000001a; + border-radius: 3px; + padding: 30px 32px; +} \ No newline at end of file diff --git a/lib/pages/subscription/upsert/web.pc.d.ts b/lib/pages/subscription/upsert/web.pc.d.ts new file mode 100644 index 000000000..caf5cf5b4 --- /dev/null +++ b/lib/pages/subscription/upsert/web.pc.d.ts @@ -0,0 +1,13 @@ +import { EntityDict } from '../../../general-app-domain'; +import { WebComponentProps } from 'oak-frontend-base'; +export default function Render(props: WebComponentProps void; +}>): JSX.Element; diff --git a/lib/pages/subscription/upsert/web.pc.js b/lib/pages/subscription/upsert/web.pc.js new file mode 100644 index 000000000..d22fdc9ea --- /dev/null +++ b/lib/pages/subscription/upsert/web.pc.js @@ -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 pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader")); +var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); +function Render(props) { + var _a = props.data, name = _a.name, description = _a.description, variant = _a.variant, _b = _a.showBack, showBack = _b === void 0 ? true : _b, entityId = _a.entityId, entity = _a.entity, oakId = _a.oakId; + var _c = props.methods, t = _c.t, update = _c.update, navigateBack = _c.navigateBack, confirm = _c.confirm; + return ((0, jsx_runtime_1.jsx)(Container, tslib_1.__assign({ variant: variant, showBack: showBack }, { children: (0, jsx_runtime_1.jsx)(antd_1.Row, { children: (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ xs: 24, sm: 12 }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 6 }, wrapperCol: { span: 16 } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u540D\u79F0", requiredMark: true, name: "name", rules: [ + { + required: true, + }, + ] }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (e) { + update({ + name: e.target.value, + }); + }, value: name }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u63CF\u8FF0", requiredMark: true, name: "description" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input.TextArea, { onChange: function (e) { + update({ + description: e.target.value, + }); + }, value: description }) }) })), (0, jsx_runtime_1.jsx)(Action, tslib_1.__assign({ variant: variant }, { children: (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 6 } }, { 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: "\u786E\u5B9A" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () { + navigateBack(); + } }, { children: "\u8FD4\u56DE" }))] }) })) }))] })) })) }) }))); +} +exports.default = Render; +function Action(props) { + var children = props.children, variant = props.variant; + if (variant === 'dialog') { + return null; + } + return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children })); +} +function Container(props) { + var children = props.children, variant = props.variant, showBack = props.showBack; + if (variant === 'inline' || variant === 'dialog') { + return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }); + } + return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ showBack: showBack, title: "\u8BA2\u9605\u53F7\u7F16\u8F91" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: children })) }))); +} diff --git a/lib/pages/system/config/upsert/web.pc.d.ts b/lib/pages/system/config/upsert/web.pc.d.ts index 9278d8d2c..d27eaaf32 100644 --- a/lib/pages/system/config/upsert/web.pc.d.ts +++ b/lib/pages/system/config/upsert/web.pc.d.ts @@ -1,4 +1,3 @@ -/// import { EntityDict } from '../../../../general-app-domain'; import { Config } from '../../../../types/Config'; import { WebComponentProps } from 'oak-frontend-base'; diff --git a/lib/pages/system/detail/web.d.ts b/lib/pages/system/detail/web.d.ts index b5371919f..cce76388c 100644 --- a/lib/pages/system/detail/web.d.ts +++ b/lib/pages/system/detail/web.d.ts @@ -1,4 +1,3 @@ -/// import { EntityDict } from '../../../general-app-domain'; import { Config } from '../../../types/Config'; import { WebComponentProps } from 'oak-frontend-base'; diff --git a/lib/pages/system/detail/web.js b/lib/pages/system/detail/web.js index 233582c84..f53536ada 100644 --- a/lib/pages/system/detail/web.js +++ b/lib/pages/system/detail/web.js @@ -16,7 +16,7 @@ function Render(props) { { label: '系统概览', key: 'detail', - children: ((0, jsx_runtime_1.jsxs)(antd_1.Descriptions, tslib_1.__assign({ column: 1, bordered: true }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: "id" }, { children: oakId })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('system:attr.name') }, { children: name })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('system:attr.description') }, { children: description })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('system:attr.super') }, { children: isSuper ? '是' : '否' })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('system:attr.folder') }, { children: folder })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('system:attr.platform') + + children: ((0, jsx_runtime_1.jsxs)(antd_1.Descriptions, tslib_1.__assign({ column: 1, bordered: true }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: "id" }, { children: (0, jsx_runtime_1.jsx)(antd_1.Typography.Paragraph, tslib_1.__assign({ copyable: true }, { children: oakId })) })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('system:attr.name') }, { children: name })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('system:attr.description') }, { children: description })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('system:attr.super') }, { children: isSuper ? '是' : '否' })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('system:attr.folder') }, { children: folder })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('system:attr.platform') + t('platform:attr.name') }, { children: platform === null || platform === void 0 ? void 0 : platform.name }))] }))), }, { diff --git a/lib/pages/system/list/web.pc.d.ts b/lib/pages/system/list/web.pc.d.ts index 843a9d166..3f7e8af66 100644 --- a/lib/pages/system/list/web.pc.d.ts +++ b/lib/pages/system/list/web.pc.d.ts @@ -1,4 +1,3 @@ -/// import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function Render(props: WebComponentProps import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function Render(props: WebComponentProps import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function Render(props: WebComponentProps import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../../general-app-domain'; export default function render(props: WebComponentProps import { EntityDict } from '../../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function Render(props: WebComponentProps import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function render(props: WebComponentProps export default function render(this: any): JSX.Element; diff --git a/lib/pages/user/search/web.d.ts b/lib/pages/user/search/web.d.ts index 5eaeadcc2..cfaabf286 100644 --- a/lib/pages/user/search/web.d.ts +++ b/lib/pages/user/search/web.d.ts @@ -1,2 +1 @@ -/// export default function render(): JSX.Element; diff --git a/lib/pages/userEntityGrant/confirm/web.d.ts b/lib/pages/userEntityGrant/confirm/web.d.ts index 1674e7f9a..c567cdf19 100644 --- a/lib/pages/userEntityGrant/confirm/web.d.ts +++ b/lib/pages/userEntityGrant/confirm/web.d.ts @@ -1,4 +1,3 @@ -/// import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../general-app-domain'; export default function render(props: WebComponentProps export default function Render(props: any): JSX.Element; diff --git a/lib/pages/userEntityGrant/detail/web.pc.d.ts b/lib/pages/userEntityGrant/detail/web.pc.d.ts index b88b8c10f..17acc3779 100644 --- a/lib/pages/userEntityGrant/detail/web.pc.d.ts +++ b/lib/pages/userEntityGrant/detail/web.pc.d.ts @@ -1,4 +1,3 @@ -/// import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../general-app-domain'; export default function Render(props: WebComponentProps import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function render(props: WebComponentProps import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function render(props: WebComponentProps import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../general-app-domain'; export default function Render(props: WebComponentProps import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../general-app-domain'; export default function Render(props: WebComponentProps export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/onEntity/web.d.ts b/lib/pages/userRelation/onEntity/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/userRelation/onEntity/web.d.ts +++ b/lib/pages/userRelation/onEntity/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/onUser/web.d.ts b/lib/pages/userRelation/onUser/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/userRelation/onUser/web.d.ts +++ b/lib/pages/userRelation/onUser/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/upsert/byMobile/web.pc.d.ts b/lib/pages/userRelation/upsert/byMobile/web.pc.d.ts index ef231e514..8c8945357 100644 --- a/lib/pages/userRelation/upsert/byMobile/web.pc.d.ts +++ b/lib/pages/userRelation/upsert/byMobile/web.pc.d.ts @@ -1,4 +1,3 @@ -/// import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../../general-app-domain'; export default function Render(props: WebComponentProps import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../../general-app-domain'; export default function Render(props: WebComponentProps export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/upsert/byUserEntityGrant/web.pc.d.ts b/lib/pages/userRelation/upsert/byUserEntityGrant/web.pc.d.ts index d4ffe02e7..7de5e2f13 100644 --- a/lib/pages/userRelation/upsert/byUserEntityGrant/web.pc.d.ts +++ b/lib/pages/userRelation/upsert/byUserEntityGrant/web.pc.d.ts @@ -1,4 +1,3 @@ -/// import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../../general-app-domain'; export default function render(props: WebComponentProps import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../../../general-app-domain'; export default function Render(props: WebComponentProps export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/upsert/onUser/web.pc.d.ts b/lib/pages/userRelation/upsert/onUser/web.pc.d.ts index e17464587..dc6832f7c 100644 --- a/lib/pages/userRelation/upsert/onUser/web.pc.d.ts +++ b/lib/pages/userRelation/upsert/onUser/web.pc.d.ts @@ -1,4 +1,3 @@ -/// import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../../general-app-domain'; export default function Render(props: WebComponentProps export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/upsert/web.pc.d.ts b/lib/pages/userRelation/upsert/web.pc.d.ts index 9779d29cb..fbdc2b78b 100644 --- a/lib/pages/userRelation/upsert/web.pc.d.ts +++ b/lib/pages/userRelation/upsert/web.pc.d.ts @@ -1,4 +1,3 @@ -/// import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../general-app-domain'; export default function Render(props: WebComponentProps import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function render(props: WebComponentProps import { EntityDict } from '../../../general-app-domain'; import { WebComponentProps } from 'oak-frontend-base'; export default function render(props: WebComponentProps): any; + success(options: Record): any; + warning(options: Record): any; + error(options: Record): any; + confirm(options: Record): any; + hide(context: any): void; +}; +export default Message; diff --git a/lib/utils/dialog/index.mp.js b/lib/utils/dialog/index.mp.js index 251130122..495d81ee7 100644 --- a/lib/utils/dialog/index.mp.js +++ b/lib/utils/dialog/index.mp.js @@ -1,6 +1,54 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); -// @ts-ignore -var index_1 = tslib_1.__importDefault(require("../../miniprogram_npm/tdesign/dialog/index")); -exports.default = index_1.default; +var DialogType = { + info: 'info', + success: 'success', + warning: 'warning', + error: 'error', + confirm: 'confirm', +}; +function getInstance(context, selector) { + if (selector === void 0) { selector = '#oak-dialog'; } + var instance = context.selectComponent(selector); + if (!instance) { + return Promise.reject(new Error('未找到Dialog组件, 请检查selector是否正确')); + } + return instance; +} +function showDialog(options, type) { + if (type === void 0) { type = DialogType.info; } + var options2 = tslib_1.__assign({}, options); + var context = options2.context; + delete options.context; + var instance = getInstance(context); + instance.resetData(function () { + instance.setData(Object.assign({ type: type }, options), instance.show); + }); + return instance; +} +var Message = { + info: function (options) { + return showDialog(options, DialogType.info); + }, + success: function (options) { + return showDialog(options, DialogType.success); + }, + warning: function (options) { + return showDialog(options, DialogType.warning); + }, + error: function (options) { + return showDialog(options, DialogType.error); + }, + confirm: function (options) { + return showDialog(options, DialogType.confirm); + }, + hide: function (context) { + var instance = getInstance(context); + if (!instance) { + return; + } + instance.linHide(); + }, +}; +exports.default = Message; diff --git a/lib/utils/message/index.mp.js b/lib/utils/message/index.mp.js index 306544bc0..5cba043fa 100644 --- a/lib/utils/message/index.mp.js +++ b/lib/utils/message/index.mp.js @@ -8,7 +8,7 @@ var MessageType = { error: 'error', }; function getInstance(context, selector) { - if (selector === void 0) { selector = '#t-message'; } + if (selector === void 0) { selector = '#oak-message'; } var instance = context.selectComponent(selector); if (!instance) { return Promise.reject(new Error('未找到Message组件, 请检查selector是否正确')); diff --git a/package.json b/package.json index a0f8d79ca..4826b3347 100644 --- a/package.json +++ b/package.json @@ -75,12 +75,14 @@ "scripts": { "make:domain": "ts-node ./scripts/make.ts", "clean": "rimraf lib/*", - "copy-files": "copyfiles -u 1 src/**/*.less lib/ & copyfiles -u 1 src/**/*.svg lib/ & copyfiles -u 1 src/**/*.xml lib/ & copyfiles -u 1 src/**/*.wxml lib/ & copyfiles -u 1 src/**/*.wxs lib/ & copyfiles -u 1 src/miniprogram_npm/**/*.js lib/ ", - "build": "tsc && npm run copy-files", + "copy-files": "copyfiles -u 1 src/**/*.svg lib/ & copyfiles -u 1 src/**/*.xml lib/ & copyfiles -u 1 src/**/*.wxml lib/ & copyfiles -u 1 src/**/*.wxs lib/ & copyfiles -u 1 src/miniprogram_npm/**/*.js lib/ ", + "copy-less": "copyfiles -u 1 src/**/*.less lib/", + "build": "tsc && npm run copy-files && npm run copy-less", "gen:areaDebug": "ts-node ./scripts/generateAreaDebug.ts", "clean:dir": "ts-node ./scripts/cleanDtsAndJs", "test": "ts-node ./test/test.ts", - "prepare": "rimraf node_modules/react & rimraf node_modules/react-dom & rimraf node_modules/react-router" + "prepare": "rimraf node_modules/react & rimraf node_modules/react-dom & rimraf node_modules/react-router", + "remove-antd": "rimraf node_modules/antd & rimraf node_modules/antd-mobile & rimraf node_modules/@ant-design & rimraf node_modules/antd-mobile-icons & rimraf node_modules/antd-mobile-v5-count" }, "main": "lib/index" } diff --git a/src/aspects/AspectDict.ts b/src/aspects/AspectDict.ts index 0b4949499..f3783093e 100644 --- a/src/aspects/AspectDict.ts +++ b/src/aspects/AspectDict.ts @@ -81,6 +81,14 @@ type GeneralAspectDict< }, context: Cxt ) => Promise; + updateApplicationConfig: ( + params: { + entity: 'application'; + entityId: string; + config: EntityDict['application']['Schema']['config']; + }, + context: Cxt + ) => Promise; }; export type AspectDict> = GeneralAspectDict; \ No newline at end of file diff --git a/src/aspects/config.ts b/src/aspects/config.ts index fd82918b9..3cb2dbffc 100644 --- a/src/aspects/config.ts +++ b/src/aspects/config.ts @@ -19,4 +19,33 @@ export async function updateConfig +>( + params: { + entity: 'application'; + entityId: string; + config: EntityDict['application']['Schema']['config']; + }, + context: Cxt +) { + const { entity, entityId, config } = params; + await context.operate( + entity, + { + id: generateNewId(), + action: 'update', + data: { + config, + }, + filter: { + id: entityId, + }, + }, + {} + ); } \ No newline at end of file diff --git a/src/aspects/index.ts b/src/aspects/index.ts index a03bd06aa..e5a89771b 100644 --- a/src/aspects/index.ts +++ b/src/aspects/index.ts @@ -7,8 +7,7 @@ import { } from './token'; import { getUploadInfo } from './extraFile'; import { getApplication } from './application'; -import { updateConfig } from './config'; -// import commonAspectDict from 'oak-common-aspect'; +import { updateConfig, updateApplicationConfig } from './config'; export const aspectDict = { loginByMobile, @@ -19,6 +18,5 @@ export const aspectDict = { sendCaptcha, getApplication, updateConfig, -}; - -// export type AspectDict = TokenAD & CrudAD; \ No newline at end of file + updateApplicationConfig, +}; \ No newline at end of file diff --git a/src/components/config/application/index.ts b/src/components/config/application/index.ts index dbb809194..5983f4849 100644 --- a/src/components/config/application/index.ts +++ b/src/components/config/application/index.ts @@ -78,7 +78,7 @@ export default OakComponent({ const { currentConfig } = this.state; const { entity, entityId } = this.props; - await this.features.config.updateConfig( + await this.features.config.updateApplicationConfig( entity, entityId, currentConfig diff --git a/src/components/config/application/web.pc.tsx b/src/components/config/application/web.pc.tsx index aa5b3c1d4..9bce878e0 100644 --- a/src/components/config/application/web.pc.tsx +++ b/src/components/config/application/web.pc.tsx @@ -18,13 +18,14 @@ import { WebComponentProps } from 'oak-frontend-base'; type Config = WebConfig | WechatPublicConfig | WechatMpConfig; function AppView(props: { + isService?: boolean; type: AppType; config: Config; setValue: (path: string, value: string) => void; removeItem: (path: string, index: number) => void; cleanKey: (path: string, key: string) => void; }) { - const { type, config, setValue, removeItem, cleanKey } = props; + const { type, config, setValue, removeItem, cleanKey, isService } = props; if (type === 'web') { return ( setValue(path, value)} removeItem={(path, index) => removeItem(path, index)} @@ -69,6 +71,7 @@ export default function render( currentConfig: Config; dirty: boolean; type: AppType; + isService?: boolean; //只对type为wechatPublic有效 默认配置服务号 }, { resetConfig: () => void; @@ -79,7 +82,14 @@ export default function render( } > ) { - const { entity, name, type, currentConfig, dirty } = props.data; + const { + entity, + name, + type, + currentConfig, + dirty, + isService = true, + } = props.data; const { resetConfig, updateConfig, setValue, removeItem, cleanKey } = props.methods; @@ -143,6 +153,7 @@ export default function render( label: '参数设置', children: ( diff --git a/src/components/config/application/wechatPublic/index.tsx b/src/components/config/application/wechatPublic/index.tsx index 1127e4a52..2ec31c06b 100644 --- a/src/components/config/application/wechatPublic/index.tsx +++ b/src/components/config/application/wechatPublic/index.tsx @@ -24,6 +24,7 @@ import { export default function WechatPublic(props: { + isService?: boolean; config: WechatPublicConfig; setValue: (path: string, value: any) => void; removeItem: (path: string, index: number) => void; @@ -32,7 +33,7 @@ export default function WechatPublic(props: { const [open, setModal] = useState(false); const [messageType, setMessageType] = useState(''); - const { config, setValue, cleanKey, removeItem } = props; + const { config, setValue, cleanKey, removeItem, isService = true } = props; const templateMsgs = config?.templateMsgs || {}; return ( @@ -93,139 +94,150 @@ export default function WechatPublic(props: { /> - - <> - - setValue( - `isService`, - checked - ) - } - /> - - + {isService && ( + + <> + + setValue( + `isService`, + checked + ) + } + /> + + + )} ), }, ]} > - - - 微信公众号-模版 - - 0)} - onEdit={(targetKey: any, action: 'add' | 'remove') => { - if (action === 'add') { - setModal(true); - } else { - cleanKey(`templateMsgs`, targetKey); - } - }} - items={ - Object.keys(templateMsgs).length > 0 - ? Object.keys(templateMsgs).map((name, idx) => { - const templateId = templateMsgs[name]; - return { - key: `${name}`, - label: `${name}`, - children: ( -

- + + 微信公众号-模版 + + 0)} + onEdit={(targetKey: any, action: 'add' | 'remove') => { + if (action === 'add') { + setModal(true); + } else { + cleanKey(`templateMsgs`, targetKey); + } + }} + items={ + Object.keys(templateMsgs).length > 0 + ? Object.keys(templateMsgs).map((name, idx) => { + const templateId = templateMsgs[name]; + return { + key: `${name}`, + label: `${name}`, + children: ( + - <> - - setValue( - `templateMsgs.${name}`, - e.target.value - ) - } - /> - - -
- ), - }; - }) - : [] - } - > - { - setModal(false); - setMessageType(''); - }} - onOk={() => { - if (!messageType) { - message.error({ - content: '请输入标签名称', - }); - return; + + <> + + setValue( + `templateMsgs.${name}`, + e.target + .value + ) + } + /> + + + + ), + }; + }) + : [] } - if (Object.keys(templateMsgs).includes(messageType)) { - message.error({ - content: '已存在相同的标签名,请重新输入', - }); - return; - } - setValue(`templateMsgs.${messageType}`, ''); - setModal(false); - setMessageType(''); - }} - open={open} - cancelText="取消" - okText="确定" - destroyOnClose={true} - > -
+ { + setModal(false); + setMessageType(''); + }} + onOk={() => { + if (!messageType) { + message.error({ + content: '请输入标签名称', + }); + return; + } + if ( + Object.keys(templateMsgs).includes(messageType) + ) { + message.error({ + content: '已存在相同的标签名,请重新输入', + }); + return; + } + setValue(`templateMsgs.${messageType}`, ''); + setModal(false); + setMessageType(''); + }} + open={open} + cancelText="取消" + okText="确定" + destroyOnClose={true} > - - <> - - setMessageType( - e.target.value.replace( - /[0-9-.]/g, - '' + + + <> + + setMessageType( + e.target.value.replace( + /[0-9-.]/g, + '' + ) ) - ) - } - /> - - - -
- + } + /> + + + +
+ + )} ); } \ No newline at end of file diff --git a/src/components/config/style/index.module.less b/src/components/config/style/index.module.less new file mode 100644 index 000000000..7c0f8675f --- /dev/null +++ b/src/components/config/style/index.module.less @@ -0,0 +1,5 @@ + + +.box { + display: block; +} \ No newline at end of file diff --git a/src/components/config/style/index.tsx b/src/components/config/style/index.tsx new file mode 100644 index 000000000..f1345b91a --- /dev/null +++ b/src/components/config/style/index.tsx @@ -0,0 +1,84 @@ +import React from 'react'; +import { Button, Form, Input, Tooltip, Tabs } from 'antd'; +import { Style as StyleType, ColorType } from '../../../types/Style'; +import { set, get } from 'oak-domain/lib/utils/lodash'; + +import Style from './index.module.less'; + +type StyleProps = { + value?: StyleType | null; + onChange: (value: StyleType) => void; +}; + +const Colors: ColorType[] = ['primary', 'success', 'error', 'warning', 'info']; + +function Color(props: { value: StyleType['color'], setValue: (path: string, value: string) => void }) { + const { value = {}, setValue } = props;; + return ( +
+ {Colors.map((ele) => ( + + <> + { + setValue(ele, e.target.value); + }} + value={get(value, ele)} + /> + + + ))} +
+ ); +} + +export default function Render(props: StyleProps) { + const { value: styleValue, onChange } = props; + + const setStyle = (path: string, value: string) => { + const newStyle = set(styleValue || {}, path, value); + onChange(newStyle); + }; + + return ( +
+ {}} + type="card" + items={[ + { + label: '颜色', + key: 'color', + component: Color, + }, + ].map((ele, i) => { + const ItemComponent = ele.component; + return { + label: ele.label, + key: ele.key, + children: ( + { + setStyle(`${ele.key}.${path}`, value); + }} + /> + ), + }; + })} + /> +
+ ); +} + diff --git a/src/components/extraFile/gallery/index.json b/src/components/extraFile/gallery/index.json index 9832a9bcc..7214fb2f0 100644 --- a/src/components/extraFile/gallery/index.json +++ b/src/components/extraFile/gallery/index.json @@ -1,7 +1,7 @@ { "component": true, "usingComponents": { - "t-icon": "../../../miniprogram_npm/tdesign/icon/icon" + "l-icon": "../../../miniprogram_npm/lin-ui/icon/index" }, "componentGenerics": { "item": true diff --git a/src/components/extraFile/gallery/index.xml b/src/components/extraFile/gallery/index.xml index 205a2decf..02ba6827f 100644 --- a/src/components/extraFile/gallery/index.xml +++ b/src/components/extraFile/gallery/index.xml @@ -14,7 +14,7 @@ - + \ No newline at end of file diff --git a/src/components/message/cell/index.ts b/src/components/message/cell/index.ts new file mode 100644 index 000000000..a6e17eedd --- /dev/null +++ b/src/components/message/cell/index.ts @@ -0,0 +1,24 @@ +export default OakComponent({ + isList: false, + entity: 'message', + projection: { + id: 1, + $$createAt$$: 1, + type: 1, + title: 1, + content: 1, + visitState: 1, + userId: 1, + user: { + id: 1, + name: 1, + }, + params: 1, + props: 1, + }, + formData: function ({ data: message, features, props }) { + return message || {}; + }, + methods: {}, + actions: ['visit'], +}); diff --git a/src/components/message/cell/web.module.less b/src/components/message/cell/web.module.less new file mode 100644 index 000000000..8e3a0e282 --- /dev/null +++ b/src/components/message/cell/web.module.less @@ -0,0 +1,46 @@ +.list { + padding: 10px 20px 10px 31px; + border-bottom: 1px solid #ddd; + cursor: pointer; + position: relative; +} + +.list__notify { + margin-bottom: 5px; + display: flex; + flex-direction: row; + justify-content: space-between; + + .notify_mask { + // display: none; + color: var(--oak-color-primary); + flex-grow: 0; + flex-shrink: 0; + white-space: nowrap; + font-size: 12px; + } + + .notify_deadline { + color: #000; + font-weight: 600; + line-height: 20px; + flex: 1 1 auto; + min-width: 20px; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + } +} + +.list__info { + display: flex; + flex-direction: row; + justify-content: space-between; + + + .create_time { + color: rgba(0, 0, 0, .4); + line-height: 20px; + font-size: 12px; + } +} \ No newline at end of file diff --git a/src/components/message/cell/web.tsx b/src/components/message/cell/web.tsx new file mode 100644 index 000000000..d6f1b645a --- /dev/null +++ b/src/components/message/cell/web.tsx @@ -0,0 +1,107 @@ +import React from 'react'; +import { Tag, Badge } from 'antd'; +import dayjs from 'dayjs'; +import Style from './web.module.less'; + +import { WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../general-app-domain'; + +const MessageType = { + adminNotification: '系统通知', + conversationMessage: '客服消息', +}; + +// success、 processing、error、default、warning +const MessageTypeToColor = { + adminNotification: 'processing', + conversationMessage: 'warning', +}; + + +export default function Render( + props: WebComponentProps< + EntityDict, + 'message', + false, + { + onItemClicked: (item: { + id: string; + params: EntityDict['message']['Schema']['params']; + }) => void; + $$createAt$$: number; + type: string; + title: string; + params: EntityDict['message']['Schema']['params']; + visitState: EntityDict['message']['Schema']['visitState']; + id: string; + }, + {} + > +) { + const { data, methods } = props; + const { + id, + params, + title, + type, + $$createAt$$, + visitState, + oakLegalActions = [], + onItemClicked, + } = data; + const { navigateTo, execute } = methods; + + return ( +
{ + onItemClicked({ + id, + params, + }); + } + : undefined + } + > +
+ {visitState === 'unvisited' && ( + + )} +
{title}
+ {oakLegalActions.includes('visit') && ( +
{ + execute('visit', false); + event.stopPropagation(); + }} + > + 标记已读 +
+ )} +
+
+
+ + {MessageType[type as keyof typeof MessageType]} + +
+ +
+ {dayjs($$createAt$$).format('YYYY-MM-DD HH:mm:ss')} +
+
+
+ ); +} diff --git a/src/components/message/cellButton/index.ts b/src/components/message/cellButton/index.ts new file mode 100644 index 000000000..7ab5cd5ce --- /dev/null +++ b/src/components/message/cellButton/index.ts @@ -0,0 +1,22 @@ +export default OakComponent({ + entity: 'message', + isList: false, + formData({ data }) { + return {}; + }, + actions: ['visit'], + methods: { + async tapAction(action: string) { + const { oakId: id } = this.props; + switch (action) { + case 'visit': { + this.execute('visit', false); + break; + } + default: { + break; + } + } + }, + }, +}); diff --git a/src/components/message/cellButton/web.module.less b/src/components/message/cellButton/web.module.less new file mode 100644 index 000000000..e69de29bb diff --git a/src/components/message/cellButton/web.tsx b/src/components/message/cellButton/web.tsx new file mode 100644 index 000000000..bd506e156 --- /dev/null +++ b/src/components/message/cellButton/web.tsx @@ -0,0 +1,46 @@ +import React from 'react'; +import { Button, Modal } from 'antd'; +import { WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../general-app-domain'; + +export default function Render( + props: WebComponentProps< + EntityDict, + 'message', + false, + {}, + { + tapAction: (action: string) => void; + } + > +) { + const { data, methods } = props; + const { t, tapAction } = methods; + const { oakLegalActions } = data; + + return oakLegalActions && oakLegalActions?.length > 0 + ? oakLegalActions.map((ele: string) => { + return ( + + ); + }) + : null; +} diff --git a/src/components/message/index.xml b/src/components/message/index.xml index e523fe35b..f0536c57d 100644 --- a/src/components/message/index.xml +++ b/src/components/message/index.xml @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/components/my/info/web.tsx b/src/components/my/info/web.tsx index 2b402b0b6..4c4da8ea1 100644 --- a/src/components/my/info/web.tsx +++ b/src/components/my/info/web.tsx @@ -1,5 +1,6 @@ -import { WebComponentProps } from 'oak-frontend-base'; import React, { useState } from 'react'; + +import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../general-app-domain'; import Styles from './web.pc.module.less'; import { Button, List, Popup, Tag, Input, Radio, Form, Space } from 'antd-mobile'; diff --git a/src/components/my/message/index.ts b/src/components/my/message/index.ts new file mode 100644 index 000000000..09cb495ca --- /dev/null +++ b/src/components/my/message/index.ts @@ -0,0 +1,39 @@ + +export default OakComponent({ + isList: false, + lifetimes: { + attached() { + this.getMessageCount(); + }, + }, + data: { + count: undefined, + }, + methods: { + goMessageList() { + this.navigateTo({ + url: '/message/list', + }); + }, + async getMessageCount() { + const userId = this.features.token.getUserId(true); + const application = this.features.application.getApplication(); + const { systemId } = application; + if (userId) { + const result = await this.features.cache.count('message', { + data: { + id: 1, + }, + filter: { + userId, + systemId, + visitState: 'unvisited', + }, + }); + this.setState({ + count: result, + }); + } + }, + }, +}); diff --git a/src/components/my/message/mobile.module.less b/src/components/my/message/mobile.module.less new file mode 100644 index 000000000..9594d0233 --- /dev/null +++ b/src/components/my/message/mobile.module.less @@ -0,0 +1,4 @@ + .icon { + font-size: 20px; + color: var(--oak-color-primary); + } \ No newline at end of file diff --git a/src/components/my/message/web.module.less b/src/components/my/message/web.module.less new file mode 100644 index 000000000..42071e75e --- /dev/null +++ b/src/components/my/message/web.module.less @@ -0,0 +1,8 @@ +.btn { + padding-inline-start: 5px; + padding-inline-end: 5px; +} + +.icon { + font-size: 20px; +} \ No newline at end of file diff --git a/src/components/my/message/web.pc.tsx b/src/components/my/message/web.pc.tsx new file mode 100644 index 000000000..ed857947a --- /dev/null +++ b/src/components/my/message/web.pc.tsx @@ -0,0 +1,48 @@ +import React, { useState } from 'react'; +import { Button, Badge } from 'antd'; +import { BellOutlined } from '@ant-design/icons'; +import { WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../general-app-domain'; +import MessageDrawerList from '../../../pages/message/drawerList'; + +import Style from './web.module.less'; + +export default function Render( + props: WebComponentProps< + EntityDict, + 'user', + false, + { + count?: number; + }, + { + goMessageList: () => void; + } + > +) { + const { data } = props; + const { count } = data; + const [open, setOpen] = useState(false); + + return ( + <> + + + )} + + + + + ); +} diff --git a/src/pages/message/detail/web.tsx b/src/pages/message/detail/web.tsx new file mode 100644 index 000000000..f2eb8d18e --- /dev/null +++ b/src/pages/message/detail/web.tsx @@ -0,0 +1,54 @@ +import React from 'react'; +import { + Card, + Button, +} from 'antd'; +import { EntityDict } from '../../../general-app-domain'; +import { WebComponentProps } from 'oak-frontend-base'; +import Style from './mobile.module.less'; + + +export default function Render( + props: WebComponentProps< + EntityDict, + 'message', + false, + { + title: string; + content: string; + id: string; + $$createAt$$: number; + type: string; + visitState: EntityDict['message']['Schema']['visitState']; + params: EntityDict['message']['Schema']['params']; + }, + { + goPage: () => void; + } + > +) { + const { data, methods } = props; + const { title, content, params } = data; + const { t, goPage } = methods; + const pathname = params?.pathname; + + return ( +
+

{title}

+
{content}
+ + {pathname && ( + + )} +
+ ); +} diff --git a/src/pages/message/drawerList/index.json b/src/pages/message/drawerList/index.json new file mode 100644 index 000000000..a07c620d3 --- /dev/null +++ b/src/pages/message/drawerList/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "消息", + "oakDisablePulldownRefresh": true +} diff --git a/src/pages/message/drawerList/index.ts b/src/pages/message/drawerList/index.ts new file mode 100644 index 000000000..2c3398fd4 --- /dev/null +++ b/src/pages/message/drawerList/index.ts @@ -0,0 +1,67 @@ + +export default OakComponent({ + entity: 'message', + isList: true, + projection: { + id: 1, + $$createAt$$: 1, + type: 1, + title: 1, + content: 1, + visitState: 1, + userId: 1, + user: { + id: 1, + name: 1, + }, + params: 1, + props: 1, + }, + filters: [ + { + filter: ({ features, props }) => { + const userId = features.token.getUserId(true); + const application = features.application.getApplication(); + const { systemId } = application; + + return { + userId, + // systemId, + // visitState: 'unvisited', + }; + }, + }, + ], + sorters: [ + { + sorter: () => { + return { + $attr: { + $$createAt$$: 1, + }, + $direction: 'desc', + }; + }, + }, + ], + formData: function ({ data: messages, features, props }) { + const pagination = this.getPagination(); + return { + messages, + pagination, + }; + }, + methods: { + goDetailById(id: string) { + this.navigateTo({ + url: `/message/detail`, + oakId: id, + }); + }, + goMessageList() { + this.navigateTo({ + url: '/message/list', + }); + }, + }, +}); diff --git a/src/pages/message/drawerList/web.module.less b/src/pages/message/drawerList/web.module.less new file mode 100644 index 000000000..ea50e8b2c --- /dev/null +++ b/src/pages/message/drawerList/web.module.less @@ -0,0 +1,6 @@ +/** index.wxss **/ +.container { + display: flex; + flex-direction: column; + background-color: var(--oak-bg-color-page); +} \ No newline at end of file diff --git a/src/pages/message/drawerList/web.tsx b/src/pages/message/drawerList/web.tsx new file mode 100644 index 000000000..49f1acf16 --- /dev/null +++ b/src/pages/message/drawerList/web.tsx @@ -0,0 +1,92 @@ +import React from 'react'; +import { Button, Space, Drawer } from 'antd'; +import Style from './web.module.less'; +import MessageCell from '../../../components/message/cell'; +import Empty from '../../../components/common/empty'; + +import { WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../general-app-domain'; + + + + +export default function Render( + props: WebComponentProps< + EntityDict, + 'message', + false, + { + messages: EntityDict['message']['Schema'][]; + onClose: () => void; + open: boolean; + }, + { + goDetailById: (id: string) => void; + goMessageList: () => void; + } + > +) { + const { data, methods } = props; + const { messages, open, onClose, oakFullpath } = data; + const { goDetailById, goMessageList } = methods; + + return ( + + + + } + bodyStyle={{ + padding: 0, + }} + destroyOnClose={true} + > +
+ {messages?.length > 0 ? ( +
+ {messages?.map((message, index: number) => ( + { + const { params, id } = item; + onClose && onClose(); + goDetailById(id); + }} + /> + ))} +
+ ) : ( +
+ +
+ )} +
+
+ ); +} diff --git a/src/pages/message/list/index.json b/src/pages/message/list/index.json new file mode 100644 index 000000000..23ae42df6 --- /dev/null +++ b/src/pages/message/list/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "消息通知", + "usingComponents": {} +} diff --git a/src/pages/message/list/index.ts b/src/pages/message/list/index.ts new file mode 100644 index 000000000..e69c4d44f --- /dev/null +++ b/src/pages/message/list/index.ts @@ -0,0 +1,62 @@ + +export default OakComponent({ + entity: 'message', + isList: true, + projection: { + id: 1, + $$createAt$$: 1, + type: 1, + title: 1, + content: 1, + visitState: 1, + userId: 1, + user: { + id: 1, + name: 1, + }, + params: 1, + props: 1, + }, + filters: [ + { + filter: ({ features, props }) => { + const userId = features.token.getUserId(true); + const application = features.application.getApplication(); + const { systemId } = application; + + return { + userId, + // systemId, + // visitState: 'unvisited', + }; + }, + }, + ], + sorters: [ + { + sorter: () => { + return { + $attr: { + $$createAt$$: 1, + }, + $direction: 'desc', + }; + }, + }, + ], + formData: function ({ data: messages, features, props }) { + const pagination = this.getPagination(); + return { + messages, + pagination, + }; + }, + methods: { + goDetailById(id: string) { + this.navigateTo({ + url: `/message/detail`, + oakId: id, + }); + }, + }, +}); diff --git a/src/pages/message/list/mobile.module.less b/src/pages/message/list/mobile.module.less new file mode 100644 index 000000000..ea50e8b2c --- /dev/null +++ b/src/pages/message/list/mobile.module.less @@ -0,0 +1,6 @@ +/** index.wxss **/ +.container { + display: flex; + flex-direction: column; + background-color: var(--oak-bg-color-page); +} \ No newline at end of file diff --git a/src/pages/message/list/web.module.less b/src/pages/message/list/web.module.less new file mode 100644 index 000000000..b8e6934cf --- /dev/null +++ b/src/pages/message/list/web.module.less @@ -0,0 +1,7 @@ +/** index.wxss **/ +.container { + background: var(--oak-bg-color-container); + box-shadow: 0 2px 3px #0000001a; + border-radius: 3px; + padding: 30px 32px; +} \ No newline at end of file diff --git a/src/pages/message/list/web.pc.tsx b/src/pages/message/list/web.pc.tsx new file mode 100644 index 000000000..fdaff4358 --- /dev/null +++ b/src/pages/message/list/web.pc.tsx @@ -0,0 +1,161 @@ +import React from 'react'; +import { Button, Badge, Table, Space, Typography } from 'antd'; +import dayjs from 'dayjs'; +import Style from './web.module.less'; +import PageHeader from '../../../components/common/pageHeader'; +import CellButton from '../../../components/message/cellButton'; + +import { WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../general-app-domain'; + +const MessageType = { + adminNotification: '系统通知', + conversationMessage: '客服消息', +}; + + +export default function Render( + props: WebComponentProps< + EntityDict, + 'message', + true, + { + pagination?: { + pageSize: number; + total: number; + currentPage: number; + }; + messages: EntityDict['message']['Schema'][]; + }, + { + goDetailById: (id: string) => void; + } + > +) { + const { data, methods } = props; + const { t, setPageSize, setCurrentPage, goDetailById } = methods; + const { messages, oakFullpath, oakLoading, pagination } = data; + const { pageSize, total, currentPage } = pagination || {}; + + return ( + +
+ { + // return index + 1; + // }, + // }, + { + dataIndex: 'title', + title: '消息内容', + render: (value, record, index) => { + if (record.visitState === 'unvisited') { + return ( + <> + + { + goDetailById(record.id); + }} + > + {value} + + + ); + } + return ( + { + goDetailById(record.id); + }} + > + {value} + + ); + }, + }, + { + dataIndex: 'type', + title: '类型', + render: (value, record, index) => { + return MessageType[ + value as keyof typeof MessageType + ]; + }, + }, + { + dataIndex: 'visitState', + title: '是否已读', + render: (value, record, index) => { + return value === 'unvisited' ? '未读' : '已读'; + }, + }, + { + dataIndex: '$$createAt$$', + title: '接收时间', + render: (value, record, index) => { + return ( +
+ {dayjs(value).format( + 'YYYY-MM-DD HH:mm:ss' + )} +
+ ); + }, + }, + { + dataIndex: 'op', + width: 300, + title: '操作', + align: 'center', + render: (value, record, index) => { + return ( + + + + + ); + }, + fixed: 'right', + }, + ]} + pagination={{ + total: total, + pageSize: pageSize, + current: currentPage, + onShowSizeChange: ( + current: number, + pageSize: number + ) => { + setPageSize(pageSize); + }, + onChange: (page: number, pageSize: number) => { + setCurrentPage(page); + }, + }} + /> + + + ); +} diff --git a/src/pages/message/list/web.tsx b/src/pages/message/list/web.tsx new file mode 100644 index 000000000..8f0a287d9 --- /dev/null +++ b/src/pages/message/list/web.tsx @@ -0,0 +1,57 @@ +import React from 'react'; +import { Tag, Badge } from 'antd'; +import Style from './mobile.module.less'; +import MessageCell from '../../../components/message/cell'; +import Empty from '../../../components/common/empty'; + +import { WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../general-app-domain'; + + +export default function Render( + props: WebComponentProps< + EntityDict, + 'message', + true, + { + messages: EntityDict['message']['Schema'][]; + }, + { + goDetailById: (id: string) => void; + } + > +) { + const { data, methods } = props; + const { messages, oakFullpath } = data; + const { goDetailById } = methods; + + return ( +
+ {messages?.length > 0 ? ( +
+ {messages?.map((message, index: number) => ( + { + goDetailById(item.id); + }} + /> + ))} +
+ ) : ( +
+ +
+ )} +
+ ); +} diff --git a/src/pages/platform/detail/index.ts b/src/pages/platform/detail/index.ts index cca66eff4..7008e0da1 100644 --- a/src/pages/platform/detail/index.ts +++ b/src/pages/platform/detail/index.ts @@ -6,6 +6,7 @@ export default OakComponent({ name: 1, config: 1, description: 1, + style: 1, }, formData({ data }) { return data || {}; diff --git a/src/pages/platform/detail/web.tsx b/src/pages/platform/detail/web.tsx index b98682006..8e973a695 100644 --- a/src/pages/platform/detail/web.tsx +++ b/src/pages/platform/detail/web.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Tabs, Card, Descriptions } from 'antd'; +import { Tabs, Card, Descriptions, Typography } from 'antd'; import PageHeader from '../../../components/common/pageHeader'; import SystemList from '../../system/list'; @@ -42,11 +42,27 @@ export default function Render( { label: '平台信息', key: 'detail', - children: - {oakId} - {name} - {description} - , + children: ( + + + + {oakId} + + + + {name} + + + {description} + + + ), }, { label: '系统管理', diff --git a/src/pages/platform/upsert/index.ts b/src/pages/platform/upsert/index.ts index 4b30e7bbd..c10c206dc 100644 --- a/src/pages/platform/upsert/index.ts +++ b/src/pages/platform/upsert/index.ts @@ -6,6 +6,7 @@ export default OakComponent({ name: 1, config: 1, description: 1, + style: 1, }, formData({ data }) { return data || {}; @@ -14,6 +15,6 @@ export default OakComponent({ async confirm() { await this.execute(); this.navigateBack(); - } + }, }, }); diff --git a/src/pages/platform/upsert/web.pc.tsx b/src/pages/platform/upsert/web.pc.tsx index a118f6b71..4ecdc12d0 100644 --- a/src/pages/platform/upsert/web.pc.tsx +++ b/src/pages/platform/upsert/web.pc.tsx @@ -1,6 +1,8 @@ import React from 'react'; import { Button, Form, Row, Col, Input, Space } from 'antd'; import PageHeader from '../../../components/common/pageHeader'; +import ComponentStyle from '../../../components/config/style'; + import Style from './web.module.less'; @@ -15,13 +17,14 @@ export default function Render( { name: string; description: string; + style: EntityDict['system']['Schema']['style']; }, { confirm: () => void; } > ) { - const { name, description } = props.data; + const { name, description, style } = props.data; const { t, update, navigateBack, confirm } = props.methods; return ( @@ -70,6 +73,23 @@ export default function Render( /> + + <> + { + update({ + style: value, + }); + }} + value={style} + /> + + + + + +
{ + // return index + 1; + // }, + // }, + { + dataIndex: 'name', + title: '订阅号名称', + width: 300, + render: (value, record, index) => { + return ( + { + goDetail(record.id); + }} + > + {value} + + ); + }, + }, + { + dataIndex: 'description', + title: '描述', + width: 200, + ellipsis: true, + }, + { + dataIndex: 'config', + title: '配置', + align: 'center', + render: (value, record, index) => { + return ( + <> + + + ); + }, + }, + { + dataIndex: 'op', + width: 200, + title: '操作', + align: 'center', + render: (value, record, index) => { + return ( + <> + + + + + ); + }, + fixed: 'right', + }, + ]} + pagination={{ + total, + pageSize, + current: currentPage, + onShowSizeChange: (pageSize: number) => { + setPageSize(pageSize); + }, + onChange: (current: number) => { + setCurrentPage(current); + }, + }} + /> + + ); +} + +function Container(props: { + children: React.ReactNode; + variant?: 'inline' | 'alone' | 'dialog'; + showBack?: boolean; +}) { + const { children, variant = 'alone', showBack } = props; + if (['inline', 'dialog'].includes(variant)) { + return <>{children}; + } + return ( + +
{children}
+
+ ); +} diff --git a/src/pages/subscription/upsert/index.ts b/src/pages/subscription/upsert/index.ts new file mode 100644 index 000000000..3c435e547 --- /dev/null +++ b/src/pages/subscription/upsert/index.ts @@ -0,0 +1,39 @@ + + +export default OakComponent({ + isList: false, + entity: 'subscription', + projection: { + id: 1, + name: 1, + config: 1, + description: 1, + entity: 1, + entityId: 1, + }, + formData({ data }) { + return data || {}; + }, + data: { + }, + lifetimes: { + ready() { + const { entityId, entity, oakId } = this.props; + + if (!oakId) { + if (entityId) { + this.update({ + entityId, + entity, + }); + } + } + }, + }, + methods: { + async confirm() { + await this.execute(); + this.navigateBack(); + }, + }, +}); diff --git a/src/pages/subscription/upsert/web.module.less b/src/pages/subscription/upsert/web.module.less new file mode 100644 index 000000000..9f3d17c7f --- /dev/null +++ b/src/pages/subscription/upsert/web.module.less @@ -0,0 +1,6 @@ +.container { + background: var(--oak-bg-color-container); + box-shadow: 0 2px 3px #0000001a; + border-radius: 3px; + padding: 30px 32px; +} \ No newline at end of file diff --git a/src/pages/subscription/upsert/web.pc.tsx b/src/pages/subscription/upsert/web.pc.tsx new file mode 100644 index 000000000..b6556ee6f --- /dev/null +++ b/src/pages/subscription/upsert/web.pc.tsx @@ -0,0 +1,136 @@ +import React from 'react'; +import { Button, Form, Row, Col, Select, Space, Input } from 'antd'; +import PageHeader from '../../../components/common/pageHeader'; +import Style from './web.module.less'; + +import { EntityDict } from '../../../general-app-domain'; +import { WebComponentProps } from 'oak-frontend-base'; + +export default function Render( + props: WebComponentProps< + EntityDict, + 'subscription', + false, + { + name: string; + description: string; + variant: 'inline' | 'alone' | 'dialog'; + showBack: boolean; + entity: string; + entityId: string; + oakId: string; + }, + { + confirm: () => void; + } + > +) { + const { + name, + description, + variant, + showBack = true, + entityId, + entity, + oakId, + } = props.data; + const { t, update, navigateBack, confirm } = props.methods; + return ( + + + + + + <> + { + update({ + name: e.target.value, + }); + }} + value={name} + /> + + + + <> + { + update({ + description: e.target.value, + }); + }} + value={description} + /> + + + + + + + + + + + + + + + + ); +} + +function Action(props: { + children: React.ReactNode; + variant?: 'inline' | 'alone' | 'dialog'; +}) { + const { children, variant } = props; + if (variant === 'dialog') { + return null; + } + return ( + <>{children} + ) +} + +function Container(props: { + children: React.ReactNode; + variant?: 'inline' | 'alone' | 'dialog'; + showBack?: boolean; +}) { + const { children, variant, showBack } = props; + if (variant === 'inline' || variant === 'dialog') { + return <>{children}; + } + return ( + +
{children}
+
+ ); +} diff --git a/src/pages/system/detail/web.tsx b/src/pages/system/detail/web.tsx index 755a40bc1..6cca31eff 100644 --- a/src/pages/system/detail/web.tsx +++ b/src/pages/system/detail/web.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Tabs, Card, Descriptions } from 'antd'; +import { Tabs, Card, Descriptions, Typography } from 'antd'; import PageHeader from '../../../components/common/pageHeader'; import ApplicationList from '../../../pages/application/list'; import DomainList from '../../../pages/domain/list'; @@ -50,7 +50,9 @@ export default function Render( children: ( - {oakId} + + {oakId} + { return value ? value.map((ele: { url: string }) => ( - + {ele.url} )) diff --git a/src/pages/system/upsert/web.pc.tsx b/src/pages/system/upsert/web.pc.tsx index 45a74fbfd..2a358590d 100644 --- a/src/pages/system/upsert/web.pc.tsx +++ b/src/pages/system/upsert/web.pc.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { Button, Form, Row, Col, Switch, Input, Space, Tooltip } from 'antd'; import PageHeader from '../../../components/common/pageHeader'; +import ComponentStyle from '../../../components/config/style'; import Style from './web.module.less'; import { set, get } from 'oak-domain/lib/utils/lodash'; @@ -40,12 +41,6 @@ export default function Render( } = props.data; const { t, update, navigateBack, confirm } = props.methods; - const setStyle = (path: string, value: string) => { - update({ - style: set(style || {}, path, value), - }); - }; - return ( @@ -130,29 +125,15 @@ export default function Render( - + <> - { - setStyle( - 'color.primary', - e.target.value - ); + { + update({ + style: value, + }); }} - value={get( - style || {}, - 'color.primary' - )} + value={style} /> diff --git a/src/triggers/message.ts b/src/triggers/message.ts index d8ff75061..aafe67610 100644 --- a/src/triggers/message.ts +++ b/src/triggers/message.ts @@ -69,7 +69,7 @@ async function tryAddMessageSent(message: CreateMessageData, channel: string, co data: dispersedData, channel, }, - }, {}); + } as EntityDict['messageSent']['CreateSingle'], {}); return 1; } diff --git a/src/types/Style.ts b/src/types/Style.ts index c760d025e..3de9893d8 100644 --- a/src/types/Style.ts +++ b/src/types/Style.ts @@ -1,9 +1,12 @@ +export type ColorType = 'primary' | 'success' | 'error' | 'warning' | 'info'; + export type Color = { - primary: string; - success?: string; - error?: string; - warning?: string; - info?: string; + // primary: string; + // success?: string; + // error?: string; + // warning?: string; + // info?: string; + [k in ColorType]?: string; }; diff --git a/src/utils/dialog/index.mp.ts b/src/utils/dialog/index.mp.ts index 962cc50a3..84306f1c5 100644 --- a/src/utils/dialog/index.mp.ts +++ b/src/utils/dialog/index.mp.ts @@ -1,4 +1,54 @@ -// @ts-ignore -import Dialog from '../../miniprogram_npm/tdesign/dialog/index'; +const DialogType = { + info: 'info', + success: 'success', + warning: 'warning', + error: 'error', + confirm: 'confirm', +}; -export default Dialog; +function getInstance(context: any, selector = '#oak-dialog') { + const instance = context.selectComponent(selector); + if (!instance) { + return Promise.reject( + new Error('未找到Dialog组件, 请检查selector是否正确') + ); + } + return instance; +} +function showDialog(options: Record, type = DialogType.info) { + const options2 = { ...options }; + const { context } = options2; + delete options.context; + const instance = getInstance(context); + instance.resetData(() => { + instance.setData(Object.assign({ type }, options), instance.show); + }); + return instance; +} + +const Message = { + info(options: Record) { + return showDialog(options, DialogType.info); + }, + success(options: Record) { + return showDialog(options, DialogType.success); + }, + warning(options: Record) { + return showDialog(options, DialogType.warning); + }, + error(options: Record) { + return showDialog(options, DialogType.error); + }, + confirm(options: Record) { + return showDialog(options, DialogType.confirm); + }, + hide(context: any) { + const instance = getInstance(context); + if (!instance) { + return; + } + instance.linHide(); + }, +}; + +export default Message; diff --git a/src/utils/message/index.mp.ts b/src/utils/message/index.mp.ts index 2fa258a1a..5b093b5e0 100644 --- a/src/utils/message/index.mp.ts +++ b/src/utils/message/index.mp.ts @@ -5,7 +5,7 @@ const MessageType = { error: 'error', }; -function getInstance(context: any, selector = '#t-message') { +function getInstance(context: any, selector = '#oak-message') { const instance = context.selectComponent(selector); if (!instance) { return Promise.reject(