提交 c2101c10 编写于 作者: 赵十四's avatar 赵十四

修改连续点击的bug

上级 55070d5a
......@@ -2,7 +2,7 @@
<view class="content">
<!-- 页头 -->
<view class="top">
<image @click="back" class="back" :src="'../../static/icon/返回.png'"></image>
<image @click="back" :disabled="btnDisabled" class="back" :src="'../../static/icon/返回.png'"></image>
<view class="title">发布帖子</view>
<image class="add" :src="'../../static/post/发送.png'" @click="addPost"></image>
</view>
......@@ -26,6 +26,7 @@
export default {
data() {
return {
btnDisabled: false,
value1: '',
imageValue: [],
img: []
......@@ -59,6 +60,13 @@
})
},
addPost() {
if (this.btnDisabled) {
return
}
this.btnDisabled = true
setTimeout(() => {
this.btnDisabled = false
}, 1000)
var length = this.imageValue.length;
for (var i = 0; i < length; i++) {
this.img.push(this.imageValue[i].path);
......@@ -67,7 +75,7 @@
uni.showToast({
title: '空内容不能发布呦',
duration: 2000,
icon:'error'
icon: 'error'
})
} else {
......
......@@ -30,7 +30,7 @@
<text class="del" @click="delPost" v-if="userId==postDetail.ownerId">删除</text>
<view class="icon-and-num">
<image class="like-icon"
:src="postDetail.islike==1?'../../static/post/喜欢2.png':'../../static/post/喜欢.png'"
:src="postDetail.islike==1?'../../static/post/喜欢2.png':'../../static/post/喜欢.png'" :disabled="btnDisabled"
style="width: 20px;height:20px;float: left;" @click="changeLike" />
<text style="font-size: 15px;float: left;">{{postDetail.likes}}</text>
<image class="comment-icon" :src="'../../static/post/评论.png'"
......@@ -67,8 +67,8 @@
<view class="like-and-time">
<text class="add-time">{{item.commentDatetime}}</text>
<view class="icon-and-num">
<image class="like-icon"
:src="item.islike==1?'../../static/post/喜欢2.png':'../../static/post/喜欢.png'"
<image class="like-icon" :disabled="btnDisabled"
:src="item.islike==1?'../../static/post/喜欢2.png':'../../static/post/喜欢.png'"
style="width: 16px;height:16px;" @click="changeCommentLike(index)" />
<text style="font-size: 12px;">{{item.commentLikes}}</text>
</view>
......@@ -100,6 +100,7 @@
data() {
return {
btnDisabled: false,
current: 1,
show: false,
value1: "",
......@@ -188,7 +189,15 @@
confirm(value) {
// 输入框的值
console.log(value)
uniCloud.callFunction({
if(value==''){
uni.showToast({
title: '空内容不能发布呦',
duration: 1000,
icon: 'error'
})
}
else{
uniCloud.callFunction({
name: 'fe-college-commentPost',
data: { //向云函数中传入的数据
userId: getApp().globalData.userId,
......@@ -201,7 +210,10 @@
this.getData();
console.log(res.result.data);
});
this.$refs.popup.close();
this.$refs.popup.close();
}
},
//评论窗口
addComment() {
......@@ -237,7 +249,13 @@
//点赞状态改变
changeLike() {
if (this.btnDisabled) {
return
}
this.btnDisabled = true
setTimeout(() => {
this.btnDisabled = false
}, 1000)
//已经点赞
if (this.postDetail.islike == 1) {
// console.log(this.allPost[index].postId);
......@@ -283,7 +301,13 @@
//改变评论的点赞状态
changeCommentLike(index) {
if (this.btnDisabled) {
return
}
this.btnDisabled = true
setTimeout(() => {
this.btnDisabled = false
}, 1000)
//已经点赞
if (this.postDetail.commentList[index].islike == 1) {
// console.log(this.allPost[index].postId);
......
......@@ -45,7 +45,7 @@
<view class="icon-and-num">
<image class="like-icon"
:src="item.islike=='1'?'../../static/post/喜欢2.png':'../../static/post/喜欢.png'"
style="width: 20px;height:20px;float: left;" @click.stop="changeAllPostLike(index)" />
style="width: 20px;height:20px;float: left;" @click.stop="changeAllPostLike(index)" :disabled="btnDisabled" />
<text style="font-size: 15px;float: left;">{{item.likes}}</text>
<image class="comment-icon" :src="'../../static/post/评论.png'"
style="width: 20px;height: 20px;margin-left: 10px;float: left;" />
......@@ -90,7 +90,7 @@
<view class="icon-and-num">
<image class="like-icon"
:src="item.islike=='1'?'../../static/post/喜欢2.png':'../../static/post/喜欢.png'"
style="width: 20px;height:20px;float: left;" @click.stop="changeAllPostLike(index)" />
style="width: 20px;height:20px;float: left;" @click.stop="changeAllPostLike(index)" :disabled="btnDisabled" />
<text style="font-size: 15px;float: left;">{{item.likes}}</text>
<image class="comment-icon" :src="'../../static/post/评论.png'"
style="width: 20px;height: 20px;margin-left: 10px;float: left;" />
......@@ -127,6 +127,7 @@
},
data() {
return {
btnDisabled: false,
current: 1,
show: false,
value1: "",
......@@ -167,12 +168,12 @@
if (index.index == 0) {
this.getMyPost();
console.log("000")
}
if (index.index == 1) {
this.getAllPost();
console.log("111")
}
},
......@@ -219,7 +220,13 @@
//点赞状态改变
changeAllPostLike(index) {
if (this.btnDisabled) {
return
}
this.btnDisabled = true
setTimeout(() => {
this.btnDisabled = false
}, 1000)
//已经点赞
if (this.allPost[index].islike == 1) {
// console.log(this.allPost[index].postId);
......@@ -264,7 +271,13 @@
//点赞状态改变
changeMyPostLike(index) {
if (this.btnDisabled) {
return
}
this.btnDisabled = true
setTimeout(() => {
this.btnDisabled = false
}, 1000)
//已经点赞
if (this.myPost[index].islike == 1) {
// console.log(this.allPost[index].postId);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册