提交 550bbb16 作者: yueyang.lv

fix(用户信息): 修改密码接口修正,费用记录时间字段修正

上级 799c9304
const rewireReactHotLoader = require("react-app-rewire-hot-loader");
// const { ModuleFederationPlugin } = require("webpack").container;
// const { dependencies } = require("./package.json");
/* config-overrides.js */
module.exports = function override(config, env) {
if (env === "development") {
config.resolve.alias["react-dom"] = "@hot-loader/react-dom";
}
// config.plugins.push(
// new ModuleFederationPlugin({
// name: "minio_console",
// remotes: {
// saturnApp: "saturnApp@http://localhost:9000/remoteEntry.js",
// },
// shared: {
// // ...dependencies,
// react: {
// import: "react", // the "react" package will be used a provided and fallback module
// shareKey: "react", // under this name the shared module will be placed in the share scope
// shareScope: "default", // share scope with this name will be used
// singleton: true, // only a single version of the shared module is allowed
// requiredVersion: dependencies.react,
// },
// },
// })
// );
config = rewireReactHotLoader(config, env);
return config;
};
......@@ -9,7 +9,6 @@
"@date-io/moment": "1.x",
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0",
"@hot-loader/react-dom": "17.0.1",
"@mui/icons-material": "^5.3.1",
"@mui/lab": "^5.0.0-alpha.67",
"@mui/material": "^5.4.0",
......@@ -17,24 +16,7 @@
"@mui/styles": "^5.3.0",
"@mui/x-data-grid": "^5.14.0",
"@mui/x-date-pickers": "^5.0.0-beta.6",
"@types/history": "^4.7.3",
"@types/jest": "27.4.0",
"@types/lodash": "^4.14.149",
"@types/minio": "^7.0.11",
"@types/node": "17.0.14",
"@types/react": "17.0.0",
"@types/react-copy-to-clipboard": "^5.0.2",
"@types/react-dom": "17.0.11",
"@types/react-grid-layout": "^1.1.1",
"@types/react-redux": "^7.1.5",
"@types/react-router": "^5.1.3",
"@types/react-router-dom": "^5.1.2",
"@types/react-virtualized": "^9.21.10",
"@types/superagent": "^4.1.12",
"@types/webpack-env": "^1.14.1",
"@types/websocket": "^1.0.0",
"@uiw/react-codemirror": "^4.3.2",
"chart.js": "^2.9.3",
"history": "^4.10.1",
"js-cookie": "^3.0.1",
"kbar": "^0.1.0-beta.27",
......@@ -55,25 +37,21 @@
"react-moment": "^1.1.1",
"react-redux": "^7.1.3",
"react-router-dom": "^5.1.2",
"react-script": "^2.0.5",
"react-virtualized": "^9.22.2",
"react-window": "^1.8.6",
"react-window-infinite-loader": "^1.0.7",
"recharts": "^2.1.1",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"styled-components": "^5.3.1",
"superagent": "^6.1.0",
"testcafe": "^1.18.3",
"use-debounce": "^7.0.1",
"websocket": "^1.0.31",
"yarn": "^1.22.17"
"websocket": "^1.0.31"
},
"scripts": {
"start": "PORT=5005 react-app-rewired start",
"server_install": "yarn --registry=https://registry.npmjs.org/",
"server_build": "./node_modules/react-scripts/bin/react-scripts.js build",
"build": "react-scripts build",
"server_build": "react-app-rewired build",
"build": "react-app-rewired build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
......@@ -94,15 +72,34 @@
},
"devDependencies": {
"@types/qrcode": "^1.4.2",
"@types/history": "^4.7.3",
"@types/jest": "27.4.0",
"@types/lodash": "^4.14.149",
"@types/minio": "^7.0.11",
"@types/node": "17.0.14",
"@types/react": "17.0.0",
"@types/react-copy-to-clipboard": "^5.0.2",
"@types/react-dom": "17.0.11",
"@types/react-grid-layout": "^1.1.1",
"@types/react-redux": "^7.1.5",
"@types/react-router": "^5.1.3",
"@types/react-router-dom": "^5.1.2",
"@types/react-virtualized": "^9.21.10",
"@types/superagent": "^4.1.12",
"@types/webpack-env": "^1.14.1",
"@types/websocket": "^1.0.0",
"@types/react-window": "^1.8.5",
"@types/react-window-infinite-loader": "^1.0.5",
"@types/recharts": "^1.8.22",
"@hot-loader/react-dom": "17.0.1",
"http-proxy-middleware": "^2.0.6",
"prettier": "2.5.1",
"react-app-rewire-hot-loader": "^2.0.1",
"react-app-rewired": "^2.1.6",
"react-scripts": "5.0.0",
"typescript": "^4.4.3"
"typescript": "^4.4.3",
"yarn": "^1.22.17",
"testcafe": "^1.18.3"
},
"resolutions": {
"nth-check": "^2.0.1",
......
......@@ -4,7 +4,7 @@
*/
import { Box } from "@mui/material";
import { FormContainer, FormContainerProps } from "react-hook-form-mui";
import { useEffect, useImperativeHandle, useRef } from "react";
import { useImperativeHandle, useRef } from "react";
export * from "./useFormPage";
......
......@@ -15,9 +15,9 @@ const columns: GridColDef[] = [
disableColumnMenu: true,
},
{
field: "date",
field: "time",
headerName: "交易时间",
width: 130,
width: 200,
disableColumnMenu: true,
},
{
......
import { Button, TextField } from "@mui/material";
import {
UserInfo,
ForgotPasswordRequestBody,
UpdatePasswordRequestBody,
} from "../../../services/interface";
import { forgotPassword } from "../../../services";
import { updatePassword } from "../../../services";
import { V_CODE_SEND } from "../../../constants";
import message from "../../../../../../utils/message";
import { useFormPage } from "../../../components/Form/useFormPage";
......@@ -18,16 +18,14 @@ interface IProps {
onReloadUserInfo: () => void;
}
type FormValue = ForgotPasswordRequestBody & { confirmPassword?: string };
type FormValue = UpdatePasswordRequestBody & { confirmPassword?: string };
export default function Password({ userInfo, onReloadUserInfo }: IProps) {
const { loading, form, submitHandler, createFieldProps } =
useFormPage<FormValue>({
defaultValues: {
phone: userInfo.phone,
},
defaultValues: {},
submitRequest: (form) => {
return forgotPassword(form).then((res) => {
return updatePassword(form).then((res) => {
message.success("修改成功");
onReloadUserInfo();
history.replace("/saturn/userinfo");
......@@ -53,11 +51,11 @@ export default function Password({ userInfo, onReloadUserInfo }: IProps) {
})}
name="code"
phone={userInfo.phone}
sendType={V_CODE_SEND.PERSONAL_AUTH.value}
sendType={V_CODE_SEND.UPDATE_PASSWORD.value}
/>
<TextFieldElement
{...createFieldProps({ label: "新密码" })}
name="password"
name="new_password"
inputProps={{ type: "password", autoComplete: "new-password" }}
/>
<TextFieldElement
......@@ -65,7 +63,7 @@ export default function Password({ userInfo, onReloadUserInfo }: IProps) {
label: "确认新密码",
validation: {
validate: (value) => {
if (value === form.getValues("password")) {
if (value === form.getValues("new_password")) {
return true;
}
return "前后输入密码不一致";
......
......@@ -64,6 +64,7 @@ export interface UserInfo {
export interface CostItem {
id: string;
date: string;
time: string;
transaction_type: string;
transaction_source: string;
transaction_money: number;
......@@ -170,6 +171,13 @@ export interface ForgotPasswordRequestBody {
phone: string;
}
/** 修改密码 */
export interface UpdatePasswordRequestBody {
/** 验证码 */
code: number;
new_password: string;
}
/** 获取订单信息 */
export interface GetOrderInfoRequestBody {
/** 订单号 */
......
......@@ -11,6 +11,7 @@ import {
UpdateUserAddressRequestBody,
PersonalAuthRequestBody,
CompanyAuthRequestBody,
UpdatePasswordRequestBody,
} from "../interface";
/** 登陆 */
......@@ -42,6 +43,12 @@ export function forgotPassword(
return request.post("/api/user/forgot-password", data);
}
/** 修改密码 */
export function updatePassword(
data: UpdatePasswordRequestBody
): ResultPromise<null> {
return request.post("/api/user/up-password", data);
}
/** 更新手机号前验证用户,获取更新手机号所用的 sign */
export function updatePhoneCheckUser(
code: number
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论