Bladeren bron

pengyouquan

邹能昇 3 maanden geleden
bovenliggende
commit
c2d22d7ae0
2 gewijzigde bestanden met toevoegingen van 24 en 1 verwijderingen
  1. 13 1
      nova-werun/components/circle-card/index.js
  2. 11 0
      nova-werun/pages/my/my-profile/index.js

+ 13 - 1
nova-werun/components/circle-card/index.js

@@ -127,6 +127,7 @@ Component({
             this.setData({
                 time
             })
+            console.log('时间',time);
             this.showchick()
         },
         formatTime(timestamp) {
@@ -142,9 +143,20 @@ Component({
                 return '昨天';
             } else {
                 const date = new Date(timestamp);
-                return date.toLocaleDateString(); // 显示具体日期
+                return this.formatDate2(date); // 显示具体日期
             }
         },
+        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}`;
+        },
         //点击点赞按钮
         async chickin() {
             this.setData({

+ 11 - 0
nova-werun/pages/my/my-profile/index.js

@@ -276,6 +276,9 @@ Page({
                     icon: 'success',
                     duration: 2000
                 })
+                setTimeout(() => {
+                    this.goback()
+                }, 2000);
                 console.log('部门保存成功');
             } catch {
                 console.log('部门保存失败');
@@ -298,6 +301,14 @@ Page({
             Profile.set('center', union.toPointer());
             try {
                 Profile.save()
+                wx.showToast({
+                    title: '提交成功',
+                    icon: 'success',
+                    duration: 2000
+                })
+                setTimeout(() => {
+                    this.goback()
+                }, 2000);
                 console.log('部门保存成功');
             } catch {
                 console.log('部门保存失败');