新增更新上级节流操作,避免用户连续点击添加多次

This commit is contained in:
weipengfei 2023-09-04 09:42:25 +08:00
parent 3b862ecdd3
commit a193cef232
3 changed files with 24 additions and 10 deletions

View File

@ -24,7 +24,7 @@
<view v-if="uniMP" style="height: 44px;"> <view v-if="uniMP" style="height: 44px;">
<u-icon name="arrow-left" color="#fff" size="20" @click="leftClick"></u-icon> <u-icon name="arrow-left" color="#fff" size="20" @click="leftClick"></u-icon>
</view> </view>
<!-- <view style="height: 30rpx"></view> --> <view v-else style="height: 30rpx"></view>
<!-- <view v-if="uniMP" style="height: 44px;"></view> --> <!-- <view v-if="uniMP" style="height: 44px;"></view> -->
<!-- #endif --> <!-- #endif -->
<view class="my_info"> <view class="my_info">

View File

@ -13,7 +13,7 @@
<view v-if="uniMP" style="height: 44px;"> <view v-if="uniMP" style="height: 44px;">
<u-icon name="arrow-left" color="#fff" size="20" @click="leftClick"></u-icon> <u-icon name="arrow-left" color="#fff" size="20" @click="leftClick"></u-icon>
</view> </view>
<!-- <view style="height: 30rpx"></view> --> <view v-else style="height: 30rpx"></view>
<!-- <view style="height: 100rpx"></view> --> <!-- <view style="height: 100rpx"></view> -->
<!-- <view v-if="uniMP" style="height: 44px"></view> --> <!-- <view v-if="uniMP" style="height: 44px"></view> -->
<!-- #endif --> <!-- #endif -->

View File

@ -56,6 +56,8 @@
</u--form> </u--form>
<!-- <button @click="addArchives" class="btn">完成更新</button> --> <!-- <button @click="addArchives" class="btn">完成更新</button> -->
<mybtn text="完成更新" @click="addArchives"></mybtn> <mybtn text="完成更新" @click="addArchives"></mybtn>
<u-modal :show="modelShow" title="警告" content='确定要删除该信息吗' closeOnClickOverlay showCancelButton
@close="modelShow=false" @cancel="modelShow=false" @confirm="deleteDemand(deleteIndex)"></u-modal>
</view> </view>
</view> </view>
</template> </template>
@ -111,6 +113,8 @@
showDemandList: [], // showDemandList: [], //
updateFlag: true, updateFlag: true,
task_id: 0, task_id: 0,
modelShow: false, //
deleteIndex: -1, //
formData: { formData: {
id_card: '', id_card: '',
sex: '', sex: '',
@ -210,22 +214,32 @@
} }
}, },
// //
changeDemand: throttle(function(e) { changeDemand(e){
this.$u.throttle(()=>this.addDemand(e), 2000)
},
addDemand(e){
uni.showLoading({
title: '添加中',
mask: true
})
this.demandShow = false; this.demandShow = false;
if (e.value[1]) { if (e.value[1]) {
this.showDemandList.push(e.value[1]); this.showDemandList.push(e.value[1]);
} else { } else {
this.showDemandList.push(e.value[0]); this.showDemandList.push(e.value[0]);
} }
}, 3000), this.$nextTick(()=>{
uni.hideLoading();
})
},
// //
removeShowDemand(index) { removeShowDemand(index) {
uni.showModal({ this.modelShow = true;
title: '确定删除这一部分内容吗', this.deleteIndex = index;
success: (res) => { },
if (res.confirm) this.showDemandList.splice(index, 1); deleteDemand(index){
} this.showDemandList.splice(index, 1);
}) this.modelShow = false;
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {