小精灵:关闭小精灵弹窗修改请求状态字段,记录请求增加loading
This commit is contained in:
@@ -8,6 +8,19 @@ const toastMsg = (content = '操作完成', time = 2) => {
|
||||
time
|
||||
});
|
||||
}
|
||||
const showLoading = (content = '加載中...') => {
|
||||
layer.open({
|
||||
type: 2,
|
||||
shadeClose: false,
|
||||
content,
|
||||
success(e) {
|
||||
layerIndex = $(e).attr('index')
|
||||
}
|
||||
})
|
||||
}
|
||||
const hideLoading = (index) => {
|
||||
layer.close(index)
|
||||
}
|
||||
|
||||
let roomId = null;
|
||||
let userDiamonds = 0 //用戶鉆石數量
|
||||
@@ -277,6 +290,7 @@ $(function () {
|
||||
})
|
||||
$('.close-record').click(() => {
|
||||
bodyScroolFun(false)
|
||||
requestStatus = false;
|
||||
$('.table-shade').hide()
|
||||
})
|
||||
$('.result-shade').on('click', () => {
|
||||
@@ -397,6 +411,7 @@ $(function () {
|
||||
|
||||
//中獎記錄請求
|
||||
function prizeRecordFun() {
|
||||
showLoading()
|
||||
var result = '';
|
||||
if (!requestStatus) {
|
||||
requestStatus = true;
|
||||
@@ -427,11 +442,14 @@ function prizeRecordFun() {
|
||||
$('.table').append(`<li class="dropload-noData">暫無數據</li>`)
|
||||
$('.table .dropload-noData').show()
|
||||
}else {
|
||||
$('.table .dropload-noData').remove()
|
||||
$('.table').append(`<li class="dropload-noData">沒有更多了</li>`)
|
||||
$('.table .dropload-noData').show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hideLoading(layerIndex)
|
||||
},
|
||||
error: function (res) {
|
||||
// $('.dropload-down').hide()
|
||||
@@ -439,6 +457,7 @@ function prizeRecordFun() {
|
||||
console.log(res, '報錯啦');
|
||||
$('.table').css({ display: 'none' })
|
||||
// $('.noData').css({ display: 'block' })
|
||||
hideLoading(layerIndex)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user