This commit is contained in:
wenjiarui 2023-08-17 18:12:23 +08:00
parent 8001536655
commit 0af01e8d78
14 changed files with 81 additions and 4 deletions

View File

@ -165,6 +165,9 @@ function getChangePasswordChannels(params, context, innerLogic) {
data: {
id: 1,
password: 1,
},
filter: {
id: userId,
}
}, {})];
case 2:

View File

@ -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,

View File

@ -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*/];

7
lib/pages/changePassword/web.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'mobile', true, {
showBack: boolean;
userId: string;
currentUserId: string;
}, {}>): import("react/jsx-runtime").JSX.Element;

View File

@ -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;

View File

@ -1,6 +1,7 @@
{
"avatar": "头像",
"mobile": "手机号",
"password": "密码",
"manage": "管理",
"bind": "绑定",
"syncWeChat": "同步微信信息",

View File

@ -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;

View File

@ -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: {

View File

@ -108,6 +108,9 @@ export async function getChangePasswordChannels<ED extends EntityDict & BaseEnti
data: {
id: 1,
password: 1,
},
filter: {
id: userId,
}
},
{}

View File

@ -85,6 +85,7 @@ export default OakComponent({
},
async onConfirmByMobile(mobile: string, captcha: string, newPassword: string) {
const userId = this.props.oakId as string;
console.log(newPassword);
const { user } = this.state;
const { result } = await this.features.cache.exec('updateUserPassword', {
userId,

View File

@ -163,7 +163,7 @@ export default function Render(
<Button
type="primary"
onClick={async () => {
await onConfirmByMobile(mobile, captcha, password2);
await onConfirmByMobile(mobile, captcha, password);
}}
disabled={!(password.length >= 8 && password === password2)}
>

View File

@ -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) ? <div className={Style.container}>
<ChangePassword
oakId={userId || currentUserId}
oakPath="$changePassword-component"
oakAutoUnmount={true}
/>
</div> : <></>
);
}

View File

@ -1,6 +1,7 @@
{
"avatar": "头像",
"mobile": "手机号",
"password": "密码",
"manage": "管理",
"bind": "绑定",
"syncWeChat": "同步微信信息",

View File

@ -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')}
</List.Item>
<List.Item
extra={'********'}
onClick={() => {
goChangePassword();
}}
>
{t('password')}
</List.Item>
</List>
<Popup