diff --git a/src/components/Common/PersonCenter/PersonCenter.js b/src/components/Common/PersonCenter/PersonCenter.js index 0eb4e1c..07026af 100644 --- a/src/components/Common/PersonCenter/PersonCenter.js +++ b/src/components/Common/PersonCenter/PersonCenter.js @@ -30,8 +30,9 @@ import OnlineUser from '@/assets/onlineUser.svg'; // import StaticEditTable from '@/components/Common/CommonTable'; import * as commonServices from '@/services/services'; import commonConfig from '../../../utils/config'; -// import SkinChangeModal from './SkinChangeModal'; +import SkinChangeModal from './SkinChangeModal'; import MenuSearchPopovor from './MenuSearchPopovor'; +import SwitchCompanyAndLanguage from './SwitchCompanyAndLanguage'; const { TabPane } = Tabs; const FormItem = Form.Item; @@ -383,7 +384,7 @@ class PersonCenter extends Component { const { menuPanel, onAddPane, app } = this.props; return (
- +
{companyName}
+
0} diff --git a/src/components/Common/PersonCenter/SkinChangeModal.js b/src/components/Common/PersonCenter/SkinChangeModal.js index 18642dc..e5604b7 100644 --- a/src/components/Common/PersonCenter/SkinChangeModal.js +++ b/src/components/Common/PersonCenter/SkinChangeModal.js @@ -1,7 +1,7 @@ /* eslint-disable */ import React, { useEffect, useRef, useState } from "react"; import AntdDraggableModal from "@/components/Common/AntdDraggableModal"; -import styles from "@/routes/IndexPage.less"; +import styles from "@/routes/indexPage.less"; const skinList = [ { diff --git a/src/components/Common/PersonCenter/SwitchCompanyAndLanguage/index.js b/src/components/Common/PersonCenter/SwitchCompanyAndLanguage/index.js new file mode 100644 index 0000000..223feea --- /dev/null +++ b/src/components/Common/PersonCenter/SwitchCompanyAndLanguage/index.js @@ -0,0 +1,221 @@ +/* eslint-disable */ +import React, { useEffect, useState } from "react"; +import { Button, Dropdown, Spin } from "antd"; +import { DownOutlined, LoadingOutlined } from "@ant-design/icons"; +import * as commonServices from "@/services/services"; +import commonConfig from "@/utils/config"; +import * as commonFunc from "@/components/Common/commonFunc"; +import * as commonUtils from "@/utils/utils"; +import styles from "./index.less"; + +const SwitchCompanyAndLanguageEvent = props => { + const { app } = props; + const { token, userinfo } = app; + + const addState = {}; + const [state, setState] = useState({ language: userinfo.sLanguage === "sChinese" ? "中文" : "EN" }); + + useEffect(() => { + const getComponyList = async () => { + const dataUrl = `${commonConfig.server_host}brand/getBrand/${userinfo.sId}`; + + const dataReturn = (await commonServices.getService(token, dataUrl)).data; + if (dataReturn.code === 1) { + const companyList = dataReturn.dataset.rows[0]; + setState(pre => ({ ...pre, companyList, companyData: companyList.find(item => item.sSubsidiaryId === userinfo.sSubsidiaryId) })); + setTimeout(() => { + const resizeEvent = new Event("resize"); + window.dispatchEvent(resizeEvent); + }, 1000); + } + }; + + getComponyList(); + }, []); + + addState.onChangeCompany = async item => { + if (item.sSubsidiaryId === state.companyData.sSubsidiaryId) return; + + setState(pre => ({ ...pre, companyLoading: true })); + const dataUrl = `${commonConfig.server_host}brand/changeBrand`; + const conditions = { + sBrandsId: item.sBrandsId, + sSubsidiaryId: item.sSubsidiaryId, + }; + const dataReturn = (await commonServices.postValueService(token, conditions, dataUrl)).data; + if (dataReturn.code === 1) { + setState(pre => ({ ...pre, companyData: item })); + const { token, systemData, rxtx, commonConst, gdslogininfo: userinfo, auxiliaryQty, footer, logoImageInfo, isInitPassword } = { + ...app, + ...dataReturn.dataset.rows[0], + }; + + const decimals = {}; + if (commonUtils.isNotEmptyArr(systemData)) { + const dNetPrice = systemData.filter(item => item.sName === "NetPrice")[0]; + const dNumAlign = systemData.filter(item => item.sName === "CkxNumAlign")[0]; + decimals.dNetPrice = Number(dNetPrice.sValue); + decimals.dNetMoney = 2; + decimals.dNumAlign = dNumAlign !== undefined && dNumAlign.sValue !== undefined ? dNumAlign.sValue : 0; + } + + props.dispatch({ + type: "login/login", + payload: { + token, + rxtx, + commonConst, + userinfo, + auxiliaryQty, + dispatch: props.dispatch, + systemData, + decimals, + dateFormat: commonFunc.getDateFormat(systemData), + footer, + logoImageInfo, + isInitPassword, + bChangeLanguage: true, + }, + }); + + setTimeout(() => { + commonUtils.clearStoreDropDownData(); + commonUtils.clearFormStoreDropDownData(); + window.xlyReload(); + }, 1000); + } + + setState(pre => ({ ...pre, companyLoading: false })); + }; + + addState.onChangeLanguage = async () => { + setState(pre => ({ ...pre, btnLoading: true })); + const dataUrl = `${commonConfig.server_host}brand/changeLanguage`; + const { language } = state; + + const dataReturn = (await commonServices.postValueService(token, { sLanguage: language === "中文" ? "sEnglish" : "sChinese" }, dataUrl)).data; + if (dataReturn.code === 1) { + setState(pre => ({ ...pre, language: language === "中文" ? "EN" : "中文" })); + const { token, systemData, rxtx, commonConst, gdslogininfo: userinfo, auxiliaryQty, footer, logoImageInfo, isInitPassword } = { + ...app, + ...dataReturn.dataset.rows[0], + }; + + const decimals = {}; + if (commonUtils.isNotEmptyArr(systemData)) { + const dNetPrice = systemData.filter(item => item.sName === "NetPrice")[0]; + const dNumAlign = systemData.filter(item => item.sName === "CkxNumAlign")[0]; + decimals.dNetPrice = Number(dNetPrice.sValue); + decimals.dNetMoney = 2; + decimals.dNumAlign = dNumAlign !== undefined && dNumAlign.sValue !== undefined ? dNumAlign.sValue : 0; + } + + props.dispatch({ + type: "login/login", + payload: { + token, + rxtx, + commonConst, + userinfo, + auxiliaryQty, + dispatch: props.dispatch, + systemData, + decimals, + dateFormat: commonFunc.getDateFormat(systemData), + footer, + logoImageInfo, + isInitPassword, + bChangeLanguage: true, + }, + }); + + setTimeout(() => { + commonUtils.clearStoreDropDownData(); + commonUtils.clearFormStoreDropDownData(); + window.xlyReload(); + }, 1000); + } + + setState(pre => ({ ...pre, btnLoading: false })); + }; + + return { + ...props, + ...addState, + ...state, + }; +}; + +const SwitchCompanyAndLanguage = baseProps => { + const props = SwitchCompanyAndLanguageEvent(baseProps); + return ( +
+ + {/* */} +
+ ); +}; + +const CompanyComponent = props => { + const { companyList = [], companyData = {}, companyLoading = false } = props; + + const bMutiLine = companyData.sName?.includes("-"); + const sName0 = bMutiLine ? companyData.sName.split("-")[0] : ""; + const sName1 = bMutiLine ? companyData.sName.split("-")[1] : ""; + return ( + !!companyList.length && ( + ({ + ...item, + key: item.sId, + label: item.sName, + onClick: props.onChangeCompany.bind(this, item), + })), + }} + > + + } + > +
+ {bMutiLine ? ( +
+
{sName0}
+
{sName1}
+
+ ) : ( + {companyData.sName} + )} + +
+
+
+ ) + ); +}; + +const LanguageComponent = props => { + const { language, btnLoading } = props; + return ( +
+ {btnLoading ? ( + + ) : ( + + )} +
+ ); +}; + +export default SwitchCompanyAndLanguage; diff --git a/src/components/Common/PersonCenter/SwitchCompanyAndLanguage/index.less b/src/components/Common/PersonCenter/SwitchCompanyAndLanguage/index.less new file mode 100644 index 0000000..ce6031c --- /dev/null +++ b/src/components/Common/PersonCenter/SwitchCompanyAndLanguage/index.less @@ -0,0 +1,54 @@ +.switchCompanyAndLanguage { + width: auto; + height: 100%; + display: flex; + + :global { + .company { + width: auto; + height: 100%; + white-space: nowrap; + // margin-right: 10px; + cursor: pointer; + display: flex; + gap: 5px; + + .companyMutiLine { + width: auto; + height: 100%; + + >div { + width: auto; + height: 20px; + display: flex; + align-items: center; + justify-content: center; + } + + >div:first-child { + font-size: 12px; + } + } + + span { + font-size: 13px !important; + } + } + + .language { + width: auto; + height: 100%; + + button { + width: 25px; + padding: 0; + color: #FFF; + font-size: 13px; + + &:hover { + color: #1890ff; + } + } + } + } +} \ No newline at end of file diff --git a/src/components/login/Login.css b/src/components/login/Login.css index 9757dfa..91088ac 100644 --- a/src/components/login/Login.css +++ b/src/components/login/Login.css @@ -28,6 +28,7 @@ line-height: 36px; font-weight: 700; color: #eda716; + margin: 0.67em 0 !important; } .header .logo h1 span { @@ -110,7 +111,7 @@ .loginForm_mode{ position: absolute; width: 330px; - height: 380px; + height: 320px; padding: 0 27px; /*top: 2%;*/ right: 5%; @@ -121,7 +122,7 @@ box-shadow: 2px 2px 3px rgba(214, 214, 214, .9); } .loginForm_face{ - height: 487px; + height: 437px; } .loginForm_face .normalLogin{ @@ -138,7 +139,7 @@ } .loginMiddle { - height: 195px; + height: 125px; } .loginTip { diff --git a/src/components/login/Login.js b/src/components/login/Login.js index 1a6eb28..a4c2d1c 100644 --- a/src/components/login/Login.js +++ b/src/components/login/Login.js @@ -3,20 +3,14 @@ import { LockOutlined, UserOutlined } from '@ant-design/icons'; import { Form } from '@ant-design/compatible'; import '@ant-design/compatible/assets/index.css'; import { Input, Button, Select, message, Radio } from 'antd-v4'; -import { FloatButton } from 'antd'; -import commonConfig from '../../utils/config'; -import * as commonServices from '../../services/services'; -import * as commonFunc from '../../components/Common/commonFunc'; +import commonConfig from '@/utils/config'; +import * as commonServices from '@/services/services'; +import * as commonFunc from '@/components/Common/commonFunc'; import logo from '@/assets/foot_logo.png'; -import * as commonUtils from '../../utils/utils'; +import * as commonUtils from '@/utils/utils'; import styles from './Login.css'; import FaceDetect from '../FaceDetect'; - -const AppComponent = () => { - return -} - const FormItem = Form.Item; const { Option } = Select; @@ -370,7 +364,6 @@ class LoginForm extends Component { return (
-

{XiaoLingYang}{WelcometoERP}

@@ -416,14 +409,14 @@ class LoginForm extends Component { {/* rules: [{ required: true, message: pleaseInputPassword }],*/} {/* })(} type="password" placeholder={pleaseInputPassword} />)}*/} {/**/} - + {/*
{getFieldDecorator('companys', { initialValue: companysId, rules: [{ required: true, message: chooseBranchCompany }], })()}
-
+
*/}