🗑️ delete: 移除修改密码模块
This commit is contained in:
parent
f266212d2e
commit
de6492a495
|
@ -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 (
|
|
||||||
<Form form={form} layout="horizontal" scrollToError onSubmit={onSubmit}>
|
|
||||||
<FormInputField
|
|
||||||
name="password"
|
|
||||||
label="新密码"
|
|
||||||
className="selfpwd"
|
|
||||||
required
|
|
||||||
after={
|
|
||||||
<Icon type={pwdType == "password" ? "eye-o" : "closed-eye"} onClick={changepwdType} />
|
|
||||||
}
|
|
||||||
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"
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<FormInputField
|
|
||||||
name="old_password"
|
|
||||||
label="再次输入新密码"
|
|
||||||
required
|
|
||||||
className="selfpwd"
|
|
||||||
notice="必须与新密码输入一致"
|
|
||||||
after={
|
|
||||||
<Icon type={repwdType == "password" ? "eye-o" : "closed-eye"} onClick={rechangepwdType} />
|
|
||||||
}
|
|
||||||
validators={[Validators.required("请确认密码"), equalsPassword]}
|
|
||||||
props={{
|
|
||||||
type: repwdType == "password" ? "password" : "text",
|
|
||||||
maxLength: 16,
|
|
||||||
autoComplete: "new-password"
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<p className="dflexajce">
|
|
||||||
<Button type="primary" htmlType="submit">
|
|
||||||
确定
|
|
||||||
</Button>
|
|
||||||
,<Button onClick={cancelFn}>取消</Button>
|
|
||||||
</p>
|
|
||||||
</Form>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
export default Modifypwd
|
|
|
@ -1,19 +1,17 @@
|
||||||
|
import { getProductInfoSelect, getUserinfo, handelResponse, postLogOut } from "@/assets/api.js"
|
||||||
import "@/assets/comm.css"
|
import "@/assets/comm.css"
|
||||||
import Bus from "@/assets/eventBus.js"
|
import Bus from "@/assets/eventBus.js"
|
||||||
import Subnav from "@/components/subnav/main"
|
import Subnav from "@/components/subnav/main"
|
||||||
import { noShowSubMenu, router } from "@/router/index"
|
import { noShowSubMenu, router } from "@/router/index"
|
||||||
import React, { Component } from "react"
|
import React, { Component } from "react"
|
||||||
import { Route, HashRouter as Router } from "react-router-dom"
|
import { Route, HashRouter as Router } from "react-router-dom"
|
||||||
import { Avatar, Dialog, Icon, Notify, Pop, Sweetalert } from "zent"
|
import { Avatar, Icon, Notify, Pop, Sweetalert } from "zent"
|
||||||
import ModifySelfpwd from "./ModifySelfpwd"
|
|
||||||
import "./home.less"
|
import "./home.less"
|
||||||
import { getProductInfoSelect, getUserinfo, handelResponse, postLogOut } from "@/assets/api.js"
|
|
||||||
export default class App extends Component {
|
export default class App extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
}
|
}
|
||||||
state = {
|
state = {
|
||||||
visible: false,
|
|
||||||
mouseMenuMask: false,
|
mouseMenuMask: false,
|
||||||
setrender: 1,
|
setrender: 1,
|
||||||
linkshow: "系统管理",
|
linkshow: "系统管理",
|
||||||
|
@ -55,11 +53,6 @@ export default class App extends Component {
|
||||||
.catch((err) => {})
|
.catch((err) => {})
|
||||||
}
|
}
|
||||||
|
|
||||||
//修改密码
|
|
||||||
modifyFn() {
|
|
||||||
this.setState({ visible: true })
|
|
||||||
}
|
|
||||||
|
|
||||||
//退出登录
|
//退出登录
|
||||||
exitFn() {
|
exitFn() {
|
||||||
let self = this
|
let self = this
|
||||||
|
@ -88,10 +81,6 @@ export default class App extends Component {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
setVisible = (visible) => {
|
|
||||||
this.setState({ visible })
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillMount(e) {
|
componentWillMount(e) {
|
||||||
let activeMenuList = JSON.parse(sessionStorage.getItem("activeMenu"))
|
let activeMenuList = JSON.parse(sessionStorage.getItem("activeMenu"))
|
||||||
const pathname = window.location.href.lastIndexOf("/")
|
const pathname = window.location.href.lastIndexOf("/")
|
||||||
|
@ -263,14 +252,6 @@ export default class App extends Component {
|
||||||
>
|
>
|
||||||
退出
|
退出
|
||||||
</span>
|
</span>
|
||||||
<span
|
|
||||||
onClick={() => {
|
|
||||||
this.modifyFn()
|
|
||||||
}}
|
|
||||||
className="modify-btn"
|
|
||||||
>
|
|
||||||
修改密码
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -284,15 +265,6 @@ export default class App extends Component {
|
||||||
</Pop>
|
</Pop>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Dialog
|
|
||||||
visible={this.state.visible}
|
|
||||||
className="questModal"
|
|
||||||
onClose={() => this.setVisible(false)}
|
|
||||||
title="修改密码"
|
|
||||||
>
|
|
||||||
<ModifySelfpwd visibleShow={(visible) => this.setVisible(visible)} />
|
|
||||||
<div></div>
|
|
||||||
</Dialog>
|
|
||||||
<aside className="mainbody">
|
<aside className="mainbody">
|
||||||
{this.state.isShowSub ? <div className="subtitle"> </div> : null}
|
{this.state.isShowSub ? <div className="subtitle"> </div> : null}
|
||||||
<div className="route-box">
|
<div className="route-box">
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
.selfpwd{
|
|
||||||
.zenticon{
|
|
||||||
font-size: 22px;
|
|
||||||
line-height: 32px!important;
|
|
||||||
margin-left: 5px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue