/* eslint-disable */ import { Modal, message as antdMessage } from 'antd-v4'; import { Modal as mobileModal } from 'antd-mobile-v2'; const { warning } = Modal; const antdMobileAlert = mobileModal.alert; let debounceCount; let secondContent = []; let width; const queryWidth = () => { width = document?.documentElement?.getBoundingClientRect()?.width <= 750 ? '80%' : 500; } const openConfirm = (config) => { queryWidth(); const { message, ...rest } = config; secondContent.push(

{message}

) if (debounceCount) { clearTimeout(debounceCount); }; const fn = () => { if (location.pathname.toLocaleLowerCase().includes('mobile')) { antdMobileAlert('温馨提示', secondContent || '出错了', [ { text: '确认', }, ]) } else { warning({ title: '温馨提示', content:
{secondContent || '出错了'}
, okText: '确认', zIndex: 1000, width, ...rest, }); } } debounceCount = setTimeout(() => { fn(); secondContent = []; }); }; /** * 替换message.error信息提示方式为warning */ export const message = { ...antdMessage, error: (content, ...rest) => { openConfirm({ message: content, ...rest }); }, };