Commit c78676545b64f1a836b558cfb259964f82b47c84

Authored by 陈鑫涛
2 parents e32e83c7 dc29d25a

Merge branch 'main' of http://git.xlyprint.cn/zhangz/xlyUmi into main

src/components/UserRegistration/index.jsx
1 import { useState, useEffect } from "react"; 1 import { useState, useEffect } from "react";
2 -import { ConfigProvider, Modal, Form, Input, Select, message } from "antd"; 2 +import { ConfigProvider, Modal, Form, Input, Select, message, Button } from "antd";
3 import commonConfig from "@/utils/config"; 3 import commonConfig from "@/utils/config";
4 import * as commonServices from "@/services/services"; 4 import * as commonServices from "@/services/services";
5 5
@@ -33,7 +33,7 @@ const UserRegistration = ({ _this }) => { @@ -33,7 +33,7 @@ const UserRegistration = ({ _this }) => {
33 if (!userRegisterMode) return ""; 33 if (!userRegisterMode) return "";
34 34
35 const props = UserRegistrationEvent(); 35 const props = UserRegistrationEvent();
36 - const { customerData = [] } = props; 36 + const { customerData = [], successModalVisible } = props;
37 37
38 const [form] = Form.useForm(); 38 const [form] = Form.useForm();
39 39
@@ -47,13 +47,40 @@ const UserRegistration = ({ _this }) => { @@ -47,13 +47,40 @@ const UserRegistration = ({ _this }) => {
47 form.submit(); 47 form.submit();
48 }; 48 };
49 49
50 - const onFinish = values => {  
51 - console.log("=====Success:", values); 50 + const onFinish = ({ username, phonenumber, sCustomerId }) => {
  51 + const url = `${commonConfig.feedback_host}sftlogininfo/insertPasswordUserName/add`;
  52 + const params = {
  53 + sUserName: username,
  54 + sLanguage: "sChinese",
  55 + sBrandsId: "1111111111",
  56 + sSubsidiaryId: "1111111111",
  57 + sPhone: phonenumber,
  58 + sCustomerId,
  59 + };
  60 + commonServices.postValueService("", params, url).then(({ data: result = {} }) => {
  61 + const { code = -1, msg = "接口出错" } = result;
  62 + if (code > -1) {
  63 + props.setState({
  64 + successModalVisible: true,
  65 + phonenumber,
  66 + });
  67 + } else {
  68 + message.error(msg);
  69 + }
  70 + });
52 }; 71 };
53 72
54 return ( 73 return (
55 <ConfigProvider prefixCls="antdV5"> 74 <ConfigProvider prefixCls="antdV5">
56 - <Modal title="用户注册" open={userRegisterMode} okText="确认" cancelText="取消" onOk={handleOk} onCancel={handleCancel} width={400}> 75 + <Modal
  76 + title="用户注册"
  77 + open={userRegisterMode && !successModalVisible}
  78 + okText="确认"
  79 + cancelText="取消"
  80 + onOk={handleOk}
  81 + onCancel={handleCancel}
  82 + width={400}
  83 + >
57 <Form 84 <Form
58 name="basic" 85 name="basic"
59 form={form} 86 form={form}
@@ -71,7 +98,7 @@ const UserRegistration = ({ _this }) =&gt; { @@ -71,7 +98,7 @@ const UserRegistration = ({ _this }) =&gt; {
71 98
72 <Form.Item 99 <Form.Item
73 label="手机号" 100 label="手机号"
74 - name="telenumber" 101 + name="phonenumber"
75 rules={[ 102 rules={[
76 { required: true, message: "未填写手机号!" }, 103 { required: true, message: "未填写手机号!" },
77 { 104 {
@@ -93,6 +120,25 @@ const UserRegistration = ({ _this }) =&gt; { @@ -93,6 +120,25 @@ const UserRegistration = ({ _this }) =&gt; {
93 </Form.Item> 120 </Form.Item>
94 </Form> 121 </Form>
95 </Modal> 122 </Modal>
  123 + <Modal
  124 + open={successModalVisible}
  125 + title="注册成功"
  126 + onCancel={handleCancel}
  127 + footer={
  128 + <Button type="primary" onClick={handleCancel}>
  129 + 确认
  130 + </Button>
  131 + }
  132 + width={400}
  133 + >
  134 + <p style={{ fontWeight: "bold", fontSize: 16 }}>请等待【管理员审核】成功后用以下账号登陆!</p>
  135 + <p>
  136 + 用户名: <span style={{ fontSize: 16 }}>{props.phonenumber}</span>
  137 + </p>
  138 + <p>
  139 + 密&nbsp;&nbsp;&nbsp;&nbsp;码: <span style={{ fontSize: 16 }}>{props.phonenumber}</span>
  140 + </p>
  141 + </Modal>
96 </ConfigProvider> 142 </ConfigProvider>
97 ); 143 );
98 }; 144 };
src/models/app.js
@@ -539,7 +539,6 @@ export default { @@ -539,7 +539,6 @@ export default {
539 const webSocket = yield select(state => state.app.webSocket); 539 const webSocket = yield select(state => state.app.webSocket);
540 let dataCode = 0; 540 let dataCode = 0;
541 const { data } = yield call(services.postValueService, token, value, url); 541 const { data } = yield call(services.postValueService, token, value, url);
542 - console.log("=====data", data);  
543 if (utils.isEmpty(webSocket)) { 542 if (utils.isEmpty(webSocket)) {
544 const reStart = true; 543 const reStart = true;
545 yield put({ type: "createWebSocket", payload: { reStart, dispatch } }); 544 yield put({ type: "createWebSocket", payload: { reStart, dispatch } });
@@ -659,6 +658,8 @@ export default { @@ -659,6 +658,8 @@ export default {
659 // 工单系统消息 658 // 工单系统消息
660 const msgData = JSON.parse(msg.data); 659 const msgData = JSON.parse(msg.data);
661 dispatch({ type: "app/saveWorkMsg", payload: { workMsg: msgData.msg } }); 660 dispatch({ type: "app/saveWorkMsg", payload: { workMsg: msgData.msg } });
  661 + } else if (window.tempWsAction) {
  662 + window.tempWsAction(msg);
662 } 663 }
663 }; 664 };
664 ws.onmessage = msg => { 665 ws.onmessage = msg => {