diff --git a/view/peko/modules/spirit/js/main.js b/view/peko/modules/spirit/js/main.js index 489ff7c..289b1fe 100644 --- a/view/peko/modules/spirit/js/main.js +++ b/view/peko/modules/spirit/js/main.js @@ -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(`
  • 暫無數據
  • `) $('.table .dropload-noData').show() }else { + $('.table .dropload-noData').remove() $('.table').append(`
  • 沒有更多了
  • `) $('.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) } }) }