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 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 3 import commonConfig from "@/utils/config";
4 4 import * as commonServices from "@/services/services";
5 5  
... ... @@ -33,7 +33,7 @@ const UserRegistration = ({ _this }) => {
33 33 if (!userRegisterMode) return "";
34 34  
35 35 const props = UserRegistrationEvent();
36   - const { customerData = [] } = props;
  36 + const { customerData = [], successModalVisible } = props;
37 37  
38 38 const [form] = Form.useForm();
39 39  
... ... @@ -47,13 +47,40 @@ const UserRegistration = ({ _this }) => {
47 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 73 return (
55 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 84 <Form
58 85 name="basic"
59 86 form={form}
... ... @@ -71,7 +98,7 @@ const UserRegistration = ({ _this }) =&gt; {
71 98  
72 99 <Form.Item
73 100 label="手机号"
74   - name="telenumber"
  101 + name="phonenumber"
75 102 rules={[
76 103 { required: true, message: "未填写手机号!" },
77 104 {
... ... @@ -93,6 +120,25 @@ const UserRegistration = ({ _this }) =&gt; {
93 120 </Form.Item>
94 121 </Form>
95 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 142 </ConfigProvider>
97 143 );
98 144 };
... ...
src/models/app.js
... ... @@ -539,7 +539,6 @@ export default {
539 539 const webSocket = yield select(state => state.app.webSocket);
540 540 let dataCode = 0;
541 541 const { data } = yield call(services.postValueService, token, value, url);
542   - console.log("=====data", data);
543 542 if (utils.isEmpty(webSocket)) {
544 543 const reStart = true;
545 544 yield put({ type: "createWebSocket", payload: { reStart, dispatch } });
... ... @@ -659,6 +658,8 @@ export default {
659 658 // 工单系统消息
660 659 const msgData = JSON.parse(msg.data);
661 660 dispatch({ type: "app/saveWorkMsg", payload: { workMsg: msgData.msg } });
  661 + } else if (window.tempWsAction) {
  662 + window.tempWsAction(msg);
662 663 }
663 664 };
664 665 ws.onmessage = msg => {
... ...