diff --git a/lib/aspects/user.js b/lib/aspects/user.js index 2bee4e46e..93192ab96 100644 --- a/lib/aspects/user.js +++ b/lib/aspects/user.js @@ -165,6 +165,9 @@ function getChangePasswordChannels(params, context, innerLogic) { data: { id: 1, password: 1, + }, + filter: { + id: userId, } }, {})]; case 2: diff --git a/lib/components/changePassword/byMobile/index.js b/lib/components/changePassword/byMobile/index.js index 3f559b2ea..4fb43e976 100644 --- a/lib/components/changePassword/byMobile/index.js +++ b/lib/components/changePassword/byMobile/index.js @@ -97,6 +97,7 @@ exports.default = OakComponent({ switch (_a.label) { case 0: userId = this.props.oakId; + console.log(newPassword); user = this.state.user; return [4 /*yield*/, this.features.cache.exec('updateUserPassword', { userId: userId, diff --git a/lib/components/changePassword/byMobile/web.js b/lib/components/changePassword/byMobile/web.js index ce95bdcb8..c615f2f96 100644 --- a/lib/components/changePassword/byMobile/web.js +++ b/lib/components/changePassword/byMobile/web.js @@ -73,7 +73,7 @@ function Render(props) { }, iconRender: function (visible) { return (visible ? (0, jsx_runtime_1.jsx)(icons_1.EyeTwoTone, {}) : (0, jsx_runtime_1.jsx)(icons_1.EyeInvisibleOutlined, {})); }, placeholder: '请再次输入密码' }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 4 } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { switch (_a.label) { - case 0: return [4 /*yield*/, onConfirmByMobile(mobile, captcha, password2)]; + case 0: return [4 /*yield*/, onConfirmByMobile(mobile, captcha, password)]; case 1: _a.sent(); return [2 /*return*/]; diff --git a/lib/pages/changePassword/web.d.ts b/lib/pages/changePassword/web.d.ts new file mode 100644 index 000000000..e894266ee --- /dev/null +++ b/lib/pages/changePassword/web.d.ts @@ -0,0 +1,7 @@ +import { WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../general-app-domain'; +export default function render(props: WebComponentProps): import("react/jsx-runtime").JSX.Element; diff --git a/lib/pages/changePassword/web.js b/lib/pages/changePassword/web.js new file mode 100644 index 000000000..b9e30bc0e --- /dev/null +++ b/lib/pages/changePassword/web.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var jsx_runtime_1 = require("react/jsx-runtime"); +var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); +var changePassword_1 = tslib_1.__importDefault(require("../../components/changePassword")); +function render(props) { + var _a = props.data, showBack = _a.showBack, userId = _a.userId, currentUserId = _a.currentUserId; + return ((userId || currentUserId) ? (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)(changePassword_1.default, { oakId: userId || currentUserId, oakPath: "$changePassword-component", oakAutoUnmount: true }) })) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})); +} +exports.default = render; diff --git a/lib/pages/user/info/locales/zh_CN.json b/lib/pages/user/info/locales/zh_CN.json index d58875760..9efe395d2 100644 --- a/lib/pages/user/info/locales/zh_CN.json +++ b/lib/pages/user/info/locales/zh_CN.json @@ -1,6 +1,7 @@ { "avatar": "头像", "mobile": "手机号", + "password": "密码", "manage": "管理", "bind": "绑定", "syncWeChat": "同步微信信息", diff --git a/lib/pages/user/info/web.d.ts b/lib/pages/user/info/web.d.ts index f6ea855a9..7632578e7 100644 --- a/lib/pages/user/info/web.d.ts +++ b/lib/pages/user/info/web.d.ts @@ -21,6 +21,7 @@ declare type DataProps = { }; declare type MethodsProps = { goAddMobile: () => void; + goChangePassword: () => void; setAvatar: () => void; setVisible: (visible: boolean, attr: string) => void; setCustomData: (attr: string, value: string | number) => void; diff --git a/lib/pages/user/info/web.js b/lib/pages/user/info/web.js index 5f2460e79..8144f5118 100644 --- a/lib/pages/user/info/web.js +++ b/lib/pages/user/info/web.js @@ -8,7 +8,7 @@ var avatar_1 = tslib_1.__importDefault(require("../../../components/extraFile/av var mobile_module_less_1 = tslib_1.__importDefault(require("./mobile.module.less")); function render(props) { var data = props.data, methods = props.methods; - var t = methods.t, clean = methods.clean, setAvatar = methods.setAvatar, setVisible = methods.setVisible, goAddMobile = methods.goAddMobile, refreshWechatPublicUserInfo = methods.refreshWechatPublicUserInfo; + var t = methods.t, clean = methods.clean, setAvatar = methods.setAvatar, setVisible = methods.setVisible, goAddMobile = methods.goAddMobile, refreshWechatPublicUserInfo = methods.refreshWechatPublicUserInfo, goChangePassword = methods.goChangePassword; var oakFullpath = data.oakFullpath, visible = data.visible, nickname = data.nickname, name = data.name, birth = data.birth, gender = data.gender, mobile = data.mobile, avatarUrl = data.avatarUrl, attr = data.attr, id = data.id, isSupportSyncWeChat = data.isSupportSyncWeChat, refreshing = data.refreshing; return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: mobile_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsxs)(antd_mobile_1.List, tslib_1.__assign({ className: mobile_module_less_1.default.list }, { children: [(0, jsx_runtime_1.jsx)(antd_mobile_1.List.Item, tslib_1.__assign({ extra: (0, jsx_runtime_1.jsx)(avatar_1.default, { oakAutoUnmount: true, oakPath: oakFullpath ? oakFullpath + '.extraFile$entity' @@ -20,7 +20,9 @@ function render(props) { setVisible(true, 'birth'); } }, { children: t('user:attr.birth') })), (0, jsx_runtime_1.jsx)(antd_mobile_1.List.Item, tslib_1.__assign({ extra: mobile ? mobile : '未设置', onClick: function () { goAddMobile(); - } }, { children: t('mobile') }))] })), (0, jsx_runtime_1.jsx)(antd_mobile_1.Popup, tslib_1.__assign({ visible: visible, onMaskClick: function () { + } }, { children: t('mobile') })), (0, jsx_runtime_1.jsx)(antd_mobile_1.List.Item, tslib_1.__assign({ extra: '********', onClick: function () { + goChangePassword(); + } }, { children: t('password') }))] })), (0, jsx_runtime_1.jsx)(antd_mobile_1.Popup, tslib_1.__assign({ visible: visible, onMaskClick: function () { clean(); setVisible(false, attr); }, bodyStyle: { diff --git a/src/aspects/user.ts b/src/aspects/user.ts index fa3094a3b..d968ea78a 100644 --- a/src/aspects/user.ts +++ b/src/aspects/user.ts @@ -108,6 +108,9 @@ export async function getChangePasswordChannels { - await onConfirmByMobile(mobile, captcha, password2); + await onConfirmByMobile(mobile, captcha, password); }} disabled={!(password.length >= 8 && password === password2)} > diff --git a/src/pages/changePassword/web.tsx b/src/pages/changePassword/web.tsx new file mode 100644 index 000000000..30d740380 --- /dev/null +++ b/src/pages/changePassword/web.tsx @@ -0,0 +1,36 @@ +import React, { useState } from 'react'; +import { List, Button, Modal } from 'antd'; +import { MobileOutlined, DeleteOutlined } from '@ant-design/icons'; +import Style from './web.module.less'; +import { WebComponentProps } from 'oak-frontend-base'; +import PageHeader from '../../components/common/pageHeader'; +import { EntityDict } from '../../general-app-domain'; +import ChangePassword from '../../components/changePassword'; + + +export default function render( + props: WebComponentProps< + EntityDict, + 'mobile', + true, + { + showBack: boolean; + userId: string; + currentUserId: string + }, + { + } + > +) { + const { showBack, userId, currentUserId } = props.data; + + return ( + (userId || currentUserId) ?
+ +
: <> + ); +} diff --git a/src/pages/user/info/locales/zh_CN.json b/src/pages/user/info/locales/zh_CN.json index f6420dd68..ad4bcd140 100644 --- a/src/pages/user/info/locales/zh_CN.json +++ b/src/pages/user/info/locales/zh_CN.json @@ -1,6 +1,7 @@ { "avatar": "头像", "mobile": "手机号", + "password": "密码", "manage": "管理", "bind": "绑定", "syncWeChat": "同步微信信息", diff --git a/src/pages/user/info/web.tsx b/src/pages/user/info/web.tsx index 26b28e81c..b52f0f321 100644 --- a/src/pages/user/info/web.tsx +++ b/src/pages/user/info/web.tsx @@ -39,6 +39,7 @@ type DataProps = { type MethodsProps = { goAddMobile: () => void; + goChangePassword: () => void; setAvatar: () => void; setVisible: (visible: boolean, attr: string) => void; setCustomData: (attr: string, value: string | number) => void; @@ -57,6 +58,7 @@ export default function render( setVisible, goAddMobile, refreshWechatPublicUserInfo, + goChangePassword, } = methods; const { oakFullpath, @@ -141,6 +143,14 @@ export default function render( > {t('mobile')} + { + goChangePassword(); + }} + > + {t('password')} +