odc.xiaohui
2023-03-20 190f42003ed5f96f285e8ff9517dbfbe70ef0ba5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// index.ts
// 获取应用实例
const managerGroup = getApp()
 
Page({
    data: {
        groupList: []
    },
    openGroup(e) {
 
        wx.navigateTo({
            url: "../../manager/group/message/index?id=" + e.currentTarget.id
        })
    },
    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 time
        if (month < 10) {
            month = "0" + month
        }
        if (day < 10) {
            day = "0" + day
        }
        if (minutes < 10) {
            minutes = "0" + minutes
        }
        if (hours < 10) {
            hours = "0" + hours
        }
        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: managerGroup.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
                    })
                }
 
            })
 
 
    }
})