|
@@ -159,16 +159,18 @@ Component({
|
|
|
|
|
|
|
|
|
|
const currentUser = Parse.User.current();
|
|
const currentUser = Parse.User.current();
|
|
- let AIMomentCommentquery = new Parse.Query('AIMomentComment');
|
|
|
|
|
|
+ let AIMomentCommentquery = new Parse.Query('AIMomentLike');
|
|
AIMomentCommentquery.equalTo('company', company);
|
|
AIMomentCommentquery.equalTo('company', company);
|
|
AIMomentCommentquery.equalTo('type', 'chickin');
|
|
AIMomentCommentquery.equalTo('type', 'chickin');
|
|
AIMomentCommentquery.equalTo('moment', P.toPointer());
|
|
AIMomentCommentquery.equalTo('moment', P.toPointer());
|
|
AIMomentCommentquery.equalTo('user', currentUser.id);
|
|
AIMomentCommentquery.equalTo('user', currentUser.id);
|
|
let moment = await AIMomentCommentquery.first()
|
|
let moment = await AIMomentCommentquery.first()
|
|
if (moment) {
|
|
if (moment) {
|
|
- moment.set('isDeleted', this.data.isclick)
|
|
|
|
|
|
+ moment.set('isLiked', this.data.isclick)
|
|
|
|
+ // moment.set('isDeleted', true)
|
|
try {
|
|
try {
|
|
let saveDate = await moment.save();
|
|
let saveDate = await moment.save();
|
|
|
|
+ this.showchick()
|
|
console.log(saveDate);
|
|
console.log(saveDate);
|
|
console.log("新数据保存成功");
|
|
console.log("新数据保存成功");
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -183,14 +185,15 @@ Component({
|
|
let user = await userquery.first();
|
|
let user = await userquery.first();
|
|
|
|
|
|
let companyPointer = Parse.Object.extend('Company').createWithoutData(company);
|
|
let companyPointer = Parse.Object.extend('Company').createWithoutData(company);
|
|
- let Comment = new Parse.Object('AIMomentComment');
|
|
|
|
|
|
+ let Comment = new Parse.Object('AIMomentLike');
|
|
Comment.set('moment', P.toPointer())
|
|
Comment.set('moment', P.toPointer())
|
|
Comment.set('company', companyPointer);
|
|
Comment.set('company', companyPointer);
|
|
Comment.set('type', 'chickin');
|
|
Comment.set('type', 'chickin');
|
|
Comment.set('user', user.toPointer());
|
|
Comment.set('user', user.toPointer());
|
|
- Comment.set('isDeleted', false);
|
|
|
|
|
|
+ Comment.set('isLiked', true);
|
|
try {
|
|
try {
|
|
let saveDate2 = await Comment.save();
|
|
let saveDate2 = await Comment.save();
|
|
|
|
+ this.showchick()
|
|
console.log(saveDate2);
|
|
console.log(saveDate2);
|
|
console.log("新数据保存成功");
|
|
console.log("新数据保存成功");
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -202,7 +205,7 @@ Component({
|
|
//显示是否点过赞
|
|
//显示是否点过赞
|
|
async showischick() {
|
|
async showischick() {
|
|
const currentUser = Parse.User.current();
|
|
const currentUser = Parse.User.current();
|
|
- let AIMomentCommentquery2 = new Parse.Query('AIMomentComment');
|
|
|
|
|
|
+ let AIMomentCommentquery2 = new Parse.Query('AIMomentLike');
|
|
AIMomentCommentquery2.equalTo('company', company);
|
|
AIMomentCommentquery2.equalTo('company', company);
|
|
AIMomentCommentquery2.equalTo('type', 'chickin');
|
|
AIMomentCommentquery2.equalTo('type', 'chickin');
|
|
AIMomentCommentquery2.equalTo('moment', this.data.objectId);
|
|
AIMomentCommentquery2.equalTo('moment', this.data.objectId);
|
|
@@ -211,11 +214,11 @@ Component({
|
|
let AIMoment1List2 = moment2.map(item => item.toJSON());
|
|
let AIMoment1List2 = moment2.map(item => item.toJSON());
|
|
if (AIMoment1List2.length != 0) {
|
|
if (AIMoment1List2.length != 0) {
|
|
this.setData({
|
|
this.setData({
|
|
- isclick: AIMoment1List2[0].isDeleted
|
|
|
|
|
|
+ isclick: AIMoment1List2[0].isLiked
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
this.setData({
|
|
this.setData({
|
|
- isclick: true
|
|
|
|
|
|
+ isclick: false
|
|
})
|
|
})
|
|
}
|
|
}
|
|
console.log('isclick', AIMoment1List2);
|
|
console.log('isclick', AIMoment1List2);
|
|
@@ -224,15 +227,16 @@ Component({
|
|
async showchick() {
|
|
async showchick() {
|
|
|
|
|
|
|
|
|
|
- let Momentquery = new Parse.Query('AIMomentComment');
|
|
|
|
|
|
+ let Momentquery = new Parse.Query('AIMomentLike');
|
|
Momentquery.equalTo('company', company);
|
|
Momentquery.equalTo('company', company);
|
|
Momentquery.equalTo('type', 'chickin');
|
|
Momentquery.equalTo('type', 'chickin');
|
|
Momentquery.equalTo('moment', this.data.objectId);
|
|
Momentquery.equalTo('moment', this.data.objectId);
|
|
Momentquery.notEqualTo('isDeleted', true)
|
|
Momentquery.notEqualTo('isDeleted', true)
|
|
Momentquery.include('user')
|
|
Momentquery.include('user')
|
|
|
|
+ Momentquery.equalTo('isLiked', true);
|
|
let r = await Momentquery.find();
|
|
let r = await Momentquery.find();
|
|
let chickList = r.map(item => item.toJSON());
|
|
let chickList = r.map(item => item.toJSON());
|
|
- console.log(chickList);
|
|
|
|
|
|
+ console.log('chickList',chickList);
|
|
this.setData({
|
|
this.setData({
|
|
chickList
|
|
chickList
|
|
})
|
|
})
|