|
@@ -24,7 +24,15 @@ Component({
|
|
|
cicleList: [],
|
|
|
time: '',
|
|
|
|
|
|
- chickList: ''
|
|
|
+ chickList: '',
|
|
|
+
|
|
|
+ show: false,
|
|
|
+
|
|
|
+ inputValue: '',
|
|
|
+ textareaHeight: 52 ,
|
|
|
+ bottomNavHeight:0,
|
|
|
+
|
|
|
+ commentList:[],
|
|
|
},
|
|
|
lifetimes: {
|
|
|
|
|
@@ -35,6 +43,8 @@ Component({
|
|
|
|
|
|
this.getcircle()
|
|
|
this.showischick()
|
|
|
+ this.getbottomheight()
|
|
|
+ this.getComment()
|
|
|
},
|
|
|
|
|
|
},
|
|
@@ -210,6 +220,94 @@ Component({
|
|
|
this.setData({
|
|
|
chickList
|
|
|
})
|
|
|
+ },
|
|
|
+
|
|
|
+ showPopup() {
|
|
|
+ this.setData({ show: true });
|
|
|
+ this.showgood()
|
|
|
+ },
|
|
|
+
|
|
|
+ onClose() {
|
|
|
+ this.setData({ show: false });
|
|
|
+ },
|
|
|
+
|
|
|
+ onInput: function(event) {
|
|
|
+ const value = event.detail.value;
|
|
|
+ this.setData({
|
|
|
+ inputValue: value,
|
|
|
+ textareaHeight: this.calculateHeight(value)
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ calculateHeight: function(value) {
|
|
|
+
|
|
|
+
|
|
|
+ const lineHeight = 40;
|
|
|
+ const lines = Math.ceil(value.length / 30);
|
|
|
+ return Math.max(52, lines * lineHeight);
|
|
|
+ },
|
|
|
+
|
|
|
+ async sendComment() {
|
|
|
+ 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("新数据保存成功");
|
|
|
+ } catch (error) {
|
|
|
+ console.error("保存数据时出现错误:", error);
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log(this.data.inputValue);
|
|
|
+
|
|
|
+ this.setData({
|
|
|
+ inputValue: '',
|
|
|
+ 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(){
|
|
|
+ const systemInfo = wx.getSystemInfoSync();
|
|
|
+ const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
|
|
|
+ this.setData({
|
|
|
+ bottomNavHeight,
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
})
|