diff --git a/lib/pages/mobile/me/index.less b/lib/pages/mobile/me/index.less index 2adb29d23..e69de29bb 100644 --- a/lib/pages/mobile/me/index.less +++ b/lib/pages/mobile/me/index.less @@ -1,38 +0,0 @@ -/** index.wxss **/ -@import "../../../config/styles/mp/index.less"; -@import "../../../config/styles/mp/mixins.less"; - -.page-body { - height: 100vh; - display: flex; - flex: 1; - flex-direction: column; - box-sizing: border-box; - align-items: stretch; - background-color: @bg-color-fade; - .safe-area-inset-bottom(); -} - -.container { - display: flex; - flex-direction: column; - flex: 1; -} -.card { - display: flex; - background-color: #fff; - padding: @spacer; - margin: @spacer; - margin-bottom: 0; - align-items: center; - justify-content: space-between; - - text { - font-size: x-large; - } -} -.btn-box { - display: flex; - align-items: center; - justify-content: center; -} diff --git a/lib/pages/userEntityGrant/confirm/web.d.ts b/lib/pages/userEntityGrant/confirm/web.d.ts index ad0b8f2aa..1674e7f9a 100644 --- a/lib/pages/userEntityGrant/confirm/web.d.ts +++ b/lib/pages/userEntityGrant/confirm/web.d.ts @@ -1,2 +1,23 @@ /// -export default function render(this: any): JSX.Element; +import { WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../general-app-domain'; +export default function render(props: WebComponentProps void; +}>): JSX.Element; diff --git a/lib/pages/userEntityGrant/confirm/web.js b/lib/pages/userEntityGrant/confirm/web.js index f9f34aaec..57ac7ce82 100644 --- a/lib/pages/userEntityGrant/confirm/web.js +++ b/lib/pages/userEntityGrant/confirm/web.js @@ -6,14 +6,14 @@ var antd_1 = require("antd"); var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); var icons_1 = require("@ant-design/icons"); var utils_1 = require("oak-frontend-base/lib/utils/utils"); -function render() { - var _this = this; - var _a = this.state, oakLoading = _a.oakLoading, oakExecuting = _a.oakExecuting, type = _a.type, expired = _a.expired, relation = _a.relation, expiresAt = _a.expiresAt, granter = _a.granter, entity = _a.entity, isExists = _a.isExists, //当前用户关系是否存在 +function render(props) { + var _a = props.data, oakLoading = _a.oakLoading, oakExecuting = _a.oakExecuting, type = _a.type, expired = _a.expired, relation = _a.relation, expiresAt = _a.expiresAt, granter = _a.granter, entity = _a.entity, isExists = _a.isExists, //当前用户关系是否存在 granteeId = _a.granteeId, number = _a.number, confirmed = _a.confirmed, userId = _a.userId; + var _b = props.methods, t = _b.t, handleConfirm = _b.handleConfirm; var isOwner = !!(granteeId && userId === granteeId); var getRelationTip = function () { var str = "".concat((granter === null || granter === void 0 ? void 0 : granter.name) || (granter === null || granter === void 0 ? void 0 : granter.nickname)); - var relationStr = relation ? _this.t("".concat(entity, ":r.").concat(relation)) : ''; + var relationStr = relation ? t("".concat(entity, ":r.").concat(relation)) : ''; if (type === 'grant') { str = str.concat('授予您【').concat(relationStr).concat('】权限'); return str; @@ -28,14 +28,14 @@ function render() { if (expired) { return '已过期,请联系相关人员重新分享'; } - // number设置1个的时候 + // number设置1个的时候 if (number === 1 && confirmed > 0 && (!isOwner || !isExists)) { return '被他人已领取'; } return '请您领取'; }; return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.content }, { children: [type === 'grant' ? ((0, jsx_runtime_1.jsx)(icons_1.UserAddOutlined, { className: web_module_less_1.default.icon })) : ((0, jsx_runtime_1.jsx)(icons_1.UserSwitchOutlined, { className: web_module_less_1.default.icon })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.title }, { children: getRelationTip() })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.description }, { children: getDescTip() }))] })), (0, jsx_runtime_1.jsxs)(antd_1.Space, tslib_1.__assign({ direction: "vertical" }, { children: [!oakLoading && !expired && !isExists && !isOwner && ((0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ block: true, type: "primary", onClick: function () { - _this.handleConfirm(); + handleConfirm(); }, disabled: oakExecuting }, { children: "\u9886\u53D6" }))), utils_1.isWeiXin && ((0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ block: true, onClick: function () { WeixinJSBridge.call('closeWindow'); } }, { children: "\u5173\u95ED" })))] }))] }))); diff --git a/lib/pages/userEntityGrant/detail/web.d.ts b/lib/pages/userEntityGrant/detail/web.d.ts index 5eaeadcc2..67d2d44f6 100644 --- a/lib/pages/userEntityGrant/detail/web.d.ts +++ b/lib/pages/userEntityGrant/detail/web.d.ts @@ -1,2 +1,2 @@ /// -export default function render(): JSX.Element; +export default function Render(props: any): JSX.Element; diff --git a/lib/pages/userEntityGrant/detail/web.js b/lib/pages/userEntityGrant/detail/web.js index 497cd9f41..d7fe65340 100644 --- a/lib/pages/userEntityGrant/detail/web.js +++ b/lib/pages/userEntityGrant/detail/web.js @@ -1,7 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var jsx_runtime_1 = require("react/jsx-runtime"); -function render() { +function Render(props) { return ((0, jsx_runtime_1.jsx)("div", { children: "react" })); } -exports.default = render; +exports.default = Render; diff --git a/lib/pages/userEntityGrant/detail/web.pc.d.ts b/lib/pages/userEntityGrant/detail/web.pc.d.ts index e6f66ee8c..b88b8c10f 100644 --- a/lib/pages/userEntityGrant/detail/web.pc.d.ts +++ b/lib/pages/userEntityGrant/detail/web.pc.d.ts @@ -1,9 +1,9 @@ /// import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../general-app-domain'; -export default function Render(props: WebComponentProps): JSX.Element; diff --git a/lib/pages/userEntityGrant/grant/index.js b/lib/pages/userEntityGrant/grant/index.js index 24c19c12d..e888cf2dc 100644 --- a/lib/pages/userEntityGrant/grant/index.js +++ b/lib/pages/userEntityGrant/grant/index.js @@ -17,11 +17,7 @@ exports.default = OakComponent({ isList: false, formData: function (_a) { var userEntityGrant = _a.data; - return tslib_1.__awaiter(void 0, void 0, void 0, function () { - return tslib_1.__generator(this, function (_b) { - return [2 /*return*/, (tslib_1.__assign({}, userEntityGrant))]; - }); - }); + return (tslib_1.__assign({}, userEntityGrant || {})); }, properties: { entity: String, @@ -57,6 +53,11 @@ exports.default = OakComponent({ number: value, }); }, + setPeriod: function (value) { + this.update({ + period: value, + }); + }, onBack: function () { this.navigateBack(); }, diff --git a/lib/pages/userEntityGrant/grant/web.d.ts b/lib/pages/userEntityGrant/grant/web.d.ts index ad0b8f2aa..07c9739eb 100644 --- a/lib/pages/userEntityGrant/grant/web.d.ts +++ b/lib/pages/userEntityGrant/grant/web.d.ts @@ -1,2 +1,18 @@ /// -export default function render(this: any): JSX.Element; +import { EntityDict } from '../../../general-app-domain'; +import { WebComponentProps } from 'oak-frontend-base'; +export default function render(props: WebComponentProps void; + reset: () => void; + setRelation: (value: string) => void; + setNumber: (value: string) => void; + setPeriod: (value: number | null) => void; +}>): JSX.Element; diff --git a/lib/pages/userEntityGrant/grant/web.js b/lib/pages/userEntityGrant/grant/web.js index 6900b9c6e..93c17dff0 100644 --- a/lib/pages/userEntityGrant/grant/web.js +++ b/lib/pages/userEntityGrant/grant/web.js @@ -4,21 +4,19 @@ var tslib_1 = require("tslib"); var jsx_runtime_1 = require("react/jsx-runtime"); var antd_1 = require("antd"); var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); -function render() { - var _this = this; - var _a = this.state, relation = _a.relation, type = _a.type, number = _a.number, period = _a.period; - var _b = this.props, relations = _b.relations, entity = _b.entity, entityId = _b.entityId; +function render(props) { + var _a = props.data, relation = _a.relation, type = _a.type, number = _a.number, period = _a.period, relations = _a.relations, entity = _a.entity, entityId = _a.entityId; + var _b = props.methods, t = _b.t, confirm = _b.confirm, reset = _b.reset, setRelation = _b.setRelation, setNumber = _b.setNumber, setPeriod = _b.setPeriod; return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.pageWithPadding }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.formContainer }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ labelCol: { span: 4 }, wrapperCol: { span: 8 } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u6743\u9650", rules: [ { required: true, message: '请选择一个权限', }, - ] }, { children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, { value: relation, onChange: function (value) { - _this.setRelation(value); + ] }, { children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, { value: relation, onChange: function (e) { + setRelation(e.target.value); }, options: relations === null || relations === void 0 ? void 0 : relations.map(function (ele) { return ({ value: ele, - label: (_this.t && _this.t(entity + ':r.' + ele)) || - ele, + label: t(entity + ':r.' + ele), }); }) }) })), type === 'grant' && ((0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u4EBA\u6570", rules: [ { required: true, @@ -27,7 +25,7 @@ function render() { ] }, { children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, { value: number, onChange: function (_a) { var target = _a.target; var value = target.value; - _this.setNumber(value); + setNumber(value); }, options: [ { value: 1, label: '单次' }, { value: 10000, label: '不限次' }, @@ -37,13 +35,11 @@ function render() { message: '请选择一个时效', }, ] }, { children: (0, jsx_runtime_1.jsx)(antd_1.InputNumber, { min: 1, max: 15, value: period, onChange: function (value) { - _this.setState({ - period: value, - }); + setPeriod(value); }, addonAfter: "\u5206\u949F" }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 4 } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ htmlType: "submit", type: "primary", onClick: function () { - _this.confirm(); + confirm(); } }, { children: "\u63D0\u4EA4" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ htmlType: "reset", onClick: function () { - _this.reset(); + reset(); } }, { children: "\u91CD\u7F6E" }))] }) }))] })) })) }))); } exports.default = render; diff --git a/lib/pages/wechatQrCode/scan/web.d.ts b/lib/pages/wechatQrCode/scan/web.d.ts index ad0b8f2aa..46deb98c8 100644 --- a/lib/pages/wechatQrCode/scan/web.d.ts +++ b/lib/pages/wechatQrCode/scan/web.d.ts @@ -1,2 +1,8 @@ /// -export default function render(this: any): JSX.Element; +import { EntityDict } from '../../../general-app-domain'; +import { WebComponentProps } from 'oak-frontend-base'; +export default function render(props: WebComponentProps): JSX.Element; diff --git a/lib/pages/wechatQrCode/scan/web.js b/lib/pages/wechatQrCode/scan/web.js index 076618514..efe072358 100644 --- a/lib/pages/wechatQrCode/scan/web.js +++ b/lib/pages/wechatQrCode/scan/web.js @@ -6,8 +6,8 @@ var icons_1 = require("@ant-design/icons"); var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); var success_1 = tslib_1.__importDefault(require("../../../components/common/result/success")); var fail_1 = tslib_1.__importDefault(require("../../../components/common/result/fail")); -function render() { - var _a = this.state, oakLoading = _a.oakLoading, isExist = _a.isExist, expired = _a.expired; +function render(props) { + var _a = props.data, oakLoading = _a.oakLoading, isExist = _a.isExist, expired = _a.expired; var V; if (oakLoading) { V = ((0, jsx_runtime_1.jsx)(success_1.default, { icon: (0, jsx_runtime_1.jsx)(icons_1.LoadingOutlined, { className: web_module_less_1.default.brand_icon }), title: "\u52A0\u8F7D\u4E2D", description: "\u6B63\u5728\u83B7\u53D6\u6570\u636E\uFF0C\u8BF7\u7A0D\u540E" })); diff --git a/lib/pages/wechatUser/login/web.d.ts b/lib/pages/wechatUser/login/web.d.ts index ad0b8f2aa..be34c97e4 100644 --- a/lib/pages/wechatUser/login/web.d.ts +++ b/lib/pages/wechatUser/login/web.d.ts @@ -1,2 +1,7 @@ /// -export default function render(this: any): JSX.Element; +import { EntityDict } from '../../../general-app-domain'; +import { WebComponentProps } from 'oak-frontend-base'; +export default function render(props: WebComponentProps): JSX.Element; diff --git a/lib/pages/wechatUser/login/web.js b/lib/pages/wechatUser/login/web.js index 5093d0dbb..6a57f464b 100644 --- a/lib/pages/wechatUser/login/web.js +++ b/lib/pages/wechatUser/login/web.js @@ -8,8 +8,8 @@ var utils_1 = require("oak-frontend-base/lib/utils/utils"); var fail_1 = tslib_1.__importDefault(require("../../../components/common/result/fail")); var success_1 = tslib_1.__importDefault(require("../../../components/common/result/success")); var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); -function render() { - var _a = this.state, error = _a.error, loading = _a.loading; +function render(props) { + var _a = props.data, error = _a.error, loading = _a.loading; var V; if (loading) { V = ((0, jsx_runtime_1.jsx)(success_1.default, { icon: (0, jsx_runtime_1.jsx)(icons_1.LoadingOutlined, { className: web_module_less_1.default.brand_icon }), title: "\u767B\u5F55\u4E2D", description: "\u6B63\u5728\u767B\u5F55..\uFF0C\u8BF7\u7A0D\u540E" })); diff --git a/src/pages/userEntityGrant/confirm/web.tsx b/src/pages/userEntityGrant/confirm/web.tsx index 5cff962f4..8da7a2785 100644 --- a/src/pages/userEntityGrant/confirm/web.tsx +++ b/src/pages/userEntityGrant/confirm/web.tsx @@ -5,8 +5,37 @@ import { UserAddOutlined, UserSwitchOutlined } from '@ant-design/icons'; import { isWeiXin } from 'oak-frontend-base/lib/utils/utils'; +import { WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../general-app-domain'; -export default function render(this: any) { +export default function render( + props: WebComponentProps< + EntityDict, + 'userEntityGrant', + true, + { + oakLoading: boolean; + oakExecuting: boolean; + type: 'grant'; + expired: boolean; + relation: boolean; + expiresAt: boolean; + granter?: { + name: string; + nickname: string; + }; + entity: string; + isExists: boolean; //当前用户关系是否存在 + granteeId: string; + number: number; + confirmed: number; + userId: string; + }, + { + handleConfirm: () => void; + } + > +) { const { oakLoading, oakExecuting, @@ -21,12 +50,13 @@ export default function render(this: any) { number, confirmed, userId, - } = this.state; + } = props.data; + const { t, handleConfirm } = props.methods; const isOwner = !!(granteeId && userId === granteeId); const getRelationTip = () => { let str = `${granter?.name || granter?.nickname}`; - const relationStr = relation ? this.t(`${entity}:r.${relation}`) : ''; + const relationStr = relation ? t(`${entity}:r.${relation}`) : ''; if (type === 'grant') { str = str.concat('授予您【').concat(relationStr).concat('】权限'); return str; @@ -42,14 +72,13 @@ export default function render(this: any) { if (expired) { return '已过期,请联系相关人员重新分享'; } - - // number设置1个的时候 + + // number设置1个的时候 if (number === 1 && confirmed > 0 && (!isOwner || !isExists)) { return '被他人已领取'; } return '请您领取'; - } - + }; return (
@@ -69,7 +98,7 @@ export default function render(this: any) { block type="primary" onClick={() => { - this.handleConfirm(); + handleConfirm(); }} disabled={oakExecuting} > diff --git a/src/pages/userEntityGrant/detail/web.pc.tsx b/src/pages/userEntityGrant/detail/web.pc.tsx index a2a19c79e..d7554525e 100644 --- a/src/pages/userEntityGrant/detail/web.pc.tsx +++ b/src/pages/userEntityGrant/detail/web.pc.tsx @@ -5,13 +5,21 @@ import QrCode from '../../../components/common/qrCode'; import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../general-app-domain'; -export default function Render(props: WebComponentProps) { - const { variant, showBack = true, url, expiresAt } = props.data; +export default function Render( + props: WebComponentProps< + EntityDict, + 'userEntityGrant', + true, + { + showBack: boolean; + variant: 'alone' | 'inline' | 'dialog'; + url: string; + expiresAt: number; + }, + {} + > +) { + const { variant, showBack = true, url, expiresAt } = props.data; return ( diff --git a/src/pages/userEntityGrant/detail/web.tsx b/src/pages/userEntityGrant/detail/web.tsx index e173e728c..564cdaa05 100644 --- a/src/pages/userEntityGrant/detail/web.tsx +++ b/src/pages/userEntityGrant/detail/web.tsx @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import Style from './mobile.module.less'; -export default function render() { +export default function Render(props: any) { return (
react diff --git a/src/pages/userEntityGrant/grant/index.ts b/src/pages/userEntityGrant/grant/index.ts index 113ef1780..2e38f1d25 100644 --- a/src/pages/userEntityGrant/grant/index.ts +++ b/src/pages/userEntityGrant/grant/index.ts @@ -15,8 +15,8 @@ export default OakComponent({ granteeId: 1, }, isList: false, - formData: async ({ data: userEntityGrant }) => ({ - ...userEntityGrant, + formData: ({ data: userEntityGrant }) => ({ + ...userEntityGrant || {}, }), properties: { entity: String, @@ -52,6 +52,11 @@ export default OakComponent({ number: value, }); }, + setPeriod(value: number) { + this.update({ + period: value, + }); + }, onBack() { this.navigateBack(); }, diff --git a/src/pages/userEntityGrant/grant/web.tsx b/src/pages/userEntityGrant/grant/web.tsx index 93f36b8f2..0f32eb866 100644 --- a/src/pages/userEntityGrant/grant/web.tsx +++ b/src/pages/userEntityGrant/grant/web.tsx @@ -2,9 +2,36 @@ import React from 'react'; import { Form, Radio, Button, Space, InputNumber } from 'antd'; import Style from './web.module.less'; -export default function render(this: any) { - const { relation, type, number, period } = this.state; - const { relations, entity, entityId } = this.props; +import { EntityDict } from '../../../general-app-domain'; +import { WebComponentProps } from 'oak-frontend-base'; + +export default function render( + props: WebComponentProps< + EntityDict, + 'token', + false, + { + relation: string; + type: 'grant'; + number: number; + period: number; + relations: string[]; + entity: string; + entityId: string; + }, + { + confirm: () => void; + reset: () => void; + setRelation: (value: string) => void; + setNumber: (value: string) => void; + setPeriod: (value: number | null) => void; + } + > +) { + const { relation, type, number, period, relations, entity, entityId } = + props.data; + const { t, confirm, reset, setRelation, setNumber, setPeriod } = + props.methods; return (
@@ -21,14 +48,12 @@ export default function render(this: any) { > { - this.setRelation(value); + onChange={(e) => { + setRelation(e.target.value); }} options={relations?.map((ele: string) => ({ value: ele, - label: - (this.t && this.t(entity + ':r.' + ele)) || - ele, + label: t(entity + ':r.' + ele), }))} > @@ -46,7 +71,7 @@ export default function render(this: any) { value={number} onChange={({ target }) => { const { value } = target; - this.setNumber(value); + setNumber(value); }} options={[ { value: 1, label: '单次' }, @@ -69,9 +94,7 @@ export default function render(this: any) { max={15} value={period} onChange={(value) => { - this.setState({ - period: value, - }); + setPeriod(value); }} addonAfter="分钟" /> @@ -82,7 +105,7 @@ export default function render(this: any) { htmlType="submit" type="primary" onClick={() => { - this.confirm(); + confirm(); }} > 提交 @@ -90,7 +113,7 @@ export default function render(this: any) {