Browse Source

限制多次点击

dev
jyt 2 years ago
parent
commit
95722eb9b6
4 changed files with 82 additions and 40 deletions
  1. +2
    -1
      main.js
  2. +53
    -37
      pages/mine/details2.vue
  3. +25
    -0
      utils/common.js
  4. +2
    -2
      utils/domain.js

+ 2
- 1
main.js View File

@@ -13,7 +13,8 @@ let zaudio = new ZAudio({
Vue.prototype.$zaudio = zaudio
Vue.prototype.$dayjs = dayjs;


import common from 'utils/common.js'
Vue.prototype.$noMultipleClicks = common.noMultipleClicks;

// 引入全局uView


+ 53
- 37
pages/mine/details2.vue View File

@@ -125,14 +125,14 @@
</view>
<view class="bounced3" style="margin-top: 20rpx;">
<view class="bounced3-1" @tap="unmarktap()">取消</view>
<view class="bounced3-2" @tap="Confirmthetag()">确认</view>
<view class="bounced3-2" @tap="$noMultipleClicks(Confirmthetag)">确认</view>
</view>
</view>
<!-- 加入常错词 -->
<view class="zhezhoa" v-if="isshow2" @tap="Cancelout"></view>
<u-modal v-model="isshow2" title="添加常错词" :show-cancel-button="true" @cancel="Cancelout" @confirm="Confirmtheexit">
<u-modal v-model="isshow2" title="添加常错词" :show-cancel-button="true" @cancel="Cancelout" @confirm="$noMultipleClicks(Confirmtheexit)">
<view class="tian-view">
<viwe class="tian-view-t1"></viwe>
<viwe class="tian-view-t2">常错词:</viwe>
@@ -183,7 +183,7 @@
</view>
<view class="bounced3">
<view class="bounced3-1" @tap="Cancelout2">取消</view>
<view class="bounced3-2" @tap="Confirmtheexit2">确认</view>
<view class="bounced3-2" @tap="$noMultipleClicks(Confirmtheexit2)">确认</view>
</view>
</view>
@@ -374,7 +374,7 @@
</view>
</view>
<view class="calibration" @click="tocalibration()">校准</view>
<view class="calibration" @click="$noMultipleClicks(tocalibration)">校准</view>
</view>
<view class="zhezhoa" v-if="effective"></view>
@@ -398,7 +398,7 @@
</view>
<view class="bounced3">
<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>
@@ -418,11 +418,13 @@
</view>
<view class="bounced3" style="margin-top: 20rpx;">
<view class="bounced3-1" @tap="unmarktap()">取消</view>
<view class="bounced3-2" @tap="roletab()">确认</view>
<view class="bounced3-2" @tap="$noMultipleClicks(roletab)">确认</view>
</view>
</view>
</view>

<u-toast ref="uToast" />
</view>
</template>
<script>
@@ -841,23 +843,33 @@
uni.showModal({
title: '提示',
content: msg,
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 => {
console.log(res)
that.Thetapeidisshow = false;
})
}
success: function(res) {
if (this.noClick) {
this.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 => {
console.log(res)
that.Thetapeidisshow = false;
})
}
setTimeout(()=> {
this.noClick= true;
}, 2000)
} else {
// 这里是重复点击的判断
}
}
});
} else {
@@ -1304,14 +1316,16 @@
this.$refs.uToast.show({
title: '正确词错误词不能超过8个字',
type: 'warning',
})
})
this.isshow2 = true;
} else {
let reg = /^[0-9]+$/
if (reg.test(this.thewrongword)) {
this.$refs.uToast.show({
title: '错误词不能为纯数字',
type: 'warning',
})
})
this.isshow2 = true;
} else {
if (this.thewrongword) {
if (this.reswrongword) {
@@ -1338,18 +1352,20 @@
this.thewrongword = "";
this.reswrongword = "";
})
} else {
uni.showToast({
title: '正确值不能为空',
duration: 2000
});
} else {
this.$refs.uToast.show({
title: '正确值不能为空',
type: 'warning',
})
this.isshow2 = true;
return
}
} else {
uni.showToast({
title: '错误词不能为空',
duration: 2000
});
} else {
this.$refs.uToast.show({
title: '错误词不能为空',
type: 'warning',
})
this.isshow2 = true;
return
}
}


+ 25
- 0
utils/common.js View File

@@ -0,0 +1,25 @@
// 防止处理多次点击
function noMultipleClicks(methods, info) {
// methods是点击后需要执行的函数, info是函数需要传的参数
let that = this;
if (that.noClick) {
// 第一次点击
console.log(methods)
that.noClick= false;
if((info && info !== '') || info ==0) {
// info是执行函数需要传的参数
methods(info);
} else {
methods();
}
setTimeout(()=> {
that.noClick= true;
}, 2000)
} else {
// 这里是重复点击的判断
}
}
//导出
export default {
noMultipleClicks, // 禁止多次点击
}

+ 2
- 2
utils/domain.js View File

@@ -7,12 +7,12 @@
// const baseUrl = 'http://192.168.31.92:8080/api';// 测试站
// const baseUrl = 'http://127.0.0.1:8080/autoSR/api';// 本地
// const baseUrl = 'http://192.168.31.244:8080/autoSR/api';// 本地
// const baseUrl = 'http://81.70.55.170:9090/autoSR/api';// 测试站
const baseUrl = 'http://81.70.55.170:9090/autoSR/api';// 测试站
// const baseUrl = 'http://192.168.31.210:8080/api'; // 泽明
// const baseUrl = 'http://192.168.31.167:8080/autoSR/api'; // 长龙
// const baseUrl = 'http://192.168.31.134:8080/autoSR/api'; // 佳豪
// const baseUrl = 'http://10.2.1.104:8081/autoSR/api'; // 刘敏
const baseUrl = 'https://zkgj.quhouse.com/api'; // 质控正式
// const baseUrl = 'https://zkgj.quhouse.com/api'; // 质控正式
// const baseUrl = 'https://hfju.com/api'; // 数智正式




Loading…
Cancel
Save