This commit is contained in:
Wang Kejun 2022-12-12 15:41:15 +08:00
parent dd8d5ee624
commit a972aaa29c
14 changed files with 101 additions and 141 deletions

View File

@ -5,7 +5,6 @@ var jsx_runtime_1 = require("react/jsx-runtime");
var react_1 = require("react");
var antd_1 = require("antd");
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
var icons_1 = require("@ant-design/icons");
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];
@ -34,24 +33,13 @@ function WechatPublic(props) {
}
}, items: Object.keys(templateMsgs).length > 0
? Object.keys(templateMsgs).map(function (name, idx) {
var _a;
var templateMsg = templateMsgs[name];
var templateId = templateMsgs[name];
return {
key: "".concat(name),
label: "".concat(name),
children: ((0, jsx_runtime_1.jsxs)(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: templateMsg === null || templateMsg === void 0 ? void 0 : templateMsg.templateId, onChange: function (e) {
return setValue("templateMsgs.".concat(name, ".templateId"), e.target.value);
} }) }) })), (_a = templateMsg === null || templateMsg === void 0 ? void 0 : templateMsg.dataDef) === null || _a === void 0 ? void 0 : _a.map(function (ele, index) { return ((0, jsx_runtime_1.jsx)(antd_1.Form.Item, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, tslib_1.__assign({ align: "baseline" }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "keyword", value: ele === null || ele === void 0 ? void 0 : ele[0], onChange: function (e) {
setValue("templateMsgs.".concat(name, ".dataDef.").concat(index, ".0"), e.target.value);
} }), (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "color", value: ele === null || ele === void 0 ? void 0 : ele[1], onChange: function (e) {
setValue("templateMsgs.".concat(name, ".dataDef.").concat(index, ".1"), e.target.value);
} }), (0, jsx_runtime_1.jsx)(icons_1.MinusCircleOutlined, { onClick: function () {
return removeItem("templateMsgs.".concat(name, ".dataDef"), index);
} })] }), "templateMsg_dataDef_".concat(index)) })); }), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "dashed", onClick: function () {
var _a;
var length = ((_a = templateMsg === null || templateMsg === void 0 ? void 0 : templateMsg.dataDef) === null || _a === void 0 ? void 0 : _a.length) || 0; //新增第几项
setValue("templateMsgs.".concat(name, ".dataDef.").concat(length), []);
}, block: true, icon: (0, jsx_runtime_1.jsx)(icons_1.PlusOutlined, {}) }, { children: "\u6DFB\u52A0 keyword" })) })] }))),
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);
} }) }) })) }))),
};
})
: [] }), (0, jsx_runtime_1.jsx)(antd_1.Modal, tslib_1.__assign({ title: "\u65B0\u5EFA\u6A21\u7248\u6807\u7B7E", onCancel: function () {
@ -70,7 +58,7 @@ function WechatPublic(props) {
});
return;
}
setValue("templateMsgs.".concat(messageType), {});
setValue("templateMsgs.".concat(messageType), '');
setModal(false);
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) {

View File

@ -13,6 +13,7 @@ export declare const ActionDefDict: {
};
message: {
iState: import("oak-domain/lib/types").ActionDef<import("./Message/Action").IAction, import("./Message/Action").IState>;
visitState: import("oak-domain/lib/types").ActionDef<"visit", import("./Message/Action").VisitState>;
};
messageSent: {
iState: import("oak-domain/lib/types").ActionDef<import("./MessageSent/Action").IAction, import("./MessageSent/Action").IState>;

View File

@ -25,13 +25,7 @@ export declare type WebConfig = {
};
passport: Passport[];
};
export declare type WechatPublicTemplateMsgsConfig = Record<string, {
templateId: string;
dataDef: [
string,
string
][];
}>;
export declare type WechatPublicTemplateMsgsConfig = Record<string, string>;
export declare type WechatPublicConfig = {
type: 'wechatPublic';
isService: boolean;

View File

@ -14,7 +14,6 @@ import { EntityDef as ExtraFile } from "./ExtraFile/Schema";
import { EntityDef as Livestream } from "./Livestream/Schema";
import { EntityDef as Message } from "./Message/Schema";
import { EntityDef as MessageSent } from "./MessageSent/Schema";
import { EntityDef as MessageType } from "./MessageType/Schema";
import { EntityDef as Mobile } from "./Mobile/Schema";
import { EntityDef as Platform } from "./Platform/Schema";
import { EntityDef as UserRole } from "./UserRole/Schema";
@ -42,7 +41,6 @@ export declare type EntityDict = {
livestream: Livestream;
message: Message;
messageSent: MessageSent;
messageType: MessageType;
mobile: Mobile;
platform: Platform;
userRole: UserRole;

View File

@ -21,7 +21,7 @@ export declare type OpSchema = EntityShape & {
extension: String<16>;
size?: Int<4> | null;
sort?: Int<4> | null;
fileType: String<16>;
fileType: String<128>;
};
export declare type OpAttr = keyof OpSchema;
export declare type Schema = EntityShape & {
@ -39,7 +39,7 @@ export declare type Schema = EntityShape & {
extension: String<16>;
size?: Int<4> | null;
sort?: Int<4> | null;
fileType: String<16>;
fileType: String<128>;
article?: Article.Schema;
user?: User.Schema;
} & {

View File

@ -87,7 +87,7 @@ exports.desc = {
fileType: {
type: "varchar",
params: {
length: 16
length: 128
}
}
},

View File

@ -2,9 +2,12 @@ import { ActionDef } from "oak-domain/lib/types/Action";
import { GenericAction } from "oak-domain/lib/actions/action";
export declare type IAction = 'succeed' | 'fail';
export declare type IState = 'sending' | 'success' | 'failure';
export declare type ParticularAction = IAction;
export declare type VisitState = 'unvisited' | 'visited';
export declare type VisitAction = 'visit';
export declare type ParticularAction = IAction | VisitAction;
export declare type Action = GenericAction | ParticularAction;
export declare const actions: string[];
export declare const ActionDefDict: {
iState: ActionDef<IAction, IState>;
visitState: ActionDef<"visit", VisitState>;
};

View File

@ -1,7 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ActionDefDict = exports.actions = void 0;
exports.actions = ["count", "stat", "download", "select", "create", "remove", "update", "succeed", "fail"];
exports.actions = ["count", "stat", "download", "select", "create", "remove", "update", "succeed", "fail", "visit"];
var IActionDef = {
stm: {
succeed: ['sending', 'success'],
@ -9,6 +9,13 @@ var IActionDef = {
},
is: 'sending'
};
exports.ActionDefDict = {
iState: IActionDef
var VisitActionDef = {
stm: {
visit: ['unvisited', 'visited']
},
is: 'unvisited'
};
exports.ActionDefDict = {
iState: IActionDef,
visitState: VisitActionDef
};

View File

@ -1,32 +1,43 @@
import { String, ForeignKey } from "oak-domain/lib/types/DataType";
import { String, Text, ForeignKey } 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 { Action, ParticularAction, IState } from "./Action";
import { Action, ParticularAction, IState, VisitState } from "./Action";
import * as User from "../User/Schema";
import * as System from "../System/Schema";
import * as MessageSent from "../MessageSent/Schema";
declare type MesageParams = {
pathname: string;
props: Record<string, any>;
state: Record<string, any>;
};
export declare type OpSchema = EntityShape & {
userId: ForeignKey<"user">;
systemId: ForeignKey<"system">;
type: 'adminNotification';
type: String<16>;
weight: 'high' | 'medium' | 'low' | 'data';
title: String<32>;
content: Text;
props: Object;
data: Object;
params: Object;
params?: MesageParams | null;
iState?: IState | null;
visitState?: VisitState | null;
};
export declare type OpAttr = keyof OpSchema;
export declare type Schema = EntityShape & {
userId: ForeignKey<"user">;
systemId: ForeignKey<"system">;
type: 'adminNotification';
type: String<16>;
weight: 'high' | 'medium' | 'low' | 'data';
title: String<32>;
content: Text;
props: Object;
data: Object;
params: Object;
params?: MesageParams | null;
iState?: IState | null;
visitState?: VisitState | null;
user: User.Schema;
system: System.Schema;
messageSent$message?: Array<MessageSent.Schema>;
@ -42,12 +53,15 @@ declare type AttrFilter = {
user: User.Filter;
systemId: Q_StringValue | SubQuery.SystemIdSubQuery;
system: System.Filter;
type: Q_EnumValue<'adminNotification'>;
type: Q_StringValue;
weight: Q_EnumValue<'high' | 'medium' | 'low' | 'data'>;
title: Q_StringValue;
content: Q_StringValue;
props: Object;
data: Object;
params: Object;
params: Q_EnumValue<MesageParams>;
iState: Q_EnumValue<IState>;
visitState: Q_EnumValue<VisitState>;
};
export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
export declare type Projection = {
@ -63,10 +77,13 @@ export declare type Projection = {
system?: System.Projection;
type?: number;
weight?: number;
title?: number;
content?: number;
props?: number;
data?: number;
params?: number;
iState?: number;
visitState?: number;
messageSent$message?: MessageSent.Selection & {
$entity: "messageSent";
};
@ -84,10 +101,13 @@ export declare type ExportProjection = {
system?: System.ExportProjection;
type?: string;
weight?: string;
title?: string;
content?: string;
props?: string;
data?: string;
params?: string;
iState?: string;
visitState?: string;
messageSent$message?: MessageSent.Exportation & {
$entity: "messageSent";
};
@ -121,8 +141,16 @@ export declare type SortAttr = {
type: number;
} | {
weight: number;
} | {
title: number;
} | {
content: number;
} | {
params: number;
} | {
iState: number;
} | {
visitState: number;
} | {
[k: string]: any;
} | OneOf<ExprOp<OpAttr | string>>;

View File

@ -15,7 +15,7 @@ exports.desc = {
type: {
type: "varchar",
params: {
length: 24
length: 16
}
},
weight: {
@ -24,6 +24,15 @@ exports.desc = {
length: 24
}
},
title: {
type: "varchar",
params: {
length: 32
}
},
content: {
type: "text"
},
props: {
type: "object"
},
@ -38,6 +47,12 @@ exports.desc = {
params: {
length: 24
}
},
visitState: {
type: "varchar",
params: {
length: 24
}
}
},
actionType: "crud",

View File

@ -1 +1 @@
{ "attr": { "user": "关联用户", "system": "系统", "type": "消息类型", "weight": "优先级", "iState": "状态", "props": "属性", "params": "渠道定制参数", "data": "透传数据" }, "action": { "succeed": "成功", "fail": "失败" }, "v": { "iState": { "sending": "发送中", "success": "发送成功", "failure": "发送失败" }, "weight": { "high": "高", "medium": "中", "low": "低", "data": "数据" }, "type": { "adminNotification": "管理员通知" } } }
{ "attr": { "title": "标题", "content": "内容", "user": "关联用户", "system": "系统", "type": "消息类型", "weight": "优先级", "iState": "发送状态", "visitState": "访问状态", "props": "属性", "params": "渠道定制参数", "data": "透传数据" }, "action": { "succeed": "成功", "fail": "失败", "visit": "阅读" }, "v": { "iState": { "sending": "发送中", "success": "发送成功", "failure": "发送失败" }, "visitState": { "unvisited": "未读", "visited": "已读" }, "weight": { "high": "高", "medium": "中", "low": "低", "data": "数据" }, "type": { "adminNotification": "系统通知", "conversationMessage": "客服消息" } } }

View File

@ -17,17 +17,16 @@ var Storage_13 = require("./ExtraFile/Storage");
var Storage_14 = require("./Livestream/Storage");
var Storage_15 = require("./Message/Storage");
var Storage_16 = require("./MessageSent/Storage");
var Storage_17 = require("./MessageType/Storage");
var Storage_18 = require("./Mobile/Storage");
var Storage_19 = require("./Platform/Storage");
var Storage_20 = require("./UserRole/Storage");
var Storage_21 = require("./Role/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");
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");
exports.storageSchema = {
modi: Storage_1.desc,
modiEntity: Storage_2.desc,
@ -45,15 +44,14 @@ exports.storageSchema = {
livestream: Storage_14.desc,
message: Storage_15.desc,
messageSent: Storage_16.desc,
messageType: Storage_17.desc,
mobile: Storage_18.desc,
platform: Storage_19.desc,
userRole: Storage_20.desc,
role: 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
mobile: Storage_17.desc,
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
};

View File

@ -14,7 +14,6 @@ import * as ExtraFile from "./ExtraFile/Schema";
import * as Livestream from "./Livestream/Schema";
import * as Message from "./Message/Schema";
import * as MessageSent from "./MessageSent/Schema";
import * as MessageType from "./MessageType/Schema";
import * as Mobile from "./Mobile/Schema";
import * as Platform from "./Platform/Schema";
import * as UserRole from "./UserRole/Schema";
@ -141,11 +140,6 @@ export declare type MessageSentIdSubQuery = {
entity: "messageSent";
}) | any;
};
export declare type MessageTypeIdSubQuery = {
[K in "$in" | "$nin"]?: (MessageType.MessageTypeIdSubQuery & {
entity: "messageType";
}) | any;
};
export declare type MobileIdSubQuery = {
[K in "$in" | "$nin"]?: (Mobile.MobileIdSubQuery & {
entity: "mobile";

View File

@ -136,7 +136,7 @@ export default function WechatPublic(props: {
items={
Object.keys(templateMsgs).length > 0
? Object.keys(templateMsgs).map((name, idx) => {
const templateMsg = templateMsgs[name];
const templateId = templateMsgs[name];
return {
key: `${name}`,
label: `${name}`,
@ -155,82 +155,16 @@ export default function WechatPublic(props: {
<Input
placeholder="请输入templateId"
type="text"
value={
templateMsg?.templateId
}
value={templateId}
onChange={(e) =>
setValue(
`templateMsgs.${name}.templateId`,
`templateMsgs.${name}`,
e.target.value
)
}
/>
</>
</Form.Item>
{templateMsg?.dataDef?.map(
(ele, index) => (
<Form.Item>
<Space
key={`templateMsg_dataDef_${index}`}
align="baseline"
>
<Input
placeholder="keyword"
value={
ele?.[0]
}
onChange={(e) => {
setValue(
`templateMsgs.${name}.dataDef.${index}.0`,
e.target.value
);
}}
/>
<Input
placeholder="color"
value={
ele?.[1]
}
onChange={(e) => {
setValue(
`templateMsgs.${name}.dataDef.${index}.1`,
e.target.value
);
}}
/>
<MinusCircleOutlined
onClick={() =>
removeItem(
`templateMsgs.${name}.dataDef`,
index
)
}
/>
</Space>
</Form.Item>
)
)}
<Form.Item>
<Button
type="dashed"
onClick={() => {
const length =
templateMsg
?.dataDef
?.length || 0; //新增第几项
setValue(
`templateMsgs.${name}.dataDef.${length}`,
[]
);
}}
block
icon={<PlusOutlined />}
>
keyword
</Button>
</Form.Item>
</Form>
),
};
@ -257,7 +191,7 @@ export default function WechatPublic(props: {
});
return;
}
setValue(`templateMsgs.${messageType}`, {});
setValue(`templateMsgs.${messageType}`, '');
setModal(false);
setMessageType('');
}}