Commit 4b1a58d98174d7e5c5b1ec00f22a6b0bd5f1a852

Authored by Min
1 parent d1b8a5ee

1.保存必填项提醒,通过常量配置

Showing 1 changed file with 6 additions and 3 deletions
src/utils/common/message.js
1 /* eslint-disable */ 1 /* eslint-disable */
2 import { Modal, message as antdMessage } from 'antd-v4'; 2 import { Modal, message as antdMessage } from 'antd-v4';
3 import { Modal as mobileModal } from 'antd-mobile-v2'; 3 import { Modal as mobileModal } from 'antd-mobile-v2';
  4 +import * as commonFunc from '@/components/Common/commonFunc';/* 通用单据方法 */
4 import commonConfig from '../config'; 5 import commonConfig from '../config';
5 6
6 const { warning } = Modal; 7 const { warning } = Modal;
@@ -15,7 +16,7 @@ const queryWidth = () => { @@ -15,7 +16,7 @@ const queryWidth = () => {
15 } 16 }
16 17
17 const openConfirm = (config) => { 18 const openConfirm = (config) => {
18 - 19 +
19 queryWidth(); 20 queryWidth();
20 const { message, ...rest } = config; 21 const { message, ...rest } = config;
21 secondContent.push(<p style={{ whiteSpace: 'pre-wrap', wordWrap: 'break-word' }}>{message}</p>) 22 secondContent.push(<p style={{ whiteSpace: 'pre-wrap', wordWrap: 'break-word' }}>{message}</p>)
@@ -61,9 +62,11 @@ export const message = { @@ -61,9 +62,11 @@ export const message = {
61 ...antdMessage, 62 ...antdMessage,
62 error: (content, ...rest) => { 63 error: (content, ...rest) => {
63 const userinfo = JSON.parse(localStorage.getItem(`${commonConfig.prefix}userinfo`)) || {}; 64 const userinfo = JSON.parse(localStorage.getItem(`${commonConfig.prefix}userinfo`)) || {};
  65 + const commonConst = JSON.parse(localStorage.getItem(`${commonConfig.prefix}commonConst`)) || {};
  66 + const requiredText = commonFunc.showMessage(commonConst, 'required');
64 const language = userinfo.sLanguage || 'sChinese'; // 默认简体中文 67 const language = userinfo.sLanguage || 'sChinese'; // 默认简体中文
65 - const requiredText = language === 'sEnglish' ? 'is Required' :  
66 - (language === 'sBig5' ? '為必填項' : '为必填项'); 68 + // const requiredText = language === 'sEnglish' ? ' is required' :
  69 + // (language === 'sBig5' ? '為必填項' : '为必填项');
67 const sContent = content?.replace('为必填项', requiredText); 70 const sContent = content?.replace('为必填项', requiredText);
68 openConfirm({ message: sContent, ...rest }); 71 openConfirm({ message: sContent, ...rest });
69 }, 72 },