|
@@ -2,6 +2,7 @@ import Taro, { Component } from '@tarojs/taro';
|
2
|
2
|
import './index.scss'
|
3
|
3
|
import { AtImagePicker } from 'taro-ui'
|
4
|
4
|
import { getDocumentVerify, commitDocumentVerify, editDocumentVerify } from '@services/user'
|
|
5
|
+import { uploadFiles } from '@utils/request'
|
5
|
6
|
|
6
|
7
|
import "taro-ui/dist/style/components/image-picker.scss";
|
7
|
8
|
import "taro-ui/dist/style/components/icon.scss";
|
|
@@ -24,7 +25,6 @@ export default class Profile extends Component {
|
24
|
25
|
// 审核状态 0审核中 1审核通过 2审核不通过 3未审核
|
25
|
26
|
componentDidMount() {
|
26
|
27
|
this.getProfile()
|
27
|
|
-
|
28
|
28
|
}
|
29
|
29
|
|
30
|
30
|
getProfile() {
|
|
@@ -34,20 +34,9 @@ export default class Profile extends Component {
|
34
|
34
|
this.setState({
|
35
|
35
|
auditStatus: 3,
|
36
|
36
|
})
|
37
|
|
-
|
38
|
37
|
} else {
|
39
|
|
- console.log(res, "res")
|
40
|
|
- let imgList = []
|
41
|
|
- let fileList = res.imgList
|
42
|
|
- fileList.map((item, index) => {
|
43
|
|
- let newObj = {}
|
44
|
|
- newObj.url = item.img
|
45
|
|
-
|
46
|
|
- imgList.push(newObj)
|
47
|
|
- }
|
48
|
|
- )
|
49
|
38
|
this.setState({
|
50
|
|
- files: imgList,
|
|
39
|
+ files: res.imgList.map(x => ({ url: x.img })),
|
51
|
40
|
auditStatus: res.verifyStatus,
|
52
|
41
|
// resData:res,
|
53
|
42
|
documentVerifyId: res.documentVerifyId,
|
|
@@ -65,11 +54,11 @@ export default class Profile extends Component {
|
65
|
54
|
}
|
66
|
55
|
|
67
|
56
|
onChange(files) {
|
68
|
|
-
|
69
|
|
-
|
70
|
|
-
|
71
|
|
- this.setState({
|
72
|
|
- files
|
|
57
|
+ const filePaths = files.map(x => x.file.path)
|
|
58
|
+ uploadFiles(filePaths).then((res) => {
|
|
59
|
+ this.setState({
|
|
60
|
+ files: res.map(x => ({ url: x}))
|
|
61
|
+ })
|
73
|
62
|
})
|
74
|
63
|
}
|
75
|
64
|
onFail(mes) {
|
|
@@ -78,6 +67,7 @@ export default class Profile extends Component {
|
78
|
67
|
onImageClick(index, file) {
|
79
|
68
|
console.log(index, file)
|
80
|
69
|
}
|
|
70
|
+
|
81
|
71
|
// 提交图片审核
|
82
|
72
|
commitBtn() {
|
83
|
73
|
console.log(this.state.auditStatus, "this.state.auditStatus")
|
|
@@ -87,34 +77,21 @@ export default class Profile extends Component {
|
87
|
77
|
let imgList = []
|
88
|
78
|
let fileList = this.state.files
|
89
|
79
|
fileList.map((item, index) => {
|
90
|
|
- let newObj = {}
|
91
|
|
- newObj.img = item.url
|
92
|
|
- newObj.sort = index
|
93
|
|
- imgList.push(newObj)
|
94
|
|
- }
|
|
80
|
+ let newObj = {}
|
|
81
|
+ newObj.img = item.url,
|
|
82
|
+ newObj.sort = index
|
|
83
|
+ imgList.push(newObj)
|
|
84
|
+ }
|
95
|
85
|
)
|
96
|
|
- // const resData = this.state.resData
|
97
|
86
|
|
98
|
87
|
const payload = {
|
99
|
|
- // ,
|
100
|
|
-
|
101
|
|
- // ...resData,
|
102
|
88
|
imgList,
|
103
|
89
|
documentVerifyId: this.state.documentVerifyId
|
104
|
|
-
|
105
|
90
|
}
|
106
|
|
- editDocumentVerify(payload).then(res => {
|
107
|
|
- let imgList = []
|
108
|
|
- let fileList = res.imgList
|
109
|
|
- fileList.map((item, index) => {
|
110
|
|
- let newObj = {}
|
111
|
|
- newObj.url = item.img
|
112
|
|
-
|
113
|
|
- imgList.push(newObj)
|
114
|
|
- })
|
115
|
91
|
|
|
92
|
+ editDocumentVerify(payload).then(res => {
|
116
|
93
|
this.setState({
|
117
|
|
- files: imgList,
|
|
94
|
+ files: res.imgList.map(x => ({url: x.img})),
|
118
|
95
|
auditStatus: res.verifyStatus
|
119
|
96
|
})
|
120
|
97
|
Taro.showToast({ icon: 'none', title: '提交成功' });
|
|
@@ -135,15 +112,8 @@ export default class Profile extends Component {
|
135
|
112
|
})
|
136
|
113
|
|
137
|
114
|
commitDocumentVerify(imgList).then(res => {
|
138
|
|
- let imgList = []
|
139
|
|
- let fileList = res.imgList
|
140
|
|
- fileList.map((item, index) => {
|
141
|
|
- let newObj = {}
|
142
|
|
- newObj.url = item.img
|
143
|
|
- imgList.push(newObj)
|
144
|
|
- })
|
145
|
115
|
this.setState({
|
146
|
|
- files: imgList,
|
|
116
|
+ files: res.imgList.map(x => ({url: x.img})),
|
147
|
117
|
auditStatus: res.verifyStatus
|
148
|
118
|
})
|
149
|
119
|
Taro.showToast({ icon: 'none', title: '提交成功' });
|