From f05a26bb7e036c3d09c84e295f1b77fdb8d9ba08 Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期四, 06 四月 2023 20:46:42 +0800
Subject: [PATCH] 修改定时

---
 miniprogram/pages/user/group/index.ts |   96 ++++++++++++++++++++++++++++++++---------------
 1 files changed, 65 insertions(+), 31 deletions(-)

diff --git a/miniprogram/pages/user/group/index.ts b/miniprogram/pages/user/group/index.ts
index 3d4f850..a0ae1fa 100644
--- a/miniprogram/pages/user/group/index.ts
+++ b/miniprogram/pages/user/group/index.ts
@@ -6,19 +6,29 @@
     data: {
         groupList: []
     },
-    openGroup(e){
-        console.log(e)
-        wx.navigateTo({
-            url:"../../user/group/message/index?id="+e.currentTarget.id+"&&ban="+e.currentTarget.dataset.ban+"&&reportId="+e.currentTarget.dataset.rptid
-        })
+    toHome() {
+        wx.navigateBack()
+    },
+    openGroup(e) {
+        if (wx.getStorageSync('role')==1) {
+            wx.navigateTo({
+                url: "../../manager/group/message/index?id=" + e.currentTarget.id
+            })
+        }else{
+            wx.navigateTo({
+                url: "../../user/group/message/index?id=" + e.currentTarget.id + "&&ban=" + e.currentTarget.dataset.ban + "&&reportId=" + e.currentTarget.dataset.rptid
+            })
+        }
+       
+       
     },
     onLoad() {
         var date = new Date()
         var month = date.getMonth() + 1
         var day = date.getDate()
-        var hours=date.getHours()
-        var minutes=date.getMinutes()
-        var secends=date.getSeconds()
+        var hours = date.getHours()
+        var minutes = date.getMinutes()
+        var secends = date.getSeconds()
         var time
         if (month < 10) {
             month = "0" + month
@@ -35,29 +45,53 @@
         if (secends < 10) {
             secends = "0" + secends
         }
-        time = date.getFullYear() + "-" + month + "-" + day + " " + hours+":"+minutes+":"+secends
-console.log(time)
-console.log("lastDate",wx.getStorageSync('time'))
-var lastTime=wx.getStorageSync('time')
-        wx.request(
-            {
-                url: userGroup.globalData.url + "/wx/user/group/list",
-                method: "GET",
-                data:{
-                    id:wx.getStorageSync('id'),
-                    newDate:time,
-                    lastDate:lastTime
-                },
-                header: { 'token': wx.getStorageSync('token') },
-                success: (res) => {
-                    console.log(res.data.data)  
-                    this.setData({
-                        groupList: res.data.data
-                    })
-                }
+        time = date.getFullYear() + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + secends
+        var lastTime = wx.getStorageSync('time')
+        console.log(wx.getStorageSync('role'));
         
-            })
-
-
+        if (wx.getStorageSync('role')==1) {
+            wx.request(
+                {
+                    url: userGroup.globalData.url + "/wx/manager/group/list",
+                    method: "GET",
+                    data: {
+                        id: wx.getStorageSync('id'),
+                        newDate: time,
+                        lastDate: lastTime
+                    },
+                    header: { 'token': wx.getStorageSync('token') },
+                    success: (res) => {
+                        console.log(res.data.data)
+                        res.data.data.map(item => {
+                            if (item.time) {
+                                item.time = item.time.substr(-8)
+                            } 
+                        })
+                        this.setData({
+                            groupList: res.data.data
+                        })
+                    }
+    
+                })
+        }else{
+            wx.request(
+                {
+                    url: userGroup.globalData.url + "/wx/user/group/list",
+                    method: "GET",
+                    data: {
+                        id: wx.getStorageSync('id'),
+                        newDate: time,
+                        lastDate: lastTime
+                    },
+                    header: { 'token': wx.getStorageSync('token') },
+                    success: (res) => {
+                        console.log(res.data.data)
+                        this.setData({
+                            groupList: res.data.data
+                        })
+                    }
+                })
+        }
+      
     }
 })

--
Gitblit v1.8.0