Browse Source

限制多次点击

Jyt
jyt 2 years ago
parent
commit
81050f92e2
5 changed files with 87 additions and 52 deletions
  1. +4
    -1
      main.js
  2. +20
    -11
      pages/index/customer.vue
  3. +24
    -16
      pages/mine/details.vue
  4. +36
    -22
      pages/mine/details2.vue
  5. +3
    -2
      pages/mine/reception/addreception.vue

+ 4
- 1
main.js View File

@@ -17,7 +17,10 @@ Vue.prototype.$zaudio = zaudio
Vue.prototype.$dayjs = dayjs; Vue.prototype.$dayjs = dayjs;
Vue.prototype.$store = store; Vue.prototype.$store = store;



import common from 'utils/common.js'
Vue.prototype.$noMultipleClicks = common.noMultipleClicks;
// 引入全局uView // 引入全局uView
import uView from 'uview-ui' import uView from 'uview-ui'
Vue.use(uView); Vue.use(uView);


+ 20
- 11
pages/index/customer.vue View File

@@ -162,6 +162,7 @@
export default { export default {
data() { data() {
return { return {
noClick:true,
// tabbar配置项 // tabbar配置项
current: 0, current: 0,
tabbarList: tabbarList, tabbarList: tabbarList,
@@ -319,17 +320,25 @@
content: "确定更改当前客户接待状态为结束?", content: "确定更改当前客户接待状态为结束?",
cancelColor: "#999999", cancelColor: "#999999",
success: res => { success: res => {
if (res.confirm) {
this.$u.post("/customer/endReception", {
id: id,
houseId: this.buildingID
}).then(res => {
uni.showToast({
icon: "none",
title: "操作成功"
})
this.init();
});
if (this.noClick) {
this.noClick= false;
if (res.confirm) {
this.$u.post("/customer/endReception", {
id: id,
houseId: this.buildingID
}).then(res => {
uni.showToast({
icon: "none",
title: "操作成功"
})
this.init();
});
}
setTimeout(()=> {
this.noClick= true;
}, 2000)
} else {
// 这里是重复点击的判断
} }
} }
}) })


+ 24
- 16
pages/mine/details.vue View File

@@ -183,7 +183,7 @@
</view> </view>
<view class="bounced3"> <view class="bounced3">
<view class="bounced3-1" @click="effective=false">取消</view> <view class="bounced3-1" @click="effective=false">取消</view>
<view class="bounced3-2" @click="effectiveAdd()">确认</view>
<view class="bounced3-2" @click="$noMultipleClicks(effectiveAdd)">确认</view>
</view> </view>
</view> </view>


@@ -370,27 +370,35 @@
//标记 //标记
alllogo() { alllogo() {
let msg = ''; let msg = '';
var that = this;
if (this.userlistobj.validInvalid != 0) { if (this.userlistobj.validInvalid != 0) {
msg = '是否标记为"有效录音"?'; msg = '是否标记为"有效录音"?';
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: msg, content: msg,
success: (res) => { success: (res) => {
if (res.confirm) {
let parames = {
id: this.customerId,
validInvalid: '',
invalidReason: 0
}
if (this.userlistobj.validInvalid == 0) {
parames.validInvalid = 1;
} else {
parames.validInvalid = 0;
}
this.$u.post("/customer/updateValidInvalid", parames).then(res => {
console.log(res)
this.gituserlist()
})
if (that.noClick) {
that.noClick= false;
if (res.confirm) {
let parames = {
id: this.customerId,
validInvalid: '',
invalidReason: 0
}
if (this.userlistobj.validInvalid == 0) {
parames.validInvalid = 1;
} else {
parames.validInvalid = 0;
}
this.$u.post("/customer/updateValidInvalid", parames).then(res => {
console.log(res)
this.gituserlist()
})
}
setTimeout(()=> {
that.noClick= true;
}, 2000)
} }
} }
}); });


+ 36
- 22
pages/mine/details2.vue View File

@@ -146,7 +146,7 @@
<viwe class="tian-view-t1"></viwe> <viwe class="tian-view-t1"></viwe>
<viwe class="tian-view-t2">常错词:</viwe> <viwe class="tian-view-t2">常错词:</viwe>
<viwe class="tian-view-t3"> <viwe class="tian-view-t3">
<textarea :auto-height="true" type="text" v-model="thewrongword" :disabled="isNum" class="tian-input" placeholder="请输入" />
<textarea :auto-height="true" v-model="thewrongword" :disabled="isNum" class="tian-input" placeholder="请输入" />
</viwe> </viwe>
</view> </view>
<view class="tian-view" style="margin-bottom: 74rpx;"> <view class="tian-view" style="margin-bottom: 74rpx;">
@@ -407,7 +407,7 @@
</view> </view>
<view class="bounced3"> <view class="bounced3">
<view class="bounced3-1" @click="effective=false">取消</view> <view class="bounced3-1" @click="effective=false">取消</view>
<view class="bounced3-2" @click="effectiveAdd()">确认</view>
<view class="bounced3-2" @click="$noMultipleClicks(effectiveAdd)">确认</view>
</view> </view>
</view> </view>


@@ -869,20 +869,28 @@
title: '提示', title: '提示',
content: msg, content: msg,
success: function(res) { success: function(res) {
if (res.confirm) {
let parames = {
id: that.customerId,
validInvalid: '',
invalidReason: 0
}
if (that.userlistobj.validInvalid == 0) {
parames.validInvalid = 1;
} else {
parames.validInvalid = 0;
}
that.$u.post("/customer/updateValidInvalid", parames).then(res => {
that.Thetapeidisshow = false;
})
if (that.noClick) {
that.noClick= false;
if (res.confirm) {
let parames = {
id: that.customerId,
validInvalid: '',
invalidReason: 0
}
if (that.userlistobj.validInvalid == 0) {
parames.validInvalid = 1;
} else {
parames.validInvalid = 0;
}
that.$u.post("/customer/updateValidInvalid", parames).then(res => {
that.Thetapeidisshow = false;
})
}
setTimeout(()=> {
that.noClick= true;
}, 2000)
} else {
// 这里是重复点击的判断
} }
} }
}); });
@@ -1277,6 +1285,8 @@
title: '正确词错误词不能超过8个字', title: '正确词错误词不能超过8个字',
type: 'warning', type: 'warning',
}) })
this.isshow2 = true;
}else{ }else{
let reg = /^[0-9]+$/ let reg = /^[0-9]+$/
if(reg.test(this.thewrongword)){ if(reg.test(this.thewrongword)){
@@ -1284,6 +1294,8 @@
title: '错误词不能为纯数字', title: '错误词不能为纯数字',
type: 'warning', type: 'warning',
}) })
this.isshow2 = true;
}else{ }else{
if (this.thewrongword) { if (this.thewrongword) {
if (this.reswrongword) { if (this.reswrongword) {
@@ -1310,17 +1322,19 @@
this.reswrongword = ""; this.reswrongword = "";
}) })
} else { } else {
uni.showToast({
this.$refs.uToast.show({
title: '正确值不能为空', title: '正确值不能为空',
duration: 2000
});
type: 'warning',
})
this.isshow2 = true;
return return
} }
} else { } else {
uni.showToast({
this.$refs.uToast.show({
title: '错误词不能为空', title: '错误词不能为空',
duration: 2000
});
type: 'warning',
})
this.isshow2 = true;
return return
} }
} }


+ 3
- 2
pages/mine/reception/addreception.vue View File

@@ -71,7 +71,7 @@
</view> </view>
</view> </view>


<view class="clive" @click="save">确定</view>
<view class="clive" @click="$noMultipleClicks(save)">确定</view>


<u-select :mask-close-able="false" v-model="Showhiddenunits" mode="single-column" :list="list" <u-select :mask-close-able="false" v-model="Showhiddenunits" mode="single-column" :list="list"
@cancel="cancel" @confirm="confirm"></u-select> @cancel="cancel" @confirm="confirm"></u-select>
@@ -89,7 +89,8 @@


export default { export default {
data() { data() {
return {
return {
noClick: true,
Showhiddenunits: false, Showhiddenunits: false,
list: [{ list: [{
label: '自然到访', label: '自然到访',


Loading…
Cancel
Save