build 及 style配置

This commit is contained in:
Wang Kejun 2022-12-21 13:20:06 +08:00
parent c4557e65ff
commit 0ce7322c32
54 changed files with 461 additions and 149 deletions

View File

@ -44,6 +44,11 @@ declare type GeneralAspectDict<ED extends EntityDict, Cxt extends BackendRuntime
entityId: string;
config: Config;
}, context: Cxt) => Promise<void>;
updateApplicationConfig: (params: {
entity: 'application';
entityId: string;
config: EntityDict['application']['Schema']['config'];
}, context: Cxt) => Promise<void>;
};
export declare type AspectDict<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>> = GeneralAspectDict<ED, Cxt>;
export {};

View File

@ -6,3 +6,8 @@ export declare function updateConfig<ED extends EntityDict, Cxt extends BackendR
entityId: string;
config: Config;
}, context: Cxt): Promise<void>;
export declare function updateApplicationConfig<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
entity: 'application';
entityId: string;
config: EntityDict['application']['Schema']['config'];
}, context: Cxt): Promise<void>;

View File

@ -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;

View File

@ -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;
};

View File

@ -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<ED extends EntityDict & BaseEntityDict> = TokenAD<ED> & CrudAD<ED>;

View File

@ -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({

View File

@ -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 {};

View File

@ -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;

View File

@ -0,0 +1,5 @@
.box {
display: block;
}

View File

@ -1 +1 @@
<l-message />
<l-message id="#oak-message" />

View File

@ -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>;
}

View File

@ -31,6 +31,7 @@ var locale = {
entityId: '对象Id',
description: '描述',
config: '配置',
offset: '已同步素材位置',
},
},
};

View File

@ -10,4 +10,5 @@ export declare class Config<ED extends EntityDict, Cxt extends BackendRuntimeCon
private cache;
constructor(cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>);
updateConfig(entity: 'platform' | 'system', entityId: string, config: ConfigDef): Promise<void>;
updateApplicationConfig(entity: 'application', entityId: string, config: EntityDict['application']['Schema']['config']): Promise<void>;
}

View File

@ -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();

View File

@ -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;
}

View File

@ -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 }))] }))),
},
] }) })) })) })));

View File

@ -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',
},
],
},

View File

@ -13,6 +13,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'application
}>;
systemId: string;
oakId: string;
style: EntityDict['system']['Schema']['style'];
}, {
confirm: () => void;
}>): JSX.Element;

View File

@ -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();

View File

@ -6,6 +6,10 @@ exports.default = OakComponent({
projection: {
id: 1,
systemId: 1,
system: {
id: 1,
name: 1,
},
url: 1,
apiPath: 1,
port: 1,

View File

@ -8,6 +8,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'domain', fa
port: string;
protocol: EntityDict['domain']['Schema']['protocol'];
tabValue: 'detail';
system: EntityDict['system']['Schema'];
}, {
onTabClick: (key: string) => void;
}>): JSX.Element;

View File

@ -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 }))] }))),
},
] }) })) })) })));
}

View File

@ -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',

View File

@ -8,6 +8,7 @@ exports.default = OakComponent({
name: 1,
config: 1,
description: 1,
style: 1,
},
formData: function (_a) {
var data = _a.data;

View File

@ -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: '系统管理',

View File

@ -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({
}
});
});
}
},
},
});

View File

@ -3,6 +3,7 @@ import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'platform', false, {
name: string;
description: string;
style: EntityDict['system']['Schema']['style'];
}, {
confirm: () => void;
}>): JSX.Element;

View File

@ -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();

View File

@ -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 }))] }))),
},
{

View File

@ -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 }) }))); })
: '';
},
},

View File

@ -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();

View File

@ -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;

View File

@ -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"
}

View File

@ -81,6 +81,14 @@ type GeneralAspectDict<
},
context: Cxt
) => Promise<void>;
updateApplicationConfig: (
params: {
entity: 'application';
entityId: string;
config: EntityDict['application']['Schema']['config'];
},
context: Cxt
) => Promise<void>;
};
export type AspectDict<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>> = GeneralAspectDict<ED, Cxt>;

View File

@ -19,4 +19,33 @@ export async function updateConfig<ED extends EntityDict, Cxt extends BackendRun
id: entityId,
}
}, {});
}
export async function updateApplicationConfig<
ED extends EntityDict,
Cxt extends BackendRuntimeContext<ED>
>(
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,
},
},
{}
);
}

View File

@ -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<ED extends EntityDict & BaseEntityDict> = TokenAD<ED> & CrudAD<ED>;
updateApplicationConfig,
};

View File

@ -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

View File

@ -0,0 +1,5 @@
.box {
display: block;
}

View File

@ -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 (
<Form>
{Colors.map((ele) => (
<Form.Item
key={ele}
label={ele}
requiredMark
name="folder"
tooltip={`设置系统【${ele}】颜色`}
rules={[
{
required: true,
},
]}
>
<>
<Input
onChange={(e) => {
setValue(ele, e.target.value);
}}
value={get(value, ele)}
/>
</>
</Form.Item>
))}
</Form>
);
}
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 (
<div>
<Tabs
onChange={() => {}}
type="card"
items={[
{
label: '颜色',
key: 'color',
component: Color,
},
].map((ele, i) => {
const ItemComponent = ele.component;
return {
label: ele.label,
key: ele.key,
children: (
<ItemComponent
value={get(styleValue, ele.key)}
setValue={(path, value) => {
setStyle(`${ele.key}.${path}`, value);
}}
/>
),
};
})}
/>
</div>
);
}

View File

