From 83b51a5a0774ea8ecb9a06304af3b956a21307c8 Mon Sep 17 00:00:00 2001
From: pjb <123456>
Date: 星期六, 08 三月 2025 09:06:55 +0800
Subject: [PATCH] CUT库条码T开头,截取后10位
---
zy-asrs-flow/src/pages/account/setting/components/security.jsx | 166 +++++++++++++++++++++++++++++++++++--------------------
1 files changed, 105 insertions(+), 61 deletions(-)
diff --git a/zy-asrs-flow/src/pages/account/setting/components/security.jsx b/zy-asrs-flow/src/pages/account/setting/components/security.jsx
index 62663fa..951b30d 100644
--- a/zy-asrs-flow/src/pages/account/setting/components/security.jsx
+++ b/zy-asrs-flow/src/pages/account/setting/components/security.jsx
@@ -1,61 +1,105 @@
-import { List } from 'antd';
-import React from 'react';
-
-
-const passwordStrength = {
- strong: <span className="strong">寮�</span>,
- medium: <span className="medium">涓�</span>,
- weak: <span className="weak">寮� Weak</span>,
-};
-
-const SecurityView = () => {
- const getData = () => [
- {
- title: '璐︽埛瀵嗙爜',
- description: (
- <>
- 褰撳墠瀵嗙爜寮哄害锛�
- {passwordStrength.strong}
- </>
- ),
- actions: [<a key="Modify">淇敼</a>],
- },
- {
- title: '瀵嗕繚鎵嬫満',
- description: `宸茬粦瀹氭墜鏈猴細138****8293`,
- actions: [<a key="Modify">淇敼</a>],
- },
- {
- title: '瀵嗕繚闂',
- description: '鏈缃瘑淇濋棶棰橈紝瀵嗕繚闂鍙湁鏁堜繚鎶よ处鎴峰畨鍏�',
- actions: [<a key="Set">璁剧疆</a>],
- },
- {
- title: '澶囩敤閭',
- description: `宸茬粦瀹氶偖绠憋細ant***sign.com`,
- actions: [<a key="Modify">淇敼</a>],
- },
- {
- title: 'MFA 璁惧',
- description: '鏈粦瀹� MFA 璁惧锛岀粦瀹氬悗锛屽彲浠ヨ繘琛屼簩娆$‘璁�',
- actions: [<a key="bind">缁戝畾</a>],
- },
- ];
-
- const data = getData();
- return (
- <>
- <List
- itemLayout="horizontal"
- dataSource={data}
- renderItem={(item) => (
- <List.Item actions={item.actions}>
- <List.Item.Meta title={item.title} description={item.description} />
- </List.Item>
- )}
- />
- </>
- );
-};
-
-export default SecurityView;
+import { Card, Form, message } from 'antd';
+import React from 'react';
+import {
+ ProForm,
+ ProFormText
+} from '@ant-design/pro-components';
+import { FormattedMessage, useIntl } from '@umijs/max';
+import { useModel } from '@umijs/max';
+import Http from '@/utils/http';
+
+const resetPwd = async (val, form, intl) => {
+ const hide = message.loading(intl.formatMessage({ id: 'page.updating', defaultMessage: '姝e湪淇敼' }));
+ try {
+ const resp = await Http.doPost('api/user/reset/pwd', val);
+ if (resp.code === 200) {
+ message.success(intl.formatMessage({ id: 'page.update.success', defaultMessage: '淇敼鎴愬姛' }));
+ form.resetFields();
+ return true;
+ } else {
+ message.error(resp.msg);
+ return false;
+ }
+ } catch (error) {
+ message.error(intl.formatMessage({ id: 'page.update.fail', defaultMessage: '淇敼澶辫触璇烽噸璇曪紒' }));
+ return false;
+ } finally {
+ hide();
+ }
+};
+
+const SecurityView = () => {
+ const intl = useIntl();
+ const [form] = Form.useForm();
+ const { initialState } = useModel('@@initialState');
+ const { currentUser } = initialState || {};
+
+ const handleFinish = (values) => {
+ resetPwd({ ...values, id: currentUser.id }, form, intl);
+ }
+
+ return (
+ <>
+ <Card>
+ <ProForm
+ form={form}
+ layout="vertical"
+ onFinish={handleFinish}
+ submitter={{
+ searchConfig: {
+ submitText: intl.formatMessage({ id: 'personal.security.button.name', defaultMessage: '淇敼瀵嗙爜' }),
+ },
+ render: (_, dom) => dom[1],
+ }}
+ >
+ <ProFormText.Password
+ width="md"
+ name="oldPwd"
+ label={intl.formatMessage({ id: 'personal.security.cur.pwd', defaultMessage: '褰撳墠瀵嗙爜' })}
+ rules={[
+ {
+ required: true,
+ },
+ ]}
+ />
+ <ProFormText.Password
+ width="md"
+ name="password"
+ label={intl.formatMessage({ id: 'personal.security.new.pwd', defaultMessage: '鏂板瘑鐮�' })}
+ rules={[
+ {
+ required: true,
+ },
+ {
+ validator(_, value) {
+ if (value.length >= 4 && value.length <= 16) {
+ return Promise.resolve();
+ }
+ return Promise.reject(new Error(intl.formatMessage({ id: 'personal.security.new.pwd.rule.length', defaultMessage: '鏂板瘑鐮佸繀椤绘槸4鍒�16涓瓧绗�!' })));
+ },
+ },
+ ]}
+ />
+ <ProFormText.Password
+ width="md"
+ name="passwordRepeat"
+ label={intl.formatMessage({ id: 'personal.security.new.pwd.confirm', defaultMessage: '纭瀵嗙爜' })}
+ rules={[
+ {
+ required: true,
+ },
+ {
+ validator(_, value) {
+ if (form.getFieldValue('password') === value) return Promise.resolve();
+ return Promise.reject(new Error(intl.formatMessage({ id: 'personal.security.new.pwd.rule.check', defaultMessage: '涓ゆ杈撳叆鐨勫瘑鐮佷笉鐩哥!' })));
+ }
+ }
+ ]}
+ />
+ </ProForm>
+ </Card>
+ </>
+ );
+};
+
+export default SecurityView;
--
Gitblit v1.9.1