odc.xiaohui
2023-04-12 ac41263c85bb295bd0dcb286173986bc88d7e4ae
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// index.ts
// 获取应用实例
const user = getApp()
 
Page({
    data: {
        videoheight:'',
        autoplay:true,
        role:0,
        swcurrent: 0,
        isShow: false,
        userInfo: {},
        causeList: [],
        images: []
    },
    // 事件处理函数
    bindViewTap() {
        wx.navigateTo({
            url: '../logs/logs',
        })
    },
    resizeVideo(e){
        console.log(e);
        this.setData({
            videoheight:e.detail.height
        })
    },
 
    onLoad() {
     
        wx.request({
            url: user.globalData.url+"/wx/login",
            data: {
                "phone": wx.getStorageSync('phone'),
            },
            method: "GET",
            success: (res) => {
                wx.setStorageSync('token', res.data.data.token)
                wx.setStorageSync('role', res.data.data.role)
                wx.setStorageSync('id', res.data.data.id)
                wx.setStorageSync('card',res.data.data.time)
 
                wx.request(
                    {
                        url: user.globalData.url + "/wx/publicity?size=" + "4",
                        method: "GET",
                        header: { 'token': wx.getStorageSync('token') },
                        success: (res) => {
                            this.setData({
                                role:wx.getStorageSync('role')
                            })
                            
                            res.data.data.map(i => {
                                let imgarr=[]
                                if (i.photoStr != null) {
                                    
                                    i.photoStr = i.photoStr.split(",").map(i => user.globalData.imageUrl + "/img/" + i),
                                        this.data.images = i.photoStr
                                        i.photoStr.map(j=>{
                                            let type=j.substring(j.lastIndexOf(".")+1)
 
                                           
                                            let obj={
                                                url: j,
                                                type:'png'
                                             }
                                             if (type=='mp4') {
                                                obj.type = 'mp4'
                                            }else{
                                                obj.type = 'png'
                                            }
                                            imgarr.push(obj)
                                        })
                                        i.imagarr=imgarr
                                }
 
                                i.releaseTime = i.releaseTime.replace(/-/g,"/")
                            })
                            this.setData({
                                causeList: res.data.data,
                            })
                                console.log(this.data.causeList);
                                
        
                        }
                    })
               }})
        if (wx.getStorageSync('info') == '') {
            wx.redirectTo({
                url: "pages/user/index"
            })
        }
    
        
       
    },
    videoplay(e){
        console.log(e);
        
        this.setData({
            autoplay:false
        })
    },
    toDetailedInformation(){
        console.log('报案详情');
        wx.navigateTo({
                    url: '/pages/manager/report/index'
                })
    },
    toManage(){
        console.log('案件管理');
                wx.navigateTo({
                            url: '/pages/manager/cause/index'
                        })
    },
    getReport() {
        wx.navigateTo({
            url: '../user/report/index'
        })
    },
    getPublicty() {
        console.log("publicty")
        wx.navigateTo({
            url: '../user/pubulicty/index'
        })
    },
    getGroup() {
        console.log("group")
        wx.navigateTo({
            url: '../user/group/index'
        })
    },
    getCause() {
        console.log("cause")
        wx.navigateTo({
            url: '../manager/cause/index'
        })
    },
    getAudi() {
        console.log("myself")
        wx.navigateTo({
            url: '../user/myself/index'
        })
    },
    more() {
        console.log("myself")
        wx.navigateTo({
            url: '../user/pubulicty/index'
        })
    }
})