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/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/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/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/entities/Subscription.d.ts b/lib/entities/Subscription.d.ts index d703bae55..322fe8770 100644 --- a/lib/entities/Subscription.d.ts +++ b/lib/entities/Subscription.d.ts @@ -1,4 +1,4 @@ -import { String, Text } from 'oak-domain/lib/types/DataType'; +import { String, Text, Int } from 'oak-domain/lib/types/DataType'; import { EntityShape } from 'oak-domain/lib/types/Entity'; export declare type WechatPublicConfig = { type: 'wechatPublic'; @@ -11,4 +11,5 @@ export interface Schema extends EntityShape { name: String<32>; 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/miniprogram_npm/lin-ui/album/index.less b/lib/miniprogram_npm/lin-ui/album/index.less index 558ca1aa8..e69de29bb 100644 --- a/lib/miniprogram_npm/lin-ui/album/index.less +++ b/lib/miniprogram_npm/lin-ui/album/index.less @@ -1,48 +0,0 @@ -/* miniprogram_npm/lin-ui/picture-album/index.wxss */ -.container { - display: grid; -} - -.vertical { - height: 360rpx; -} - -.parent { - display: inline-grid; - grid-template-columns: repeat(auto-fill); -} - -.child { - box-sizing: border-box; - background-color: white; - flex: 0 0 44%; - height: 100px; - border: 1px solid red; - margin-top: 4%; - margin-left: 2%; - margin-right: 2%; -} - -.dimback { - background: #000; -} - -.dim { - opacity: 0.6; - filter: alpha(opacity=60); -} - - -.imageContainer { - position: relative; -} - -.imageContainer:last-child>.text { - color: white; - font-weight: bold; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - font-size: larger; -} 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/upsert/index.js b/lib/pages/application/upsert/index.js index f6988d76e..fcddfc790 100644 --- a/lib/pages/application/upsert/index.js +++ b/lib/pages/application/upsert/index.js @@ -11,6 +11,7 @@ exports.default = OakComponent({ description: 1, type: 1, systemId: 1, + style: 1, }, formData: function (_a) { var data = _a.data; @@ -22,10 +23,10 @@ exports.default = OakComponent({ value: 'web', }, { - value: "wechatMp", + value: 'wechatMp', }, { - value: "wechatPublic", + value: 'wechatPublic', }, ], }, diff --git a/lib/pages/application/upsert/web.pc.d.ts b/lib/pages/application/upsert/web.pc.d.ts index c775ea403..90a5cdac0 100644 --- a/lib/pages/application/upsert/web.pc.d.ts +++ b/lib/pages/application/upsert/web.pc.d.ts @@ -13,6 +13,7 @@ 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/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 0fde0e02e..8703ed615 100644 --- a/lib/pages/domain/detail/web.d.ts +++ b/lib/pages/domain/detail/web.d.ts @@ -8,6 +8,7 @@ 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.js b/lib/pages/domain/list/web.pc.js index 6da24787f..cf3870980 100644 --- a/lib/pages/domain/list/web.pc.js +++ b/lib/pages/domain/list/web.pc.js @@ -22,6 +22,11 @@ function Render(props) { { dataIndex: 'url', title: '域名', + 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: 'apiPath', 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.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/upsert/index.js b/lib/pages/platform/upsert/index.js index 08d6c4dbe..36aef985d 100644 --- a/lib/pages/platform/upsert/index.js +++ b/lib/pages/platform/upsert/index.js @@ -9,6 +9,7 @@ exports.default = OakComponent({ name: 1, config: 1, description: 1, + style: 1, }, formData: function (_a) { var data = _a.data; @@ -27,6 +28,6 @@ exports.default = OakComponent({ } }); }); - } + }, }, }); diff --git a/lib/pages/platform/upsert/web.pc.d.ts b/lib/pages/platform/upsert/web.pc.d.ts index edcc6ab29..d7aefb70d 100644 --- a/lib/pages/platform/upsert/web.pc.d.ts +++ b/lib/pages/platform/upsert/web.pc.d.ts @@ -3,6 +3,7 @@ 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/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.js b/lib/pages/system/list/web.pc.js index aaabc5d66..57f3cc7a4 100644 --- a/lib/pages/system/list/web.pc.js +++ b/lib/pages/system/list/web.pc.js @@ -47,7 +47,7 @@ function Render(props) { title: '访问域名', render: function (value, record, index) { return value - ? value.map(function (ele) { return ((0, jsx_runtime_1.jsx)(antd_1.Space, { children: (0, jsx_runtime_1.jsx)(antd_1.Tag, { children: ele.url }) })); }) + ? value.map(function (ele) { return ((0, jsx_runtime_1.jsx)(antd_1.Space, tslib_1.__assign({ direction: "vertical" }, { children: (0, jsx_runtime_1.jsx)(antd_1.Tag, { children: ele.url }) }))); }) : ''; }, }, diff --git a/lib/pages/system/upsert/web.pc.js b/lib/pages/system/upsert/web.pc.js index a61b69b65..94aa5594d 100644 --- a/lib/pages/system/upsert/web.pc.js +++ b/lib/pages/system/upsert/web.pc.js @@ -4,16 +4,11 @@ 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")); -var lodash_1 = require("oak-domain/lib/utils/lodash"); function Render(props) { var _a = props.data, name = _a.name, description = _a.description, folder = _a.folder, super2 = _a.super, style = _a.style, variant = _a.variant, _b = _a.showBack, showBack = _b === void 0 ? true : _b; var _c = props.methods, t = _c.t, update = _c.update, navigateBack = _c.navigateBack, confirm = _c.confirm; - var setStyle = function (path, value) { - update({ - style: (0, lodash_1.set)(style || {}, path, value), - }); - }; 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, @@ -38,13 +33,11 @@ function Render(props) { update({ super: checked, }); - } }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u4E3B\u9898\u8272", requiredMark: true, name: "folder", tooltip: "\u8BBE\u7F6E\u7CFB\u7EDF\u4E3B\u9898\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) { - setStyle('color.primary', e.target.value); - }, value: (0, lodash_1.get)(style || {}, 'color.primary') }) }) })), (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/types/Style.d.ts b/lib/types/Style.d.ts index 9790ea60a..5b0330583 100644 --- a/lib/types/Style.d.ts +++ b/lib/types/Style.d.ts @@ -1,9 +1,6 @@ +export declare type ColorType = 'primary' | 'success' | 'error' | 'warning' | 'info'; export declare type Color = { - primary: string; - success?: string; - error?: string; - warning?: string; - info?: string; + [k in ColorType]?: string; }; export declare type Style = { color?: Color; diff --git a/package.json b/package.json index a0f8d79ca..86e45edb1 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,8 @@ "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/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/features/config.ts b/src/features/config.ts index cdba20056..13d76bf7b 100644 --- a/src/features/config.ts +++ b/src/features/config.ts @@ -13,10 +13,12 @@ export class Config< Cxt extends BackendRuntimeContext, FrontCxt extends FrontendRuntimeContext, AD extends AspectDict & CommonAspectDict - > extends Feature { +> extends Feature { private cache: Cache>; - constructor(cache: Cache>) { + constructor( + cache: Cache> + ) { super(); this.cache = cache; } @@ -24,12 +26,25 @@ export class Config< async updateConfig( entity: 'platform' | 'system', entityId: string, - config: ConfigDef, + config: ConfigDef ) { await this.cache.exec('updateConfig', { entity, entityId, - config + config, + }); + this.publish(); + } + + async updateApplicationConfig( + entity: 'application', + entityId: string, + config: EntityDict['application']['Schema']['config'] + ) { + await this.cache.exec('updateApplicationConfig', { + entity, + entityId, + config, }); this.publish(); } diff --git a/src/pages/application/detail/web.tsx b/src/pages/application/detail/web.tsx index a18a60430..ca415dbf5 100644 --- a/src/pages/application/detail/web.tsx +++ b/src/pages/application/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 Style from './web.module.less'; @@ -51,7 +51,9 @@ export default function Render( children: ( - {oakId} + + {oakId} + ; systemId: string; oakId: string; + style: EntityDict['system']['Schema']['style']; }, { confirm: () => void; @@ -39,6 +41,7 @@ export default function Render( showBack = true, systemId, oakId, + style, } = props.data; const { t, update, navigateBack, confirm } = props.methods; return ( @@ -115,6 +118,19 @@ export default function Render( + + <> + { + update({ + style: value, + }); + }} + value={style} + /> + + + diff --git a/src/pages/domain/detail/index.ts b/src/pages/domain/detail/index.ts index 6ba35835c..5e6a9c3f6 100644 --- a/src/pages/domain/detail/index.ts +++ b/src/pages/domain/detail/index.ts @@ -4,6 +4,10 @@ export default OakComponent({ projection: { id: 1, systemId: 1, + system: { + id: 1, + name: 1, + }, url: 1, apiPath: 1, port: 1, diff --git a/src/pages/domain/detail/web.tsx b/src/pages/domain/detail/web.tsx index cdd37ee94..6501ace63 100644 --- a/src/pages/domain/detail/web.tsx +++ b/src/pages/domain/detail/web.tsx @@ -1,7 +1,6 @@ import React from 'react'; -import { Tabs, Card } from 'antd'; +import { Tabs, Card, Descriptions, Typography } from 'antd'; import PageHeader from '../../../components/common/pageHeader'; -import ApplicationList from '../../../pages/application/list'; import Style from './web.module.less'; @@ -21,13 +20,15 @@ export default function Render( port: string; protocol: EntityDict['domain']['Schema']['protocol']; tabValue: 'detail'; + system: EntityDict['system']['Schema']; }, { onTabClick: (key: string) => void; } > ) { - const { oakId, url, tabValue } = props.data; + const { oakId, url, tabValue, system, apiPath, protocol, port } = + props.data; const { t, navigateBack, onTabClick } = props.methods; return ( @@ -42,7 +43,43 @@ export default function Render( { label: '域名概览', key: 'detail', - children:
详情
, + children: ( + + + + {oakId} + + + + {url} + + + {apiPath} + + + {port} + + + {protocol} + + + {system?.name} + + + ), }, ]} /> diff --git a/src/pages/domain/list/web.pc.tsx b/src/pages/domain/list/web.pc.tsx index eaff16570..3bf437642 100644 --- a/src/pages/domain/list/web.pc.tsx +++ b/src/pages/domain/list/web.pc.tsx @@ -75,6 +75,17 @@ export default function Render( { dataIndex: 'url', title: '域名', + render: (value, record, index) => { + return ( + { + goDetail(record.id); + }} + > + {value} + + ); + }, }, { dataIndex: 'apiPath', 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} + /> + + +