|
@@ -18,47 +18,50 @@ export default (props) => {
|
18
|
18
|
e.stopPropagation();
|
19
|
19
|
|
20
|
20
|
if (disabled) return;
|
21
|
|
-
|
|
21
|
+
|
22
|
22
|
setLoading(true);
|
23
|
23
|
|
24
|
24
|
// eslint-disable-next-line no-undef
|
25
|
|
- SmartCity.chooseImage({
|
26
|
|
- count : 1 // 图片张数
|
27
|
|
- },function(res){
|
28
|
|
- console.log("--------上传图片---------", res);
|
29
|
|
- const base64 = res[0].imageData;
|
30
|
|
- const fileName = res[0].name;
|
31
|
|
- const fileType = res[0].type;
|
32
|
|
-
|
33
|
|
- uploadFileBase64(base64, fileName, fileType).then(resp => {
|
34
|
|
- setLoading(false);
|
35
|
|
- onChange((value || []).concat(resp));
|
36
|
|
- }).catch((err) => {
|
|
25
|
+ if (IS_APP_CLIENT) {
|
|
26
|
+ // eslint-disable-next-line no-undef
|
|
27
|
+ SmartCity.chooseImage({
|
|
28
|
+ count : 1 // 图片张数
|
|
29
|
+ },function(res){
|
|
30
|
+ console.log("--------上传图片---------", res);
|
|
31
|
+ const base64 = res[0].imageData;
|
|
32
|
+ const fileName = res[0].name;
|
|
33
|
+ const fileType = res[0].type;
|
|
34
|
+
|
|
35
|
+ uploadFileBase64(base64, fileName, fileType).then(resp => {
|
|
36
|
+ setLoading(false);
|
|
37
|
+ onChange((value || []).concat(resp));
|
|
38
|
+ }).catch((err) => {
|
|
39
|
+ console.error(err);
|
|
40
|
+ setLoading(false);
|
|
41
|
+ });
|
|
42
|
+ });
|
|
43
|
+ } else {
|
|
44
|
+ Taro.chooseMedia({
|
|
45
|
+ maxDuration: 60,
|
|
46
|
+ // sizeType: "compressed",
|
|
47
|
+ success: (res) => {
|
|
48
|
+ const { tempFiles } = res;
|
|
49
|
+ uploadFiles(tempFiles)
|
|
50
|
+ .then((resp) => {
|
|
51
|
+ setLoading(false);
|
|
52
|
+ onChange((value || []).concat(resp));
|
|
53
|
+ })
|
|
54
|
+ .catch((err) => {
|
|
55
|
+ console.error(err);
|
|
56
|
+ setLoading(false);
|
|
57
|
+ });
|
|
58
|
+ },
|
|
59
|
+ fail: (err) => {
|
37
|
60
|
console.error(err);
|
38
|
61
|
setLoading(false);
|
39
|
|
- });
|
40
|
|
- });
|
41
|
|
-
|
42
|
|
- // Taro.chooseMedia({
|
43
|
|
- // maxDuration: 60,
|
44
|
|
- // // sizeType: "compressed",
|
45
|
|
- // success: (res) => {
|
46
|
|
- // const { tempFiles } = res;
|
47
|
|
- // uploadFiles(tempFiles)
|
48
|
|
- // .then((resp) => {
|
49
|
|
- // setLoading(false);
|
50
|
|
- // onChange((value || []).concat(resp));
|
51
|
|
- // })
|
52
|
|
- // .catch((err) => {
|
53
|
|
- // console.error(err);
|
54
|
|
- // setLoading(false);
|
55
|
|
- // });
|
56
|
|
- // },
|
57
|
|
- // fail: (err) => {
|
58
|
|
- // console.error(err);
|
59
|
|
- // setLoading(false);
|
60
|
|
- // },
|
61
|
|
- // });
|
|
62
|
+ },
|
|
63
|
+ });
|
|
64
|
+ }
|
62
|
65
|
};
|
63
|
66
|
|
64
|
67
|
const onDelete = (item) => {
|