Merge branch 'dev' of codeup.aliyun.com:61c14a7efa282c88e103c23f/oak-general-business into dev

This commit is contained in:
梁朝伟 2023-11-07 17:27:49 +08:00
commit 8f68a5a494
208 changed files with 2444 additions and 3774 deletions

View File

@ -1,6 +1,7 @@
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
import { EntityDict } from '../oak-app-domain';
import { Config } from '../types/Config';
import { Style } from '../types/Style';
export declare function updateConfig<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
entity: 'platform' | 'system';
entityId: string;
@ -11,3 +12,8 @@ export declare function updateApplicationConfig<ED extends EntityDict, Cxt exten
entityId: string;
config: EntityDict['application']['Schema']['config'];
}, context: Cxt): Promise<void>;
export declare function updateStyle<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
entity: 'platform' | 'system';
entityId: string;
style: Style;
}, context: Cxt): Promise<void>;

View File

@ -25,3 +25,16 @@ export async function updateApplicationConfig(params, context) {
},
}, {});
}
export async function updateStyle(params, context) {
const { entity, entityId, style } = params;
await context.operate(entity, {
id: generateNewId(),
action: 'update',
data: {
style,
},
filter: {
id: entityId,
},
}, {});
}

View File

@ -1,8 +1,7 @@
import { loginByMobile, loginWechat, loginWechatMp, syncUserInfoWechatMp, sendCaptcha, switchTo, refreshWechatPublicUserInfo, getWechatMpUserPhoneNumber, logout, loginByWechat, wakeupParasite } from './token';
import { getInfoByUrl } from './extraFile';
import { getApplication, signatureJsSDK, uploadWechatMedia, batchGetArticle, getArticle, batchGetMaterialList, getMaterial, deleteMaterial } from './application';
import { updateConfig, updateApplicationConfig } from './config';
import { updateStyle } from './style2';
import { updateConfig, updateApplicationConfig, updateStyle } from './config';
import { syncMessageTemplate } from './template';
import { mergeUser, getChangePasswordChannels, updateUserPassword } from './user';
import { createWechatLogin } from './wechatLogin';

View File

@ -1,8 +1,7 @@
import { loginByMobile, loginWechat, loginWechatMp, syncUserInfoWechatMp, sendCaptcha, switchTo, refreshWechatPublicUserInfo, getWechatMpUserPhoneNumber, logout, loginByWechat, wakeupParasite, } from './token';
import { getInfoByUrl } from './extraFile';
import { getApplication, signatureJsSDK, uploadWechatMedia, batchGetArticle, getArticle, batchGetMaterialList, getMaterial, deleteMaterial, } from './application';
import { updateConfig, updateApplicationConfig } from './config';
import { updateStyle } from './style2';
import { updateConfig, updateApplicationConfig, updateStyle } from './config';
import { syncMessageTemplate } from './template';
import { mergeUser, getChangePasswordChannels, updateUserPassword } from './user';
import { createWechatLogin } from './wechatLogin';

View File

@ -1,8 +0,0 @@
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
import { EntityDict } from '../oak-app-domain';
import { Style } from '../types/Style';
export declare function updateStyle<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
entity: 'platform' | 'system';
entityId: string;
style: Style;
}, context: Cxt): Promise<void>;

View File

@ -1,14 +0,0 @@
import { generateNewId } from 'oak-domain/lib/utils/uuid';
export async function updateStyle(params, context) {
const { entity, entityId, style } = params;
await context.operate(entity, {
id: generateNewId(),
action: 'update',
data: {
style,
},
filter: {
id: entityId,
}
}, {});
}

View File

@ -16,13 +16,5 @@ export default OakComponent({
formData({ data }) {
return data || {};
},
methods: {
goWechatPublicTagList() {
const { oakId } = this.props;
this.navigateTo({
url: '/wechatPublic/tag/list',
applicationId: oakId,
});
}
},
methods: {},
});

View File

@ -1,6 +1,6 @@
import { WebConfig, WechatPublicConfig, WechatMpConfig } from '../../../oak-app-domain/Application/Schema';
import { EntityDict } from '../../../oak-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../oak-app-domain';
type Config = WebConfig | WechatPublicConfig | WechatMpConfig;
export default function Render(props: WebComponentProps<EntityDict, 'application', false, {
name: string;

View File

@ -1,13 +1,12 @@
import { jsx as _jsx } from "react/jsx-runtime";
import { useState } from 'react';
import { Tabs, Card } from 'antd';
import Style from './web.module.less';
import WechatMenu from '../../wechatMenu';
import WechatPublicAutoReply from '../../wechatPublicAutoReply';
import UserWechatPublicTag from '../../userWechatPublicTag';
export default function Render(props) {
const { oakId, tabValue, config, name, description, type, system } = props.data;
const { t, navigateBack, onTabClick, goWechatPublicTagList } = props.methods;
const { oakId, tabValue, name } = props.data;
const { t, navigateBack, onTabClick } = props.methods;
const [tabKey, setTabKey] = useState('menu');
const Actions = [];
const items = [
@ -27,7 +26,7 @@ export default function Render(props) {
children: (_jsx(UserWechatPublicTag, { oakAutoUnmount: true, applicationId: oakId, oakPath: `$application-detail-user-${oakId}` }))
}
];
return (_jsx("div", { className: Style.container, children: _jsx(Card, { title: name, bordered: false, extra: Actions, children: _jsx(Tabs, { items: items, onChange: (key) => {
setTabKey(key);
} }) }) }));
return (_jsx(Card, { title: name, bordered: false, extra: Actions, children: _jsx(Tabs, { items: items, onChange: (key) => {
setTabKey(key);
} }) }));
}

View File

@ -55,8 +55,8 @@ export default function Render(props) {
});
}
if (id && oakFullpath) {
return (_jsx("div", { className: Styles.container, children: _jsx(Tabs, { tabPosition: 'left', onChange: (key) => {
setTabKey(key);
}, items: items, style: { height: 520 } }) }));
return (_jsx(Tabs, { tabPosition: "left", onChange: (key) => {
setTabKey(key);
}, items: items, style: { height: 520 } }));
}
}

View File

@ -1,9 +1,4 @@
.container {
background: var(--oak-bg-color-container);
padding: 8px;
.tabLabel {
writing-mode: vertical-rl;
letter-spacing: .2rem;
}
}
.tabLabel {
writing-mode: vertical-rl;
letter-spacing: .2rem;
}

View File

