新增接口超时问题

This commit is contained in:
Dragon
2024-02-26 14:32:32 +08:00
parent 8722c6584b
commit 92c9774b18
2 changed files with 8 additions and 1 deletions

View File

@@ -257,7 +257,7 @@
<script src="../../common/js/vconsole.min.js"></script>
<script src="../../common/js/svga.min.js"></script>
<script src="../../common/js/route-constant.js"></script>
<script src="./js/index.js?v=2.6"></script>
<script src="./js/index.js?v=2.7"></script>
</body>
</html>

View File

@@ -123,6 +123,7 @@ const getNewestAct = () => {
networkRequest({
type: 'GET',
url: urlPrefix + '/act/callBattle/getNewestAct',
timeout: 3000,
success (res) {
if (res.code === 200) {
if ($.isEmptyObject(res.data) || res.data.status === 4) {
@@ -172,6 +173,12 @@ const getNewestAct = () => {
},
error (err) {
toastMsg('網絡錯誤,請退出重進')
},
complete: function (XMLHttpRequest, status) {
if (status == 'timeout') {
XMLHttpRequest.abort()// 超时后中断请求
toastMsg('您當前網路異常,請退出重進~')
}
}
})
}