|
@@ -24,7 +24,7 @@ Component({
|
|
|
cicleList: [],
|
|
|
time: '',
|
|
|
//点赞人
|
|
|
- chickList:''
|
|
|
+ chickList: ''
|
|
|
},
|
|
|
lifetimes: {
|
|
|
|
|
@@ -34,6 +34,7 @@ Component({
|
|
|
attached: async function () {
|
|
|
// 在组件实例进入页面节点树时执行
|
|
|
this.getcircle()
|
|
|
+ this.showischick()
|
|
|
},
|
|
|
|
|
|
},
|
|
@@ -77,9 +78,7 @@ Component({
|
|
|
console.log(this.data.isgood);
|
|
|
},
|
|
|
isclick() {
|
|
|
- // this.setData({
|
|
|
- // isclick: !this.data.isclick
|
|
|
- // })
|
|
|
+
|
|
|
this.chickin()
|
|
|
setTimeout(() => {
|
|
|
this.showchick()
|
|
@@ -102,6 +101,7 @@ Component({
|
|
|
this.setData({
|
|
|
images: this.data.cicleList[0].images
|
|
|
})
|
|
|
+ console.log('isclick', this.data.isclick);
|
|
|
// 将 ISO 字符串转换为时间戳并传递给 formatTime
|
|
|
const createdAt = new Date(this.data.cicleList[0].createdAt).getTime();
|
|
|
const time = this.formatTime(createdAt);
|
|
@@ -128,6 +128,9 @@ Component({
|
|
|
},
|
|
|
//点击点赞按钮
|
|
|
async chickin() {
|
|
|
+ this.setData({
|
|
|
+ isclick: !this.data.isclick
|
|
|
+ })
|
|
|
let AIMomentquery = new Parse.Query('AIMoment');
|
|
|
AIMomentquery.equalTo('company', company);
|
|
|
AIMomentquery.equalTo('objectId', this.data.objectId);
|
|
@@ -136,13 +139,12 @@ Component({
|
|
|
AIMomentquery.include('profile');
|
|
|
AIMomentquery.notEqualTo('isDeleted', true)
|
|
|
let P = await AIMomentquery.first();
|
|
|
- //点赞成功
|
|
|
- this.setData({
|
|
|
- isclick: !this.data.isclick
|
|
|
- })
|
|
|
+
|
|
|
+
|
|
|
const currentUser = Parse.User.current();
|
|
|
let AIMomentCommentquery = new Parse.Query('AIMomentComment');
|
|
|
AIMomentCommentquery.equalTo('company', company);
|
|
|
+ AIMomentCommentquery.equalTo('type', 'chickin');
|
|
|
AIMomentCommentquery.equalTo('moment', P.toPointer());
|
|
|
AIMomentCommentquery.equalTo('user', currentUser.id);
|
|
|
let moment = await AIMomentCommentquery.first()
|
|
@@ -167,6 +169,7 @@ Component({
|
|
|
let Comment = new Parse.Object('AIMomentComment');
|
|
|
Comment.set('moment', P.toPointer())
|
|
|
Comment.set('company', companyPointer);
|
|
|
+ Comment.set('type', 'chickin');
|
|
|
Comment.set('user', user.toPointer());
|
|
|
Comment.set('isDeleted', false);
|
|
|
try {
|
|
@@ -176,11 +179,11 @@ Component({
|
|
|
} catch (error) {
|
|
|
console.error("保存数据时出现错误:", error);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
- //显示点赞人
|
|
|
- async showchick() {
|
|
|
+ //显示是否点过赞
|
|
|
+ async showischick() {
|
|
|
const currentUser = Parse.User.current();
|
|
|
let AIMomentCommentquery2 = new Parse.Query('AIMomentComment');
|
|
|
AIMomentCommentquery2.equalTo('company', company);
|
|
@@ -188,13 +191,18 @@ Component({
|
|
|
AIMomentCommentquery2.equalTo('user', currentUser.id);
|
|
|
let moment2 = await AIMomentCommentquery2.find()
|
|
|
let AIMoment1List2 = moment2.map(item => item.toJSON());
|
|
|
- console.log('AIMoment1List2',AIMoment1List2);
|
|
|
this.setData({
|
|
|
isclick:AIMoment1List2[0].isDeleted
|
|
|
})
|
|
|
+ },
|
|
|
+ //显示点赞人
|
|
|
+ async showchick() {
|
|
|
+
|
|
|
+
|
|
|
let Momentquery = new Parse.Query('AIMomentComment');
|
|
|
Momentquery.equalTo('company', company);
|
|
|
- Momentquery.equalTo('moment', this.data.cicleList[0].objectId);
|
|
|
+ Momentquery.equalTo('type', 'chickin');
|
|
|
+ Momentquery.equalTo('moment', this.data.objectId);
|
|
|
Momentquery.notEqualTo('isDeleted', true)
|
|
|
Momentquery.include('user')
|
|
|
let r = await Momentquery.find();
|