beforeAuditSubmit.js 938 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
import { message, Modal } from 'antd';
import { uaaRequest } from '@/webPublic/one_stop_public/utils/request';

export default function beforeAuditSubmit(params) {
  if (
    params &&
    window.beforeAuditSubmit &&
    typeof window.beforeAuditSubmit === 'function'
  ) {
    console.log('beforeAuditSubmit函数开始执行');
    // const content = params.content && isJSON(params.content) ? JSON.parse(params.content) : {};

    return window
      .beforeAuditSubmit({
        message,
        Modal,
        uaaRequest: (url, data) => {
          return uaaRequest(url, data);
        },
        userNowInfo: localStorage.getItem('user') ? JSON.parse(localStorage.getItem('user')) : '',
        submitParams: params,
      })
      .then((res) => {
        return res;
      })
      .catch((err) => {
        return false;
      });
  } else {
    return new Promise((resolve, reject) => {
      resolve(params);
    });
  }
}