tanghaolin
2022-07-27 fd4d1d9296ba620de15b47bd1d58383d46ecb626
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
 var Constant = require('../../utils/constant.js');
 var app = getApp();
 import Request  from "../../utils/api"
 Page({
   data: {
     //报修图片
     imagesList: [],
     currentUserID: 1,
     currentCorpID: 1,
     currentEmployeeID: 1, //当前用户ID
     RequestEntity: {}
   },
   //查看图片
   previewImage: function (e) {
     var that = this;
     var imagesList = [];
     var current = e.target.dataset.src.OriginPath;
     var images = that.data.imagesList;
     for (var i = 0; i < images.length; i++) {
       imagesList.push(images[i].OriginPath)
     }
     //  console.log(current, imagesList, "bigPicture:大图", "smallPicture:小图")
     wx.previewImage({
       current: current,
       urls: imagesList
     })
   },
   onLoad: function (options) {
     //console.log(options.id)
     if (options.id == '' || options.id == undefined)
       return;
     var requestformid = options.id;
     var that = this;
 
     var userInfo = app.globalData.userInfo;
     if (userInfo) {
       this.setData({
         currentCorpID: userInfo.CorpID,
         currentEmployeeID: userInfo.EmployeeID
       });
     }
 
 
     Request({
       url: Constant.BASE_SERVER_URL + "Repair/RepairRequestForm/Mobile/GetMyPendingDetailByID@V1.0",
       method: 'GET',
       data: {
         CorpID: userInfo.CorpID,
         ID: requestformid
       },
       header: {
         'content-type': 'application/json'
       },
       fail: function (err) {
         // wx.showModal({
         //   title: '',
         //   content: '通讯失败',
         // })
       }, //请求失败
       success: function (res) {
        //  console.log(res.data.Data)
         var result = res.data;
         if (result.Code != 0) {
           wx.showModal({
             title: '',
             content: result.Message,
           });
           return;
         }
         var RequestEntity = result.Data;
         var imagesList = [];
         if (RequestEntity.FileList != null && RequestEntity.FileList.length > 0) {
           for (var i = 0; i < RequestEntity.FileList.length; i++) {
             var big_image_name = Constant.BASE_SERVER_URL + RequestEntity.FileList[i].StorageUrl;
          
             var m = {};
             m.OriginPath = big_image_name;
             m.ThumbPath = big_image_name;
             imagesList.push(m);
           }
         }
         //console.log(imagesList)
         that.setData({
           RequestEntity: RequestEntity,
           imagesList: imagesList
         })
       }
     });
   },
 
   onReady: function () {},
   onShow: function () {},
   onHide: function () {},
   onUnload: function () {},
   onPullDownRefresh: function () {},
   onReachBottom: function () {},
   onShareAppMessage: function () {
     return Constant.Share;
   },
 })