diff --git a/App.vue b/App.vue
index 326d821..2c8ce4a 100644
--- a/App.vue
+++ b/App.vue
@@ -196,6 +196,10 @@ page {
padding-top: 10rpx;
}
+.pt-12 {
+ padding-top: 24rpx;
+}
+
.pt-15 {
padding-top: 30rpx;
}
@@ -251,6 +255,10 @@ page {
margin-bottom: 20rpx;
}
+.mt-5 {
+ margin-top: 10rpx;
+}
+
.mt-10 {
margin-top: 20rpx;
}
diff --git a/components/form-template/form-cell/form-positive-find.vue b/components/form-template/form-cell/form-positive-find.vue
new file mode 100644
index 0000000..3ff8c3a
--- /dev/null
+++ b/components/form-template/form-cell/form-positive-find.vue
@@ -0,0 +1,89 @@
+
+
+
+
+ {{ name || '阳性发现' }}
+
+
+
+
+
+
+
+ {{ idx + 1 }}、阳性发现
+
+
+
+
+
+
+
+ {{ idx + 1 }}、处理意见
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/form-template/form-cell/form-upload.vue b/components/form-template/form-cell/form-upload.vue
index 2fdcb00..1296be0 100644
--- a/components/form-template/form-cell/form-upload.vue
+++ b/components/form-template/form-cell/form-upload.vue
@@ -6,11 +6,12 @@
+
-
+
@@ -48,26 +49,72 @@ const files = computed(() => value.value.map(i => {
url: i.url,
name: i.name,
type: i.type,
- isImage: /image/i.test(i.type)
+ isImage: /image/i.test(i.type),
+ isPdf: /application\/pdf/i.test(i.type),
}
}))
-function addImage() {
- uni.chooseImage({
- count: 1,
+function addFile() {
+ wx.chooseMessageFile({
+ count: 1, // 最多选择1个文件
+ type: 'all', // 所有类型文件
success: async (res) => {
+ const file = res.tempFiles[0];
+ const { path, name, size } = file;
+ const type = checkFileValid(name, size);
+ // 检查文件类型和大小
+ if (!type) return;
loading();
- const result = await upload(res.tempFilePaths[0]);
+ const result = await upload(path);
hideLoading();
if (result) {
- change([...value.value, { url: result, type: 'image/png' }])
+ change([...value.value, { url: result, type }])
} else {
toast('上传失败')
}
+ },
+ fail: (err) => {
+ toast('上传失败')
}
})
}
+function checkFileValid(fileName, fileSize) {
+ // 获取文件扩展名
+ const ext = fileName.split('.').pop().toLowerCase();
+ // 文件大小限制 (10MB)
+ const maxSize = 10 * 1024 * 1024;
+ if (fileSize > maxSize) {
+ toast('文件大小不能超过10MB')
+ return false;
+ }
+
+ if (['jpg', 'jpeg', 'png'].includes(ext)) {
+ return 'image/png'
+ }
+ if (ext === 'pdf') {
+ return 'application/pdf'
+ }
+ toast('仅支持图片或PDF')
+ return false;
+}
+
+// function addImage() {
+// uni.chooseImage({
+// count: 1,
+// success: async (res) => {
+// loading();
+// const result = await upload(res.tempFilePaths[0]);
+// hideLoading();
+// if (result) {
+// change([...value.value, { url: result, type: 'image/png' }])
+// } else {
+// toast('上传失败')
+// }
+// }
+// })
+// }
+
function change(value) {
emits('change', {
title: props.title,
diff --git a/components/form-template/form-cell/index.vue b/components/form-template/form-cell/index.vue
index e00418d..d4b9b87 100644
--- a/components/form-template/form-cell/index.vue
+++ b/components/form-template/form-cell/index.vue
@@ -1,5 +1,5 @@
-
+
+