|
@@ -1,10 +1,9 @@
|
1
|
|
-import React, { useState } from "react";
|
|
1
|
+import React, { useState, useRef } from "react";
|
2
|
2
|
import Taro, { useDidShow } from "@tarojs/taro";
|
3
|
3
|
import "./index.scss";
|
4
|
4
|
import { View, Text, Input, Image } from "@tarojs/components";
|
5
|
5
|
import Tab from "../../compents/tab/index";
|
6
|
6
|
import Tags from "../../compents/tags/index";
|
7
|
|
-import { AtImagePicker } from "taro-ui";
|
8
|
7
|
import request, { uploadFiles } from "../../util/request";
|
9
|
8
|
import uploadicon from "../../assets/uploadicon.png";
|
10
|
9
|
import IsLogin from "../../layout/IsLogin";
|
|
@@ -80,13 +79,27 @@ const batchimport = props => {
|
80
|
79
|
success: res => {
|
81
|
80
|
const tempFilePaths = res.tempFilePaths;
|
82
|
81
|
|
|
82
|
+ Taro.showLoading({title: '请稍候...'})
|
|
83
|
+
|
83
|
84
|
uploadFiles(tempFilePaths, "/api/mp/taMetaImage").then(res1 => {
|
84
|
|
- setImgUrl(res1);
|
85
|
|
- });
|
|
85
|
+ setImgUrl(imgUrl.concat(res1));
|
|
86
|
+ Taro.hideLoading()
|
|
87
|
+ }).catch(err => Taro.hideLoading());
|
86
|
88
|
}
|
87
|
89
|
});
|
88
|
90
|
};
|
89
|
91
|
|
|
92
|
+ const handleImageDelete = row => {
|
|
93
|
+ Taro.showModal({
|
|
94
|
+ content: '确认删除当前图片?',
|
|
95
|
+ success: res => {
|
|
96
|
+ if (res.confirm) {
|
|
97
|
+ setImgUrl(imgUrl.filter(x => x.imageId !== row.imageId))
|
|
98
|
+ }
|
|
99
|
+ }
|
|
100
|
+ })
|
|
101
|
+ }
|
|
102
|
+
|
90
|
103
|
return (
|
91
|
104
|
<IsLogin>
|
92
|
105
|
<View className="batchimport">
|
|
@@ -97,9 +110,9 @@ const batchimport = props => {
|
97
|
110
|
className="at-row at-row--wrap at-row__justify--center"
|
98
|
111
|
style={{ marginTop: "0.15rem" }}
|
99
|
112
|
>
|
100
|
|
- {labelList.map((item, index) => {
|
|
113
|
+ {labelList.map(item => {
|
101
|
114
|
return (
|
102
|
|
- <View className="at-col at-col-4" key={index}>
|
|
115
|
+ <View className="at-col at-col-4" key={item.name}>
|
103
|
116
|
<View className="tags-btn">{item.name}</View>
|
104
|
117
|
</View>
|
105
|
118
|
);
|
|
@@ -127,6 +140,7 @@ const batchimport = props => {
|
127
|
140
|
<View
|
128
|
141
|
className="at-col at-col-3"
|
129
|
142
|
style={{ padding: "3px", height: "94px" }}
|
|
143
|
+ key={x.imageId}
|
130
|
144
|
>
|
131
|
145
|
<Image
|
132
|
146
|
className="guide-view-img"
|
|
@@ -135,7 +149,7 @@ const batchimport = props => {
|
135
|
149
|
height: "100%"
|
136
|
150
|
}}
|
137
|
151
|
mode="aspectFit"
|
138
|
|
- onClick={() => onUpImage()}
|
|
152
|
+ onClick={() => handleImageDelete(x)}
|
139
|
153
|
src={x.image}
|
140
|
154
|
></Image>
|
141
|
155
|
</View>
|
|
@@ -177,7 +191,7 @@ const batchimport = props => {
|
177
|
191
|
<View style={{ padding: "0 20px" }}>
|
178
|
192
|
{tagList.map((item, index) => {
|
179
|
193
|
return (
|
180
|
|
- <View className="material-card">
|
|
194
|
+ <View className="material-card" key={item.name}>
|
181
|
195
|
<Text>{item.name}</Text>
|
182
|
196
|
<Tags
|
183
|
197
|
list={item.taMateTagList}
|
|
@@ -200,6 +214,7 @@ const batchimport = props => {
|
200
|
214
|
},
|
201
|
215
|
e => {
|
202
|
216
|
if (labelList.length > 0) setPageState("2");
|
|
217
|
+ setImgUrl([])
|
203
|
218
|
}
|
204
|
219
|
]}
|
205
|
220
|
></Tab>
|