@ -13,10 +13,12 @@ export class Config<
Cxt extends BackendRuntimeContext<ED>,
FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>,
AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>
> extends Feature {
> extends Feature {
private cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>;
constructor(cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>) {
constructor(
cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>
) {
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();
}

View File

@ -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: (
<Descriptions column={1} bordered>
<Descriptions.Item label="id">
{oakId}
<Typography.Paragraph copyable>
{oakId}
</Typography.Paragraph>
</Descriptions.Item>
<Descriptions.Item
label={t('application:attr.name')}

View File

@ -14,6 +14,7 @@ export default OakComponent({
description: 1,
type: 1,
systemId: 1,
style: 1,
},
formData({ data }) {
return data || {};
@ -24,10 +25,10 @@ export default OakComponent({
value: 'web',
},
{
value: "wechatMp",
value: 'wechatMp',
},
{
value: "wechatPublic",
value: 'wechatPublic',
},
] as typeOption[],
},

View File

@ -1,6 +1,7 @@
import React from 'react';
import { Button, Form, Row, Col, Select, Space, Input } from 'antd';
import PageHeader from '../../../components/common/pageHeader';
import ComponentStyle from '../../../components/config/style';
import Style from './web.module.less';
import { EntityDict } from '../../../general-app-domain';
@ -24,6 +25,7 @@ export default function Render(
}>;
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(
</>
</Form.Item>
<Form.Item label="样式" requiredMark name="style">
<>
<ComponentStyle
onChange={(value) => {
update({
style: value,
});
}}
value={style}
/>
</>
</Form.Item>
<Action variant={variant}>
<Form.Item wrapperCol={{ offset: 6 }}>
<Space>

View File

@ -4,6 +4,10 @@ export default OakComponent({
projection: {
id: 1,
systemId: 1,
system: {
id: 1,
name: 1,
},
url: 1,
apiPath: 1,
port: 1,

View File

@ -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 (
<PageHeader showBack={true} title="域名概览">
@ -42,7 +43,43 @@ export default function Render(
{
label: '域名概览',
key: 'detail',
children: <div></div>,
children: (
<Descriptions column={1} bordered>
<Descriptions.Item label="id">
<Typography.Paragraph copyable>
{oakId}
</Typography.Paragraph>
</Descriptions.Item>
<Descriptions.Item
label={t('domain:attr.url')}
>
{url}
</Descriptions.Item>
<Descriptions.Item
label={t('domain:attr.apiPath')}
>
{apiPath}
</Descriptions.Item>
<Descriptions.Item
label={t('domain:attr.port')}
>
{port}
</Descriptions.Item>
<Descriptions.Item
label={t('domain:attr.protocol')}
>
{protocol}
</Descriptions.Item>
<Descriptions.Item
label={
t('domain:attr.system') +
t('system:attr.name')
}
>
{system?.name}
</Descriptions.Item>
</Descriptions>
),
},
]}
/>

View File

@ -75,6 +75,17 @@ export default function Render(
{
dataIndex: 'url',
title: '域名',
render: (value, record, index) => {
return (
<Typography.Link
onClick={() => {
goDetail(record.id);
}}
>
{value}
</Typography.Link>
);
},
},
{
dataIndex: 'apiPath',

View File

@ -6,6 +6,7 @@ export default OakComponent({
name: 1,
config: 1,
description: 1,
style: 1,
},
formData({ data }) {
return data || {};

View File

@ -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: <Descriptions column={1} bordered>
<Descriptions.Item label="id">{oakId}</Descriptions.Item>
<Descriptions.Item label={t('platform:attr.name')}>{name}</Descriptions.Item>
<Descriptions.Item label={t('platform:attr.description')}>{description}</Descriptions.Item>
</Descriptions>,
children: (
<Descriptions column={1} bordered>
<Descriptions.Item label="id">
<Typography.Paragraph copyable>
{oakId}
</Typography.Paragraph>
</Descriptions.Item>
<Descriptions.Item
label={t('platform:attr.name')}
>
{name}
</Descriptions.Item>
<Descriptions.Item
label={t(
'platform:attr.description'
)}
>
{description}
</Descriptions.Item>
</Descriptions>
),
},
{
label: '系统管理',

View File

@ -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();
}
},
},
});

View File

@ -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 (
<PageHeader showBack={true} title="平台编辑">
@ -70,6 +73,23 @@ export default function Render(
/>
</>
</Form.Item>
<Form.Item
label="样式"
requiredMark
name="style"
>
<>
<ComponentStyle
onChange={(value) => {
update({
style: value,
});
}}
value={style}
/>
</>
</Form.Item>
<Form.Item wrapperCol={{ offset: 4 }}>
<Space>
<Button

View File

@ -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: (
<Descriptions column={1} bordered>
<Descriptions.Item label="id">
{oakId}
<Typography.Paragraph copyable>
{oakId}
</Typography.Paragraph>
</Descriptions.Item>
<Descriptions.Item
label={t('system:attr.name')}

View File

@ -108,7 +108,7 @@ export default function Render(
render: (value, record, index) => {
return value
? value.map((ele: { url: string }) => (
<Space>
<Space direction="vertical">
<Tag>{ele.url}</Tag>
</Space>
))

View File

@ -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 (
<Container variant={variant} showBack={showBack}>
<Row>
@ -130,29 +125,15 @@ export default function Render(
</>
</Form.Item>
<Form.Item
label="主题色"
requiredMark
name="folder"
tooltip="设置系统主题颜色"
rules={[
{
required: true,
},
]}
>
<Form.Item label="样式" requiredMark name="style">
<>
<Input
onChange={(e) => {
setStyle(
'color.primary',
e.target.value
);
<ComponentStyle
onChange={(value) => {
update({
style: value,
});
}}
value={get(
style || {},
'color.primary'
)}
value={style}
/>
</>
</Form.Item>

View File

@ -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;
};