|
@@ -41,9 +41,12 @@ Component({
|
|
|
commenttext: "评论",
|
|
|
focusedCommentId: null,
|
|
|
isCommentFocused: false,
|
|
|
- noCommentCount:0,
|
|
|
+ noCommentCount: 0,
|
|
|
//
|
|
|
- showconfirm:false
|
|
|
+ showconfirm: false,
|
|
|
+ //
|
|
|
+ maxLength: 100, // 设置最大长度
|
|
|
+ showFull: false, // 控制是否显示完整内容
|
|
|
},
|
|
|
lifetimes: {
|
|
|
|
|
@@ -128,7 +131,7 @@ Component({
|
|
|
this.setData({
|
|
|
time
|
|
|
})
|
|
|
- console.log('时间',time);
|
|
|
+ console.log('时间', time);
|
|
|
this.showchick()
|
|
|
},
|
|
|
formatTime(timestamp) {
|
|
@@ -149,12 +152,12 @@ Component({
|
|
|
},
|
|
|
formatDate2(date1) {
|
|
|
date1 = new Date(date1);
|
|
|
-
|
|
|
+
|
|
|
// 获取年份、月份和日期
|
|
|
const year1 = date1.getFullYear();
|
|
|
const month1 = date1.getMonth() + 1; // 月份从0开始,所以要加1
|
|
|
const day1 = date1.getDate();
|
|
|
-
|
|
|
+
|
|
|
// 返回格式化的字符串
|
|
|
return `${year1}/${month1}/${day1}`;
|
|
|
},
|
|
@@ -250,7 +253,7 @@ Component({
|
|
|
Momentquery.equalTo('isLiked', true);
|
|
|
let r = await Momentquery.find();
|
|
|
let chickList = r.map(item => item.toJSON());
|
|
|
- console.log('chickList',chickList);
|
|
|
+ console.log('chickList', chickList);
|
|
|
this.setData({
|
|
|
chickList
|
|
|
})
|
|
@@ -418,7 +421,7 @@ Component({
|
|
|
if (!this.data.isCommentFocused) { // 只有在没有评论聚焦时才重置
|
|
|
const updatedCommentList = this.data.commentList.map(comment => ({
|
|
|
...comment,
|
|
|
- showdeletid: false ,// 重置所有评论的 showdeletid
|
|
|
+ showdeletid: false, // 重置所有评论的 showdeletid
|
|
|
}));
|
|
|
|
|
|
this.setData({
|
|
@@ -533,21 +536,34 @@ Component({
|
|
|
|
|
|
},
|
|
|
//显示确认框
|
|
|
- showconfirm(){
|
|
|
+ showconfirm() {
|
|
|
this.setData({
|
|
|
- showconfirm:true
|
|
|
+ showconfirm: true
|
|
|
})
|
|
|
},
|
|
|
//取消确认框
|
|
|
- cancleconfirm(){
|
|
|
+ cancleconfirm() {
|
|
|
this.setData({
|
|
|
- showconfirm:false
|
|
|
+ showconfirm: false
|
|
|
})
|
|
|
},
|
|
|
//点击确认
|
|
|
- clickconfirm(){
|
|
|
+ clickconfirm() {
|
|
|
console.log('删除了');
|
|
|
this.deletecircle()
|
|
|
- }
|
|
|
+ },
|
|
|
+ // 显示完整内容
|
|
|
+ showFullContent() {
|
|
|
+ this.setData({
|
|
|
+ showFull: true
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 收起内容
|
|
|
+ showLessContent() {
|
|
|
+ this.setData({
|
|
|
+ showFull: false
|
|
|
+ });
|
|
|
+ },
|
|
|
}
|
|
|
})
|