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

设置空内容帖子不能发布

上级 31a5fb6f
......@@ -63,29 +63,38 @@
for (var i = 0; i < length; i++) {
this.img.push(this.imageValue[i].path);
}
console.log(this.img);
uniCloud.callFunction({
name: 'fe-college-makePost',
data: { //向云函数中传入的数据
userId: getApp().globalData.userId,
picture: this.img,
content: this.value1,
},
if (length == 0 && this.value1 == '') {
uni.showToast({
title: '空内容不能发布呦',
duration: 2000,
icon:'error'
})
.then(res => {
if (res.result.code == 200) {
uni.showToast({
title: '发布成功',
duration: 2000,
success: () => {
setTimeout(() => {
uni.navigateBack();
}, 1000)
}
})
}
// console.log(res.result);
});
} else {
uniCloud.callFunction({
name: 'fe-college-makePost',
data: { //向云函数中传入的数据
userId: getApp().globalData.userId,
picture: this.img,
content: this.value1,
},
})
.then(res => {
if (res.result.code == 200) {
uni.showToast({
title: '发布成功',
duration: 2000,
success: () => {
setTimeout(() => {
uni.navigateBack();
}, 1000)
}
})
}
// console.log(res.result);
});
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册