|
@@ -6,6 +6,10 @@ import { uploadFiles } from '@utils/request'
|
6
|
6
|
|
7
|
7
|
import "taro-ui/dist/style/components/image-picker.scss";
|
8
|
8
|
import "taro-ui/dist/style/components/icon.scss";
|
|
9
|
+const profileBg = require('@assets/profile.png')
|
|
10
|
+const add = require('@assets/add.png')
|
|
11
|
+const img = require('@assets/shop/banner1.jpg')
|
|
12
|
+const closeImg = require('@assets/close.png')
|
9
|
13
|
|
10
|
14
|
// import { connect } from '@tarojs/redux'
|
11
|
15
|
|
|
@@ -20,6 +24,7 @@ export default class Profile extends Component {
|
20
|
24
|
files: [],
|
21
|
25
|
auditStatus: 0,
|
22
|
26
|
documentVerifyId: '',
|
|
27
|
+ images: []
|
23
|
28
|
|
24
|
29
|
}
|
25
|
30
|
// 审核状态 0审核中 1审核通过 2审核不通过 3未审核
|
|
@@ -57,10 +62,36 @@ export default class Profile extends Component {
|
57
|
62
|
const filePaths = files.map(x => x.file.path)
|
58
|
63
|
uploadFiles(filePaths).then((res) => {
|
59
|
64
|
this.setState({
|
60
|
|
- files: res.map(x => ({ url: x}))
|
|
65
|
+ files: res.map(x => ({ url: x }))
|
61
|
66
|
})
|
62
|
67
|
})
|
63
|
68
|
}
|
|
69
|
+ // 选择图片
|
|
70
|
+ bindAlbumClick(e) {
|
|
71
|
+ e.stopPropagation()
|
|
72
|
+ Taro.chooseImage({
|
|
73
|
+ count: 6,
|
|
74
|
+ sizeType: ['original', 'compressed'], //可选择原图或压缩后的图片
|
|
75
|
+ sourceType: ['album', 'camera'], //可选择性开放访问相册、相机
|
|
76
|
+ success: res => {
|
|
77
|
+ uploadFiles(res.tempFilePaths).then(data => {
|
|
78
|
+
|
|
79
|
+ const images = this.state.images.concat(data)
|
|
80
|
+ console.log(images, "data")
|
|
81
|
+ this.setState({
|
|
82
|
+ marginTop: 0,
|
|
83
|
+ messageType: 'image',
|
|
84
|
+ images: images
|
|
85
|
+ }, this.onSendMsg)
|
|
86
|
+ })
|
|
87
|
+ }
|
|
88
|
+ })
|
|
89
|
+ }
|
|
90
|
+ // 删除图片
|
|
91
|
+ deleteImg(inx) {
|
|
92
|
+ console.log(inx, "inx")
|
|
93
|
+ }
|
|
94
|
+
|
64
|
95
|
onFail(mes) {
|
65
|
96
|
console.log(mes)
|
66
|
97
|
}
|
|
@@ -77,11 +108,11 @@ export default class Profile extends Component {
|
77
|
108
|
let imgList = []
|
78
|
109
|
let fileList = this.state.files
|
79
|
110
|
fileList.map((item, index) => {
|
80
|
|
- let newObj = {}
|
81
|
|
- newObj.img = item.url,
|
|
111
|
+ let newObj = {}
|
|
112
|
+ newObj.img = item.url,
|
82
|
113
|
newObj.sort = index
|
83
|
|
- imgList.push(newObj)
|
84
|
|
- }
|
|
114
|
+ imgList.push(newObj)
|
|
115
|
+ }
|
85
|
116
|
)
|
86
|
117
|
|
87
|
118
|
const payload = {
|
|
@@ -91,7 +122,7 @@ export default class Profile extends Component {
|
91
|
122
|
|
92
|
123
|
editDocumentVerify(payload).then(res => {
|
93
|
124
|
this.setState({
|
94
|
|
- files: res.imgList.map(x => ({url: x.img})),
|
|
125
|
+ files: res.imgList.map(x => ({ url: x.img })),
|
95
|
126
|
auditStatus: res.verifyStatus
|
96
|
127
|
})
|
97
|
128
|
Taro.showToast({ icon: 'none', title: '提交成功' });
|
|
@@ -113,7 +144,7 @@ export default class Profile extends Component {
|
113
|
144
|
|
114
|
145
|
commitDocumentVerify(imgList).then(res => {
|
115
|
146
|
this.setState({
|
116
|
|
- files: res.imgList.map(x => ({url: x.img})),
|
|
147
|
+ files: res.imgList.map(x => ({ url: x.img })),
|
117
|
148
|
auditStatus: res.verifyStatus
|
118
|
149
|
})
|
119
|
150
|
Taro.showToast({ icon: 'none', title: '提交成功' });
|
|
@@ -127,21 +158,53 @@ export default class Profile extends Component {
|
127
|
158
|
|
128
|
159
|
|
129
|
160
|
render() {
|
130
|
|
-
|
|
161
|
+ const { images } = this.state
|
131
|
162
|
|
132
|
163
|
return (
|
133
|
|
- <View className="profile-page">
|
134
|
|
- <View className="tip">
|
135
|
|
- 建议上传相关购房资格等相关资料,最多上传8张,
|
136
|
|
- </View>
|
137
|
|
- <View className="tip">
|
138
|
|
- 审核通过后将获取更多积分、兑换好礼~
|
139
|
|
- </View>
|
140
|
|
- {this.state.auditStatus == 1 &&
|
|
164
|
+ <View className="profile-page" style={`background: url(${profileBg}) no-repeat top;background-size: 100% 100%;`}>
|
|
165
|
+
|
|
166
|
+ {/* {this.state.auditStatus == 1 &&
|
141
|
167
|
<View className="commit-text" >审核通过,快去查看积分吧~</View>
|
|
168
|
+ } */}
|
|
169
|
+ {!images.length &&
|
|
170
|
+ <View className="up-images">
|
|
171
|
+
|
|
172
|
+ <View style="margin-bottom:18px" className="up-btn" onClick={this.bindAlbumClick}>
|
|
173
|
+ <Image className="add-img" src={add} />
|
|
174
|
+ 上传资料
|
|
175
|
+ </View>
|
|
176
|
+ <View className="tip">
|
|
177
|
+ 建议上传相关购房资格等相关资料,审核
|
|
178
|
+ </View>
|
|
179
|
+ <View className="tip">
|
|
180
|
+ 通过后将获取更多积分、兑换好礼~
|
|
181
|
+ </View>
|
|
182
|
+ </View>
|
142
|
183
|
}
|
143
|
|
-
|
144
|
|
- <AtImagePicker
|
|
184
|
+ {images.length &&
|
|
185
|
+ <View>
|
|
186
|
+ <View style="padding:10px 20px">
|
|
187
|
+ <View className="up-btn" onClick={this.bindAlbumClick}>
|
|
188
|
+ <Image className="add-img" src={add} />
|
|
189
|
+ 上传资料
|
|
190
|
+ </View>
|
|
191
|
+ </View>
|
|
192
|
+ <View className="image-box">
|
|
193
|
+ {
|
|
194
|
+ images.map((item, index) => {
|
|
195
|
+ return (
|
|
196
|
+ <View className="image-con">
|
|
197
|
+ <Image className="close-btn" src={closeImg} onClick={this.deleteImg} />
|
|
198
|
+ <Image className="img" src={item} />
|
|
199
|
+ </View>
|
|
200
|
+ )
|
|
201
|
+ })
|
|
202
|
+ }
|
|
203
|
+
|
|
204
|
+ </View>
|
|
205
|
+ </View>
|
|
206
|
+ }
|
|
207
|
+ {/* <AtImagePicker
|
145
|
208
|
showAddBtn={(this.state.files.length < 8 && this.state.auditStatus == 2) || (this.state.auditStatus == 3 && this.state.files.length < 8)}
|
146
|
209
|
length={2}
|
147
|
210
|
mode="scaleToFill"
|
|
@@ -149,8 +212,9 @@ export default class Profile extends Component {
|
149
|
212
|
onChange={this.onChange.bind(this)}
|
150
|
213
|
onFail={this.onFail.bind(this)}
|
151
|
214
|
onImageClick={this.onImageClick.bind(this)}
|
152
|
|
- />
|
153
|
|
- {this.state.auditStatus == 2 &&
|
|
215
|
+ /> */}
|
|
216
|
+
|
|
217
|
+ {/* {this.state.auditStatus == 2 &&
|
154
|
218
|
<View className="commit-text" >审核未通过,请重新提交!</View>
|
155
|
219
|
}
|
156
|
220
|
|
|
@@ -159,7 +223,7 @@ export default class Profile extends Component {
|
159
|
223
|
}
|
160
|
224
|
{this.state.auditStatus == 0 &&
|
161
|
225
|
<View className="commit-text" >审核中</View>
|
162
|
|
- }
|
|
226
|
+ } */}
|
163
|
227
|
|
164
|
228
|
</View>
|
165
|
229
|
)
|