odc.xiaohui
2023-03-13 ae28f9db9fa0ebe24b9c21cb37daf23bafee7e92
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
// index.ts
 
import { imageProps } from "miniprogram/miniprogram_npm/@vant/weapp/uploader/shared"
 
// 获取应用实例
const userDetail = getApp()
 
Page({
    data: {
        reportDetail: {},
        isShow: false,
        causeIndex: 0,
        images:[]
    },
 
//查看图片
face(){
    wx.previewMedia({
        sources:[{url:userDetail.globalData.imageUrl+"/img/"+this.data.reportDetail.pic}]
    })
},
 
     onLoad(e) {
       wx.request(
            {
                url: userDetail.globalData.url + "/report/" + e.id,
                method: "GET",
                header: { 'token': wx.getStorageSync('token') },
                success: (res) => {
                    console.log(res)
                    if (res.data.data.reportMaterials != null) {
                        this.setData({
                            images: res.data.data.reportMaterials.split(",").map(i=>userDetail.globalData.imageUrl + "/img/" +i)
                        })
                    }
                    this.setData({
                        reportDetail: res.data.data
                    })
                    // for (let index = 0; index < this.data.images.length; index++) {
                    //     if (this.data.images != null && this.data.images[index] != "" && this.data.images != undefined) {
                    //         this.data.images[index] = userDetail.globalData.imageUrl + "/img/" + this.data.images[index]
                    //     }
                    // }
                    // this.setData({
                    //     images: this.data.images
                    // })
                    console.log(this.data.images)
                }
            })
 
    }
})