@hzab/form-render-mobile 1.2.2-beta → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hzab/form-render-mobile",
|
|
3
|
-
"version": "1.2.2
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "formily-form-render-mobile",
|
|
5
5
|
"main": "src",
|
|
6
6
|
"scripts": {
|
|
@@ -44,8 +44,7 @@
|
|
|
44
44
|
"@formily/antd-mobile": "1.0.0-beta.3",
|
|
45
45
|
"@formily/core": "2.2.29",
|
|
46
46
|
"@formily/react": "2.2.29",
|
|
47
|
-
"@hzab/data-model": "^
|
|
48
|
-
"@hzab/utils": "^1.0.4",
|
|
47
|
+
"@hzab/data-model": "^0.0.3",
|
|
49
48
|
"antd-mobile": "^5.32.0",
|
|
50
49
|
"antd-mobile-icons": "^0.2.2",
|
|
51
50
|
"nanoid": "^3.3.7",
|
|
@@ -13,7 +13,7 @@ export async function handleOssUpload(files, opt) {
|
|
|
13
13
|
const ossUpload = new OssUpload({
|
|
14
14
|
axios: opt.axios,
|
|
15
15
|
axiosConf: axiosConf,
|
|
16
|
-
serverUrl: ossUrl || "/api/v1/
|
|
16
|
+
serverUrl: ossUrl || "/api/v1/common/oss/getWebOssConfig",
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
const promise = [];
|
|
@@ -105,10 +105,10 @@ export function handleMaxCount(fileList, maxCount) {
|
|
|
105
105
|
}
|
|
106
106
|
/**判断是否私有 */
|
|
107
107
|
const isSelf = (selfUrlList, fileUrl) => {
|
|
108
|
-
let flag =
|
|
108
|
+
let flag = "?";
|
|
109
109
|
selfUrlList?.forEach((el) => {
|
|
110
110
|
if (fileUrl?.startsWith(el)) {
|
|
111
|
-
flag =
|
|
111
|
+
flag = "&";
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
114
|
return flag;
|
|
@@ -132,9 +132,7 @@ export function handleInputFileList(_fileList, maxCount = 1, opt) {
|
|
|
132
132
|
if (typeof file === "string") {
|
|
133
133
|
const uid = nanoid();
|
|
134
134
|
let thumbnailUrl = "";
|
|
135
|
-
|
|
136
|
-
thumbnailUrl = `${file}${opt?.thumbnailParams ? "?" + opt?.thumbnailParams : ""}`;
|
|
137
|
-
}
|
|
135
|
+
thumbnailUrl = `${file}${opt?.thumbnailParams ? isSelf(opt?.selfUrlList, file) + opt?.thumbnailParams : ""}`;
|
|
138
136
|
return {
|
|
139
137
|
name: uid,
|
|
140
138
|
uid: uid,
|
|
@@ -23,6 +23,7 @@ function Uploader(props, ref) {
|
|
|
23
23
|
accept,
|
|
24
24
|
disabled,
|
|
25
25
|
readOnly,
|
|
26
|
+
readPretty,
|
|
26
27
|
value,
|
|
27
28
|
baseUrl = "",
|
|
28
29
|
// 文件大小限制
|
|
@@ -42,8 +43,8 @@ function Uploader(props, ref) {
|
|
|
42
43
|
// cordova插件上传类型 cordova-plugin-chooser | cordova-plugin-camera
|
|
43
44
|
cordovaPlugin = "cordova-plugin-camera",
|
|
44
45
|
uploaderProps,
|
|
45
|
-
thumbnailParams = "
|
|
46
|
-
selfUrlList = ["https://
|
|
46
|
+
thumbnailParams = "image_process=resize,p_30",
|
|
47
|
+
selfUrlList = ["https://self-oss.abt.hzabjt.com"]
|
|
47
48
|
} = props;
|
|
48
49
|
const [loading, setLoading] = useState(false);
|
|
49
50
|
const [fileList, setFileList] = useState(handleInputFileList(value, maxCount, {
|
|
@@ -134,7 +135,6 @@ function Uploader(props, ref) {
|
|
|
134
135
|
const actions = useMemo(() => {
|
|
135
136
|
const allEnum = {
|
|
136
137
|
select: { text: "选择文件", key: "select" },
|
|
137
|
-
input: { text: "选择文件(H5)", key: "input" },
|
|
138
138
|
image: { text: "拍照", key: "captureImage" },
|
|
139
139
|
video: { text: "录像", key: "captureVideo" },
|
|
140
140
|
audio: { text: "录音", key: "captureAudio" },
|
|
@@ -192,10 +192,6 @@ function Uploader(props, ref) {
|
|
|
192
192
|
}
|
|
193
193
|
break;
|
|
194
194
|
|
|
195
|
-
case "input":
|
|
196
|
-
uploaderRef.current.click();
|
|
197
|
-
console.log("使用h5上传", uploaderRef)
|
|
198
|
-
break;
|
|
199
195
|
case "captureImage":
|
|
200
196
|
getImage(props.imgPluginOpt, props.getImgOpt).then((res) => {
|
|
201
197
|
onFileChange({
|
|
@@ -273,7 +269,7 @@ function Uploader(props, ref) {
|
|
|
273
269
|
onItemDel={onItemDel}
|
|
274
270
|
headers={headers}
|
|
275
271
|
/>
|
|
276
|
-
{disabled || readOnly || (maxCount > 0 && fileList.length >= maxCount) ? null : (
|
|
272
|
+
{disabled || readOnly || readPretty || (maxCount > 0 && fileList.length >= maxCount) ? null : (
|
|
277
273
|
<>
|
|
278
274
|
<div
|
|
279
275
|
className={`uploader-add-btn ${loading ? "uploader-add-btn-loading" : ""}`}
|