From 80078586462a5d66221d716adca79b6173c2bc08 Mon Sep 17 00:00:00 2001
From: chenzeping <ChenZeping02609@163.com>
Date: 星期二, 09 三月 2021 17:04:33 +0800
Subject: [PATCH] 修改已知问题
---
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