From 55799a2edbfc4bc6fce4f4c2350e5b9bb7214ed7 Mon Sep 17 00:00:00 2001 From: YANGDL <114714267@qq.com> Date: 星期二, 09 三月 2021 14:51:35 +0800 Subject: [PATCH] 修复ie下不能显示的问题 --- src/utils/AjaxUtils.js | 61 ++++++++++++++++++------------ 1 files changed, 36 insertions(+), 25 deletions(-) diff --git a/src/utils/AjaxUtils.js b/src/utils/AjaxUtils.js index 11138b0..0499763 100644 --- a/src/utils/AjaxUtils.js +++ b/src/utils/AjaxUtils.js @@ -1,5 +1,5 @@ import $ from 'jquery' - +import axios from 'axios' /** * 瀵筳query鐨勫皝瑁卆jax鐨勪紶鏁版嵁鏂规硶 * @param pUrl 璇锋眰鐨剈rl @@ -28,36 +28,47 @@ * @param pData 鍙傛暟 * @param pBackFun 鎴愬姛鍥炶皟 */ -function get4JsonDataByUrl (pUrl, pData, pBackFun) { - $.ajax({ - type: 'get', +function get4JsonDataByUrl (oUrl, pData, pBackFun) { + const pUrl = encodeURI(oUrl) + axios({ + method: 'get', url: pUrl, - dataType: 'json', - data: pData, - async: true, - success: function (datas, nnn) { - pBackFun(datas) - }, - error: function (err, nnnn) { - console.error('鏁版嵁鑾峰彇澶辫触', err, pUrl) - } + data: pData + }).then(function (response) { + pBackFun(response) }) + .catch(function (error) { + console.error('鏁版嵁鑾峰彇澶辫触', error) + }) } -function GetDataAsynByUrl (pUrl, pData, pBackFun) { - $.ajax({ - type: 'GET', +const GetDataAsynByUrl = async (oUrl, pData) => { + const pUrl = encodeURI(oUrl) + const res = await axios({ + method: 'get', url: pUrl, - data: pData, - timeout: 600000, - async: true, - success: function (datas, nnn) { - pBackFun(datas) - }, - error: function (e, nnnn) { - console.error('鏁版嵁鑾峰彇澶辫触', pUrl) - } + data: pData + }).then((response) => { + return (response) }) + .catch((error) => { + console.error('鏁版嵁鑾峰彇澶辫触', error) + }) + return res + + // $.ajax({ + // type: 'GET', + // url: pUrl, + // data: pData, + // timeout: 600000, + // async: true, + // success: function (datas, nnn) { + // pBackFun(datas) + // }, + // error: function (e, nnnn) { + // console.error('鏁版嵁鑾峰彇澶辫触', pUrl) + // } + // }) } function postDataAsynByUrl (pUrl, pData, pBackFun) { $.ajax({ -- Gitblit v1.8.0