caipin 4 vuotta sitten
vanhempi
commit
78725d5232

+ 24 - 0
src/pages/Account/Information/api.ts

@@ -0,0 +1,24 @@
+/*
+ * @description: 
+ * @Author: CP
+ * @Date: 2021-01-07 15:04:37
+ * @FilePath: \management\src\pages\Account\Information\api.ts
+ */
+import {  iUserInfo } from "@/types/setting"
+import request from "@/utils/common/request"
+/**
+ * 获取项目信息
+ */
+export async function apiProjectAccountInfo() {
+  const { data } = await request.get('/api/projectAccount')
+  return data
+}
+
+/**
+ * 编辑账号
+ * @param payload - 载荷
+ */
+export async function apiAccountEdit(payload: any) {
+  const { data } = await request.post(`/api/projectAccount/account/save`, payload)
+  return data
+}

+ 10 - 0
src/pages/Account/Information/index.module.scss

@@ -0,0 +1,10 @@
+.projectInfo {
+  display: flex;
+  width: 100%;
+  margin-top: 1rem;
+  .formContent {
+    flex: 0 0 41.666667%;
+    max-width: 41.666667%;
+    padding: 0 15px;
+  }
+}

+ 10 - 0
src/pages/Account/Safe/index.module.scss

@@ -0,0 +1,10 @@
+.projectInfo {
+  display: flex;
+  width: 100%;
+  margin-top: 1rem;
+  .formContent {
+    flex: 0 0 41.666667%;
+    max-width: 41.666667%;
+    padding: 0 15px;
+  }
+}

+ 26 - 5
src/pages/Account/Safe/index.tsx

@@ -3,27 +3,48 @@ import Header from '@/components/Header'
 import { Button, Form, Input, message } from 'antd'
 import styles from './index.module.scss'
 
+interface iPassword {
+  password: string
+  newPassword: string
+  confirmPassword: string
+}
+
 export default function index() {
   const [ form ] = Form.useForm() 
   const [ loading, setLoading ] = useState<boolean>(false)
+
+  // 保存表单信息
+  const changePassword = async (values:any) => {
+    setLoading(true)
+    
+    console.log(values)
+    // const { code = -1 } = await apiAccountEdit(values)
+    // if (code === consts.RET_CODE.SUCCESS) {
+    //   message.success("更新成功!")
+    //   initData()
+    // }
+   
+    setLoading(false)
+  }
+
   return (
     <div className="wrap-contaniner">
       <Header title="账号安全"></Header>
       <div className={styles.projectInfo}>
         <Form form={form} className={styles.formContent} layout="vertical" size="small">
-          <Form.Item name="account" label="旧密码" rules={[ { required: true, message: '请输入旧密码' } ]}>
+          <Form.Item name="password" label="旧密码" rules={[ { required: true, message: '请输入旧密码' } ]}>
             <Input.Password></Input.Password>
           </Form.Item>
-          <Form.Item name="name" label="新密码" rules={[ { required: true, message: '请输入新密码' } ]}>
+          <Form.Item name="newPassword" label="新密码" rules={[ { required: true, message: '请输入新密码' } ]}>
           <Input.Password></Input.Password>
           </Form.Item>
-          <Form.Item name="company" label="确认新密码" rules={[ { required: true, message: '请输入确认新密码' } ]}>
+          <Form.Item name="confirmPassword" label="确认新密码" rules={[ { required: true, message: '请输入确认新密码' } ]}>
           <Input.Password></Input.Password>
           </Form.Item>
           
-          <Button type="primary" size="small" loading={loading}    onClick={() => {
+          <Button type="primary" size="small" loading={loading}  onClick={() => {
               form.validateFields().then(values => {
-                // saveAccountInfo(values)
+                 changePassword(values)
               })
             }}>保存修改</Button>
         </Form>