|
@@ -28,11 +28,14 @@ Component({
|
|
|
|
|
|
show: false,
|
|
|
|
|
|
- inputValue: '',
|
|
|
- textareaHeight: 52 ,
|
|
|
- bottomNavHeight:0,
|
|
|
+ inputValue: '',
|
|
|
+ textareaHeight: 52,
|
|
|
+ bottomNavHeight: 0,
|
|
|
|
|
|
- commentList:[],
|
|
|
+ commentList: [],
|
|
|
+
|
|
|
+ poptype: '',
|
|
|
+ userobject: ''
|
|
|
},
|
|
|
lifetimes: {
|
|
|
|
|
@@ -200,9 +203,9 @@ Component({
|
|
|
let moment2 = await AIMomentCommentquery2.find()
|
|
|
let AIMoment1List2 = moment2.map(item => item.toJSON());
|
|
|
this.setData({
|
|
|
- isclick:AIMoment1List2[0].isDeleted
|
|
|
+ isclick: AIMoment1List2[0].isDeleted
|
|
|
})
|
|
|
- console.log('isclick',AIMoment1List2);
|
|
|
+ console.log('isclick', AIMoment1List2);
|
|
|
},
|
|
|
|
|
|
async showchick() {
|
|
@@ -223,23 +226,28 @@ Component({
|
|
|
},
|
|
|
|
|
|
showPopup() {
|
|
|
- this.setData({ show: true });
|
|
|
+ this.setData({
|
|
|
+ show: true,
|
|
|
+ poptype: 'one'
|
|
|
+ });
|
|
|
this.showgood()
|
|
|
- },
|
|
|
-
|
|
|
- onClose() {
|
|
|
- this.setData({ show: false });
|
|
|
- },
|
|
|
-
|
|
|
- onInput: function(event) {
|
|
|
+ },
|
|
|
+
|
|
|
+ onClose() {
|
|
|
+ this.setData({
|
|
|
+ show: false
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ onInput: function (event) {
|
|
|
const value = event.detail.value;
|
|
|
this.setData({
|
|
|
inputValue: value,
|
|
|
textareaHeight: this.calculateHeight(value)
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
- calculateHeight: function(value) {
|
|
|
+
|
|
|
+ calculateHeight: function (value) {
|
|
|
|
|
|
|
|
|
const lineHeight = 40;
|
|
@@ -248,13 +256,121 @@ Component({
|
|
|
},
|
|
|
|
|
|
async sendComment() {
|
|
|
+
|
|
|
+ if (this.data.poptype == 'one') {
|
|
|
+ let AIMomentquery = new Parse.Query('AIMoment');
|
|
|
+ AIMomentquery.equalTo('company', company);
|
|
|
+ AIMomentquery.equalTo('objectId', this.data.objectId);
|
|
|
+ AIMomentquery.equalTo('isVisible', true);
|
|
|
+ AIMomentquery.notEqualTo('isDeleted', true)
|
|
|
+ let P = await AIMomentquery.first();
|
|
|
+
|
|
|
+ const currentUser = Parse.User.current();
|
|
|
+ let userquery = new Parse.Query('_User');
|
|
|
+ userquery.equalTo('company', company);
|
|
|
+ userquery.equalTo('objectId', currentUser.id);
|
|
|
+ userquery.notEqualTo('isDeleted', true)
|
|
|
+ let user = await userquery.first();
|
|
|
+
|
|
|
+ let companyPointer = Parse.Object.extend('Company').createWithoutData(company);
|
|
|
+ let Comment = new Parse.Object('AIMomentComment');
|
|
|
+ Comment.set('moment', P.toPointer())
|
|
|
+ Comment.set('company', companyPointer);
|
|
|
+ Comment.set('type', 'coment');
|
|
|
+ Comment.set('isDeleted', false);
|
|
|
+ Comment.set('content', this.data.inputValue);
|
|
|
+ Comment.set('user', user.toPointer());
|
|
|
+ try {
|
|
|
+ let saveDate2 = await Comment.save();
|
|
|
+ console.log(saveDate2);
|
|
|
+ console.log("新数据保存成功");
|
|
|
+ this.getComment()
|
|
|
+ } catch (error) {
|
|
|
+ console.error("保存数据时出现错误:", error);
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log(this.data.inputValue);
|
|
|
+
|
|
|
+ this.setData({
|
|
|
+ inputValue: '',
|
|
|
+ textareaHeight: 52
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.data.poptype == 'two') {
|
|
|
+ console.log('id',this.data.userobject);
|
|
|
+ this.rebackmoment()
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ async getComment() {
|
|
|
+ let Momentquery = new Parse.Query('AIMomentComment');
|
|
|
+ Momentquery.equalTo('company', company);
|
|
|
+ Momentquery.equalTo('type', 'coment');
|
|
|
+ Momentquery.equalTo('moment', this.data.objectId);
|
|
|
+ Momentquery.notEqualTo('isDeleted', true);
|
|
|
+ Momentquery.include('user');
|
|
|
+ Momentquery.include('comment.user');
|
|
|
+
|
|
|
+
|
|
|
+ Momentquery.ascending('createdAt');
|
|
|
+
|
|
|
+ let r = await Momentquery.find();
|
|
|
+ let commentList = r.map(item => item.toJSON());
|
|
|
+ console.log('评论', commentList);
|
|
|
+ this.setData({
|
|
|
+ commentList
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ async showpop(e) {
|
|
|
+ const objectId = e.currentTarget.dataset.id
|
|
|
+ let AIMomentCommentquery = new Parse.Query('AIMomentComment');
|
|
|
+ AIMomentCommentquery.equalTo('company', company);
|
|
|
+ AIMomentCommentquery.equalTo('objectId', objectId);
|
|
|
+ AIMomentCommentquery.notEqualTo('isDeleted', true)
|
|
|
+ AIMomentCommentquery.include('user');
|
|
|
+ let r = await AIMomentCommentquery.find();
|
|
|
+ let commentList = r.map(item => item.toJSON());
|
|
|
+
|
|
|
+ const currentUser = Parse.User.current();
|
|
|
+ let userquery = new Parse.Query('_User');
|
|
|
+ userquery.equalTo('company', company);
|
|
|
+ userquery.equalTo('objectId', currentUser.id);
|
|
|
+ userquery.notEqualTo('isDeleted', true)
|
|
|
+ let R = await userquery.find();
|
|
|
+ let user = R.map(item => item.toJSON());
|
|
|
+
|
|
|
+ if(user[0].objectId!=commentList[0].user.objectId){
|
|
|
+ this.setData({
|
|
|
+ show: true,
|
|
|
+ poptype: 'two',
|
|
|
+ userobject:objectId
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ console.log('点击了自己');
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ async rebackmoment() {
|
|
|
+
|
|
|
+
|
|
|
+ let AIMomentCommentquery = new Parse.Query('AIMomentComment');
|
|
|
+ AIMomentCommentquery.equalTo('company', company);
|
|
|
+ AIMomentCommentquery.equalTo('objectId', this.data.userobject);
|
|
|
+ AIMomentCommentquery.notEqualTo('isDeleted', true)
|
|
|
+ let Puser = await AIMomentCommentquery.first();
|
|
|
+
|
|
|
let AIMomentquery = new Parse.Query('AIMoment');
|
|
|
AIMomentquery.equalTo('company', company);
|
|
|
AIMomentquery.equalTo('objectId', this.data.objectId);
|
|
|
AIMomentquery.equalTo('isVisible', true);
|
|
|
AIMomentquery.notEqualTo('isDeleted', true)
|
|
|
let P = await AIMomentquery.first();
|
|
|
-
|
|
|
+
|
|
|
const currentUser = Parse.User.current();
|
|
|
let userquery = new Parse.Query('_User');
|
|
|
userquery.equalTo('company', company);
|
|
@@ -266,6 +382,7 @@ Component({
|
|
|
let Comment = new Parse.Object('AIMomentComment');
|
|
|
Comment.set('moment', P.toPointer())
|
|
|
Comment.set('company', companyPointer);
|
|
|
+ Comment.set('comment', Puser.toPointer());
|
|
|
Comment.set('type', 'coment');
|
|
|
Comment.set('isDeleted', false);
|
|
|
Comment.set('content', this.data.inputValue);
|
|
@@ -286,24 +403,8 @@ Component({
|
|
|
textareaHeight: 52
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
- async getComment(){
|
|
|
- let Momentquery = new Parse.Query('AIMomentComment');
|
|
|
- Momentquery.equalTo('company', company);
|
|
|
- Momentquery.equalTo('type', 'coment');
|
|
|
- Momentquery.equalTo('moment', this.data.objectId);
|
|
|
- Momentquery.notEqualTo('isDeleted', true)
|
|
|
- Momentquery.include('user')
|
|
|
- Momentquery.include('comment.user')
|
|
|
- let r = await Momentquery.find();
|
|
|
- let commentList = r.map(item => item.toJSON());
|
|
|
- console.log('评论',commentList);
|
|
|
- this.setData({
|
|
|
- commentList
|
|
|
- })
|
|
|
- },
|
|
|
|
|
|
- getbottomheight(){
|
|
|
+ getbottomheight() {
|
|
|
const systemInfo = wx.getSystemInfoSync();
|
|
|
const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
|
|
|
this.setData({
|