💪 optimize: 优化代码

This commit is contained in:
wangsongsole 2024-02-06 13:55:50 +08:00
parent a783378148
commit d813ed168a
1 changed files with 3 additions and 7 deletions

View File

@ -1,10 +1,10 @@
import { generateRsaKey, setResellMerchant } from "@/assets/api"
import FormItem from "@/components/form-item/main" import FormItem from "@/components/form-item/main"
import Form from "@/components/form/main" import Form from "@/components/form/main"
import Ipt from "@/components/input/main" import Ipt from "@/components/input/main"
import { cloneDeep, omit } from "lodash-es" import { omit } from "lodash-es"
import { useEffect, useRef, useState } from "react" import { useEffect, useRef, useState } from "react"
import { Button, Card, Checkbox, Input, Notify, Radio, RadioGroup } from "zent" import { Button, Card, Checkbox, Input, Notify, Radio, RadioGroup } from "zent"
import { setResellMerchant, generateRsaKey } from "@/assets/api"
import "./index" import "./index"
export default function Merchant() { export default function Merchant() {
const [state, setState] = useState({ const [state, setState] = useState({
@ -45,11 +45,7 @@ export default function Merchant() {
useEffect(() => { useEffect(() => {
const { merchant, id } = JSON.parse(sessionStorage.getItem("merchant")) const { merchant, id } = JSON.parse(sessionStorage.getItem("merchant"))
const cloneState = cloneDeep(state) setState({ ...state, reseller_id: id, ...merchant })
for (let key in cloneState) {
cloneState[key] = merchant[key]
}
setState({ ...state, reseller_id: id, ...cloneState })
}, []) }, [])
/* 获取密钥 */ /* 获取密钥 */