From 1f638070ccfecee3b286498c79d9b96765377f32 Mon Sep 17 00:00:00 2001 From: qf Date: Tue, 10 Jan 2023 16:14:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=B2=BE=E7=81=B5=EF=BC=9A=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E5=B0=8F=E7=B2=BE=E7=81=B5=E5=BC=B9=E7=AA=97=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=AF=B7=E6=B1=82=E7=8A=B6=E6=80=81=E5=AD=97=E6=AE=B5?= =?UTF-8?q?,=E8=AE=B0=E5=BD=95=E8=AF=B7=E6=B1=82=E5=A2=9E=E5=8A=A0loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view/peko/modules/spirit/js/main.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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) } }) }