@ -70,18 +70,8 @@ export default OakComponent({
},
},
methods: {
// async addExtraFile(
// extraFile: EntityDict['extraFile']['CreateSingle']['data']
// ) {
// const result = await this.features.cache.operate('extraFile', {
// action: 'create',
// data: extraFile,
// id: generateNewId(),
// });
// return result;
// },
async uploadFile(extraFile) {
const result = await this.features.extraFile.createAndUpload(extraFile, extraFile.extra1);
async uploadFile(extraFile, file) {
const result = await this.features.extraFile.autoUpload(extraFile, file);
return result;
},
setEditor(editor) {

View File

@ -1,7 +1,7 @@
import "@wangeditor/editor/dist/css/style.css";
import { EntityDict } from "./../../../oak-app-domain";
import { WebComponentProps } from "oak-frontend-base";
export default function Render(props: WebComponentProps<EntityDict, "article", false, {
export default function Render(props: WebComponentProps<EntityDict, 'article', false, {
id: string;
name: string;
editor: any;
@ -19,11 +19,7 @@ export default function Render(props: WebComponentProps<EntityDict, "article", f
setEditor: (editor: any) => void;
check: () => void;
preview: () => void;
addExtraFile: (file: EntityDict["extraFile"]["CreateSingle"]["data"]) => Promise<void>;
uploadFile: (file: EntityDict["extraFile"]["CreateSingle"]["data"]) => Promise<{
bucket: string;
url: string;
}>;
uploadFile: (extraFile: EntityDict['extraFile']['CreateSingle']['data'], file: File) => Promise<string>;
clearContentTip: () => void;
gotoPreview: (content?: string, title?: string) => void;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -27,17 +27,17 @@ function customCheckImageFn(src, alt, url) {
}
export default function Render(props) {
const { methods: method, data } = props;
const { t, setEditor, check, preview, addExtraFile, uploadFile, update, setHtml, gotoPreview, } = method;
const { id, content, editor, origin1, oakFullpath, html, oakId, articleMenuId, changeIsEdit } = data;
const [articleId, setArticleId] = useState("");
const { t, setEditor, check, preview, uploadFile, update, setHtml, gotoPreview, } = method;
const { id, content, editor, origin1, oakFullpath, html, oakId, articleMenuId, changeIsEdit, } = data;
const [articleId, setArticleId] = useState('');
useEffect(() => {
if (id) {
setArticleId(id);
}
}, [id]);
return (_jsxs("div", { className: Style.container, children: [_jsx("div", { style: { width: 'calc(100% - 20px)' }, children: _jsx(Toolbar, { editor: editor, defaultConfig: toolbarConfig, mode: "default" }) }), _jsxs(Row, { children: [_jsx(Col, { flex: 4 }), _jsx(Col, { flex: 16, children: _jsx("div", { className: Style.content, children: _jsxs("div", { className: Style.editorContainer, children: [data.contentTip && (_jsx(Alert, { type: "info", message: t("tips.content"), closable: true, onClose: () => method.clearContentTip() })), _jsx("div", { className: Style.titleContainer, children: _jsx(Input, { onChange: (e) => update({ name: e.target.value }), value: data.name, placeholder: "请输入文章标题", size: "large", maxLength: 32, suffix: `${[...(data.name || "")].length}/32`, className: Style.titleInput }) }), _jsx("div", { className: Style.editorContent, children: _jsx(Editor, { defaultConfig: {
return (_jsxs("div", { className: Style.container, children: [_jsx("div", { style: { width: 'calc(100% - 20px)' }, children: _jsx(Toolbar, { editor: editor, defaultConfig: toolbarConfig, mode: "default" }) }), _jsxs(Row, { children: [_jsx(Col, { flex: 4 }), _jsx(Col, { flex: 16, children: _jsx("div", { className: Style.content, children: _jsxs("div", { className: Style.editorContainer, children: [data.contentTip && (_jsx(Alert, { type: "info", message: t('tips.content'), closable: true, onClose: () => method.clearContentTip() })), _jsx("div", { className: Style.titleContainer, children: _jsx(Input, { onChange: (e) => update({ name: e.target.value }), value: data.name, placeholder: '请输入文章标题', size: "large", maxLength: 32, suffix: `${[...(data.name || '')].length}/32`, className: Style.titleInput }) }), _jsx("div", { className: Style.editorContent, children: _jsx(Editor, { defaultConfig: {
autoFocus: true,
placeholder: "请输入文章内容...",
placeholder: '请输入文章内容...',
MENU_CONF: {
checkImage: customCheckImageFn,
uploadImage: {
@ -46,33 +46,28 @@ export default function Render(props) {
// TS 语法
// file 即选中的文件
const { name, size, type } = file;
const extension = name.substring(name.lastIndexOf(".") + 1);
const filename = name.substring(0, name.lastIndexOf("."));
const extension = name.substring(name.lastIndexOf('.') + 1);
const filename = name.substring(0, name.lastIndexOf('.'));
const extraFile = {
entity: "article",
entity: 'article',
entityId: articleId,
extra1: file,
origin: origin1,
type: "image",
tag1: "source",
type: 'image',
tag1: 'source',
objectId: generateNewId(),
filename,
size,
extension,
bucket: "",
bucket: '',
id: generateNewId(),
};
try {
// 自己实现上传,并得到图片 url alt href
const { url, bucket } = await uploadFile(extraFile);
extraFile.bucket = bucket;
extraFile.extra1 = null;
// await addExtraFile(extraFile);
const url = await uploadFile(extraFile, file);
// 最后插入图片
insertFn("http://" + url, extraFile.filename);
}
catch (err) {
insertFn(url, extraFile.filename);
}
catch (err) { }
},
},
uploadVideo: {
@ -81,30 +76,27 @@ export default function Render(props) {
// TS 语法
// file 即选中的文件
const { name, size, type } = file;
const extension = name.substring(name.lastIndexOf(".") + 1);
const filename = name.substring(0, name.lastIndexOf("."));
const extension = name.substring(name.lastIndexOf('.') + 1);
const filename = name.substring(0, name.lastIndexOf('.'));
const extraFile = {
entity: "article",
entity: 'article',
entityId: articleId,
extra1: file,
origin: origin1,
type: "video",
tag1: "source",
type: 'video',
tag1: 'source',
objectId: generateNewId(),
filename,
size,
extension,
bucket: "",
bucket: '',
id: generateNewId(),
};
try {
// 自己实现上传,并得到图片 url alt href
const { url, bucket } = await uploadFile(extraFile);
extraFile.bucket = bucket;
extraFile.extra1 = null;
await addExtraFile(extraFile);
const url = await uploadFile(extraFile, file);
// 最后插入图片
insertFn("http://" + url, "http://" + url + "?vframe/jpg/offset/0");
insertFn(url, url +
'?vframe/jpg/offset/0');
}
catch (err) { }
},
@ -114,7 +106,8 @@ export default function Render(props) {
setHtml(editorDom.getHtml());
}, style: {
minHeight: 440,
}, mode: "default" }) }), _jsx("div", { className: Style.footer, children: _jsx(Row, { align: "middle", children: _jsx(Col, { flex: "none", children: _jsxs(Space, { children: [_jsx(Button, { disabled: !data.oakDirty || data.oakExecuting, type: "primary", onClick: () => {
}, mode: "default" }) }), _jsx("div", { className: Style.footer, children: _jsx(Row, { align: "middle", children: _jsx(Col, { flex: "none", children: _jsxs(Space, { children: [_jsx(Button, { disabled: !data.oakDirty ||
data.oakExecuting, type: "primary", onClick: () => {
check();
}, children: "\u4FDD\u5B58" }), _jsxs(Button, { onClick: () => {
gotoPreview(content, data.name);

View File

@ -1,7 +1,6 @@
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useState } from 'react';
import { Form, Input, Space, Button, Select } from 'antd';
import Style from './web.module.less';
import { EyeInvisibleOutlined, EyeTwoTone } from '@ant-design/icons';
export default function Render(props) {
const { data, methods } = props;
@ -33,7 +32,7 @@ export default function Render(props) {
},
], children: _jsx(Input, { allowClear: true, value: captcha, maxLength: 4, placeholder: '请输入验证码', onChange: (e) => {
setCaptcha(e.target.value);
}, className: Style['loginbox-input'], suffix: _jsx(Button, { size: "small", type: "link", disabled: (!mobile) || counter > 0, onClick: () => sendCaptcha(mobile), children: counter > 0 ? `${counter}秒后可重发` : '发送验证码' }) }) }), _jsx(Form.Item, { label: '输入新密码', name: "password", help: validateHelp, rules: [
}, suffix: _jsx(Button, { size: "small", type: "link", disabled: (!mobile) || counter > 0, onClick: () => sendCaptcha(mobile), children: counter > 0 ? `${counter}秒后可重发` : '发送验证码' }) }) }), _jsx(Form.Item, { label: '输入新密码', name: "password", help: validateHelp, rules: [
{
required: true,
message: '请输入密码',

View File

@ -10,20 +10,20 @@ export default function Render(props) {
{
key: 'password',
label: '原密码验证',
children: _jsx(ByPassword, { oakId: oakId, oakPath: oakFullpath })
children: _jsx(ByPassword, { oakId: oakId, oakPath: oakFullpath }),
},
{
key: 'mobile',
label: '手机号验证',
children: _jsx(ByMobile, { oakId: oakId, oakPath: oakFullpath })
}
children: _jsx(ByMobile, { oakId: oakId, oakPath: oakFullpath }),
},
];
if (channels.length === 0) {
return _jsx(Alert, { message: _jsxs(_Fragment, { children: ["\u8BF7\u60A8\u5148", _jsx("div", { style: {
return (_jsx(Alert, { message: _jsxs(_Fragment, { children: ["\u8BF7\u60A8\u5148", _jsx("div", { style: {
color: 'blue',
display: 'inline',
textDecoration: 'underline'
}, onClick: () => goToMobile(), children: "\u70B9\u6B64\u7ED1\u5B9A\u624B\u673A\u53F7" }), "\u518D\u8FDB\u884C\u5BC6\u7801\u4FEE\u6539"] }), type: "info" });
textDecoration: 'underline',
}, onClick: () => goToMobile(), children: "\u70B9\u6B64\u7ED1\u5B9A\u624B\u673A\u53F7" }), "\u518D\u8FDB\u884C\u5BC6\u7801\u4FEE\u6539"] }), type: "info" }));
}
return (_jsx(Tabs, { items: items.filter((ele) => channels.includes(ele.key)) }));
return _jsx(Tabs, { items: items.filter((ele) => channels.includes(ele.key)) });
}

View File

@ -1,7 +1,7 @@
/// <reference types="react" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, false, {
bgColor: string;
bgImgUrl: string;
backgroundColor: string;
backgroundUrl: string;
selectedIndex: number;
list: {
redDot: boolean;
@ -15,5 +15,6 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
}[];
color: string;
selectedColor: string;
border: boolean;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
export default _default;

View File

@ -2,15 +2,16 @@ export default OakComponent({
isList: false,
properties: {
// 背景色
bgColor: '',
backgroundColor: '',
// 背景图
bgImgUrl: '',
backgroundUrl: '',
// 当前选中索引
selectedIndex: 0,
// tab 项
list: [],
color: '#666',
selectedColor: '',
border: false,
},
lifetimes: {
show() {

View File

@ -13,7 +13,7 @@
z-index: 999;
width: 750rpx;
height: 106rpx;
height: calc(106rpx + env(safe-area-inset-bottom));
display: flex;
background-color: white;
background-size: 100% 100%;
@ -21,11 +21,14 @@
.safe-area-inset-bottom();
}
.@{component}_border {
border-top: 1px solid #e6e6e6;
}
.@{component}__item-wrapper {
display: flex;
height: 100%;
justify-content: center;
.safe-area-inset-bottom();
}
.@{component}__item-container {

View File

@ -1,5 +1,5 @@
<view wx:if="{{showTabBar}}" class="tab-bar"
style="{{bgColor?'background-color:'+bgColor+';':''}} {{bgImg?'background-image: url('+bgImgUrl+');':''}}">
<view wx:if="{{showTabBar}}" class="tab-bar {{ border ? 'tab-bar_border' : '' }}"
style="{{backgroundColor ? 'background-color:'+ backgroundColor +';':''}} {{backgroundUrl ? 'background-image: url('+ backgroundUrl+ ');' : ''}}">
<view class="tab-bar__item-wrapper" data-index="{{index}}" mut-bind:tap="onTapItem" style="width:{{750/list.length}}rpx" wx:for="{{list}}" wx:key="index">
<view class="tab-bar__item-container">
<!-- 标签图标 -->

View File

@ -1,7 +1,5 @@
.container {
background: var(--oak-bg-color-container);
// box-shadow: 0 2px 3px #0000001a;
// border-radius: 3px;
padding: 30px 32px;
}

View File

@ -12,18 +12,6 @@ export default OakComponent({
dirty: false,
currentStyle: {},
},
// listeners: {
// config(prev, next) {
// if (prev.config !== next.config) {
// const config2 = next.config || {};
// this.setState({
// initialConfig: config2,
// dirty: false,
// currentConfig: cloneDeep(config2),
// });
// }
// },
// },
lifetimes: {
ready() {
const { style } = this.props;
@ -35,34 +23,13 @@ export default OakComponent({
}
},
methods: {
setValue(newStyle) {
const newStyle2 = cloneDeep(newStyle || {});
setValue(style) {
const newStyle = cloneDeep(style || {});
this.setState({
currentStyle: newStyle2,
currentStyle: newStyle,
dirty: true,
});
},
// cleanKey(path: string, key: string) {
// const { currentConfig } = this.state;
// const obj = get(currentConfig, path);
// const obj2 = omit(obj, [key]);
// set(currentConfig, path, obj2);
// const newConfig = cloneDeep(currentConfig);
// this.setState({
// currentConfig: newConfig,
// dirty: true,
// });
// },
// removeItem(path: string, index: number) {
// const { currentConfig } = this.state;
// const array = get(currentConfig, path);
// (array as any[]).splice(index, 1);
// const newConfig = cloneDeep(currentConfig || {});
// this.setState({
// currentConfig: newConfig,
// dirty: true,
// });
// },
resetStyle() {
const { initialStyle } = this.state;
this.setState({
@ -73,7 +40,7 @@ export default OakComponent({
async updateStyle() {
const { currentStyle } = this.state;
const { entity, entityId } = this.props;
await this.features.style2.updateStyle(entity, entityId, currentStyle);
await this.features.config.updateStyle(entity, entityId, currentStyle);
this.setMessage({
content: '操作成功',
type: 'success',

View File

@ -1,42 +1,4 @@
.container {
background: var(--oak-bg-color-container);
// box-shadow: 0 2px 3px #0000001a;
// border-radius: 3px;
padding: 30px 32px;
}
.padding {
background-color: var(--oak-bg-color-page);
width: 100%;
height: 77px;
}
.ctrl {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 10px;
border: solid 0.4px;
border-radius: 3px;
border-color: var(--oak-border-color);
position: absolute;
z-index: 10;
background-color: var(--oak-bg-color-container);
width: calc(100vw - 138px);
top: 85px;
height: 55px;
text {
color: var(--oak-text-color-secondary);
.weight {
font-weight: bold;
color: var(--oak-text-color-primary);
text-decoration: underline;
}
}
}
.contains {
margin-top: 20px;

View File

@ -5,7 +5,7 @@ import StyleUpsert from '../../style';
export default function Render(props) {
const { entity, currentStyle, dirty, name } = props.data;
const { resetStyle, updateStyle, setValue, t } = props.methods;
return (_jsxs(_Fragment, { children: [_jsx(Affix, { offsetTop: 64, children: _jsx(Alert, { message: _jsx("div", { children: _jsxs("text", { children: ["\u60A8\u6B63\u5728\u66F4\u65B0", _jsx(Typography.Text, { keyboard: true, className: Style.weight, children: entity }), "\u5BF9\u8C61", _jsx(Typography.Text, { keyboard: true, className: Style.weight, children: name }), "\u7684\u6837\u5F0F\uFF0C\u8BF7\u8C28\u614E\u64CD\u4F5C"] }) }), type: "info", showIcon: true, action: _jsxs(Space, { children: [_jsx(Button, { disabled: !dirty, type: "primary", danger: true, onClick: () => resetStyle(), style: {
return (_jsxs(_Fragment, { children: [_jsx(Affix, { offsetTop: 64, children: _jsx(Alert, { message: _jsx("div", { children: _jsxs("text", { children: ["\u60A8\u6B63\u5728\u66F4\u65B0", _jsx(Typography.Text, { keyboard: true, children: entity }), "\u5BF9\u8C61", _jsx(Typography.Text, { keyboard: true, children: name }), "\u7684\u6837\u5F0F\uFF0C\u8BF7\u8C28\u614E\u64CD\u4F5C"] }) }), type: "info", showIcon: true, action: _jsxs(Space, { children: [_jsx(Button, { disabled: !dirty, type: "primary", danger: true, onClick: () => resetStyle(), style: {
marginRight: 10,
}, children: t('common::reset') }), _jsx(Button, { disabled: !dirty, type: "primary", onClick: () => updateStyle(), children: t('common::action.confirm') })] }) }) }), _jsx("div", { className: Style.contains, children: _jsx(StyleUpsert, { value: currentStyle, onChange: (s) => {
setValue(s);

View File

@ -1,7 +1,5 @@
.container {
background: var(--oak-bg-color-container);
// box-shadow: 0 2px 3px #0000001a;
// border-radius: 3px;
padding: 30px 32px;
}

View File

@ -1,18 +1,16 @@
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Tabs, Card, Descriptions, Typography } from 'antd';
import PageHeader from '../../../components/common/pageHeader';
import Style from './web.module.less';
export default function Render(props) {
const { oakId, url, tabValue, system, apiPath, protocol, port } = props.data;
const { t, navigateBack, onTabClick } = props.methods;
return (_jsx(PageHeader, { showBack: true, title: "\u57DF\u540D\u6982\u89C8", children: _jsx("div", { className: Style.container, children: _jsx(Card, { title: url, bordered: false, children: _jsx(Tabs, { activeKey: tabValue, onTabClick: (key) => {
onTabClick(key);
}, items: [
{
label: '域名概览',
key: 'detail',
children: (_jsxs(Descriptions, { column: 1, bordered: true, children: [_jsx(Descriptions.Item, { label: "id", children: _jsx(Typography.Paragraph, { copyable: true, children: oakId }) }), _jsx(Descriptions.Item, { label: t('domain:attr.url'), children: url }), _jsx(Descriptions.Item, { label: t('domain:attr.apiPath'), children: apiPath }), _jsx(Descriptions.Item, { label: t('domain:attr.port'), children: port }), _jsx(Descriptions.Item, { label: t('domain:attr.protocol'), children: protocol }), _jsx(Descriptions.Item, { label: t('domain:attr.system') +
t('system:attr.name'), children: system?.name })] })),
},
] }) }) }) }));
return (_jsx(Card, { title: url, bordered: false, children: _jsx(Tabs, { activeKey: tabValue, onTabClick: (key) => {
onTabClick(key);
}, items: [
{
label: '域名概览',
key: 'detail',
children: (_jsxs(Descriptions, { column: 1, bordered: true, children: [_jsx(Descriptions.Item, { label: "id", children: _jsx(Typography.Paragraph, { copyable: true, children: oakId }) }), _jsx(Descriptions.Item, { label: t('domain:attr.url'), children: url }), _jsx(Descriptions.Item, { label: t('domain:attr.apiPath'), children: apiPath }), _jsx(Descriptions.Item, { label: t('domain:attr.port'), children: port }), _jsx(Descriptions.Item, { label: t('domain:attr.protocol'), children: protocol }), _jsx(Descriptions.Item, { label: t('domain:attr.system') +
t('system:attr.name'), children: system?.name })] })),
},
] }) }));
}

View File

@ -7,8 +7,6 @@ export default function Render(props: WebComponentProps<EntityDict, 'domain', fa
apiPath: string;
port: number;
protocol: EntityDict['domain']['Schema']['protocol'];
variant: 'inline' | 'alone' | 'dialog';
showBack: boolean;
}, {
confirm: () => void;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -1,61 +1,45 @@
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { Button, Form, Row, Col, Input, Space, Select } from 'antd';
import PageHeader from '../../../components/common/pageHeader';
import Style from './web.module.less';
export default function Render(props) {
const { systemId, url, apiPath, port, protocol, variant, showBack = true, } = props.data;
const { systemId, url, apiPath, port, protocol, } = props.data;
const { t, update, navigateBack, confirm } = props.methods;
return (_jsx(Container, { variant: variant, showBack: showBack, children: _jsx(Row, { children: _jsx(Col, { xs: 24, sm: 12, children: _jsxs(Form, { colon: true, labelCol: { span: 6 }, wrapperCol: { span: 16 }, children: [_jsx(Form.Item, { label: "\u8BBF\u95EE\u57DF\u540D", required: true, children: _jsx(_Fragment, { children: _jsx(Input, { placeholder: "\u8F93\u5165\u57DF\u540D\uFF0C\u4F8B\u5982\uFF1Awww.abc.com", onChange: (e) => {
update({
url: e.target.value,
});
}, value: url }) }) }), _jsx(Form.Item, { label: "\u8BF7\u6C42\u8DEF\u5F84", children: _jsx(_Fragment, { children: _jsx(Input, { onChange: (e) => {
update({
apiPath: e.target.value,
});
}, value: apiPath }) }) }), _jsx(Form.Item, { label: "\u7AEF\u53E3", required: true, children: _jsx(_Fragment, { children: _jsx(Input, { onChange: (e) => {
const v = e.target.value;
update({
port: v ? Number(v) : undefined,
});
}, value: port }) }) }), _jsx(Form.Item
return (_jsx(Row, { children: _jsx(Col, { xs: 24, sm: 12, children: _jsxs(Form, { colon: true, labelCol: { span: 6 }, wrapperCol: { span: 16 }, children: [_jsx(Form.Item, { label: "\u8BBF\u95EE\u57DF\u540D", required: true, children: _jsx(_Fragment, { children: _jsx(Input, { placeholder: "\u8F93\u5165\u57DF\u540D\uFF0C\u4F8B\u5982\uFF1Awww.abc.com", onChange: (e) => {
update({
url: e.target.value,
});
}, value: url }) }) }), _jsx(Form.Item, { label: "\u8BF7\u6C42\u8DEF\u5F84", children: _jsx(_Fragment, { children: _jsx(Input, { onChange: (e) => {
update({
apiPath: e.target.value,
});
}, value: apiPath }) }) }), _jsx(Form.Item, { label: "\u7AEF\u53E3", required: true, children: _jsx(_Fragment, { children: _jsx(Input, { onChange: (e) => {
const v = e.target.value;
update({
port: v ? Number(v) : undefined,
});
}, value: port }) }) }), _jsx(Form.Item
//name="protocol"
, {
//name="protocol"
, {
//name="protocol"
required: true, label: "\u534F\u8BAE", children: _jsx(_Fragment, { children: _jsx(Select
required: true, label: "\u534F\u8BAE", children: _jsx(_Fragment, { children: _jsx(Select
// mode="multiple"
, {
// mode="multiple"
, {
// mode="multiple"
allowClear: true, style: { width: '100%' }, placeholder: "\u8BF7\u9009\u62E9\u534F\u8BAE", value: protocol, onChange: (value) => {
update({
protocol: value,
});
}, options: [
{
label: 'http',
value: 'http',
},
{
label: 'https',
value: 'https',
},
] }) }) }), _jsx(Action, { variant: variant, children: _jsx(Form.Item, { wrapperCol: { offset: 6 }, children: _jsxs(Space, { children: [_jsx(Button, { type: "primary", onClick: () => {
confirm();
}, children: "\u786E\u5B9A" }), _jsx(Button, { onClick: () => {
navigateBack();
}, children: "\u8FD4\u56DE" })] }) }) })] }) }) }) }));
}
function Action(props) {
const { children, variant } = props;
if (variant === 'dialog') {
return null;
}
return (_jsx(_Fragment, { children: children }));
}
function Container(props) {
const { children, variant, showBack } = props;
if (variant === 'inline' || variant === 'dialog') {
return _jsx(_Fragment, { children: children });
}
return (_jsx(PageHeader, { showBack: showBack, title: "\u7CFB\u7EDF\u7F16\u8F91", children: _jsx("div", { className: Style.container, children: children }) }));
allowClear: true, style: { width: '100%' }, placeholder: "\u8BF7\u9009\u62E9\u534F\u8BAE", value: protocol, onChange: (value) => {
update({
protocol: value,
});
}, options: [
{
label: 'http',
value: 'http',
},
{
label: 'https',
value: 'https',
},
] }) }) }), _jsx(Form.Item, { wrapperCol: { offset: 6 }, children: _jsxs(Space, { children: [_jsx(Button, { type: "primary", onClick: () => {
confirm();
}, children: "\u786E\u5B9A" }), _jsx(Button, { onClick: () => {
navigateBack();
}, children: "\u8FD4\u56DE" })] }) })] }) }) }));
}

View File

@ -1,5 +1,4 @@
import { generateNewId } from 'oak-domain/lib/utils/uuid';
import { OakUnloggedInException } from 'oak-domain/lib/types';
export default OakComponent({
isList: true,
properties: {
@ -49,26 +48,6 @@ export default OakComponent({
this.triggerEvent('statuschange', e);
}
},
async addExtraFile(extraFile) {
try {
const result = await this.features.cache.operate('extraFile', {
action: 'create',
data: extraFile,
id: generateNewId(),
});
return result;
}
catch (error) {
if (error.constructor.name ===
OakUnloggedInException.name) {
this.navigateTo({
url: '/login',
});
return;
}
throw error;
}
},
async onPickMp(event) {
if (process.env.OAK_PLATFORM === 'wechatMp') {
const { mediaType } = event.currentTarget.dataset;
@ -90,7 +69,6 @@ export default OakComponent({
const extension = tempFilePath.substring(tempFilePath.lastIndexOf('.') + 1);
const filename = tempFilePath.substring(0, tempFilePath.lastIndexOf('.'));
const extraFile = {
extra1: tempFilePath,
origin: 'qiniu',
type: 'image',
tag1: this.props.tag1 || 'editorImg',
@ -104,11 +82,11 @@ export default OakComponent({
entityId: this.props.entityId,
bucket: '',
id: generateNewId(),
uploadState: 'uploading'
};
const { url } = await this.features.extraFile.createAndUpload(extraFile, extraFile.extra1);
// await this.addExtraFile(extraFile);
const url = await this.features.extraFile.autoUpload(extraFile, tempFilePath);
this.editorCtx.insertImage({
src: 'http://' + url,
src: url,
});
}
}

View File

@ -20,10 +20,10 @@ export default OakComponent({
sort: 1,
applicationId: 1,
},
features: ['extraFile2'],
features: ['extraFile'],
formData({ data: extraFiles, features }) {
const avatar = extraFiles?.filter((ele) => !ele.$$deleteAt$$ && ele.tag1 === 'avatar')[0];
const avatarUrl = features.extraFile2.getUrl(avatar);
const avatarUrl = features.extraFile.getUrl(avatar);
return {
avatar,
avatarUrl,
@ -117,7 +117,7 @@ export default OakComponent({
};
// 如果autoUpload
if (autoUpload) {
await this.features.extraFile2.autoUpload(updateData, extra1);
await this.features.extraFile.autoUpload(updateData, extra1);
if (avatar) {
this.removeItem(avatar.id);
this.execute();
@ -128,7 +128,7 @@ export default OakComponent({
if (avatar) {
this.removeItem(avatar.id);
}
this.features.extraFile2.addLocalFile(id, extra1);
this.features.extraFile.addLocalFile(id, extra1);
}
},
},

View File

@ -2,7 +2,7 @@ import assert from 'assert';
export default OakComponent({
formData({ features }) {
const ids = this.getEfIds();
const states = ids.map((id) => features.extraFile2.getFileState(id));
const states = ids.map((id) => features.extraFile.getFileState(id));
let state = 'uploaded';
states.forEach((ele) => {
if (ele) {
@ -60,7 +60,7 @@ export default OakComponent({
assert(v[attr] instanceof Array);
const [e2, fk2] = rel;
if (e2 === 'extraFile') {
efIds.push(...(v[attr].map((ele) => ele.id)));
efIds.push(...v[attr].map((ele) => ele.id));
}
else {
v[attr].forEach((ele) => getRecursive(e2, ele));
@ -69,7 +69,7 @@ export default OakComponent({
}
};
if (value instanceof Array) {
value.forEach(ele => getRecursive(entity, ele));
value.forEach((ele) => getRecursive(entity, ele));
}
getRecursive(entity, value);
return efIds;
@ -81,11 +81,11 @@ export default OakComponent({
}
const promises = [];
ids.forEach((id) => {
const fileState = this.features.extraFile2.getFileState(id);
const fileState = this.features.extraFile.getFileState(id);
if (fileState) {
const { state } = fileState;
if (['local', 'failed'].includes(state)) {
promises.push(this.features.extraFile2.upload(id));
promises.push(this.features.extraFile.upload(id));
}
}
});
@ -117,5 +117,5 @@ export default OakComponent({
}
},
},
features: ['extraFile2'],
features: ['extraFile'],
});

View File

@ -1,7 +1,7 @@
import { WebComponentProps } from 'oak-frontend-base';
import { ButtonProps } from 'antd-mobile';
import { EntityDict } from '../../../oak-app-domain';
import { FileState } from '../../../features/extraFile2';
import { FileState } from '../../../features/extraFile';
export default function render(props: WebComponentProps<EntityDict, any, true, {
state: FileState;
size?: ButtonProps['size'];

View File

@ -1,7 +1,7 @@
import { WebComponentProps } from 'oak-frontend-base';
import { ButtonProps } from 'antd';
import { EntityDict } from '../../../oak-app-domain';
import { FileState } from '../../../features/extraFile2';
import { FileState } from '../../../features/extraFile';
export default function render(props: WebComponentProps<EntityDict, any, true, {
state: FileState;
size?: ButtonProps['size'];

View File

@ -151,13 +151,15 @@ export default OakComponent({
isModalOpen1: false,
});
},
createExtraFileData(params) {
createExtraFileData(file) {
const { methodsType } = this.state;
const { tag1, tag2, entity, entityId } = this.props;
let extension = '';
let filename = '';
const applicationId = this.features.application.getApplicationId();
const createData = {
extra1: params,
applicationId,
extra1: file,
entity,
entityId,
type: 'image',
@ -165,11 +167,12 @@ export default OakComponent({
tag2,
bucket: '',
id: generateNewId(),
objectId: generateNewId(), // 这个域用来标识唯一性
};
assert(entity, '必须传入entity');
switch (methodsType) {
case 'uploadLocalImg':
const { name, size, type } = params;
const { name, size, type } = file;
extension = name.substring(name.lastIndexOf('.') + 1);
filename = name.substring(0, name.lastIndexOf('.'));
Object.assign(createData, {
@ -185,7 +188,7 @@ export default OakComponent({
origin: 'unknown',
extension,
filename,
isBridge: this.isWechatUrlFn(params)
isBridge: this.isWechatUrlFn(file),
});
break;
case 'original':
@ -193,7 +196,7 @@ export default OakComponent({
origin: 'unknown',
extension,
filename,
isBridge: this.isWechatUrlFn(params)
isBridge: this.isWechatUrlFn(file),
});
break;
}
@ -201,17 +204,12 @@ export default OakComponent({
},
async myAddItem(createData) {
// 目前只支持七牛上传
const { methodsType } = this.state;
this.addItem(Object.assign(createData, {
const file = createData.extra1;
const id = this.addItem(Object.assign(createData, {
extra1: null,
}), async () => {
if (createData.bucket) {
// 说明本函数已经执行过了
return;
}
}, async () => {
await this.features.extraFile.upload(createData, createData.extra1);
});
uploadState: 'uploading',
}));
this.features.extraFile.addLocalFile(id, file);
},
async myUpdateItem(params) {
const { file } = this.state;

View File

@ -20,7 +20,7 @@ export default OakComponent({
isBridge: 1,
uploadState: 1,
},
features: ['extraFile2'],
features: ['extraFile'],
formData({ data, features }) {
let files = data?.sort((ele1, ele2) => ele1.sort - ele2.sort);
if (this.props.tag1) {
@ -30,9 +30,9 @@ export default OakComponent({
files = files?.filter((ele) => ele?.tag2 === this.props.tag2);
}
const files2 = files.map((ele) => {
const url = features.extraFile2.getUrl(ele);
const thumbUrl = features.extraFile2.getUrl(ele, this.props.style);
const fileName = features.extraFile2.getFileName(ele);
const url = features.extraFile.getUrl(ele);
const thumbUrl = features.extraFile.getUrl(ele, this.props.style);
const fileName = features.extraFile.getFileName(ele);
return {
url,
thumbUrl,

View File

@ -1,5 +1,5 @@
import { EntityDict } from '../../../oak-app-domain';
import { FileState } from '../../../features/extraFile2';
import { FileState } from '../../../features/extraFile';
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
import { ReactComponentProps } from 'oak-frontend-base/lib/types/Page';
type ExtraFile = EntityDict['extraFile']['OpSchema'];

View File

@ -95,7 +95,7 @@ export default OakComponent({
}
},
},
features: ['extraFile2'],
features: ['extraFile'],
formData({ data, features }) {
let files = data
?.filter((ele) => !ele.$$deleteAt$$)
@ -107,10 +107,10 @@ export default OakComponent({
files = files?.filter((ele) => ele?.tag2 === this.props.tag2);
}
const files2 = files.map((ele) => {
const url = features.extraFile2.getUrl(ele);
const thumbUrl = features.extraFile2.getUrl(ele, 'thumbnail');
const fileState = features.extraFile2.getFileState(ele.id);
const fileName = features.extraFile2.getFileName(ele);
const url = features.extraFile.getUrl(ele);
const thumbUrl = features.extraFile.getUrl(ele, 'thumbnail');
const fileState = features.extraFile.getFileState(ele.id);
const fileName = features.extraFile.getFileName(ele);
return {
url,
thumbUrl,
@ -127,7 +127,7 @@ export default OakComponent({
methods: {
onRemove(file) {
this.removeItem(file.id);
this.features.extraFile2.removeLocalFiles([file.id]);
this.features.extraFile.removeLocalFiles([file.id]);
},
addExtraFileInner(options, file) {
const { type, origin = 'qiniu', // 默认qiniu
@ -154,7 +154,7 @@ export default OakComponent({
sort,
uploadState: 'uploading',
});
this.features.extraFile2.addLocalFile(id, file);
this.features.extraFile.addLocalFile(id, file);
},
addFileByWeb(file) {
const { size, type, name } = file;

View File

@ -1,13 +1,4 @@
/** index.wxss **/
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
margin: 20px;
}
.title {
font-family: "helvetica neue", PingFangSC-Light, arial, "hiragino sans gb", "microsoft yahei ui", "microsoft yahei", simsun, sans-serif;

View File

@ -1,4 +1,4 @@
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { Button, } from 'antd';
import Style from './mobile.module.less';
export default function Render(props) {
@ -6,7 +6,7 @@ export default function Render(props) {
const { title, content, router } = data;
const { t, goPage } = methods;
const pathname = router?.pathname;
return (_jsxs("div", { className: Style.container, children: [_jsx("h1", { className: Style.title, children: title }), _jsx("div", { className: Style.content, children: content }), pathname && (_jsx(Button, { className: Style.btn, block: true, type: "primary", onClick: () => {
return (_jsxs(_Fragment, { children: [_jsx("h1", { className: Style.title, children: title }), _jsx("div", { className: Style.content, children: content }), pathname && (_jsx(Button, { className: Style.btn, block: true, type: "primary", onClick: () => {
goPage();
}, children: "\u524D\u5F80" }))] }));
}

View File

@ -1,26 +1,4 @@
/** index.wxss **/
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}
.warp {
word-break: break-all;
min-width: 320px;
max-width: 600px;
border: 1px solid rgb(246, 246, 246);
background-color: rgb(247, 248, 250);
margin: auto;
padding: 30px;
}
.inner {
background-color: rgb(255, 255, 255);
padding: 30px;
box-shadow: rgb(122 55 55 / 20%) 0px 1px 1px 0px;
}
.title {

View File

@ -1,4 +1,4 @@
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Button, } from 'antd';
import Style from './web.module.less';
export default function Render(props) {
@ -6,7 +6,7 @@ export default function Render(props) {
const { title, content, router } = data;
const { t, goPage } = methods;
const pathname = router?.pathname;
return (_jsx("div", { className: Style.container, children: _jsx("div", { className: Style.warp, children: _jsxs("div", { className: Style.inner, children: [_jsx("h1", { className: Style.title, children: title }), _jsx("div", { className: Style.content, children: content }), pathname && (_jsx(Button, { className: Style.btn, block: true, type: "primary", onClick: () => {
return (_jsx(_Fragment, { children: _jsx("div", { className: Style.warp, children: _jsxs("div", { className: Style.inner, children: [_jsx("h1", { className: Style.title, children: title }), _jsx("div", { className: Style.content, children: content }), pathname && (_jsx(Button, { className: Style.btn, block: true, type: "primary", onClick: () => {
goPage();
}, children: "\u524D\u5F80" }))] }) }) }));
}

View File

@ -1,14 +1,13 @@
import { jsx as _jsx } from "react/jsx-runtime";
import Style from './mobile.module.less';
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
import MessageCell from '../../../components/message/cell';
import Empty from '../../../components/common/empty';
export default function Render(props) {
const { data, methods } = props;
const { messages, oakFullpath } = data;
const { goDetailById } = methods;
return (_jsx("div", { className: Style.container, children: messages?.length > 0 ? (_jsx("div", { children: messages?.map((message, index) => (_jsx(MessageCell, { oakId: message.id, oakPath: oakFullpath
return (_jsx(_Fragment, { children: messages?.length > 0 ? (_jsx("div", { children: messages?.map((message, index) => (_jsx(MessageCell, { oakId: message.id, oakPath: oakFullpath
? `${oakFullpath}.${message.id}`
: '', onItemClicked: (item) => {
goDetailById(item.id);
} }, message.id))) })) : (_jsx("div", { className: Style.noData, children: _jsx(Empty, { description: "\u6682\u65E0\u6D88\u606F", image: Empty.PRESENTED_IMAGE_SIMPLE }) })) }));
} }, message.id))) })) : (_jsx(Empty, { description: "\u6682\u65E0\u6D88\u606F", image: Empty.PRESENTED_IMAGE_SIMPLE })) }));
}

View File

@ -1,7 +1,6 @@
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { Badge, Table, Typography } from 'antd';
import dayjs from 'dayjs';
import Style from './web.module.less';
import ActionBtnPanel from 'oak-frontend-base/es/components/actionBtnPanel';
const MessageType = {
adminNotification: '系统通知',
@ -12,85 +11,85 @@ export default function Render(props) {
const { t, setPageSize, setCurrentPage, goDetailById } = methods;
const { messages, oakFullpath, oakLoading, oakPagination } = data;
const { pageSize, total, currentPage } = oakPagination || {};
return (_jsx("div", { className: Style.container, children: _jsx(Table, { loading: oakLoading, dataSource: messages || [], rowKey: "id",
// scroll={{ x: 1200 }}
columns: [
// {
// dataIndex: 'serial-number',
// title: '序号',
// render: (value, record, index) => {
// return index + 1;
// },
// },
{
dataIndex: 'title',
title: '消息内容',
render: (value, record, index) => {
if (record.visitState === 'unvisited') {
return (_jsxs(_Fragment, { children: [_jsx(Badge, { style: { marginRight: 5 }, status: "processing" }), _jsx(Typography.Link, { onClick: () => {
goDetailById(record.id);
}, children: value })] }));
}
return (_jsx(Typography.Text, { onClick: () => {
goDetailById(record.id);
}, children: value }));
},
},
{
dataIndex: 'type',
title: '类型',
render: (value, record, index) => {
return MessageType[value];
},
},
{
dataIndex: 'visitState',
title: '是否已读',
render: (value, record, index) => {
return value === 'unvisited' ? '未读' : '已读';
},
},
{
dataIndex: '$$createAt$$',
title: '接收时间',
render: (value, record, index) => {
return (_jsx("div", { children: dayjs(value).format('YYYY-MM-DD HH:mm:ss') }));
},
},
{
dataIndex: 'op',
width: 300,
title: '操作',
align: 'center',
render: (value, record, index) => {
return (_jsx(ActionBtnPanel, { mode: "table-cell", entity: "message", items: [
{
label: '详情',
onClick: () => {
return (_jsx(Table, { loading: oakLoading, dataSource: messages || [], rowKey: "id",
// scroll={{ x: 1200 }}
columns: [
// {
// dataIndex: 'serial-number',
// title: '序号',
// render: (value, record, index) => {
// return index + 1;
// },
// },
{
dataIndex: 'title',
title: '消息内容',
render: (value, record, index) => {
if (record.visitState === 'unvisited') {
return (_jsxs(_Fragment, { children: [_jsx(Badge, { style: { marginRight: 5 }, status: "processing" }), _jsx(Typography.Link, { onClick: () => {
goDetailById(record.id);
},
}, children: value })] }));
}
return (_jsx(Typography.Text, { onClick: () => {
goDetailById(record.id);
}, children: value }));
},
},
{
dataIndex: 'type',
title: '类型',
render: (value, record, index) => {
return MessageType[value];
},
},
{
dataIndex: 'visitState',
title: '是否已读',
render: (value, record, index) => {
return value === 'unvisited' ? '未读' : '已读';
},
},
{
dataIndex: '$$createAt$$',
title: '接收时间',
render: (value, record, index) => {
return (_jsx("div", { children: dayjs(value).format('YYYY-MM-DD HH:mm:ss') }));
},
},
{
dataIndex: 'op',
width: 300,
title: '操作',
align: 'center',
render: (value, record, index) => {
return (_jsx(ActionBtnPanel, { mode: "table-cell", entity: "message", items: [
{
label: '详情',
onClick: () => {
goDetailById(record.id);
},
{
action: 'visit',
show: record['#oakLegalActions']?.includes('visit'),
onClick: async () => {
methods.updateItem({}, record.id, 'visit');
await methods.execute();
},
},
{
action: 'visit',
show: record['#oakLegalActions']?.includes('visit'),
onClick: async () => {
methods.updateItem({}, record.id, 'visit');
await methods.execute();
},
] }));
},
fixed: 'right',
},
] }));
},
], pagination: {
total: total,
pageSize: pageSize,
current: currentPage,
onShowSizeChange: (current, pageSize) => {
setPageSize(pageSize);
},
onChange: (page, pageSize) => {
setCurrentPage(page);
},
} }) }));
fixed: 'right',
},
], pagination: {
total: total,
pageSize: pageSize,
current: currentPage,
onShowSizeChange: (current, pageSize) => {
setPageSize(pageSize);
},
onChange: (page, pageSize) => {
setCurrentPage(page);
},
} }));
}

View File

@ -1,4 +1,4 @@
import { jsx as _jsx } from "react/jsx-runtime";
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
import Style from './web.module.less';
import MessageCell from '../../../components/message/cell';
import Empty from '../../../components/common/empty';
@ -6,7 +6,7 @@ export default function Render(props) {
const { data, methods } = props;
const { messages, open, onClose, oakFullpath } = data;
const { goDetailById, goMessageList } = methods;
return (_jsx("div", { className: Style.container, children: messages?.length > 0 ? (_jsx("div", { children: messages?.map((message, index) => (_jsx(MessageCell, { oakId: message.id, oakPath: oakFullpath
return (_jsx(_Fragment, { children: messages?.length > 0 ? (_jsx("div", { children: messages?.map((message, index) => (_jsx(MessageCell, { oakId: message.id, oakPath: oakFullpath
? `${oakFullpath}.${message.id}`
: '', onItemClicked: (item) => {
const { id } = item;

View File

@ -1,4 +1,4 @@
import { WebComponentProps } from "oak-frontend-base";
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../oak-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'messageTypeTemplate', true, {
mtt: EntityDict['messageTypeTemplate']['Schema'][];

View File

@ -1,14 +1,14 @@
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { useState } from 'react';
import { Table, Button, Space, Typography, Select, Modal } from 'antd';
import Styles from './web.module.less';
export default function Render(props) {
const { oakPagination, mtt = [], dirtyIds = [], oakLoading, messageTypes = [], applicationId, wechatPublicTemplates = [], } = props.data;
const { setCurrentPage, setPageSize, t, addItem, syncTemplate, removeItem, updateItem, recoverItem, resetItem, execute } = props.methods;
const { setCurrentPage, setPageSize, t, addItem, syncTemplate, removeItem, updateItem, recoverItem, resetItem, execute, } = props.methods;
const [syncDisable, setSyncDisable] = useState(false);
const [open, setOpen] = useState(false);
const { pageSize, total, currentPage } = oakPagination || {};
return (_jsxs("div", { className: Styles.container, children: [_jsxs(Space, { children: [_jsx(Button, { type: "default", disabled: !(messageTypes.length > 0 && wechatPublicTemplates.length > 0), onClick: () => {
return (_jsxs(_Fragment, { children: [_jsxs(Space, { children: [_jsx(Button, { type: "default", disabled: !(messageTypes.length > 0 &&
wechatPublicTemplates.length > 0), onClick: () => {
addItem({
templateId: wechatPublicTemplates[0].id,
});
@ -26,17 +26,20 @@ export default function Render(props) {
title: '消息类型',
width: 180,
render: (value, record, index) => {
if (dirtyIds.includes(record.id) && !record.$$deleteAt$$) {
if (dirtyIds.includes(record.id) &&
!record.$$deleteAt$$) {
return (_jsx(Select, { style: {
width: '100%',
}, value: value, onChange: (e) => updateItem({
type: e,
}, record.id), options: messageTypes.map(ele => ({
}, record.id), options: messageTypes.map((ele) => ({
value: ele,
label: ele
label: ele,
})) }));
}
return (_jsx(Typography.Text, { type: !!record.$$deleteAt$$ ? 'danger' : undefined, delete: !!record.$$deleteAt$$, children: value }));
return (_jsx(Typography.Text, { type: !!record.$$deleteAt$$
? 'danger'
: undefined, delete: !!record.$$deleteAt$$, children: value }));
},
},
{
@ -44,17 +47,20 @@ export default function Render(props) {
title: '模板消息标题',
width: 300,
render: (value, record, index) => {
if (dirtyIds.includes(record.id) && !record.$$deleteAt$$) {
if (dirtyIds.includes(record.id) &&
!record.$$deleteAt$$) {
return (_jsx(Select, { style: {
width: '100%',
}, value: value, onChange: (e) => updateItem({
type: e,
}, record.id), options: wechatPublicTemplates.map(ele => ({
}, record.id), options: wechatPublicTemplates.map((ele) => ({
value: ele.id,
label: ele.title
label: ele.title,
})) }));
}
return (_jsx(Typography.Text, { type: !!record.$$deleteAt$$ ? 'danger' : undefined, delete: !!record.$$deleteAt$$, children: record?.template?.title }));
return (_jsx(Typography.Text, { type: !!record.$$deleteAt$$
? 'danger'
: undefined, delete: !!record.$$deleteAt$$, children: record?.template?.title }));
},
},
{
@ -67,11 +73,12 @@ export default function Render(props) {
removeItem(record.id);
}, children: t('common::action.remove') })) : (_jsx(Button, { type: "link", onClick: () => {
recoverItem(record.id);
}, children: "\u6062\u590D" })), !record.$$deleteAt$$ && (!dirtyIds.includes(record.id) ? (_jsx(Button, { type: "link", onClick: () => {
updateItem({}, record.id);
}, children: t('common::action.update') })) : (_jsx(Button, { type: "link", onClick: () => {
resetItem(record.id);
}, children: "\u6062\u590D" })))] }));
}, children: "\u6062\u590D" })), !record.$$deleteAt$$ &&
(!dirtyIds.includes(record.id) ? (_jsx(Button, { type: "link", onClick: () => {
updateItem({}, record.id);
}, children: t('common::action.update') })) : (_jsx(Button, { type: "link", onClick: () => {
resetItem(record.id);
}, children: "\u6062\u590D" })))] }));
},
fixed: 'right',
},
@ -85,7 +92,7 @@ export default function Render(props) {
onChange: (current) => {
setCurrentPage(current);
},
} }), _jsx(Modal, { title: '\u6A21\u677F\u5217\u8868', open: open, destroyOnClose: true, onCancel: () => {
} }), _jsx(Modal, { title: "\u6A21\u677F\u5217\u8868", open: open, destroyOnClose: true, onCancel: () => {
setOpen(false);
}, width: '80%', footer: null, children: _jsx(Table, { dataSource: wechatPublicTemplates, rowKey: "id", columns: [
{

View File

@ -1,13 +1,12 @@
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { Form, Space, Button, InputNumber, Typography, AutoComplete, } from 'antd';
import Style from './web.module.less';
import ParasiteDetail from '../detail';
export default function Render(props) {
const { methods, data } = props;
const { entity, entityId, relation, period, parasiteId, options, nameLabel, nameRequired, } = props.data;
const { setPeriod, confirm, setInit, onSelect, onSearch, setSearchValue } = methods;
if (!!parasiteId) {
return (_jsxs("div", { className: Style.container, children: [_jsx(ParasiteDetail, { oakId: parasiteId, oakAutoUnmount: true, oakPath: "$parasite/upsert-parasite/detail" }), _jsx("div", { style: {
return (_jsxs(_Fragment, { children: [_jsx(ParasiteDetail, { oakId: parasiteId, oakAutoUnmount: true, oakPath: "$parasite/upsert-parasite/detail" }), _jsx("div", { style: {
width: '100%',
display: 'flex',
justifyContent: 'flex-end',
@ -15,11 +14,11 @@ export default function Render(props) {
setInit();
}, children: "\u91CD\u65B0\u751F\u6210" }) })] }));
}
return (_jsx(_Fragment, { children: _jsx("div", { className: Style.container, children: _jsxs(Form, { labelCol: { span: 4 }, wrapperCol: { span: 8 }, children: [_jsx(Form.Item, { label: nameLabel || '名称', required: nameRequired, children: _jsx(_Fragment, { children: _jsx(AutoComplete, { options: options, style: { width: 200 }, onSelect: onSelect, onSearch: (text) => onSearch(text), placeholder: "\u8BF7\u8F93\u5165", onChange: (value) => {
setSearchValue(value);
} }) }) }), _jsx(Form.Item, { label: "\u6709\u6548\u671F", required: true, children: _jsx(_Fragment, { children: _jsx(InputNumber, { min: 1, max: 30, placeholder: "\u8BF7\u8F93\u5165", onChange: (value) => {
setPeriod(value);
}, value: period, addonAfter: _jsx(Typography, { children: "\u5929" }) }) }) }), _jsx(Form.Item, { wrapperCol: { offset: 4 }, children: _jsx(Space, { children: _jsx(Button, { type: "primary", onClick: () => {
confirm();
}, children: "\u63D0\u4EA4" }) }) })] }) }) }));
return (_jsx(_Fragment, { children: _jsxs(Form, { labelCol: { span: 4 }, wrapperCol: { span: 8 }, children: [_jsx(Form.Item, { label: nameLabel || '名称', required: nameRequired, children: _jsx(_Fragment, { children: _jsx(AutoComplete, { options: options, style: { width: 200 }, onSelect: onSelect, onSearch: (text) => onSearch(text), placeholder: "\u8BF7\u8F93\u5165", onChange: (value) => {
setSearchValue(value);
} }) }) }), _jsx(Form.Item, { label: "\u6709\u6548\u671F", required: true, children: _jsx(_Fragment, { children: _jsx(InputNumber, { min: 1, max: 30, placeholder: "\u8BF7\u8F93\u5165", onChange: (value) => {
setPeriod(value);
}, value: period, addonAfter: _jsx(Typography, { children: "\u5929" }) }) }) }), _jsx(Form.Item, { wrapperCol: { offset: 4 }, children: _jsx(Space, { children: _jsx(Button, { type: "primary", onClick: () => {
confirm();
}, children: "\u63D0\u4EA4" }) }) })] }) }));
}

View File

@ -1,5 +1,4 @@
.container {
background: var(--oak-bg-color-container);
padding: 8px;
height: 100%;

View File

@ -83,13 +83,13 @@ export default OakComponent({
userId: session?.userId,
userMobile: session?.user?.mobile$user &&
session?.user?.mobile$user[0]?.mobile,
userAvatar: features.extraFile2.getUrl(session?.user?.extraFile$entity &&
userAvatar: features.extraFile.getUrl(session?.user?.extraFile$entity &&
session?.user?.extraFile$entity[0]),
};
if (type === 'image') {
const extraFile$entity = sessionMessage?.extraFile$entity;
Object.assign(newSessionMessage, {
picUrl: features.extraFile2.getUrl(extraFile$entity && extraFile$entity[0]),
picUrl: features.extraFile.getUrl(extraFile$entity && extraFile$entity[0]),
});
}
return newSessionMessage;

View File

@ -285,7 +285,7 @@ export default OakComponent({
entity: 'sessionMessage',
entityId: sessionMessageId,
};
await this.features.extraFile2.autoUpload(extraFile, originFileObj);
await this.features.extraFile.autoUpload(extraFile, originFileObj);
try {
this.updateItem({
createTime: Date.now(),
@ -298,12 +298,12 @@ export default OakComponent({
// },
// ],
}, sessionMessageId);
// this.features.extraFile2.addLocalFile(
// this.features.extraFile.addLocalFile(
// extraFile?.id,
// originFileObj
// );
await this.execute(undefined, false);
// this.features.extraFile2.upload(extraFile?.id);
// this.features.extraFile.upload(extraFile?.id);
this.pageScroll('comment');
this.createItem();
}
@ -368,12 +368,12 @@ export default OakComponent({
// },
// ],
// } as EntityDict['sessionMessage']['CreateSingle']['data']);
// this.features.extraFile2.addLocalFile(
// this.features.extraFile.addLocalFile(
// extraFile?.id,
// originFileObj
// );
// await this.execute(undefined, false);
// this.features.extraFile2.upload(extraFile?.id);
// this.features.extraFile.upload(extraFile?.id);
// } catch (err) {
// throw err;
// }

View File

@ -1,9 +1,4 @@
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}
.upsert {
margin-top: 40px;

View File

@ -0,0 +1,3 @@
.container {
background: var(--oak-bg-color-container);
}

View File

@ -2,7 +2,4 @@
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}

View File

@ -2,7 +2,4 @@
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}

View File

@ -1,69 +1,71 @@
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { useState } from 'react';
import { Table, Button, Avatar, Space, Tag, Modal, } from 'antd';
// import UserEntityGrantList from '../../../pages/userEntityGrant/list';
import Style from './web.module.less';
export default function Render(props) {
const { oakPagination, users = [], entity, entityId, oakLoading, } = props.data;
const { pageSize, total, currentPage } = oakPagination || {};
const { goUpsert, t, setCurrentPage, setPageSize, confirmDelete, goUpdate, } = props.methods;
const [idRemove, setIdRemove] = useState(undefined);
const [inviteVisible, setInviteVisible] = useState(false);
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: Style.container, children: [_jsx(Space, { style: { marginBottom: 16 }, children: _jsx(Button, { type: "primary", onClick: () => goUpsert(), children: "\u6DFB\u52A0" }) }), _jsx(Table, { loading: oakLoading, rowKey: "id", columns: [
{
width: 100,
dataIndex: 'index',
title: '序号',
render: (value, record, index) => index + 1,
},
{
dataIndex: 'avatar',
title: '头像',
render: (value, record, index) => {
return value ? (_jsx(Avatar, { src: value, shape: "circle" })) : (_jsx("span", { children: "\u672A\u8BBE\u7F6E" }));
},
},
{
dataIndex: 'name',
title: '姓名',
},
{
dataIndex: 'nickname',
title: '昵称',
},
{
dataIndex: 'mobile',
title: '手机号',
},
{
dataIndex: 'relations',
title: '权限',
render: (value, record, index) => {
return (_jsx(Space, { children: record.userRelation$user?.map((ele, index) => (_jsx(Tag, { children: ele.relation.name ? t(entity + ':r.' + ele.relation.name) : ele.relation.display }, index))) }));
},
},
{
title: '操作',
dataIndex: 'operate',
render: (value, record, index) => {
return (_jsxs(Space, { children: [_jsx("a", { onClick: (e) => goUpdate(record.id), children: !!record.userRelation$user?.length
? t('common::action.update')
: t('common::action.grant') }), !!record.userRelation$user?.length && (_jsx("a", { style: {
color: 'var(--oak-color-error)',
}, onClick: () => setIdRemove(record.id), children: t('common::action.revoke') }))] }));
},
},
], dataSource: users, pagination: {
total,
pageSize,
current: currentPage,
onShowSizeChange: (current, size) => {
setPageSize(current);
},
onChange: (page, pageSize) => {
setCurrentPage(page);
},
} })] }), _jsx(Modal, { title: t('common::areYouSure'), open: !!idRemove, onOk: async () => {
return (_jsxs(_Fragment, { children: [_jsx(Space, { style: { marginBottom: 16 }, children: _jsx(Button, { type: "primary", onClick: () => goUpsert(), children: "\u6DFB\u52A0" }) }), _jsx(Table, { loading: oakLoading, rowKey: "id", columns: [
{
width: 100,
dataIndex: 'index',
title: '序号',
render: (value, record, index) => index + 1,
},
{
dataIndex: 'avatar',
title: '头像',
render: (value, record, index) => {
return value ? (_jsx(Avatar, { src: value, shape: "circle" })) : (_jsx("span", { children: "\u672A\u8BBE\u7F6E" }));
},
},
{
dataIndex: 'name',
title: '姓名',
},
{
dataIndex: 'nickname',
title: '昵称',
},
{
dataIndex: 'mobile',
title: '手机号',
},
{
dataIndex: 'relations',
title: '权限',
render: (value, record, index) => {
return (_jsx(Space, { children: record.userRelation$user?.map((ele, index) => (_jsx(Tag, { children: ele.relation.name
? t(entity +
':r.' +
ele.relation.name)
: ele.relation.display }, index))) }));
},
},
{
title: '操作',
dataIndex: 'operate',
render: (value, record, index) => {
return (_jsxs(Space, { children: [_jsx("a", { onClick: (e) => goUpdate(record.id), children: !!record.userRelation$user?.length
? t('common::action.update')
: t('common::action.grant') }), !!record.userRelation$user?.length && (_jsx("a", { style: {
color: 'var(--oak-color-error)',
}, onClick: () => setIdRemove(record.id), children: t('common::action.revoke') }))] }));
},
},
], dataSource: users, pagination: {
total,
pageSize,
current: currentPage,
onShowSizeChange: (current, size) => {
setPageSize(current);
},
onChange: (page, pageSize) => {
setCurrentPage(page);
},
} }), _jsx(Modal, { title: t('common::areYouSure'), open: !!idRemove, onOk: async () => {
await confirmDelete(idRemove);
setIdRemove(undefined);
}, onCancel: () => setIdRemove(undefined), cancelText: t('common::action.cancel'), okText: t('common::action.confirm'), children: _jsx("p", { children: t('confirmRevokeAll') }) })] }));

View File

@ -1,11 +1,11 @@
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { Form, Input, Button } from 'antd-mobile';
import Style from './mobile.module.less';
import Style from './web.module.less';
import OnUser from '../onUser/index';
export default function Render(props) {
const { mobileValue, mobileValueReady, relations, entity, entityId, userId, oakFullpath, oakExecutable, oakDirty } = props.data;
const { onConfirm, onMobileChange, onReset, t } = props.methods;
return (_jsxs(Form, { footer: _jsxs("div", { className: Style['btn-container'], children: [_jsx(Button, { color: "primary", style: { flex: 2 }, onClick: () => {
return (_jsxs(Form, { footer: _jsxs("div", { className: Style.btnContainer, children: [_jsx(Button, { color: "primary", style: { flex: 2 }, onClick: () => {
onConfirm();
}, disabled: !oakExecutable, children: t('common::action.confirm') }), _jsx(Button, { style: { flex: 1 }, onClick: () => onReset(), children: t('common::reset') })] }), children: [_jsx(Form.Item, { label: "\u624B\u673A\u53F7\u7801", name: "mobile", rules: [
{
@ -22,6 +22,5 @@ export default function Render(props) {
},
], children: _jsx(_Fragment, { children: _jsx(Input, { maxLength: 11, value: mobileValue, onChange: (value) => {
onMobileChange(value);
}, placeholder: t('inputMobile'), type: "tel", clearable: true }) }) }), mobileValueReady && userId && (_jsx(OnUser, { oakAutoUnmount: true, oakPath: oakFullpath ? `${oakFullpath}.user`
: undefined, entity: entity, entityId: entityId, relations: relations, oakId: userId }))] }));
}, placeholder: t('inputMobile'), type: "tel", clearable: true }) }) }), mobileValueReady && userId && (_jsx(OnUser, { oakAutoUnmount: true, oakPath: oakFullpath ? `${oakFullpath}.user` : undefined, entity: entity, entityId: entityId, relations: relations, oakId: userId }))] }));
}

View File

@ -1,17 +1,6 @@
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}
.formContainer {
padding-top: 32px;
width: 676px;
margin: 0 auto;
}
.tip {
font-size: 12px;
color: var(--oak-warning-color);
.btnContainer {
width: 100%;
display: flex;
flex-direction: row;
}

View File

@ -1,7 +1,7 @@
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useState } from 'react';
import { Form, Input, Button, Space } from 'antd';
import Style from './web.module.less';
import Style from './web.pc.module.less';
import OnUser from '../onUser/index';
export default function Render(props) {
const { mobileValue, mobileValueReady, relations, entity, entityId, userId, oakFullpath, oakExecutable, legal, isNew } = props.data;

View File

@ -1,8 +1,6 @@
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
background: var(--oak-bg-color-container);
}

View File

@ -1,11 +1,10 @@
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Form, Button } from 'antd-mobile';
import Style from './mobile.module.less';
import { Form, Button, Space } from 'antd-mobile';
import OnUser from '../onUser/index';
export default function Render(props) {
const { relations, entity, entityId, oakId, oakDirty, oakFullpath, oakExecutable } = props.data;
const { onConfirm, onReset, t } = props.methods;
return (_jsx(Form, { footer: _jsxs("div", { className: Style['btn-container'], children: [_jsx(Button, { color: "primary", style: { flex: 2 }, onClick: () => {
return (_jsx(Form, { footer: _jsxs(Space, { children: [_jsx(Button, { color: "primary", style: { flex: 2 }, onClick: () => {
onConfirm();
}, disabled: oakExecutable !== true, children: t('common::action.confirm') }), _jsx(Button, { style: { flex: 1 }, onClick: () => onReset(), children: t('common::reset') })] }), children: _jsx(OnUser, { oakAutoUnmount: true, oakPath: oakFullpath && `${oakFullpath}.user`, entity: entity, entityId: entityId, relations: relations, oakId: oakId }) }));
}

View File

@ -1,9 +1,8 @@
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Form, Button, Space } from 'antd';
import Style from './web.module.less';
import OnUser from '../onUser/index';
export default function Render(props) {
const { relations, entity, entityId, oakId, oakDirty, oakFullpath } = props.data;
const { onConfirm, onReset, t } = props.methods;
return (_jsxs("div", { className: Style.container, children: [_jsx(OnUser, { oakAutoUnmount: true, oakPath: oakFullpath && `${oakFullpath}.user`, entity: entity, entityId: entityId, relations: relations, oakId: oakId }), _jsx(Form, { colon: true, labelCol: { span: 4 }, wrapperCol: { span: 8 }, children: _jsx(Form.Item, { wrapperCol: { offset: 4 }, children: _jsxs(Space, { children: [_jsx(Button, { disabled: !oakDirty, type: "primary", onClick: () => onConfirm(), children: t('common::action.confirm') }), _jsx(Button, { htmlType: "reset", onClick: () => onReset(), children: t('common::reset') })] }) }) })] }));
return (_jsxs(_Fragment, { children: [_jsx(OnUser, { oakAutoUnmount: true, oakPath: oakFullpath && `${oakFullpath}.user`, entity: entity, entityId: entityId, relations: relations, oakId: oakId }), _jsx(Form, { colon: true, labelCol: { span: 4 }, wrapperCol: { span: 8 }, children: _jsx(Form.Item, { wrapperCol: { offset: 4 }, children: _jsxs(Space, { children: [_jsx(Button, { disabled: !oakDirty, type: "primary", onClick: () => onConfirm(), children: t('common::action.confirm') }), _jsx(Button, { htmlType: "reset", onClick: () => onReset(), children: t('common::reset') })] }) }) })] }));
}

View File

@ -6,13 +6,16 @@ export default function render(props) {
const { relations, userEntityGrant, userEntityGrantId, period, unit, maxes, rules, oakExecutable, } = props.data;
const { relationIds, type, multiple, relationEntity, rule } = userEntityGrant || {};
const { update, t, onBack, confirm, setInit, setPeriod, setUnit } = props.methods;
const P = !!userEntityGrantId ? (_jsxs(_Fragment, { children: [_jsx(NoticeBar, { content: t('shareCode'), color: 'info' }), _jsx(UserEntityGrantShare, { oakId: userEntityGrantId, oakAutoUnmount: true, oakPath: "$userRelation/upsert/byUserEntityGrant-userEntityGrant/detail" }), _jsx("div", { style: {
const P = !!userEntityGrantId ? (_jsxs(_Fragment, { children: [_jsx(NoticeBar, { content: t('shareCode'), color: "info" }), _jsx(UserEntityGrantShare, { oakId: userEntityGrantId, oakAutoUnmount: true, oakPath: "$userRelation/upsert/byUserEntityGrant-userEntityGrant/detail" }), _jsx("div", { style: {
width: '100%',
display: 'flex',
justifyContent: 'center',
}, children: _jsx(Button, { color: "primary", onClick: () => setInit(), block: true, children: t('restart') }) })] })) : (_jsxs(Form, { children: [_jsx(Form.Item, { label: t('userEntityGrant:attr.relationIds'), required: true, children: _jsx(Checkbox.Group, { value: relationIds || [], onChange: (val) => {
update({ relationIds: val });
}, children: _jsx(Space, { direction: 'vertical', children: relations?.map((ele) => (_jsx(Checkbox, { value: ele.id, children: ele.display || t(`${relationEntity}:r.${ele.name}`) }))) }) }) }), relationIds?.length > 1 && (_jsx(Form.Item, { label: t('userEntityGrant:attr.rule'), required: true, help: t('helpRule'), children: _jsx(Radio.Group, { value: rule, onChange: (val) => update({ rule: val }), children: _jsx(Space, { direction: 'vertical', children: rules.map((ele) => _jsx(Radio, { value: ele, children: t(`userEntityGrant:v.rule.${ele}`) })) }) }) })), type === 'grant' && (_jsx(Form.Item, { label: t('multiple'), required: true, help: t('helpMutiple'), children: _jsx(Switch, { checked: multiple || false, onChange: (val) => update({ multiple: val }) }) })), _jsx(Form.Item, { label: t('userEntityGrant:attr.expiresAt'), name: "period", rules: [
}, children: _jsx(Space, { direction: "vertical", children: relations?.map((ele) => (_jsx(Checkbox, { value: ele.id, children: ele.display ||
t(`${relationEntity}:r.${ele.name}`) }))) }) }) }), relationIds?.length > 1 && (_jsx(Form.Item, { label: t('userEntityGrant:attr.rule'), required: true, help: t('helpRule'), children: _jsx(Radio.Group, { value: rule, onChange: (val) => update({
rule: val,
}), children: _jsx(Space, { direction: "vertical", children: rules.map((ele) => (_jsx(Radio, { value: ele, children: t(`userEntityGrant:v.rule.${ele}`) }))) }) }) })), type === 'grant' && (_jsx(Form.Item, { label: t('multiple'), required: true, help: t('helpMutiple'), children: _jsx(Switch, { checked: multiple || false, onChange: (val) => update({ multiple: val }) }) })), _jsx(Form.Item, { label: t('userEntityGrant:attr.expiresAt'), name: "period", rules: [
{
required: true,
message: t('chooseExpiresAt'),
@ -25,10 +28,10 @@ export default function render(props) {
{
label: t('unit.minute'),
value: 'minute',
}
},
], defaultValue: ['minute'], value: unit && [unit], onChange: (arr) => setUnit(arr[0]) }), children: _jsx(_Fragment, { children: _jsx(Input, { min: 1, max: maxes[unit], value: `${period}`, type: "number", placeholder: t('chooseExpiresAt'), onChange: (value) => {
const v = parseInt(value);
setPeriod(v);
} }) }) }), _jsxs("div", { className: Style['btn-container'], children: [_jsx(Button, { color: "primary", onClick: () => confirm(), disabled: oakExecutable !== true, style: { flex: 2 }, children: t('common::action.confirm') }), _jsx(Button, { onClick: () => onBack(), style: { flex: 1 }, children: t('common::back') })] })] }));
} }) }) }), _jsxs("div", { className: Style.btnContainer, children: [_jsx(Button, { color: "primary", onClick: () => confirm(), disabled: oakExecutable !== true, style: { flex: 2 }, children: t('common::action.confirm') }), _jsx(Button, { onClick: () => onBack(), style: { flex: 1 }, children: t('common::back') })] })] }));
return _jsx("div", { className: Style.container, children: P });
}

View File

@ -1,12 +1,10 @@
.container {
padding: 30px 32px;
background: var(--oak-bg-color-container);
// box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
// border-radius: 3px;
}
.btn-container {
.btnContainer {
width: 100%;
display: flex;
flex-direction: row;

View File

@ -1,7 +1,7 @@
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { Form, Radio, Button, Alert, InputNumber, Space, Checkbox, Select, Switch, } from 'antd';
import UserEntityGrantShare from '../../../userEntityGrant/share';
import Style from './web.module.less';
import Style from './web.pc.module.less';
export default function render(props) {
const { relations, userEntityGrant, userEntityGrantId, period, unit, maxes, oakExecutable, rules, } = props.data;
const { relationIds, type, rule, multiple, relationEntity } = userEntityGrant || {};

View File

@ -1,8 +1,6 @@
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
background: var(--oak-bg-color-container);
}

View File

@ -1,10 +1,7 @@
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
background: var(--oak-bg-color-container);
}
.tab {
height: 100%;
}

View File

@ -1,11 +1,10 @@
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { Form, Input } from 'antd-mobile';
import Style from './mobile.module.less';
import UserRelation from './userRelation';
export default function Render(props) {
const { name, isNew, nickname, password, relations, oakFullpath, entity, entityId } = props.data;
const { t, update } = props.methods;
return (_jsxs(_Fragment, { children: [_jsx(Form.Item, { style: { marginBottom: 0 }, label: _jsx("div", { className: Style.tip, children: !isNew ? t('existedUser') : t('newUser') }) }), _jsx(Form.Item, { label: t('user:attr.name'), name: "name", rules: [
return (_jsxs(_Fragment, { children: [_jsx(Form.Item, { style: { marginBottom: 0 }, label: !isNew ? t('existedUser') : t('newUser') }), _jsx(Form.Item, { label: t('user:attr.name'), name: "name", rules: [
{
required: true,
},
@ -13,11 +12,11 @@ export default function Render(props) {
update({
name: value,
});
}, value: name, placeholder: t('placeholder.name') }) }) }), !isNew ? _jsx(Form.Item, { label: t('user:attr.nickname'), name: "nickname", rules: [
}, value: name, placeholder: t('placeholder.name') }) }) }), !isNew ? (_jsx(Form.Item, { label: t('user:attr.nickname'), name: "nickname", rules: [
{
required: true,
},
], children: _jsx(_Fragment, { children: _jsx(Input, { disabled: true, value: nickname }) }) }) : _jsx(Form.Item, { label: t('user:attr.password'), name: "password", rules: [
], children: _jsx(_Fragment, { children: _jsx(Input, { disabled: true, value: nickname }) }) })) : (_jsx(Form.Item, { label: t('user:attr.password'), name: "password", rules: [
{
required: true,
},
@ -25,10 +24,11 @@ export default function Render(props) {
update({
password: value,
});
}, placeholder: t('placeholder.password') }) }) }), _jsx(Form.Item, { label: t('auth'), rules: [
}, placeholder: t('placeholder.password') }) }) })), _jsx(Form.Item, { label: t('auth'), rules: [
{
required: true,
},
], name: "relation", children: _jsx(UserRelation, { oakAutoUnmount: true, oakPath: oakFullpath ? `${oakFullpath}.userRelation$user`
], name: "relation", children: _jsx(UserRelation, { oakAutoUnmount: true, oakPath: oakFullpath
? `${oakFullpath}.userRelation$user`
: undefined, entity: entity, entityId: entityId, relations: relations }) })] }));
}

View File

@ -1,7 +1,6 @@
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { useState } from 'react';
import { Form, Input } from 'antd';
import Style from './web.module.less';
import UserRelation from './userRelation';
import { EyeInvisibleOutlined, EyeTwoTone } from '@ant-design/icons';
import { encryptPasswordSha1 } from '../../../../utils/password';
@ -12,7 +11,7 @@ export default function Render(props) {
const [validateHelp, setValidateHelp] = useState('');
const [validateHelp1, setValidateHelp1] = useState('');
const [validateStatus, setValidateStatus] = useState('');
return (_jsx("div", { className: Style.container, children: _jsxs(Form, { colon: true, labelCol: { span: 4 }, wrapperCol: { span: 8 }, children: [_jsx(Form.Item, { style: { marginBottom: 0 }, label: _jsx("div", { className: Style.tip, children: !isNew ? t('existedUser') : t('newUser') }), colon: false }), _jsx(Form.Item, { label: t('user:attr.name'), name: "name", rules: [
return (_jsx(_Fragment, { children: _jsxs(Form, { colon: true, labelCol: { span: 4 }, wrapperCol: { span: 8 }, children: [_jsx(Form.Item, { style: { marginBottom: 0 }, label: !isNew ? t('existedUser') : t('newUser'), colon: false }), _jsx(Form.Item, { label: t('user:attr.name'), name: "name", rules: [
{
required: true,
},
@ -21,71 +20,83 @@ export default function Render(props) {
update({
name: strValue,
});
}, value: name, placeholder: t('placeholder.name') }) }) }), !isNew ? _jsx(Form.Item, { label: t('user:attr.nickname'), name: "nickname", rules: [
}, value: name, placeholder: t('placeholder.name') }) }) }), !isNew ? (_jsx(Form.Item, { label: t('user:attr.nickname'), name: "nickname", rules: [
{
required: true,
},
], children: _jsx(_Fragment, { children: _jsx(Input, { disabled: true, value: nickname }) }) }) :
_jsxs(_Fragment, { children: [_jsx(Form.Item, { label: t('user:attr.password'), name: "password", help: validateHelp1, rules: [
{
message: '请输入密码',
validator: (_, value) => {
if (!value && !password2) {
setValidateHelp1('');
setValidateStatus('');
return;
}
if (value.length < 8) {
setValidateHelp1('密码最短长度为8位');
setValidateStatus('error');
return;
], children: _jsx(_Fragment, { children: _jsx(Input, { disabled: true, value: nickname }) }) })) : (_jsxs(_Fragment, { children: [_jsx(Form.Item, { label: t('user:attr.password'), name: "password", help: validateHelp1, rules: [
{
message: '请输入密码',
validator: (_, value) => {
if (!value && !password2) {
setValidateHelp1('');
setValidateStatus('');
return;
}
if (value.length < 8) {
setValidateHelp1('密码最短长度为8位');
setValidateStatus('error');
return;
}
else {
if (password2) {
setValidateHelp(value === password2
? ''
: '两次输入的密码不一致,请检查');
setValidateStatus(value === password2
? 'success'
: 'error');
}
else {
if (password2) {
setValidateHelp(value === password2 ? '' : '两次输入的密码不一致,请检查');
setValidateStatus(value === password2 ? 'success' : 'error');
}
else {
setValidateHelp('请再次确认密码');
setValidateStatus('error');
}
setValidateHelp('请再次确认密码');
setValidateStatus('error');
}
}
},
], hasFeedback: true, validateStatus: validateStatus, children: _jsx(Input.Password, { value: password, onChange: (e) => {
const strValue = e.target.value;
},
], hasFeedback: true, validateStatus: validateStatus, children: _jsx(Input.Password, { value: password, onChange: (e) => {
const strValue = e.target.value;
update({
password: strValue,
});
setPasswordConfirm(password2 || strValue
? password2 === strValue
: true);
}, iconRender: (visible) => visible ? (_jsx(EyeTwoTone, {})) : (_jsx(EyeInvisibleOutlined, {})), placeholder: t('placeholder.password') }) }), _jsx(Form.Item, { label: '确认密码', name: "passwordConfirm", rules: [
{
validator: (_, value) => {
if (!value && !password) {
setValidateHelp('');
setValidateStatus('');
return;
}
if (password.length < 8) {
return;
}
setValidateHelp(value === password
? ''
: '两次输入的密码不一致,请检查');
setValidateStatus(value === password
? 'success'
: 'error');
},
},
], validateTrigger: "onChange", help: validateHelp, validateStatus: validateStatus, hasFeedback: true, children: _jsx(Input.Password, { value: password2, onChange: (e) => {
const strValue = e.target.value;
setPassword2(strValue);
if (password === strValue) {
update({
password: strValue,
passwordSha1: encryptPasswordSha1(password),
});
setPasswordConfirm((password2 || strValue) ? password2 === strValue : true);
}, iconRender: (visible) => (visible ? _jsx(EyeTwoTone, {}) : _jsx(EyeInvisibleOutlined, {})), placeholder: t('placeholder.password') }) }), _jsx(Form.Item, { label: '确认密码', name: "passwordConfirm", rules: [
{
validator: (_, value) => {
if (!value && !password) {
setValidateHelp('');
setValidateStatus('');
return;
}
if (password.length < 8) {
return;
}
setValidateHelp(value === password ? '' : '两次输入的密码不一致,请检查');
setValidateStatus(value === password ? 'success' : 'error');
}
},
], validateTrigger: "onChange", help: validateHelp, validateStatus: validateStatus, hasFeedback: true, children: _jsx(Input.Password, { value: password2, onChange: (e) => {
const strValue = e.target.value;
setPassword2(strValue);
if (password === strValue) {
update({
passwordSha1: encryptPasswordSha1(password)
});
}
setPasswordConfirm((password || strValue) ? password === strValue : true);
}, iconRender: (visible) => (visible ? _jsx(EyeTwoTone, {}) : _jsx(EyeInvisibleOutlined, {})), placeholder: '请再次输入密码' }) })] }), _jsx(Form.Item, { label: t('auth'), rules: [
}
setPasswordConfirm(password || strValue
? password === strValue
: true);
}, iconRender: (visible) => visible ? (_jsx(EyeTwoTone, {})) : (_jsx(EyeInvisibleOutlined, {})), placeholder: '请再次输入密码' }) })] })), _jsx(Form.Item, { label: t('auth'), rules: [
{
required: true,
},
], name: "relation", children: _jsx(UserRelation, { oakAutoUnmount: true, oakPath: oakFullpath ? `${oakFullpath}.userRelation$user`
], name: "relation", children: _jsx(UserRelation, { oakAutoUnmount: true, oakPath: oakFullpath
? `${oakFullpath}.userRelation$user`
: undefined, entity: entity, entityId: entityId, relations: relations }) })] }) }));
}

View File

@ -1,8 +1,5 @@
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
background: var(--oak-bg-color-container);
}

View File

@ -14,4 +14,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'relation',
qrCodeType?: QrCodeType;
rule: EntityDict['userEntityGrant']['OpSchema']['rule'];
ruleOnRow: EntityDict['userEntityGrant']['OpSchema']['ruleOnRow'];
}, {}>): import("react/jsx-runtime").JSX.Element;
}, {}>): JSX.Element;

View File

@ -52,5 +52,5 @@ export default function Render(props) {
}
SubPart = _jsx(Tabs, { items: items2 });
}
return (_jsx(_Fragment, { children: SubPart }));
return SubPart;
}

View File

@ -2,8 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
import { useState } from 'react';
import { Space, Button, Table, Modal, Descriptions, } from 'antd';
const { confirm } = Modal;
import PageHeader from '../../../components/common/pageHeader';
import Style from './web.module.less';
import dayjs from 'dayjs';
import WechatPublicTagUpsert from '../upsert';
export default function Render(props) {
@ -40,111 +38,124 @@ export default function Render(props) {
await execute();
sync(oakId);
};
return (_jsx(PageHeader, { title: "\u5FAE\u4FE1\u516C\u4F17\u53F7\u6807\u7B7E", showBack: showBack, children: _jsxs("div", { className: Style.container, children: [_jsxs(Space, { style: { marginBottom: 20 }, children: [_jsx(Button, { type: "primary", onClick: () => {
setOpen(true);
setOakId('');
setText('');
}, children: "\u6DFB\u52A0TAG" }), _jsx(Button, { onClick: async () => {
const modal = confirm({
title: '确定一键拉取吗?',
content: '一键拉取微信微信公众号tag可能会导致列表数据发生变化',
okText: '确定',
cancelText: '取消',
onOk: (e) => {
oneKeySync();
modal.destroy();
},
});
}, children: "\u4E00\u952E\u62C9\u53D6" })] }), _jsx(WechatPublicTagUpsert, { isUpdate: oakId ? true : false, oakAutoUnmount: true, open: open, changeOpen: changeOpen, changeText: changeText, text: text, tagName: tagName, addTag: addTag, editTag: editTag }), _jsx(Modal, { title: '\u6807\u7B7E\u8BE6\u60C5', onCancel: () => setDetailOpen(false), footer: null, open: detailOpen, width: 800, children: _jsxs(Descriptions, { bordered: true, column: 3, children: [_jsx(Descriptions.Item, { label: '\u6807\u7B7E\u540D', children: tagInfo.text }), _jsx(Descriptions.Item, { label: '\u5FAE\u4FE1\u7AEFid', children: tagInfo.wechatId ? tagInfo.wechatId : '--' }), _jsx(Descriptions.Item, { label: '\u72B6\u6001', children: tagInfo.iState === 'wait' ? '待同步' : tagInfo.iState === 'success' ? '同步成功' : '同步失败' }), _jsx(Descriptions.Item, { label: '\u540C\u6B65\u65F6\u95F4', children: tagInfo.syncAt ? dayjs(tagInfo.syncAt).format('YYYY-MM-DD HH:mm') : '--' }), _jsx(Descriptions.Item, { label: '\u521B\u5EFA\u65F6\u95F4', children: dayjs(tagInfo.$$createAt$$).format('YYYY-MM-DD HH:mm') }), _jsx(Descriptions.Item, { label: '\u66F4\u65B0\u65F6\u95F4', children: dayjs(tagInfo.$$updateAt$$).format('YYYY-MM-DD HH:mm') })] }) }), _jsx(Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
{
dataIndex: '$$seq$$',
title: '序号',
width: 100,
return (_jsxs(_Fragment, { children: [_jsxs(Space, { style: { marginBottom: 20 }, children: [_jsx(Button, { type: "primary", onClick: () => {
setOpen(true);
setOakId('');
setText('');
}, children: "\u6DFB\u52A0TAG" }), _jsx(Button, { onClick: async () => {
const modal = confirm({
title: '确定一键拉取吗?',
content: '一键拉取微信微信公众号tag可能会导致列表数据发生变化',
okText: '确定',
cancelText: '取消',
onOk: (e) => {
oneKeySync();
modal.destroy();
},
});
}, children: "\u4E00\u952E\u62C9\u53D6" })] }), _jsx(WechatPublicTagUpsert, { isUpdate: oakId ? true : false, oakAutoUnmount: true, open: open, changeOpen: changeOpen, changeText: changeText, text: text, tagName: tagName, addTag: addTag, editTag: editTag }), _jsx(Modal, { title: "\u6807\u7B7E\u8BE6\u60C5", onCancel: () => setDetailOpen(false), footer: null, open: detailOpen, width: 800, children: _jsxs(Descriptions, { bordered: true, column: 3, children: [_jsx(Descriptions.Item, { label: "\u6807\u7B7E\u540D", children: tagInfo.text }), _jsx(Descriptions.Item, { label: "\u5FAE\u4FE1\u7AEFid", children: tagInfo.wechatId ? tagInfo.wechatId : '--' }), _jsx(Descriptions.Item, { label: "\u72B6\u6001", children: tagInfo.iState === 'wait'
? '待同步'
: tagInfo.iState === 'success'
? '同步成功'
: '同步失败' }), _jsx(Descriptions.Item, { label: "\u540C\u6B65\u65F6\u95F4", children: tagInfo.syncAt
? dayjs(tagInfo.syncAt).format('YYYY-MM-DD HH:mm')
: '--' }), _jsx(Descriptions.Item, { label: "\u521B\u5EFA\u65F6\u95F4", children: dayjs(tagInfo.$$createAt$$).format('YYYY-MM-DD HH:mm') }), _jsx(Descriptions.Item, { label: "\u66F4\u65B0\u65F6\u95F4", children: dayjs(tagInfo.$$updateAt$$).format('YYYY-MM-DD HH:mm') })] }) }), _jsx(Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
{
dataIndex: '$$seq$$',
title: '序号',
width: 100,
},
{
dataIndex: 'text',
title: t('wechatPublicTag:attr.text'),
width: 150,
ellipsis: true,
},
{
dataIndex: 'wechatId',
title: t('wechatPublicTag:attr.wechatId'),
width: 100,
},
{
dataIndex: 'iState',
title: '状态',
width: 100,
render: (value, record, index) => {
return value === 'wait'
? '待同步'
: value === 'success'
? '同步成功'
: '同步失败';
},
{
dataIndex: 'text',
title: t('wechatPublicTag:attr.text'),
width: 150,
ellipsis: true,
},
{
dataIndex: 'syncAt',
title: t('wechatPublicTag:attr.syncAt'),
width: 100,
render: (value, record, index) => {
return value
? dayjs(value).format('YYYY-MM-DD HH:mm')
: '--';
},
{
dataIndex: 'wechatId',
title: t('wechatPublicTag:attr.wechatId'),
width: 100,
},
{
dataIndex: '$$createAt$$',
title: '创建时间',
width: 100,
render: (value, record, index) => {
return dayjs(value).format('YYYY-MM-DD HH:mm');
},
{
dataIndex: 'iState',
title: '状态',
width: 100,
render: (value, record, index) => {
return value === 'wait' ? '待同步' : value === 'success' ? '同步成功' : '同步失败';
},
},
{
dataIndex: '$$updateAt$$',
title: '更新时间',
width: 100,
render: (value, record, index) => {
return dayjs(value).format('YYYY-MM-DD HH:mm');
},
{
dataIndex: 'syncAt',
title: t('wechatPublicTag:attr.syncAt'),
width: 100,
render: (value, record, index) => {
return value ? dayjs(value).format('YYYY-MM-DD HH:mm') : '--';
},
},
{
dataIndex: 'op',
width: 200,
title: '操作',
align: 'center',
render: (value, record, index) => {
return (_jsxs(_Fragment, { children: [_jsx(Button, { type: "link", onClick: () => {
setTagInfo(record);
setDetailOpen(true);
}, children: "\u8BE6\u60C5" }), (!record.wechatId ||
![0, 1, 2].includes(record.wechatId)) && (_jsx(Button, { type: "link", onClick: () => {
setOpen(true);
setOakId(record.id);
setText(record.text);
setTagName(record.text);
}, children: "\u66F4\u65B0" })), (record.iState === 'fail' ||
record.iState === 'wait') && (_jsx(Button, { type: "link", onClick: () => {
sync(record.id);
}, children: "\u540C\u6B65" })), _jsx(Button, { type: "link", onClick: () => {
const modal = confirm({
title: '确定删除该标签吗?',
content: '删除后不可恢复',
okText: '确定',
cancelText: '取消',
onOk: (e) => {
deleteTag(record.id);
modal.destroy();
},
});
}, danger: true, children: "\u5220\u9664" })] }));
},
{
dataIndex: '$$createAt$$',
title: '创建时间',
width: 100,
render: (value, record, index) => {
return dayjs(value).format('YYYY-MM-DD HH:mm');
},
},
{
dataIndex: '$$updateAt$$',
title: '更新时间',
width: 100,
render: (value, record, index) => {
return dayjs(value).format('YYYY-MM-DD HH:mm');
},
},
{
dataIndex: 'op',
width: 200,
title: '操作',
align: 'center',
render: (value, record, index) => {
return (_jsxs(_Fragment, { children: [_jsx(Button, { type: "link", onClick: () => {
setTagInfo(record);
setDetailOpen(true);
}, children: "\u8BE6\u60C5" }), (!record.wechatId || ![0, 1, 2].includes(record.wechatId)) &&
_jsx(Button, { type: "link", onClick: () => {
setOpen(true);
setOakId(record.id);
setText(record.text);
setTagName(record.text);
}, children: "\u66F4\u65B0" }), (record.iState === 'fail' || record.iState === 'wait') && _jsx(Button, { type: "link", onClick: () => {
sync(record.id);
}, children: "\u540C\u6B65" }), _jsx(Button, { type: "link", onClick: () => {
const modal = confirm({
title: '确定删除该标签吗?',
content: '删除后不可恢复',
okText: '确定',
cancelText: '取消',
onOk: (e) => {
deleteTag(record.id);
modal.destroy();
},
});
}, danger: true, children: "\u5220\u9664" })] }));
},
fixed: 'right',
},
], pagination: {
total,
pageSize,
current: currentPage,
onShowSizeChange: (pageSize) => {
setPageSize(pageSize);
},
onChange: (current) => {
setCurrentPage(current);
},
} })] }) }));
fixed: 'right',
},
], pagination: {
total,
pageSize,
current: currentPage,
onShowSizeChange: (pageSize) => {
setPageSize(pageSize);
},
onChange: (current) => {
setCurrentPage(current);
},
} })] }));
}

View File

@ -3,6 +3,7 @@ import AspectDict from '../aspects/AspectDict';
import { EntityDict } from '../oak-app-domain';
import { Cache } from 'oak-frontend-base/es/features/cache';
import { Config as ConfigDef } from '../types/Config';
import { Style as StyleDef } from '../types/Style';
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
import { CommonAspectDict } from 'oak-common-aspect';
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
@ -11,4 +12,5 @@ export declare class Config<ED extends EntityDict, Cxt extends BackendRuntimeCon
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>;
updateStyle(entity: 'platform' | 'system' | 'application', entityId: string, style: StyleDef): Promise<void>;
}

View File

@ -21,4 +21,12 @@ export class Config extends Feature {
});
this.publish();
}
async updateStyle(entity, entityId, style) {
await this.cache.exec('updateStyle', {
entity,
entityId,
style,
});
this.publish();
}
}

View File

@ -1,5 +1,6 @@
import { Feature } from 'oak-frontend-base';
import { Cache } from 'oak-frontend-base/es/features/cache';
import { RunningTree } from 'oak-frontend-base/es/features/runningTree';
import { Locales } from 'oak-frontend-base/es/features/locales';
import { CommonAspectDict } from 'oak-common-aspect';
import AspectDict from '../aspects/AspectDict';
@ -7,16 +8,25 @@ import { EntityDict } from '../oak-app-domain';
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
import { Application } from './application';
export type FileState = 'local' | 'uploading' | 'uploaded' | 'failed';
export declare class ExtraFile<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
private cache;
private application;
private locales;
constructor(cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>, application: Application<ED, Cxt, FrontCxt, AD>, locales: Locales<ED, Cxt, FrontCxt, AD>);
createAndUpload(extraFile: EntityDict['extraFile']['CreateSingle']['data'], file: string | File): Promise<{
url: string;
}>;
upload(extraFile: EntityDict['extraFile']['CreateSingle']['data'], file: string | File): Promise<void>;
private files;
private runningTree;
constructor(cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>, application: Application<ED, Cxt, FrontCxt, AD>, locales: Locales<ED, Cxt, FrontCxt, AD>, runningTree: RunningTree<ED, Cxt, FrontCxt, AD>);
addLocalFile(id: string, file: File | string): void;
removeLocalFiles(ids: string[]): void;
upload(id: string): Promise<void>;
uploadCommit(efPaths: string[], oakFullpath: string): Promise<void>;
getUrl(extraFile?: EntityDict['extraFile']['OpSchema'] | EntityDict['extraFile']['Schema'] | null, style?: string): string;
getFileState(id: string): {
state: FileState;
percentage?: number;
} | undefined;
getFileName(extraFile: EntityDict['extraFile']['OpSchema']): string;
formatBytes(size: number): string;
autoUpload(extraFile: EntityDict['extraFile']['OpSchema'], file: File | string): Promise<string>;
private uploadToAspect;
}

View File

@ -3,115 +3,133 @@ import { Upload } from 'oak-frontend-base/es/utils/upload';
import { bytesToSize, getFileURL } from '../utils/extraFile';
import { assert } from 'oak-domain/lib/utils/assert';
import { getCos } from '../utils/cos';
import { generateNewId } from 'oak-domain/lib/utils/uuid';
import { unset } from 'oak-domain/lib/utils/lodash';
import { generateNewId, generateNewIdAsync } from 'oak-domain';
import { extraFileProjection } from '../types/Projection';
export class ExtraFile extends Feature {
cache;
application;
locales;
constructor(cache, application, locales) {
files;
runningTree;
constructor(cache, application, locales, runningTree) {
super();
this.cache = cache;
this.application = application;
this.locales = locales;
this.files = {};
this.runningTree = runningTree;
}
async createAndUpload(extraFile, file) {
await this.cache.operate('extraFile', {
action: 'create',
data: extraFile,
id: generateNewId(),
});
await this.upload(extraFile, file);
const application = this.application.getApplication();
return {
url: this.getUrl(extraFile),
addLocalFile(id, file) {
assert(!this.files[id]);
this.files[id] = {
file,
state: 'local',
};
this.publish();
}
async upload(extraFile, file) {
const { id, origin } = extraFile;
assert(origin, '未设置上传方式');
const [extraFileData] = this.cache.get('extraFile', {
data: {
origin: 1,
type: 1,
bucket: 1,
objectId: 1,
tag1: 1,
tag2: 1,
filename: 1,
md5: 1,
entity: 1,
entityId: 1,
extra1: 1,
extension: 1,
size: 1,
sort: 1,
fileType: 1,
isBridge: 1,
uploadState: 1,
uploadMeta: 1,
},
removeLocalFiles(ids) {
ids.forEach((id) => unset(this.files, id));
this.publish();
}
async upload(id) {
const [extraFile] = this.cache.get('extraFile', {
data: extraFileProjection,
filter: {
id,
},
});
assert(extraFile && extraFile.uploadState === 'uploading');
const item = this.files[id];
assert(item);
const { file, state } = item;
assert(['local', 'failed'].includes(state));
item.state = 'uploading';
item.percentage = 0;
const up = new Upload();
try {
const cos = getCos(origin);
await cos.upload(extraFileData, up.uploadFile, file, async () => undefined);
await this.cache.operate('extraFile', {
action: 'update',
data: {
uploadState: 'success',
},
filter: {
id,
},
id: generateNewId(),
});
const cos = getCos(extraFile.origin);
await cos.upload(extraFile, up.uploadFile, file, this.uploadToAspect.bind(this));
if (!cos.autoInform()) {
await this.cache.exec('operate', {
entity: 'extraFile',
operation: {
id: await generateNewIdAsync(),
action: 'update',
data: {
uploadState: 'success',
},
},
});
}
item.state = 'uploaded';
item.percentage = undefined;
this.publish();
}
catch (err) {
await this.cache.operate('extraFile', {
action: 'update',
data: {
uploadState: 'failed',
},
filter: {
id,
},
id: generateNewId(),
});
item.state = 'failed';
item.percentage = undefined;
this.publish();
throw err;
}
}
async uploadCommit(efPaths, oakFullpath) {
assert(false, '方法已经废弃');
assert(efPaths && efPaths.length > 0);
let ids = [];
if (oakFullpath) {
ids = efPaths
.map((path) => {
const path2 = path ? `${oakFullpath}.${path}` : oakFullpath;
const data = this.runningTree.getFreshValue(path2);
assert(data, `efPath为${path}的路径上取不到extraFile数据请设置正确的相对路径`);
return data.map((ele) => ele.id);
})
.flat()
.filter((ele) => !!ele);
}
assert(ids.length > 0);
const promises = [];
ids.forEach((id) => {
const fileState = this.getFileState(id);
if (fileState) {
const { state } = fileState;
if (['local', 'failed'].includes(state)) {
promises.push(this.upload(id));
}
}
});
if (promises.length > 0) {
await Promise.all(promises);
}
}
getUrl(extraFile, style) {
if (!extraFile) {
return '';
}
let url;
if (extraFile?.isBridge && extraFile?.extra1) {
if (typeof extraFile?.extra1 === 'string') {
url = this.locales.makeBridgeUrl(extraFile?.extra1);
return url;
}
return this.locales.makeBridgeUrl(extraFile?.extra1);
}
if (extraFile?.extra1) {
// 有extra1就用extra1 可能File对象 可能外部链接
if (typeof extraFile?.extra1 === 'string') {
return extraFile?.extra1;
const { id } = extraFile;
if (this.files[id]) {
const { file } = this.files[id];
if (typeof file === 'string') {
return file;
}
if (extraFile?.extra1 instanceof File) {
return getFileURL(extraFile?.extra1) || '';
if (file instanceof File) {
return getFileURL(file);
}
return extraFile?.extra1 || '';
assert(false, 'the incoming file is not supported');
}
const { origin } = extraFile;
const cos = getCos(origin);
const context = this.cache.begin();
this.cache.commit();
url = cos.composeFileUrl(extraFile, context, style);
return url;
return cos.composeFileUrl(extraFile, context, style);
}
getFileState(id) {
if (this.files[id]) {
return this.files[id];
}
}
getFileName(extraFile) {
const name = extraFile.filename +
@ -121,4 +139,53 @@ export class ExtraFile extends Feature {
formatBytes(size) {
return bytesToSize(size);
}
async autoUpload(extraFile, file) {
const extraFileId = extraFile.id || generateNewId();
const applicationId = extraFile.applicationId || this.application.getApplicationId();
await this.cache.operate('extraFile', {
action: 'create',
data: Object.assign(extraFile, {
id: extraFileId,
applicationId,
}),
id: await generateNewIdAsync(),
});
const [newExtraFile] = this.cache.get('extraFile', {
data: extraFileProjection,
filter: {
id: extraFileId,
},
});
const up = new Upload();
try {
const cos = getCos(newExtraFile.origin);
await cos.upload(newExtraFile, up.uploadFile, file, this.uploadToAspect.bind(this));
return this.getUrl(newExtraFile);
}
catch (err) {
await this.cache.operate('extraFile', {
action: 'remove',
data: {},
filter: {
id: extraFileId,
},
id: await generateNewIdAsync(),
});
throw err;
}
}
// 私有
async uploadToAspect(file, name, // 文件的part name
aspectName, // 上传的aspect名
formData, // 上传的其它part参数
autoInform // 上传成功是否会自动通知server若不会则需要前台显式通知
) {
const formData2 = new FormData();
for (const key of Object.keys(formData)) {
formData2.append(key, formData[key]);
}
formData2.append(name || 'file', file);
const { result } = await this.cache.exec(aspectName, formData2);
return result;
}
}

View File

@ -1,32 +0,0 @@
import { Feature } from 'oak-frontend-base';
import { Cache } from 'oak-frontend-base/es/features/cache';
import { RunningTree } from 'oak-frontend-base/es/features/runningTree';
import { Locales } from 'oak-frontend-base/es/features/locales';
import { CommonAspectDict } from 'oak-common-aspect';
import AspectDict from '../aspects/AspectDict';
import { EntityDict } from '../oak-app-domain';
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
import { Application } from './application';
export type FileState = 'local' | 'uploading' | 'uploaded' | 'failed';
export declare class ExtraFile2<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
private cache;
private application;
private locales;
private files;
private runningTree;
constructor(cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>, application: Application<ED, Cxt, FrontCxt, AD>, locales: Locales<ED, Cxt, FrontCxt, AD>, runningTree: RunningTree<ED, Cxt, FrontCxt, AD>);
addLocalFile(id: string, file: File | string): void;
removeLocalFiles(ids: string[]): void;
upload(id: string): Promise<void>;
uploadCommit(efPaths: string[], oakFullpath: string): Promise<void>;
getUrl(extraFile?: EntityDict['extraFile']['OpSchema'] | EntityDict['extraFile']['Schema'] | null, style?: string): string;
getFileState(id: string): {
state: FileState;
percentage?: number;
} | undefined;
getFileName(extraFile: EntityDict['extraFile']['OpSchema']): string;
formatBytes(size: number): string;
autoUpload(extraFile: EntityDict['extraFile']['OpSchema'], file: File | string): Promise<string>;
private uploadToAspect;
}

View File

@ -1,193 +0,0 @@
import { Feature } from 'oak-frontend-base';
import { Upload } from 'oak-frontend-base/es/utils/upload';
import { bytesToSize, getFileURL } from '../utils/extraFile';
import { assert } from 'oak-domain/lib/utils/assert';
import { getCos } from '../utils/cos';
import { unset } from 'oak-domain/lib/utils/lodash';
import { generateNewId, generateNewIdAsync } from 'oak-domain';
import { extraFileProjection } from '../types/Projection';
export class ExtraFile2 extends Feature {
cache;
application;
locales;
files;
runningTree;
constructor(cache, application, locales, runningTree) {
super();
this.cache = cache;
this.application = application;
this.locales = locales;
this.files = {};
this.runningTree = runningTree;
}
addLocalFile(id, file) {
assert(!this.files[id]);
this.files[id] = {
file,
state: 'local',
};
this.publish();
}
removeLocalFiles(ids) {
ids.forEach((id) => unset(this.files, id));
this.publish();
}
async upload(id) {
const [extraFile] = this.cache.get('extraFile', {
data: extraFileProjection,
filter: {
id,
},
});
assert(extraFile && extraFile.uploadState === 'uploading');
const item = this.files[id];
assert(item);
const { file, state } = item;
assert(['local', 'failed'].includes(state));
item.state = 'uploading';
item.percentage = 0;
const up = new Upload();
try {
const cos = getCos(extraFile.origin);
await cos.upload(extraFile, up.uploadFile, file, this.uploadToAspect.bind(this));
if (!cos.autoInform()) {
await this.cache.exec('operate', {
entity: 'extraFile',
operation: {
id: await generateNewIdAsync(),
action: 'update',
data: {
uploadState: 'success',
},
},
});
}
item.state = 'uploaded';
item.percentage = undefined;
this.publish();
}
catch (err) {
item.state = 'failed';
item.percentage = undefined;
this.publish();
}
}
async uploadCommit(efPaths, oakFullpath) {
assert(false, '方法已经废弃');
assert(efPaths && efPaths.length > 0);
let ids = [];
if (oakFullpath) {
ids = efPaths
.map((path) => {
const path2 = path
? `${oakFullpath}.${path}`
: oakFullpath;
const data = this.runningTree.getFreshValue(path2);
assert(data, `efPath为${path}的路径上取不到extraFile数据请设置正确的相对路径`);
return data.map((ele) => ele.id);
})
.flat()
.filter((ele) => !!ele);
}
assert(ids.length > 0);
const promises = [];
ids.forEach((id) => {
const fileState = this.getFileState(id);
if (fileState) {
const { state } = fileState;
if (['local', 'failed'].includes(state)) {
promises.push(this.upload(id));
}
}
});
if (promises.length > 0) {
await Promise.all(promises);
}
}
getUrl(extraFile, style) {
if (!extraFile) {
return '';
}
if (extraFile?.isBridge && extraFile?.extra1) {
return this.locales.makeBridgeUrl(extraFile?.extra1);
}
const { id } = extraFile;
if (this.files[id]) {
const { file } = this.files[id];
if (typeof file === 'string') {
return file;
}
if (file instanceof File) {
return getFileURL(file);
}
assert(false, 'the incoming file is not supported');
}
const { origin } = extraFile;
const cos = getCos(origin);
const context = this.cache.begin();
this.cache.commit();
return cos.composeFileUrl(extraFile, context, style);
}
getFileState(id) {
if (this.files[id]) {
return this.files[id];
}
}
getFileName(extraFile) {
const name = extraFile.filename +
(extraFile.extension ? `.${extraFile.extension}` : '');
return name;
}
formatBytes(size) {
return bytesToSize(size);
}
async autoUpload(extraFile, file) {
const extraFileId = extraFile.id || generateNewId();
const applicationId = extraFile.applicationId || this.application.getApplicationId();
await this.cache.operate('extraFile', {
action: 'create',
data: Object.assign(extraFile, {
id: extraFileId,
applicationId,
}),
id: await generateNewIdAsync(),
});
const [newExtraFile] = this.cache.get('extraFile', {
data: extraFileProjection,
filter: {
id: extraFileId,
},
});
const up = new Upload();
try {
const cos = getCos(newExtraFile.origin);
await cos.upload(newExtraFile, up.uploadFile, file, this.uploadToAspect.bind(this));
return this.getUrl(newExtraFile);
}
catch (err) {
await this.cache.operate('extraFile', {
action: 'remove',
data: {},
filter: {
id: extraFileId,
},
id: await generateNewIdAsync(),
});
throw err;
}
}
// 私有
async uploadToAspect(file, name, // 文件的part name
aspectName, // 上传的aspect名
formData, // 上传的其它part参数
autoInform // 上传成功是否会自动通知server若不会则需要前台显式通知
) {
const formData2 = new FormData();
for (const key of Object.keys(formData)) {
formData2.append(key, formData[key]);
}
formData2.append(name || 'file', file);
const { result } = await this.cache.exec(aspectName, formData2);
return result;
}
}

View File

@ -1,10 +1,8 @@
import { CommonAspectDict } from 'oak-common-aspect';
import { Token } from './token';
import { ExtraFile } from './extraFile';
import { ExtraFile2 } from './extraFile2';
import { Application } from './application';
import { Config } from './config';
import { Style2 } from './style2';
import { Template } from './template';
import { WeiXinJsSdk } from './weiXinJsSdk';
import { WechatMenu } from './wechatMenu';
@ -21,10 +19,8 @@ export declare function initialize<ED extends EntityDict, Cxt extends BackendRun
export type GeneralFeatures<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> = {
token: Token<ED, Cxt, FrontCxt, AD>;
extraFile: ExtraFile<ED, Cxt, FrontCxt, AD>;
extraFile2: ExtraFile2<ED, Cxt, FrontCxt, AD>;
application: Application<ED, Cxt, FrontCxt, AD>;
config: Config<ED, Cxt, FrontCxt, AD>;
style2: Style2<ED, Cxt, FrontCxt, AD>;
template: Template<ED, Cxt, FrontCxt, AD>;
weiXinJsSdk: WeiXinJsSdk<ED, Cxt, FrontCxt, AD>;
theme: Theme<ED, Cxt, FrontCxt, AD>;

View File

@ -1,9 +1,7 @@
import { Token } from './token';
import { ExtraFile } from './extraFile';
import { ExtraFile2 } from './extraFile2';
import { Application } from './application';
import { Config } from './config';
import { Style2 } from './style2';
import { Template } from './template';
import { WeiXinJsSdk } from './weiXinJsSdk';
import { WechatMenu } from './wechatMenu';
@ -16,21 +14,16 @@ export function initialize(basicFeatures, type, domain) {
const wechatMenu = new WechatMenu(basicFeatures.cache, basicFeatures.localStorage);
const wechatPublicTag = new WechatPublicTag(basicFeatures.cache, basicFeatures.localStorage);
const userWechatPublicTag = new UserWechatPublicTag(basicFeatures.cache, basicFeatures.localStorage);
// 临时代码,合并后再删
const extraFile = new ExtraFile(basicFeatures.cache, application, basicFeatures.locales);
const extraFile2 = new ExtraFile2(basicFeatures.cache, application, basicFeatures.locales, basicFeatures.runningTree);
const extraFile = new ExtraFile(basicFeatures.cache, application, basicFeatures.locales, basicFeatures.runningTree);
const config = new Config(basicFeatures.cache);
const style2 = new Style2(basicFeatures.cache);
const template = new Template(basicFeatures.cache);
const weiXinJsSdk = new WeiXinJsSdk(basicFeatures.cache, basicFeatures.localStorage, basicFeatures.environment);
const theme = new Theme(basicFeatures.cache, basicFeatures.localStorage);
return {
token,
extraFile,
extraFile2,
application,
config,
style2,
template,
weiXinJsSdk,
theme,

View File

@ -1,13 +0,0 @@
import { Feature } from 'oak-frontend-base';
import AspectDict from '../aspects/AspectDict';
import { EntityDict } from '../oak-app-domain';
import { Cache } from 'oak-frontend-base/es/features/cache';
import { Style as StyleDef } from '../types/Style';
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
import { CommonAspectDict } from 'oak-common-aspect';
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
export declare class Style2<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
private cache;
constructor(cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>);
updateStyle(entity: 'platform' | 'system' | 'application', entityId: string, style: StyleDef): Promise<void>;
}

View File

@ -1,16 +0,0 @@
import { Feature } from 'oak-frontend-base';
export class Style2 extends Feature {
cache;
constructor(cache) {
super();
this.cache = cache;
}
async updateStyle(entity, entityId, style) {
await this.cache.exec('updateStyle', {
entity,
entityId,
style,
});
this.publish();
}
}

View File

@ -81,7 +81,7 @@ export default OakComponent({
}
},
uploadFile(extraFile) {
return this.features.extraFile.createAndUpload(extraFile, extraFile.extra1);
return this.features.extraFile.autoUpload(extraFile, extraFile.extra1);
},
setEditor(editor) {
this.setState({

View File

@ -1,6 +1,7 @@
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
import { EntityDict } from '../oak-app-domain';
import { Config } from '../types/Config';
import { Style } from '../types/Style';
export declare function updateConfig<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
entity: 'platform' | 'system';
entityId: string;
@ -11,3 +12,8 @@ export declare function updateApplicationConfig<ED extends EntityDict, Cxt exten
entityId: string;
config: EntityDict['application']['Schema']['config'];
}, context: Cxt): Promise<void>;
export declare function updateStyle<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
entity: 'platform' | 'system';
entityId: string;
style: Style;
}, context: Cxt): Promise<void>;

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateApplicationConfig = exports.updateConfig = void 0;
exports.updateStyle = exports.updateApplicationConfig = exports.updateConfig = void 0;
const uuid_1 = require("oak-domain/lib/utils/uuid");
async function updateConfig(params, context) {
const { entity, entityId, config } = params;
@ -30,3 +30,17 @@ async function updateApplicationConfig(params, context) {
}, {});
}
exports.updateApplicationConfig = updateApplicationConfig;
async function updateStyle(params, context) {
const { entity, entityId, style } = params;
await context.operate(entity, {
id: (0, uuid_1.generateNewId)(),
action: 'update',
data: {
style,
},
filter: {
id: entityId,
},
}, {});
}
exports.updateStyle = updateStyle;

View File

@ -1,8 +1,7 @@
import { loginByMobile, loginWechat, loginWechatMp, syncUserInfoWechatMp, sendCaptcha, switchTo, refreshWechatPublicUserInfo, getWechatMpUserPhoneNumber, logout, loginByWechat, wakeupParasite } from './token';
import { getInfoByUrl } from './extraFile';
import { getApplication, signatureJsSDK, uploadWechatMedia, batchGetArticle, getArticle, batchGetMaterialList, getMaterial, deleteMaterial } from './application';
import { updateConfig, updateApplicationConfig } from './config';
import { updateStyle } from './style2';
import { updateConfig, updateApplicationConfig, updateStyle } from './config';
import { syncMessageTemplate } from './template';
import { mergeUser, getChangePasswordChannels, updateUserPassword } from './user';
import { createWechatLogin } from './wechatLogin';

View File

@ -4,7 +4,6 @@ const token_1 = require("./token");
const extraFile_1 = require("./extraFile");
const application_1 = require("./application");
const config_1 = require("./config");
const style2_1 = require("./style2");
const template_1 = require("./template");
const user_1 = require("./user");
const wechatLogin_1 = require("./wechatLogin");
@ -27,7 +26,7 @@ const aspectDict = {
sendCaptcha: token_1.sendCaptcha,
getApplication: application_1.getApplication,
updateConfig: config_1.updateConfig,
updateStyle: style2_1.updateStyle,
updateStyle: config_1.updateStyle,
updateApplicationConfig: config_1.updateApplicationConfig,
getWechatMpUserPhoneNumber: token_1.getWechatMpUserPhoneNumber,
logout: token_1.logout,

View File

@ -1,8 +0,0 @@
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
import { EntityDict } from '../oak-app-domain';
import { Style } from '../types/Style';
export declare function updateStyle<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
entity: 'platform' | 'system';
entityId: string;
style: Style;
}, context: Cxt): Promise<void>;

View File

@ -1,18 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateStyle = void 0;
const uuid_1 = require("oak-domain/lib/utils/uuid");
async function updateStyle(params, context) {
const { entity, entityId, style } = params;
await context.operate(entity, {
id: (0, uuid_1.generateNewId)(),
action: 'update',
data: {
style,
},
filter: {
id: entityId,
}
}, {});
}
exports.updateStyle = updateStyle;

View File

@ -3,6 +3,7 @@ import AspectDict from '../aspects/AspectDict';
import { EntityDict } from '../oak-app-domain';
import { Cache } from 'oak-frontend-base/es/features/cache';
import { Config as ConfigDef } from '../types/Config';
import { Style as StyleDef } from '../types/Style';
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
import { CommonAspectDict } from 'oak-common-aspect';
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
@ -11,4 +12,5 @@ export declare class Config<ED extends EntityDict, Cxt extends BackendRuntimeCon
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>;
updateStyle(entity: 'platform' | 'system' | 'application', entityId: string, style: StyleDef): Promise<void>;
}

View File

@ -24,5 +24,13 @@ class Config extends oak_frontend_base_1.Feature {
});
this.publish();
}
async updateStyle(entity, entityId, style) {
await this.cache.exec('updateStyle', {
entity,
entityId,
style,
});
this.publish();
}
}
exports.Config = Config;

View File

@ -1,5 +1,6 @@
import { Feature } from 'oak-frontend-base';
import { Cache } from 'oak-frontend-base/es/features/cache';
import { RunningTree } from 'oak-frontend-base/es/features/runningTree';
import { Locales } from 'oak-frontend-base/es/features/locales';
import { CommonAspectDict } from 'oak-common-aspect';
import AspectDict from '../aspects/AspectDict';
@ -7,16 +8,25 @@ import { EntityDict } from '../oak-app-domain';
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
import { Application } from './application';
export type FileState = 'local' | 'uploading' | 'uploaded' | 'failed';
export declare class ExtraFile<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
private cache;
private application;
private locales;
constructor(cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>, application: Application<ED, Cxt, FrontCxt, AD>, locales: Locales<ED, Cxt, FrontCxt, AD>);
createAndUpload(extraFile: EntityDict['extraFile']['CreateSingle']['data'], file: string | File): Promise<{
url: string;
}>;
upload(extraFile: EntityDict['extraFile']['CreateSingle']['data'], file: string | File): Promise<void>;
private files;
private runningTree;
constructor(cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>, application: Application<ED, Cxt, FrontCxt, AD>, locales: Locales<ED, Cxt, FrontCxt, AD>, runningTree: RunningTree<ED, Cxt, FrontCxt, AD>);
addLocalFile(id: string, file: File | string): void;
removeLocalFiles(ids: string[]): void;
upload(id: string): Promise<void>;
uploadCommit(efPaths: string[], oakFullpath: string): Promise<void>;
getUrl(extraFile?: EntityDict['extraFile']['OpSchema'] | EntityDict['extraFile']['Schema'] | null, style?: string): string;
getFileState(id: string): {
state: FileState;
percentage?: number;
} | undefined;
getFileName(extraFile: EntityDict['extraFile']['OpSchema']): string;
formatBytes(size: number): string;
autoUpload(extraFile: EntityDict['extraFile']['OpSchema'], file: File | string): Promise<string>;
private uploadToAspect;
}

View File

@ -6,115 +6,133 @@ const upload_1 = require("oak-frontend-base/es/utils/upload");
const extraFile_1 = require("../utils/extraFile");
const assert_1 = require("oak-domain/lib/utils/assert");
const cos_1 = require("../utils/cos");
const uuid_1 = require("oak-domain/lib/utils/uuid");
const lodash_1 = require("oak-domain/lib/utils/lodash");
const oak_domain_1 = require("oak-domain");
const Projection_1 = require("../types/Projection");
class ExtraFile extends oak_frontend_base_1.Feature {
cache;
application;
locales;
constructor(cache, application, locales) {
files;
runningTree;
constructor(cache, application, locales, runningTree) {
super();
this.cache = cache;
this.application = application;
this.locales = locales;
this.files = {};
this.runningTree = runningTree;
}
async createAndUpload(extraFile, file) {
await this.cache.operate('extraFile', {
action: 'create',
data: extraFile,
id: (0, uuid_1.generateNewId)(),
});
await this.upload(extraFile, file);
const application = this.application.getApplication();
return {
url: this.getUrl(extraFile),
addLocalFile(id, file) {
(0, assert_1.assert)(!this.files[id]);
this.files[id] = {
file,
state: 'local',
};
this.publish();
}
async upload(extraFile, file) {
const { id, origin } = extraFile;
(0, assert_1.assert)(origin, '未设置上传方式');
const [extraFileData] = this.cache.get('extraFile', {
data: {
origin: 1,
type: 1,
bucket: 1,
objectId: 1,
tag1: 1,
tag2: 1,
filename: 1,
md5: 1,
entity: 1,
entityId: 1,
extra1: 1,
extension: 1,
size: 1,
sort: 1,
fileType: 1,
isBridge: 1,
uploadState: 1,
uploadMeta: 1,
},
removeLocalFiles(ids) {
ids.forEach((id) => (0, lodash_1.unset)(this.files, id));
this.publish();
}
async upload(id) {
const [extraFile] = this.cache.get('extraFile', {
data: Projection_1.extraFileProjection,
filter: {
id,
},
});
(0, assert_1.assert)(extraFile && extraFile.uploadState === 'uploading');
const item = this.files[id];
(0, assert_1.assert)(item);
const { file, state } = item;
(0, assert_1.assert)(['local', 'failed'].includes(state));
item.state = 'uploading';
item.percentage = 0;
const up = new upload_1.Upload();
try {
const cos = (0, cos_1.getCos)(origin);
await cos.upload(extraFileData, up.uploadFile, file, async () => undefined);
await this.cache.operate('extraFile', {
action: 'update',
data: {
uploadState: 'success',
},
filter: {
id,
},
id: (0, uuid_1.generateNewId)(),
});
const cos = (0, cos_1.getCos)(extraFile.origin);
await cos.upload(extraFile, up.uploadFile, file, this.uploadToAspect.bind(this));
if (!cos.autoInform()) {
await this.cache.exec('operate', {
entity: 'extraFile',
operation: {
id: await (0, oak_domain_1.generateNewIdAsync)(),
action: 'update',
data: {
uploadState: 'success',
},
},
});
}
item.state = 'uploaded';
item.percentage = undefined;
this.publish();
}
catch (err) {
await this.cache.operate('extraFile', {
action: 'update',
data: {
uploadState: 'failed',
},
filter: {
id,
},
id: (0, uuid_1.generateNewId)(),
});
item.state = 'failed';
item.percentage = undefined;
this.publish();
throw err;
}
}
async uploadCommit(efPaths, oakFullpath) {
(0, assert_1.assert)(false, '方法已经废弃');
(0, assert_1.assert)(efPaths && efPaths.length > 0);
let ids = [];
if (oakFullpath) {
ids = efPaths
.map((path) => {
const path2 = path ? `${oakFullpath}.${path}` : oakFullpath;
const data = this.runningTree.getFreshValue(path2);
(0, assert_1.assert)(data, `efPath为${path}的路径上取不到extraFile数据请设置正确的相对路径`);
return data.map((ele) => ele.id);
})
.flat()
.filter((ele) => !!ele);
}
(0, assert_1.assert)(ids.length > 0);
const promises = [];
ids.forEach((id) => {
const fileState = this.getFileState(id);
if (fileState) {
const { state } = fileState;
if (['local', 'failed'].includes(state)) {
promises.push(this.upload(id));
}
}
});
if (promises.length > 0) {
await Promise.all(promises);
}
}
getUrl(extraFile, style) {
if (!extraFile) {
return '';
}
let url;
if (extraFile?.isBridge && extraFile?.extra1) {
if (typeof extraFile?.extra1 === 'string') {
url = this.locales.makeBridgeUrl(extraFile?.extra1);
return url;
}
return this.locales.makeBridgeUrl(extraFile?.extra1);
}
if (extraFile?.extra1) {
// 有extra1就用extra1 可能File对象 可能外部链接
if (typeof extraFile?.extra1 === 'string') {
return extraFile?.extra1;
const { id } = extraFile;
if (this.files[id]) {
const { file } = this.files[id];
if (typeof file === 'string') {
return file;
}
if (extraFile?.extra1 instanceof File) {
return (0, extraFile_1.getFileURL)(extraFile?.extra1) || '';
if (file instanceof File) {
return (0, extraFile_1.getFileURL)(file);
}
return extraFile?.extra1 || '';
(0, assert_1.assert)(false, 'the incoming file is not supported');
}
const { origin } = extraFile;
const cos = (0, cos_1.getCos)(origin);
const context = this.cache.begin();
this.cache.commit();
url = cos.composeFileUrl(extraFile, context, style);
return url;
return cos.composeFileUrl(extraFile, context, style);
}
getFileState(id) {
if (this.files[id]) {
return this.files[id];
}
}
getFileName(extraFile) {
const name = extraFile.filename +
@ -124,5 +142,54 @@ class ExtraFile extends oak_frontend_base_1.Feature {
formatBytes(size) {
return (0, extraFile_1.bytesToSize)(size);
}
async autoUpload(extraFile, file) {
const extraFileId = extraFile.id || (0, oak_domain_1.generateNewId)();
const applicationId = extraFile.applicationId || this.application.getApplicationId();
await this.cache.operate('extraFile', {
action: 'create',
data: Object.assign(extraFile, {
id: extraFileId,
applicationId,
}),
id: await (0, oak_domain_1.generateNewIdAsync)(),
});
const [newExtraFile] = this.cache.get('extraFile', {
data: Projection_1.extraFileProjection,
filter: {
id: extraFileId,
},
});
const up = new upload_1.Upload();
try {
const cos = (0, cos_1.getCos)(newExtraFile.origin);
await cos.upload(newExtraFile, up.uploadFile, file, this.uploadToAspect.bind(this));
return this.getUrl(newExtraFile);
}
catch (err) {
await this.cache.operate('extraFile', {
action: 'remove',
data: {},
filter: {
id: extraFileId,
},
id: await (0, oak_domain_1.generateNewIdAsync)(),
});
throw err;
}
}
// 私有
async uploadToAspect(file, name, // 文件的part name
aspectName, // 上传的aspect名
formData, // 上传的其它part参数
autoInform // 上传成功是否会自动通知server若不会则需要前台显式通知
) {
const formData2 = new FormData();
for (const key of Object.keys(formData)) {
formData2.append(key, formData[key]);
}
formData2.append(name || 'file', file);
const { result } = await this.cache.exec(aspectName, formData2);
return result;
}
}
exports.ExtraFile = ExtraFile;

View File

@ -1,32 +0,0 @@
import { Feature } from 'oak-frontend-base';
import { Cache } from 'oak-frontend-base/es/features/cache';
import { RunningTree } from 'oak-frontend-base/es/features/runningTree';
import { Locales } from 'oak-frontend-base/es/features/locales';
import { CommonAspectDict } from 'oak-common-aspect';
import AspectDict from '../aspects/AspectDict';
import { EntityDict } from '../oak-app-domain';
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
import { Application } from './application';
export type FileState = 'local' | 'uploading' | 'uploaded' | 'failed';
export declare class ExtraFile2<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
private cache;
private application;
private locales;
private files;
private runningTree;
constructor(cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>, application: Application<ED, Cxt, FrontCxt, AD>, locales: Locales<ED, Cxt, FrontCxt, AD>, runningTree: RunningTree<ED, Cxt, FrontCxt, AD>);
addLocalFile(id: string, file: File | string): void;
removeLocalFiles(ids: string[]): void;
upload(id: string): Promise<void>;
uploadCommit(efPaths: string[], oakFullpath: string): Promise<void>;
getUrl(extraFile?: EntityDict['extraFile']['OpSchema'] | EntityDict['extraFile']['Schema'] | null, style?: string): string;
getFileState(id: string): {
state: FileState;
percentage?: number;
} | undefined;
getFileName(extraFile: EntityDict['extraFile']['OpSchema']): string;
formatBytes(size: number): string;
autoUpload(extraFile: EntityDict['extraFile']['OpSchema'], file: File | string): Promise<string>;
private uploadToAspect;
}

View File

@ -1,197 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExtraFile2 = void 0;
const oak_frontend_base_1 = require("oak-frontend-base");
const upload_1 = require("oak-frontend-base/es/utils/upload");
const extraFile_1 = require("../utils/extraFile");
const assert_1 = require("oak-domain/lib/utils/assert");
const cos_1 = require("../utils/cos");
const lodash_1 = require("oak-domain/lib/utils/lodash");
const oak_domain_1 = require("oak-domain");
const Projection_1 = require("../types/Projection");
class ExtraFile2 extends oak_frontend_base_1.Feature {
cache;
application;
locales;
files;
runningTree;
constructor(cache, application, locales, runningTree) {
super();
this.cache = cache;
this.application = application;
this.locales = locales;
this.files = {};
this.runningTree = runningTree;
}
addLocalFile(id, file) {
(0, assert_1.assert)(!this.files[id]);
this.files[id] = {
file,
state: 'local',
};
this.publish();
}
removeLocalFiles(ids) {
ids.forEach((id) => (0, lodash_1.unset)(this.files, id));
this.publish();
}
async upload(id) {
const [extraFile] = this.cache.get('extraFile', {
data: Projection_1.extraFileProjection,
filter: {
id,
},
});
(0, assert_1.assert)(extraFile && extraFile.uploadState === 'uploading');
const item = this.files[id];
(0, assert_1.assert)(item);
const { file, state } = item;
(0, assert_1.assert)(['local', 'failed'].includes(state));
item.state = 'uploading';
item.percentage = 0;
const up = new upload_1.Upload();
try {
const cos = (0, cos_1.getCos)(extraFile.origin);
await cos.upload(extraFile, up.uploadFile, file, this.uploadToAspect.bind(this));
if (!cos.autoInform()) {
await this.cache.exec('operate', {
entity: 'extraFile',
operation: {
id: await (0, oak_domain_1.generateNewIdAsync)(),
action: 'update',
data: {
uploadState: 'success',
},
},
});
}
item.state = 'uploaded';
item.percentage = undefined;
this.publish();
}
catch (err) {
item.state = 'failed';
item.percentage = undefined;
this.publish();
}
}
async uploadCommit(efPaths, oakFullpath) {
(0, assert_1.assert)(false, '方法已经废弃');
(0, assert_1.assert)(efPaths && efPaths.length > 0);
let ids = [];
if (oakFullpath) {
ids = efPaths
.map((path) => {
const path2 = path
? `${oakFullpath}.${path}`
: oakFullpath;
const data = this.runningTree.getFreshValue(path2);
(0, assert_1.assert)(data, `efPath为${path}的路径上取不到extraFile数据请设置正确的相对路径`);
return data.map((ele) => ele.id);
})
.flat()
.filter((ele) => !!ele);
}
(0, assert_1.assert)(ids.length > 0);
const promises = [];
ids.forEach((id) => {
const fileState = this.getFileState(id);
if (fileState) {
const { state } = fileState;
if (['local', 'failed'].includes(state)) {
promises.push(this.upload(id));
}
}
});
if (promises.length > 0) {
await Promise.all(promises);
}
}
getUrl(extraFile, style) {
if (!extraFile) {
return '';
}
if (extraFile?.isBridge && extraFile?.extra1) {
return this.locales.makeBridgeUrl(extraFile?.extra1);
}
const { id } = extraFile;
if (this.files[id]) {
const { file } = this.files[id];
if (typeof file === 'string') {
return file;
}
if (file instanceof File) {
return (0, extraFile_1.getFileURL)(file);
}
(0, assert_1.assert)(false, 'the incoming file is not supported');
}
const { origin } = extraFile;
const cos = (0, cos_1.getCos)(origin);
const context = this.cache.begin();
this.cache.commit();
return cos.composeFileUrl(extraFile, context, style);
}
getFileState(id) {
if (this.files[id]) {
return this.files[id];
}
}
getFileName(extraFile) {
const name = extraFile.filename +
(extraFile.extension ? `.${extraFile.extension}` : '');
return name;
}
formatBytes(size) {
return (0, extraFile_1.bytesToSize)(size);
}
async autoUpload(extraFile, file) {
const extraFileId = extraFile.id || (0, oak_domain_1.generateNewId)();
const applicationId = extraFile.applicationId || this.application.getApplicationId();
await this.cache.operate('extraFile', {
action: 'create',
data: Object.assign(extraFile, {
id: extraFileId,
applicationId,
}),
id: await (0, oak_domain_1.generateNewIdAsync)(),
});
const [newExtraFile] = this.cache.get('extraFile', {
data: Projection_1.extraFileProjection,
filter: {
id: extraFileId,
},
});
const up = new upload_1.Upload();
try {
const cos = (0, cos_1.getCos)(newExtraFile.origin);
await cos.upload(newExtraFile, up.uploadFile, file, this.uploadToAspect.bind(this));
return this.getUrl(newExtraFile);
}
catch (err) {
await this.cache.operate('extraFile', {
action: 'remove',
data: {},
filter: {
id: extraFileId,
},
id: await (0, oak_domain_1.generateNewIdAsync)(),
});
throw err;
}
}
// 私有
async uploadToAspect(file, name, // 文件的part name
aspectName, // 上传的aspect名
formData, // 上传的其它part参数
autoInform // 上传成功是否会自动通知server若不会则需要前台显式通知
) {
const formData2 = new FormData();
for (const key of Object.keys(formData)) {
formData2.append(key, formData[key]);
}
formData2.append(name || 'file', file);
const { result } = await this.cache.exec(aspectName, formData2);
return result;
}
}
exports.ExtraFile2 = ExtraFile2;

View File

@ -1,10 +1,8 @@
import { CommonAspectDict } from 'oak-common-aspect';
import { Token } from './token';
import { ExtraFile } from './extraFile';
import { ExtraFile2 } from './extraFile2';
import { Application } from './application';
import { Config } from './config';
import { Style2 } from './style2';
import { Template } from './template';
import { WeiXinJsSdk } from './weiXinJsSdk';
import { WechatMenu } from './wechatMenu';
@ -21,10 +19,8 @@ export declare function initialize<ED extends EntityDict, Cxt extends BackendRun
export type GeneralFeatures<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> = {
token: Token<ED, Cxt, FrontCxt, AD>;
extraFile: ExtraFile<ED, Cxt, FrontCxt, AD>;
extraFile2: ExtraFile2<ED, Cxt, FrontCxt, AD>;
application: Application<ED, Cxt, FrontCxt, AD>;
config: Config<ED, Cxt, FrontCxt, AD>;
style2: Style2<ED, Cxt, FrontCxt, AD>;
template: Template<ED, Cxt, FrontCxt, AD>;
weiXinJsSdk: WeiXinJsSdk<ED, Cxt, FrontCxt, AD>;
theme: Theme<ED, Cxt, FrontCxt, AD>;

View File

@ -4,10 +4,8 @@ exports.initialize = void 0;
const tslib_1 = require("tslib");
const token_1 = require("./token");
const extraFile_1 = require("./extraFile");
const extraFile2_1 = require("./extraFile2");
const application_1 = require("./application");
const config_1 = require("./config");
const style2_1 = require("./style2");
const template_1 = require("./template");
const weiXinJsSdk_1 = require("./weiXinJsSdk");
const wechatMenu_1 = require("./wechatMenu");
@ -20,21 +18,16 @@ function initialize(basicFeatures, type, domain) {
const wechatMenu = new wechatMenu_1.WechatMenu(basicFeatures.cache, basicFeatures.localStorage);
const wechatPublicTag = new wechatPublicTag_1.WechatPublicTag(basicFeatures.cache, basicFeatures.localStorage);
const userWechatPublicTag = new userWechatPublicTag_1.UserWechatPublicTag(basicFeatures.cache, basicFeatures.localStorage);
// 临时代码,合并后再删
const extraFile = new extraFile_1.ExtraFile(basicFeatures.cache, application, basicFeatures.locales);
const extraFile2 = new extraFile2_1.ExtraFile2(basicFeatures.cache, application, basicFeatures.locales, basicFeatures.runningTree);
const extraFile = new extraFile_1.ExtraFile(basicFeatures.cache, application, basicFeatures.locales, basicFeatures.runningTree);
const config = new config_1.Config(basicFeatures.cache);
const style2 = new style2_1.Style2(basicFeatures.cache);
const template = new template_1.Template(basicFeatures.cache);
const weiXinJsSdk = new weiXinJsSdk_1.WeiXinJsSdk(basicFeatures.cache, basicFeatures.localStorage, basicFeatures.environment);
const theme = new theme_1.default(basicFeatures.cache, basicFeatures.localStorage);
return {
token,
extraFile,
extraFile2,
application,
config,
style2,
template,
weiXinJsSdk,
theme,

View File

@ -1,13 +0,0 @@
import { Feature } from 'oak-frontend-base';
import AspectDict from '../aspects/AspectDict';
import { EntityDict } from '../oak-app-domain';
import { Cache } from 'oak-frontend-base/es/features/cache';
import { Style as StyleDef } from '../types/Style';
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
import { CommonAspectDict } from 'oak-common-aspect';
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
export declare class Style2<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
private cache;
constructor(cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>);
updateStyle(entity: 'platform' | 'system' | 'application', entityId: string, style: StyleDef): Promise<void>;
}

View File

@ -1,20 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Style2 = void 0;
const oak_frontend_base_1 = require("oak-frontend-base");
class Style2 extends oak_frontend_base_1.Feature {
cache;
constructor(cache) {
super();
this.cache = cache;
}
async updateStyle(entity, entityId, style) {
await this.cache.exec('updateStyle', {
entity,
entityId,
style,
});
this.publish();
}
}
exports.Style2 = Style2;

View File

@ -2,6 +2,7 @@ import { generateNewId } from 'oak-domain/lib/utils/uuid';
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
import { EntityDict } from '../oak-app-domain';
import { Config } from '../types/Config';
import { Style } from '../types/Style';
export async function updateConfig<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
entity: 'platform' | 'system',
@ -48,4 +49,32 @@ export async function updateApplicationConfig<
},
{}
);
}
export async function updateStyle<
ED extends EntityDict,
Cxt extends BackendRuntimeContext<ED>
>(
params: {
entity: 'platform' | 'system';
entityId: string;
style: Style;
},
context: Cxt
) {
const { entity, entityId, style } = params;
await context.operate(
entity,
{
id: generateNewId(),
action: 'update',
data: {
style,
},
filter: {
id: entityId,
},
},
{}
);
}

Some files were not shown because too many files have changed in this diff Show More