Commit 26b47e3a authored by gongguan's avatar gongguan

删除数据看板的页码,增加保存活动和上传图片时的防抖和防上传图片在开启后再次开启

parent c292ffa4
......@@ -9,9 +9,5 @@
<table dataSource="{{list}}" loading="{{isLoading}}" isZebra>
<table-column a:for="{{titleList}}" title="{{item}}" dataIndex="{{item}}" width="{{index === 0 ? 120 : 'auto'}}"/>
</table>
<view class="rank-pagination">
<text class="rank-pagination-text">共 {{total}} 条</text>
<pagination showJump="{{false}}" defaultCurrent="{{1}}" current="{{searchInfo.pageNo}}" data-type="all" pageSize="{{searchInfo.pageSize}}" onChange="handleChangePage" pageShowCount="{{10}}" total="{{total}}" a:if="{{total > 0}}" shape="arrow-only" />
</view>
</view>
</dialog-wrap>
\ No newline at end of file
......@@ -10,7 +10,6 @@ Component({
},
titleList: [],
list: [],
total: 0,
isLoading: false,
winactivityId: ""
},
......@@ -33,11 +32,10 @@ Component({
async searchList() {
this.setData({
isLoading: true,
list: [],
total: 0
list: []
});
const startDay = this.data.searchInfo.timeRange[0].replace(/-/g, '/')
const endDay = this.data.searchInfo.timeRange[1].replace(/-/g, '/')
const startDay = this.data.searchInfo.timeRange[0].replace(/-/g, "/");
const endDay = this.data.searchInfo.timeRange[1].replace(/-/g, "/");
const params = {
activityId: this.props.selectedItem.activityId,
startDay,
......@@ -63,8 +61,7 @@ Component({
this.setData({
isLoading: false,
titleList,
list: tableData,
total: tableData.length
list: tableData
});
}
},
......
......@@ -11,7 +11,7 @@ import {
saveActivityInfo,
} from '/api'
import {
addFloat,setPrizeProbalityRange
addFloat,setPrizeProbalityRange,throttleHandle
} from '/utils/helper'
const THANKS_TYPE = 5
......@@ -122,7 +122,7 @@ Component({
return Object.values(newValidator).some(i => i.status === 'error')
},
// 提交信息
async onSubmit() {
onSubmit: throttleHandle(async function() {
my.showLoading();
console.log(this.data, 'this.data')
......@@ -154,7 +154,7 @@ Component({
}
}
my.hideLoading();
},
}, 1000),
showFailToast(text) {
my.showToast({
type: 'fail',
......@@ -214,7 +214,7 @@ Component({
return prizeInfoListCopy
},
backList() {
this.$page.$router.push("/activity/list");
this.$page.$router.go(-1)
}
},
})
......@@ -154,6 +154,26 @@ const setPrizeProbalityRange = (prizes) => {
}
})
}
/**
* 防连点
* @param {fn} fn 函数
* @param {wait} wait 时间
*/
const throttleHandle = (fn, wait = 1000) => {
let lastTime = 0
return function cb(...args) {
let nowTime = Date.now()
if(nowTime - lastTime > wait) {
fn.call(this,...args)
lastTime = nowTime
}
}
}
module.exports = {
passUrlList,
signFigures,
......@@ -161,5 +181,6 @@ module.exports = {
accMul,
addFloat,
urlCheck,
setPrizeProbalityRange
setPrizeProbalityRange,
throttleHandle
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment