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
| // pages/mExtra/pSupervisionchangeDetail/pSupervisionchangeDetail.js
| import bUpload from "../../../base/behaviors/bUpload"
| import bLoadingStatus from '../../../base/behaviors/bLoadingStatus'
| import bLoadingToast from '../../../base/behaviors/bLoadingToast'
| import taskservice from "../../../service/taskservice"
|
| Page({
| behaviors: [bUpload, bLoadingStatus, bLoadingToast],
| /**
| * 页面的初始数据
| */
| data: {
| problemList: [],
| pIndex: 0,
|
| previewImageUrls: [],
| previewCurrent: 0,
| showPreview: false,
| },
|
| /**
| * 生命周期函数--监听页面加载
| */
| onLoad(options) {
| var that = this
| this.getOpenerEventChannel().on('acceptDataFromOpenerPage', function (data) {
| that.setData({
| problemList: data.data,
| index: data.index,
| })
| })
| },
|
| submitDialog(e) {
| const index = e.currentTarget.dataset.index
| if (this.data.imgFiles.length == 0) {
| wx.showToast({
| title: '请至少选择一张图片',
| icon: 'none',
| })
| } else {
| this.setData({
| showDialog: true,
| pIndex: index
| })
| }
| },
|
| changeProblem() {
| this.setData({
| showDialog: false,
| })
| this.setData({loading: true})
| const pId = this.data.problemList[this.data.pIndex].guid
| let path = []
| this.data.imgFiles.forEach(f => {
| path.push(f.url)
| });
| taskservice.uploadChangePic(pId, path, {
| success: (res)=> {
| this.setData({loading: false})
| this.getOpenerEventChannel().emit('uploadOver', {
| index: this.data.index
| })
| wx.navigateBack({
| delta: 1,
| })
| },
| complete (res) {
| }
| })
| },
|
| //图片放大预览
| previewImage(e) {
| const {
| index,
| type
| } = e.currentTarget.dataset;
| const previewImageUrls = []
| const pro = this.data.problemList[index[0]]
| if (type == 'pro') {
| pro.proPics.forEach(p => {
| previewImageUrls.push(p)
| });
| } else {
| pro.changePics.forEach(p => {
| previewImageUrls.push(p)
| });
| }
| this.setData({
| previewImageUrls,
| previewCurrent: index[1],
| showPreview: true,
| title: pro.problemname
| });
| },
| })
|
|