odc.xiaohui
2023-04-14 89470d761e2daef431c0f68355a973945607cfa8
miniprogram/pages/user/index.ts
@@ -4,9 +4,9 @@
Page({
    data: {
        videoheight:'',
        autoplay:true,
        role:0,
        videoheight: '',
        autoplay: true,
        role: 0,
        swcurrent: 0,
        isShow: false,
        userInfo: {},
@@ -19,17 +19,17 @@
            url: '../logs/logs',
        })
    },
    resizeVideo(e){
    resizeVideo(e) {
        console.log(e);
        this.setData({
            videoheight:e.detail.height
            videoheight: e.detail.height
        })
    },
    onLoad() {
        wx.request({
            url: user.globalData.url+"/wx/login",
            url: user.globalData.url + "/wx/login",
            data: {
                "phone": wx.getStorageSync('phone'),
            },
@@ -38,7 +38,7 @@
                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.setStorageSync('card', res.data.data.time)
                wx.request(
                    {
@@ -47,77 +47,83 @@
                        header: { 'token': wx.getStorageSync('token') },
                        success: (res) => {
                            this.setData({
                                role:wx.getStorageSync('role')
                                role: wx.getStorageSync('role')
                            })
                            res.data.data.map(i => {
                                let imgarr=[]
                                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)
                                    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
                                        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,"/")
                                i.releaseTime = i.releaseTime.replace(/-/g, "/")
                            })
                            this.setData({
                                causeList: res.data.data,
                            })
                                console.log(this.data.causeList);
                            console.log(this.data.causeList);
                        }
                    })
               }})
            }
        })
        if (wx.getStorageSync('info') == '') {
            wx.redirectTo({
                url: "pages/user/index"
            })
        }
    },
    videoplay(e){
    videoplay(e) {
        console.log(e);
        this.setData({
            autoplay:false
            autoplay: false
        })
    },
    toDetailedInformation(){
    toDetailedInformation() {
        console.log('报案详情');
        wx.navigateTo({
                    url: '/pages/manager/report/index'
                })
            url: '/pages/manager/report/index'
        })
    },
    toManage(){
    toManage() {
        console.log('案件管理');
                wx.navigateTo({
                            url: '/pages/manager/cause/index'
                        })
        wx.navigateTo({
            url: '/pages/manager/cause/index'
        })
    },
    getReport() {
        wx.navigateTo({
            url: '../user/report/index'
        })
    },
    getamoter() {
        wx.navigateTo({
            url: '../user/announcement/index'
        })
    },
    getPublicty() {
        console.log("publicty")
        wx.navigateTo({