This commit is contained in:
wenjiarui 2023-08-30 17:29:30 +08:00
parent eca230974b
commit b20d670c63
8 changed files with 81 additions and 60 deletions

View File

@ -3,7 +3,7 @@ import React from 'react';
import { MapProps, APILoaderConfig } from '@uiw/react-amap';
import './index.less';
export declare type APILoaderProps = {
akey: APILoaderConfig['akay'];
akey: APILoaderConfig['akey'];
version?: APILoaderConfig['version'];
};
declare type RenderProps = {

View File

@ -42,6 +42,6 @@ var memo = function (props) {
};
}
}, [window.AMap, useAMapUI]);
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: style, className: (0, classnames_1.default)("".concat(prefixCls, "-map"), className) }, { children: (0, jsx_runtime_1.jsx)(react_amap_1.APILoader, tslib_1.__assign({ akay: akey, version: version }, { children: (0, jsx_runtime_1.jsx)(react_amap_1.Map, tslib_1.__assign({ ref: mapRef }, mapProps, { children: children })) })) })));
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: style, className: (0, classnames_1.default)("".concat(prefixCls, "-map"), className) }, { children: (0, jsx_runtime_1.jsx)(react_amap_1.APILoader, tslib_1.__assign({ akey: akey, version: version }, { children: (0, jsx_runtime_1.jsx)(react_amap_1.Map, tslib_1.__assign({ ref: mapRef }, mapProps, { children: children })) })) })));
};
exports.default = memo;

View File

@ -28,7 +28,7 @@ exports.default = OakComponent({
if (userId !== currentUserId) {
var isRoot = this.features.token.isRoot();
if (!isRoot) {
throw new types_1.OakUserUnpermittedException();
throw new types_1.OakUserInvisibleException();
}
}
}

View File

@ -5,8 +5,4 @@
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}
.list {
margin-top: 10px !important;
}

View File

@ -16,42 +16,44 @@ function render(props) {
var eventLoggedIn = "user:info:login:".concat(Date.now());
return ((0, jsx_runtime_1.jsxs)(pageHeader_1.default, tslib_1.__assign({ showBack: showBack, title: "\u6211\u7684\u624B\u673A\u53F7" }, { children: [(0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {
setOpen(true);
} }, { children: "\u7ED1\u5B9A" })), (0, jsx_runtime_1.jsx)(antd_1.List, tslib_1.__assign({ bordered: true, className: web_module_less_1.default.list }, { children: mobiles === null || mobiles === void 0 ? void 0 : mobiles.map(function (ele, index) { return ((0, jsx_runtime_1.jsx)(antd_1.List.Item, tslib_1.__assign({ extra: allowRemove && tokenMobileId !== ele.id && ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ onClick: function () {
var modal = antd_1.Modal.confirm({
title: "\u786E\u8BA4\u5220\u9664\u5417\uFF1F\u5220\u9664\u540E\u65E0\u6CD5\u7528\u6B64\u53F7\u7801\u767B\u5F55",
okText: '确定',
cancelText: '取消',
onOk: function (e) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var err_1;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
removeItem(ele.id);
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, execute()];
case 2:
_a.sent();
return [3 /*break*/, 4];
case 3:
err_1 = _a.sent();
recoverItem(ele.id);
throw err_1;
case 4:
modal.destroy();
return [2 /*return*/];
}
}, style: { marginBottom: 16 } }, { children: "\u7ED1\u5B9A" })), (0, jsx_runtime_1.jsx)(antd_1.Row, { children: (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ xs: 24, sm: 12 }, { children: (0, jsx_runtime_1.jsx)(antd_1.List, tslib_1.__assign({ bordered: true }, { children: mobiles === null || mobiles === void 0 ? void 0 : mobiles.map(function (ele, index) { return ((0, jsx_runtime_1.jsx)(antd_1.List.Item, tslib_1.__assign({ extra: allowRemove &&
tokenMobileId !== ele.id && ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ onClick: function () {
var modal = antd_1.Modal
.confirm({
title: "\u786E\u8BA4\u5220\u9664\u5417\uFF1F\u5220\u9664\u540E\u65E0\u6CD5\u7528\u6B64\u53F7\u7801\u767B\u5F55",
okText: '确定',
cancelText: '取消',
onOk: function (e) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var err_1;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
removeItem(ele.id);
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, execute()];
case 2:
_a.sent();
return [3 /*break*/, 4];
case 3:
err_1 = _a.sent();
recoverItem(ele.id);
throw err_1;
case 4:
modal.destroy();
return [2 /*return*/];
}
});
}); },
onCancel: function (e) {
modal.destroy();
},
});
}); },
onCancel: function (e) {
modal.destroy();
},
});
} }, { children: (0, jsx_runtime_1.jsx)(icons_1.DeleteOutlined, {}) }))) }, { children: (0, jsx_runtime_1.jsx)(antd_1.List.Item.Meta, { avatar: (0, jsx_runtime_1.jsx)(icons_1.MobileOutlined, {}), title: ele.mobile }) }), index)); }) }))] })), (0, jsx_runtime_1.jsx)(antd_1.Modal, tslib_1.__assign({ title: "\u7ED1\u5B9A\u624B\u673A\u53F7", open: open, destroyOnClose: true, footer: null, onCancel: function () {
} }, { children: (0, jsx_runtime_1.jsx)(icons_1.DeleteOutlined, {}) }))) }, { children: (0, jsx_runtime_1.jsx)(antd_1.List.Item.Meta, { avatar: (0, jsx_runtime_1.jsx)(icons_1.MobileOutlined, {}), title: ele.mobile }) }), index)); }) })) })) })] })), (0, jsx_runtime_1.jsx)(antd_1.Modal, tslib_1.__assign({ title: "\u7ED1\u5B9A\u624B\u673A\u53F7", open: open, destroyOnClose: true, footer: null, onCancel: function () {
setOpen(false);
} }, { children: (0, jsx_runtime_1.jsx)(login_1.default, { callback: function () {
setOpen(false);
}, oakPath: "$mobile/me-mobile/login", oakAutoUnmount: true }) }))] })));
} }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { padding: 16 } }, { children: (0, jsx_runtime_1.jsx)(login_1.default, { callback: function () {
setOpen(false);
}, oakPath: "$mobile/me-mobile/login", oakAutoUnmount: true }) })) }))] })));
}
exports.default = render;

