diff --git a/src/pages/home/ModifySelfpwd.js b/src/pages/home/ModifySelfpwd.js deleted file mode 100644 index 35147888..00000000 --- a/src/pages/home/ModifySelfpwd.js +++ /dev/null @@ -1,121 +0,0 @@ -import { handelResponse, putmodifySelf } from "@/assets/api.js" -import "@/assets/comm.css" -import { cloneDeep } from "lodash-es" -import React from "react" -import { Button, Form, FormInputField, FormStrategy, Icon, Notify, Validators } from "zent" -import "./modifySelf.less" -function equalsPassword(value, ctx) { - if (value !== ctx.getSectionValue("password").password) { - return { - name: "passwordEqual", - message: "两次填写的密码不一致" - } - } - return null -} - -const Modifypwd = (props) => { - const form = Form.useForm(FormStrategy.View) - const [pwdType, setPwdType] = React.useState("password") - const [repwdType, setRePwdType] = React.useState("password") - - const onSubmit = React.useCallback((form) => { - const value = form.getValue() - if (value) { - let data = cloneDeep(value) - let parmas = { - password: data.password - } - putmodifySelf(parmas) - .then((res) => { - handelResponse( - res, - (response, msg) => { - Notify.clear() - Notify.success(msg) - setTimeout(() => { - window.location.href = "/" - sessionStorage.clear() - }, 2000) - }, - (err) => { - Notify.clear() - Notify.error(res.data.message) - } - ) - }) - .catch((err) => {}) - } - }, []) - - const cancelFn = () => { - props.visibleShow(false) - } - - const changepwdType = () => { - if (pwdType == "password") { - setPwdType("text") - } else { - setPwdType("password") - } - } - - const rechangepwdType = () => { - if (repwdType == "password") { - setRePwdType("text") - } else { - setRePwdType("password") - } - } - - return ( -
- - } - helpDesc="" - validators={[ - Validators.required("请输入新密码"), - Validators.pattern( - /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/, - "6-16位字符,数字+字母组成,(字母区分大小写)" - ) - ]} - notice="6-16位字符,数字+字母组成,字母(区分大小写)" - props={{ - type: pwdType == "password" ? "password" : "text", - maxLength: 16, - autoComplete: "new-password" - }} - /> - - } - validators={[Validators.required("请确认密码"), equalsPassword]} - props={{ - type: repwdType == "password" ? "password" : "text", - maxLength: 16, - autoComplete: "new-password" - }} - /> -

- - , -

- - ) -} -export default Modifypwd diff --git a/src/pages/home/home.js b/src/pages/home/home.js index 38867344..bb5bd71f 100644 --- a/src/pages/home/home.js +++ b/src/pages/home/home.js @@ -1,19 +1,17 @@ +import { getProductInfoSelect, getUserinfo, handelResponse, postLogOut } from "@/assets/api.js" import "@/assets/comm.css" import Bus from "@/assets/eventBus.js" import Subnav from "@/components/subnav/main" import { noShowSubMenu, router } from "@/router/index" import React, { Component } from "react" import { Route, HashRouter as Router } from "react-router-dom" -import { Avatar, Dialog, Icon, Notify, Pop, Sweetalert } from "zent" -import ModifySelfpwd from "./ModifySelfpwd" +import { Avatar, Icon, Notify, Pop, Sweetalert } from "zent" import "./home.less" -import { getProductInfoSelect, getUserinfo, handelResponse, postLogOut } from "@/assets/api.js" export default class App extends Component { constructor(props) { super(props) } state = { - visible: false, mouseMenuMask: false, setrender: 1, linkshow: "系统管理", @@ -55,11 +53,6 @@ export default class App extends Component { .catch((err) => {}) } - //修改密码 - modifyFn() { - this.setState({ visible: true }) - } - //退出登录 exitFn() { let self = this @@ -88,10 +81,6 @@ export default class App extends Component { }) } - setVisible = (visible) => { - this.setState({ visible }) - } - componentWillMount(e) { let activeMenuList = JSON.parse(sessionStorage.getItem("activeMenu")) const pathname = window.location.href.lastIndexOf("/") @@ -263,14 +252,6 @@ export default class App extends Component { > 退出 - { - this.modifyFn() - }} - className="modify-btn" - > - 修改密码 - @@ -284,15 +265,6 @@ export default class App extends Component { - this.setVisible(false)} - title="修改密码" - > - this.setVisible(visible)} /> -
-