Commit 73380781fbd28b95c90424eff4f45ac6955e02a2

Authored by 陈鑫涛
2 parents 0cfa5749 8ae71a67

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

src/components/Common/PersonCenter/PersonCenter.js
... ... @@ -30,8 +30,9 @@ import OnlineUser from '@/assets/onlineUser.svg';
30 30 // import StaticEditTable from '@/components/Common/CommonTable';
31 31 import * as commonServices from '@/services/services';
32 32 import commonConfig from '../../../utils/config';
33   -// import SkinChangeModal from './SkinChangeModal';
  33 +import SkinChangeModal from './SkinChangeModal';
34 34 import MenuSearchPopovor from './MenuSearchPopovor';
  35 +import SwitchCompanyAndLanguage from './SwitchCompanyAndLanguage';
35 36  
36 37 const { TabPane } = Tabs;
37 38 const FormItem = Form.Item;
... ... @@ -383,7 +384,7 @@ class PersonCenter extends Component {
383 384 const { menuPanel, onAddPane, app } = this.props;
384 385 return (
385 386 <div className={styles.dropdownContainer} id="pcDropdwonContainer">
386   - <Space align="baseline">
  387 + <Space align="baseline" style={{ display: 'flex', alignItems: 'center' }}>
387 388 <div style={{ display: 'none' }} className={styles.dropdownDiv}>{companyName}</div>
388 389 <div
389 390 className="sysSearchInput"
... ... @@ -417,6 +418,7 @@ class PersonCenter extends Component {
417 418 />
418 419 </Popover>
419 420 </div>
  421 + <SwitchCompanyAndLanguage {...props} />
420 422 <div
421 423 className="sysNewBox"
422 424 onFocus={() => 0}
... ...
src/components/Common/PersonCenter/SkinChangeModal.js
1 1 /* eslint-disable */
2 2 import React, { useEffect, useRef, useState } from "react";
3 3 import AntdDraggableModal from "@/components/Common/AntdDraggableModal";
4   -import styles from "@/routes/IndexPage.less";
  4 +import styles from "@/routes/indexPage.less";
5 5  
6 6 const skinList = [
7 7 {
... ...
src/components/Common/PersonCenter/SwitchCompanyAndLanguage/index.js 0 → 100644
  1 +/* eslint-disable */
  2 +import React, { useEffect, useState } from "react";
  3 +import { Button, Dropdown, Spin } from "antd";
  4 +import { DownOutlined, LoadingOutlined } from "@ant-design/icons";
  5 +import * as commonServices from "@/services/services";
  6 +import commonConfig from "@/utils/config";
  7 +import * as commonFunc from "@/components/Common/commonFunc";
  8 +import * as commonUtils from "@/utils/utils";
  9 +import styles from "./index.less";
  10 +
  11 +const SwitchCompanyAndLanguageEvent = props => {
  12 + const { app } = props;
  13 + const { token, userinfo } = app;
  14 +
  15 + const addState = {};
  16 + const [state, setState] = useState({ language: userinfo.sLanguage === "sChinese" ? "中文" : "EN" });
  17 +
  18 + useEffect(() => {
  19 + const getComponyList = async () => {
  20 + const dataUrl = `${commonConfig.server_host}brand/getBrand/${userinfo.sId}`;
  21 +
  22 + const dataReturn = (await commonServices.getService(token, dataUrl)).data;
  23 + if (dataReturn.code === 1) {
  24 + const companyList = dataReturn.dataset.rows[0];
  25 + setState(pre => ({ ...pre, companyList, companyData: companyList.find(item => item.sSubsidiaryId === userinfo.sSubsidiaryId) }));
  26 + setTimeout(() => {
  27 + const resizeEvent = new Event("resize");
  28 + window.dispatchEvent(resizeEvent);
  29 + }, 1000);
  30 + }
  31 + };
  32 +
  33 + getComponyList();
  34 + }, []);
  35 +
  36 + addState.onChangeCompany = async item => {
  37 + if (item.sSubsidiaryId === state.companyData.sSubsidiaryId) return;
  38 +
  39 + setState(pre => ({ ...pre, companyLoading: true }));
  40 + const dataUrl = `${commonConfig.server_host}brand/changeBrand`;
  41 + const conditions = {
  42 + sBrandsId: item.sBrandsId,
  43 + sSubsidiaryId: item.sSubsidiaryId,
  44 + };
  45 + const dataReturn = (await commonServices.postValueService(token, conditions, dataUrl)).data;
  46 + if (dataReturn.code === 1) {
  47 + setState(pre => ({ ...pre, companyData: item }));
  48 + const { token, systemData, rxtx, commonConst, gdslogininfo: userinfo, auxiliaryQty, footer, logoImageInfo, isInitPassword } = {
  49 + ...app,
  50 + ...dataReturn.dataset.rows[0],
  51 + };
  52 +
  53 + const decimals = {};
  54 + if (commonUtils.isNotEmptyArr(systemData)) {
  55 + const dNetPrice = systemData.filter(item => item.sName === "NetPrice")[0];
  56 + const dNumAlign = systemData.filter(item => item.sName === "CkxNumAlign")[0];
  57 + decimals.dNetPrice = Number(dNetPrice.sValue);
  58 + decimals.dNetMoney = 2;
  59 + decimals.dNumAlign = dNumAlign !== undefined && dNumAlign.sValue !== undefined ? dNumAlign.sValue : 0;
  60 + }
  61 +
  62 + props.dispatch({
  63 + type: "login/login",
  64 + payload: {
  65 + token,
  66 + rxtx,
  67 + commonConst,
  68 + userinfo,
  69 + auxiliaryQty,
  70 + dispatch: props.dispatch,
  71 + systemData,
  72 + decimals,
  73 + dateFormat: commonFunc.getDateFormat(systemData),
  74 + footer,
  75 + logoImageInfo,
  76 + isInitPassword,
  77 + bChangeLanguage: true,
  78 + },
  79 + });
  80 +
  81 + setTimeout(() => {
  82 + commonUtils.clearStoreDropDownData();
  83 + commonUtils.clearFormStoreDropDownData();
  84 + window.xlyReload();
  85 + }, 1000);
  86 + }
  87 +
  88 + setState(pre => ({ ...pre, companyLoading: false }));
  89 + };
  90 +
  91 + addState.onChangeLanguage = async () => {
  92 + setState(pre => ({ ...pre, btnLoading: true }));
  93 + const dataUrl = `${commonConfig.server_host}brand/changeLanguage`;
  94 + const { language } = state;
  95 +
  96 + const dataReturn = (await commonServices.postValueService(token, { sLanguage: language === "中文" ? "sEnglish" : "sChinese" }, dataUrl)).data;
  97 + if (dataReturn.code === 1) {
  98 + setState(pre => ({ ...pre, language: language === "中文" ? "EN" : "中文" }));
  99 + const { token, systemData, rxtx, commonConst, gdslogininfo: userinfo, auxiliaryQty, footer, logoImageInfo, isInitPassword } = {
  100 + ...app,
  101 + ...dataReturn.dataset.rows[0],
  102 + };
  103 +
  104 + const decimals = {};
  105 + if (commonUtils.isNotEmptyArr(systemData)) {
  106 + const dNetPrice = systemData.filter(item => item.sName === "NetPrice")[0];
  107 + const dNumAlign = systemData.filter(item => item.sName === "CkxNumAlign")[0];
  108 + decimals.dNetPrice = Number(dNetPrice.sValue);
  109 + decimals.dNetMoney = 2;
  110 + decimals.dNumAlign = dNumAlign !== undefined && dNumAlign.sValue !== undefined ? dNumAlign.sValue : 0;
  111 + }
  112 +
  113 + props.dispatch({
  114 + type: "login/login",
  115 + payload: {
  116 + token,
  117 + rxtx,
  118 + commonConst,
  119 + userinfo,
  120 + auxiliaryQty,
  121 + dispatch: props.dispatch,
  122 + systemData,
  123 + decimals,
  124 + dateFormat: commonFunc.getDateFormat(systemData),
  125 + footer,
  126 + logoImageInfo,
  127 + isInitPassword,
  128 + bChangeLanguage: true,
  129 + },
  130 + });
  131 +
  132 + setTimeout(() => {
  133 + commonUtils.clearStoreDropDownData();
  134 + commonUtils.clearFormStoreDropDownData();
  135 + window.xlyReload();
  136 + }, 1000);
  137 + }
  138 +
  139 + setState(pre => ({ ...pre, btnLoading: false }));
  140 + };
  141 +
  142 + return {
  143 + ...props,
  144 + ...addState,
  145 + ...state,
  146 + };
  147 +};
  148 +
  149 +const SwitchCompanyAndLanguage = baseProps => {
  150 + const props = SwitchCompanyAndLanguageEvent(baseProps);
  151 + return (
  152 + <div className={styles.switchCompanyAndLanguage}>
  153 + <CompanyComponent {...props} />
  154 + {/* <LanguageComponent {...props} /> */}
  155 + </div>
  156 + );
  157 +};
  158 +
  159 +const CompanyComponent = props => {
  160 + const { companyList = [], companyData = {}, companyLoading = false } = props;
  161 +
  162 + const bMutiLine = companyData.sName?.includes("-");
  163 + const sName0 = bMutiLine ? companyData.sName.split("-")[0] : "";
  164 + const sName1 = bMutiLine ? companyData.sName.split("-")[1] : "";
  165 + return (
  166 + !!companyList.length && (
  167 + <Dropdown
  168 + trigger={["click"]}
  169 + menu={{
  170 + items: companyList.map(item => ({
  171 + ...item,
  172 + key: item.sId,
  173 + label: item.sName,
  174 + onClick: props.onChangeCompany.bind(this, item),
  175 + })),
  176 + }}
  177 + >
  178 + <Spin
  179 + spinning={companyLoading}
  180 + indicator={
  181 + <LoadingOutlined
  182 + style={{
  183 + fontSize: 24,
  184 + }}
  185 + spin
  186 + />
  187 + }
  188 + >
  189 + <div className="company">
  190 + {bMutiLine ? (
  191 + <div className="companyMutiLine">
  192 + <div>{sName0}</div>
  193 + <div>{sName1}</div>
  194 + </div>
  195 + ) : (
  196 + <span>{companyData.sName}</span>
  197 + )}
  198 + <DownOutlined />
  199 + </div>
  200 + </Spin>
  201 + </Dropdown>
  202 + )
  203 + );
  204 +};
  205 +
  206 +const LanguageComponent = props => {
  207 + const { language, btnLoading } = props;
  208 + return (
  209 + <div className="language">
  210 + {btnLoading ? (
  211 + <LoadingOutlined style={{ fontSize: 16 }} />
  212 + ) : (
  213 + <Button type="link" onClick={props.onChangeLanguage}>
  214 + {language}
  215 + </Button>
  216 + )}
  217 + </div>
  218 + );
  219 +};
  220 +
  221 +export default SwitchCompanyAndLanguage;
... ...
src/components/Common/PersonCenter/SwitchCompanyAndLanguage/index.less 0 → 100644
  1 +.switchCompanyAndLanguage {
  2 + width: auto;
  3 + height: 100%;
  4 + display: flex;
  5 +
  6 + :global {
  7 + .company {
  8 + width: auto;
  9 + height: 100%;
  10 + white-space: nowrap;
  11 + // margin-right: 10px;
  12 + cursor: pointer;
  13 + display: flex;
  14 + gap: 5px;
  15 +
  16 + .companyMutiLine {
  17 + width: auto;
  18 + height: 100%;
  19 +
  20 + >div {
  21 + width: auto;
  22 + height: 20px;
  23 + display: flex;
  24 + align-items: center;
  25 + justify-content: center;
  26 + }
  27 +
  28 + >div:first-child {
  29 + font-size: 12px;
  30 + }
  31 + }
  32 +
  33 + span {
  34 + font-size: 13px !important;
  35 + }
  36 + }
  37 +
  38 + .language {
  39 + width: auto;
  40 + height: 100%;
  41 +
  42 + button {
  43 + width: 25px;
  44 + padding: 0;
  45 + color: #FFF;
  46 + font-size: 13px;
  47 +
  48 + &:hover {
  49 + color: #1890ff;
  50 + }
  51 + }
  52 + }
  53 + }
  54 +}
0 55 \ No newline at end of file
... ...
src/components/login/Login.css
... ... @@ -28,6 +28,7 @@
28 28 line-height: 36px;
29 29 font-weight: 700;
30 30 color: #eda716;
  31 + margin: 0.67em 0 !important;
31 32 }
32 33  
33 34 .header .logo h1 span {
... ... @@ -110,7 +111,7 @@
110 111 .loginForm_mode{
111 112 position: absolute;
112 113 width: 330px;
113   - height: 380px;
  114 + height: 320px;
114 115 padding: 0 27px;
115 116 /*top: 2%;*/
116 117 right: 5%;
... ... @@ -121,7 +122,7 @@
121 122 box-shadow: 2px 2px 3px rgba(214, 214, 214, .9);
122 123 }
123 124 .loginForm_face{
124   - height: 487px;
  125 + height: 437px;
125 126 }
126 127  
127 128 .loginForm_face .normalLogin{
... ... @@ -138,7 +139,7 @@
138 139 }
139 140  
140 141 .loginMiddle {
141   - height: 195px;
  142 + height: 125px;
142 143 }
143 144  
144 145 .loginTip {
... ...
src/components/login/Login.js
... ... @@ -3,20 +3,14 @@ import { LockOutlined, UserOutlined } from &#39;@ant-design/icons&#39;;
3 3 import { Form } from '@ant-design/compatible';
4 4 import '@ant-design/compatible/assets/index.css';
5 5 import { Input, Button, Select, message, Radio } from 'antd-v4';
6   -import { FloatButton } from 'antd';
7   -import commonConfig from '../../utils/config';
8   -import * as commonServices from '../../services/services';
9   -import * as commonFunc from '../../components/Common/commonFunc';
  6 +import commonConfig from '@/utils/config';
  7 +import * as commonServices from '@/services/services';
  8 +import * as commonFunc from '@/components/Common/commonFunc';
10 9 import logo from '@/assets/foot_logo.png';
11   -import * as commonUtils from '../../utils/utils';
  10 +import * as commonUtils from '@/utils/utils';
12 11 import styles from './Login.css';
13 12 import FaceDetect from '../FaceDetect';
14 13  
15   -
16   -const AppComponent = () => {
17   - return <FloatButton/>
18   -}
19   -
20 14 const FormItem = Form.Item;
21 15 const { Option } = Select;
22 16  
... ... @@ -370,7 +364,6 @@ class LoginForm extends Component {
370 364  
371 365 return (
372 366 <div className={styles.wraper}>
373   - <AppComponent />
374 367 <div className={styles.header}>
375 368 <div className={styles.logo}>
376 369 <h1>{XiaoLingYang}<span>{WelcometoERP}</span></h1>
... ... @@ -416,14 +409,14 @@ class LoginForm extends Component {
416 409 {/* rules: [{ required: true, message: pleaseInputPassword }],*/}
417 410 {/* })(<Input className={styles.loginInput} size="large" prefix={<LockOutlined className={styles.loginIcon} />} type="password" placeholder={pleaseInputPassword} />)}*/}
418 411 {/*</FormItem>*/}
419   - <FormItem className={styles.loginTip}>
  412 + {/* <FormItem className={styles.loginTip}>
420 413 <div className={styles.loginSelect}>
421 414 {getFieldDecorator('companys', {
422 415 initialValue: companysId,
423 416 rules: [{ required: true, message: chooseBranchCompany }],
424 417 })(<Select placeholder={chooseBranchCompany} size="large" dropdownStyle={dropdownStyle} onSelect={this.handleSelect}>{options}</Select>)}
425 418 </div>
426   - </FormItem>
  419 + </FormItem> */}
427 420 </div>
428 421 <FormItem className={styles.loginBottom}>
429 422 <Button type="primary" htmlType="submit" className={styles.loginButton} loading={loginLoading}>
... ...
src/global.less
... ... @@ -2,6 +2,7 @@
2 2 @import "./index.less";
3 3 @import "./default.less";
4 4 @import "./variable.less";
  5 +@import "./skinchange.less";
5 6  
6 7 .ant-card-head {
7 8 border-bottom: 1px solid #d9d9d9;
... ...
src/routes/indexPage.js
  1 +import { useEffect, useState } from 'react';
1 2 import { connect } from 'umi';
2 3 import { ConfigProvider, Layout } from 'antd-v4';
3 4 import zhCN from 'antd-v4/lib/locale-provider/zh_CN';
... ... @@ -11,9 +12,17 @@ import styles from &#39;./indexPage.less&#39;;
11 12 const { Header, Content } = Layout;
12 13  
13 14 function IndexPage() {
  15 + const [key, setKey] = useState(0);
  16 +
  17 + useEffect(() => {
  18 + window.xlyReload = () => {
  19 + setKey(pre => pre + 1);
  20 + };
  21 + }, []);
  22 +
14 23 return (
15 24 <ConfigProvider locale={zhCN}>
16   - <Layout>
  25 + <Layout key={key}>
17 26 <Header className={styles.header}>
18 27 <div className={styles.headerRight}>
19 28 <div className={styles.personCenter}>
... ...
src/skinchange.less 0 → 100644
  1 +:root {
  2 + body[data-skin=default] {
  3 + --xly-skin-header-color: #383d41; // 顶部导航栏背景色
  4 + --xly-skin-menu-color: #343848; // 左侧一级菜单背景色
  5 + --xly-skin-menu-span-color: #ccd6df; // 菜单字体色
  6 + --xly-skin-submenu-color: #303538; // 展开后二级菜单背景色
  7 + --xly-skin-active-color: #1890FF; // 激活色
  8 + --xly-skin-modal-bg-color: #646464; // modal弹窗header背景色
  9 + }
  10 +
  11 + body[data-skin=color1] {
  12 + --xly-skin-header-color: #6e5064;
  13 + --xly-skin-menu-color: #b482a4;
  14 + --xly-skin-menu-span-color: #FFF;
  15 + --xly-skin-submenu-color: #7c5a71;
  16 + --xly-skin-active-color: #84c015;
  17 + --xly-skin-modal-bg-color: #6e5064;
  18 + }
  19 +
  20 + body[data-skin=color2] {
  21 + --xly-skin-header-color: #0010fc;
  22 + --xly-skin-menu-color: #515bf3;
  23 + --xly-skin-menu-span-color: #FFF;
  24 + --xly-skin-submenu-color: #656ab3;
  25 + --xly-skin-active-color: #dd8547;
  26 + --xly-skin-modal-bg-color: #0010fc;
  27 + }
  28 +
  29 + body[data-skin=color3] {
  30 + --xly-skin-header-color: #433598;
  31 + --xly-skin-menu-color: #7160d5;
  32 + --xly-skin-menu-span-color: #FFF;
  33 + --xly-skin-submenu-color: #624fce;
  34 + --xly-skin-active-color: #dd8547;
  35 + --xly-skin-modal-bg-color: #433598;
  36 + }
  37 +
  38 + body[data-skin=color4] {
  39 + --xly-skin-header-color: #e1408e;
  40 + --xly-skin-menu-color: #c56f98;
  41 + --xly-skin-menu-span-color: #FFF;
  42 + --xly-skin-submenu-color: #cd5790;
  43 + --xly-skin-active-color: #03bcff;
  44 + --xly-skin-modal-bg-color: #e1408e;
  45 + }
  46 +
  47 + body[data-skin=color5] {
  48 + --xly-skin-header-color: #f46b5f;
  49 + --xly-skin-menu-color: #e69892;
  50 + --xly-skin-menu-span-color: #FFF;
  51 + --xly-skin-submenu-color: #c6655e;
  52 + --xly-skin-active-color: #cdd32b;
  53 + --xly-skin-modal-bg-color: #f46b5f;
  54 + }
  55 +
  56 + body[data-skin=color6] {
  57 + --xly-skin-header-color: #fa375c;
  58 + --xly-skin-menu-color: #eb8498;
  59 + --xly-skin-menu-span-color: #FFF;
  60 + --xly-skin-submenu-color: #cc576f;
  61 + --xly-skin-active-color: #cdd32b;
  62 + --xly-skin-modal-bg-color: #fa375c;
  63 + }
  64 +
  65 + body[data-skin=color7] {
  66 + --xly-skin-header-color: #6f41ed;
  67 + --xly-skin-menu-color: #8b70d5;
  68 + --xly-skin-menu-span-color: #FFF;
  69 + --xly-skin-submenu-color: rgb(76, 82, 169);
  70 + --xly-skin-active-color: #cdd32b;
  71 + --xly-skin-modal-bg-color: #6f41ed;
  72 + }
  73 +
  74 + body[data-skin=color8] {
  75 + --xly-skin-header-color: #fd4138;
  76 + --xly-skin-menu-color: #e3736e;
  77 + --xly-skin-menu-span-color: #FFF;
  78 + --xly-skin-submenu-color: #c3514b;
  79 + --xly-skin-active-color: #cdd32b;
  80 + --xly-skin-modal-bg-color: #fd4138;
  81 + }
  82 +}
0 83 \ No newline at end of file
... ...