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

修改连续点击的bug

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