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
| // pages/m_consult/consultdetailqa/consultdetailqa.js
| const consultservice = require("../../../service/consultservice")
| const app = getApp()
|
| Page({
|
| /**
| * 页面的初始数据
| */
| data: {
| showloading: false,
| question: {},
| //问题涉及的项目
| questionTag: [{
| icon: '',
| name: ''
| }],
| answers: [],
|
| showDialog: false,
| groups: [
| 'actionSlot1',
| // { text: '示例菜单', value: 1 },
| // { text: '示例菜单', value: 2 },
| // { text: '负向菜单', type: 'warn', value: 3 }
| ]
| },
|
| /**
| * 生命周期函数--监听页面加载
| */
| onLoad(options) {
| var that = this
| this.getOpenerEventChannel().on('acceptDataFromOpenerPage', function (data) {
| that.setData({
| id: data.id
| })
|
| that.getQuestion()
| that.getAnswers()
| })
| },
|
| getQuestion() {
| this.setData({
| showloading: true
| })
| var that = this
| consultservice.getQuestion(app.globalData.accessToken.userId, this.data.id, {
| success(res) {
| let questionTag = []
| if (res.cqIsPunish) questionTag.push({icon: '/res/icons/cq_punish.png', name: '涉及行政处罚'})
| if (res.cqIsIllegal) questionTag.push({icon: '/res/icons/cq_illegal.png', name: '涉及刑事责任'})
| if (res.cqIsSupervise) questionTag.push({icon: '/res/icons/cq_supervise.png', name: '涉及环保督察要点'})
| if (res.cqIsShotspot) questionTag.push({icon: '/res/icons/cq_shotspot.png', name: '涉及环保管理热点'})
| that.setData({
| question: res,
| questionTag
| })
| console.log(res);
| },
| complete(res) {
| that.setData({
| showloading: false
| })
| }
| })
| },
|
| getAnswers() {
| this.setData({
| showloading: true
| })
| var that = this
| consultservice.getAnswers(app.globalData.accessToken.userId, this.data.id, {
| success(res) {
| res.forEach(r => {
| r.saContent = r.saContent.replaceAll('\\n', '<br/>')
| });
| that.setData({
| answers: res
| })
| 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()
| }
| })
|
|