View File

@ -29,6 +29,24 @@ exports.default = OakComponent({
},
},
},
user$ref: {
$entity: 'user',
data: {
mobile$user: {
$entity: 'mobile',
data: {
id: 1,
mobile: 1,
userId: 1,
user: {
id: 1,
userState: 1,
refId: 1,
},
},
},
},
},
extraFile$entity: {
$entity: 'extraFile',
data: {
@ -75,7 +93,12 @@ exports.default = OakComponent({
var application = features.application.getApplication();
var avatar = (user === null || user === void 0 ? void 0 : user.extraFile$entity) && (user === null || user === void 0 ? void 0 : user.extraFile$entity[0]);
var avatarUrl = features.extraFile.getUrl(avatar);
var mobile = (((user === null || user === void 0 ? void 0 : user.mobile$user) && (user === null || user === void 0 ? void 0 : user.mobile$user[0])) || {}).mobile;
var mobile = (((user === null || user === void 0 ? void 0 : user.mobile$user) && (user === null || user === void 0 ? void 0 : user.mobile$user[0])) ||
((user === null || user === void 0 ? void 0 : user.user$ref) &&
(user === null || user === void 0 ? void 0 : user.user$ref[0]) &&
(user === null || user === void 0 ? void 0 : user.user$ref[0].mobile$user) &&
(user === null || user === void 0 ? void 0 : user.user$ref[0].mobile$user[0])) ||
{}).mobile;
var genderOption = (user === null || user === void 0 ? void 0 : user.gender) &&
this.state.genderOptions.find(function (ele) { return ele.value === (user === null || user === void 0 ? void 0 : user.gender); });
var appType = application === null || application === void 0 ? void 0 : application.type;
@ -159,7 +182,7 @@ exports.default = OakComponent({
oakId = this.props.oakId;
userId = this.features.token.getUserId();
if (userId !== oakId) {
throw new types_1.OakUserUnpermittedException();
throw new types_1.OakUserInvisibleException();
}
this.setState({ birthEnd: (0, dayjs_1.default)().format('YYYY-MM-DD') });
return [2 /*return*/];
@ -422,13 +445,13 @@ exports.default = OakComponent({
err_3 = _b.sent();
this.setMessage({
content: '解绑失败',
type: 'warning'
type: 'warning',
});
return [3 /*break*/, 4];
case 4: return [2 /*return*/];
}
});
});
}
},
},
});

View File

@ -10,7 +10,7 @@
"src/entities/*"
],
"dependencies": {
"@uiw/react-amap": "^4.0.2",
"@uiw/react-amap": "^5.0.12",
"@wangeditor/editor": "^5.1.22",
"@wangeditor/editor-for-react": "^1.0.4",
"cheerio": "^1.0.0-rc.12",
@ -80,9 +80,9 @@
"mocha": "^8.2.1",
"react-router-dom": "^6.13.0",
"rimraf": "^3.0.2",
"svg-captcha": "^1.4.0",
"ts-node": "~10.9.1",
"typescript": "~4.7.4",
"svg-captcha": "^1.4.0"
"typescript": "~4.7.4"
},
"scripts": {
"make:locale": "ts-node ./scripts/buildLocale.ts",

View File

@ -6,21 +6,21 @@ import classNames from 'classnames';
import './index.less'
export type APILoaderProps = {
akey: APILoaderConfig['akay'];
akey: APILoaderConfig['akey'];
version?: APILoaderConfig['version'];
};
type RenderProps =
| {
children?: (data: {
AMap: typeof AMap;
map: AMap.Map;
container?: HTMLDivElement | null;
}) => undefined;
}
children?: (data: {
AMap: typeof AMap;
map: AMap.Map;
container?: HTMLDivElement | null;
}) => undefined;
}
| {
children?: React.ReactNode;
};
children?: React.ReactNode;
};
export interface AMapProps extends APILoaderProps {
style?: React.CSSProperties;
@ -70,7 +70,7 @@ const memo = (props: AMapProps) => {
};
}
}
}, []);
}, []);
useEffect(() => {
if (!useAMapUI) {
@ -95,7 +95,7 @@ const memo = (props: AMapProps) => {
style={style}
className={classNames(`${prefixCls}-map`, className)}
>
<APILoader akay={akey} version={version}>
<APILoader akey={akey} version={version}>
<Map ref={mapRef} {...mapProps}>
{children as MapProps['children']}
</Map>