riku
2022-09-14 2206df0da6499846c78a358cf95ca33c218a5c5d
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
// pages/m_consult/consultdetailcase/consultdetailcase.js
const consultservice = require("../../../service/consultservice")
const util = require("../../../utils/util")
const app = getApp()
 
Page({
 
  /**
   * 页面的初始数据
   */
  data: {
    showloading: false,
    case: {},
    caseTag: [],
 
    showDialog: false,
    groups: [
      'actionSlot1',
    ]
  },
 
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    var that = this
    this.getOpenerEventChannel().on('acceptDataFromOpenerPage', function (data) {
      that.setData({
        id: data.id
      })
      that.getCase()
    })
  },
 
  getCase() {
    this.setData({
      showloading: true
    })
    var that = this
    consultservice.getCase(app.globalData.accessToken.userId, this.data.id, {
      success(res) {
        let caseTag = []
        if (res.ecIsPunish) caseTag.push({icon: '/res/icons/cq_punish.png', name: '涉及行政处罚'})
        if (res.ecIsIllegal) caseTag.push({icon: '/res/icons/cq_illegal.png', name: '涉及刑事责任'})
        if (res.ecIsSupervise) caseTag.push({icon: '/res/icons/cq_supervise.png', name: '涉及环保督察要点'})
        if (res.ecIsShotspot) caseTag.push({icon: '/res/icons/cq_shotspot.png', name: '涉及环保管理热点'})
        if (res.ecIsMinor) caseTag.push({icon: '/res/icons/cq_minor.png', name: '涉及轻微违法'})
        if (res.ecIsDetained) caseTag.push({icon: '/res/icons/cq_detained.png', name: '涉及行政拘留'})
 
        res.ecSummary = res.ecSummary.replaceAll('\\n', '<br/>')
        res.ecMeaning = res.ecMeaning.replaceAll('\\n', '<br/>')
        res.ecExamined = res.ecExamined.replaceAll('\\n', '<br/>')
        res.ecEnlightenment = res.ecEnlightenment.replaceAll('\\n', '<br/>')
        res.ecOccurDate = util.formatTime(res.ecOccurDate)
        that.setData({
          case: res,
          caseTag
        })
        console.log(res);
      },
      complete(res) {
        that.setData({
          showloading: false
        })
      }
    })
  },
 
  openDialog: function () {
    this.setData({
      showDialog: true
    })
  },
  closeDialog: function () {
    this.setData({
      showDialog: false
    })
  },
  btnClick(e) {
    console.log(e)
    this.closeDialog()
  },
 
  previewImage(e) {
    const i = e.currentTarget.dataset.index
    // const img = this.data.case.ecAppendixUrl[i]
    const remark = this.data.case.ecAppendixText[i]
    const previewImageUrls = this.data.case.ecAppendixUrl;
    this.setData({
      previewImageUrls,
      remark,
      previewCurrent: 0,
      showPreview: true
    });
  },
})