From 85832c85a73adfbef540b57777791cfaa2776727 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 20 十一月 2025 10:27:23 +0800
Subject: [PATCH] fix: 优化绞线报工
---
src/pages/production/twist/attachment/index.vue | 81 +---------------------------------------
1 files changed, 3 insertions(+), 78 deletions(-)
diff --git a/src/pages/production/twist/attachment/index.vue b/src/pages/production/twist/attachment/index.vue
index 0d17e10..f601172 100644
--- a/src/pages/production/twist/attachment/index.vue
+++ b/src/pages/production/twist/attachment/index.vue
@@ -36,23 +36,6 @@
</view>
</template>
- <!-- 瑙嗛棰勮 -->
- <template v-else-if="isVideoType(item.url)">
- <video
- v-if="!item.loadError"
- :src="getFullUrl(item.url)"
- class="media-preview"
- :controls="false"
- :show-center-play-btn="false"
- @error="onVideoError(item)"
- />
- <!-- 瑙嗛鍔犺浇澶辫触鏄剧ず榛樿鍥炬爣 -->
- <view v-else class="file-icon-wrapper">
- <wd-icon name="video" size="48px" color="#ccc" />
- <text class="file-name error-text">鍔犺浇澶辫触</text>
- </view>
- </template>
-
<!-- 鍏朵粬鏂囦欢绫诲瀷鏄剧ず鍥炬爣 -->
<view v-else class="file-icon-wrapper">
<wd-icon name="file-outline" size="48px" color="#999" />
@@ -91,7 +74,7 @@
const detailData = ref<any>({});
-// 鑾峰彇瀹屾暣鐨勫浘鐗�/瑙嗛 URL
+// 鑾峰彇瀹屾暣鐨勫浘鐗� URL
const getFullUrl = (url: string) => {
if (!url) return "";
// 濡傛灉宸茬粡鏄畬鏁寸殑 URL锛坔ttp 鎴� https 寮�澶达級锛岀洿鎺ヨ繑鍥�
@@ -118,12 +101,6 @@
return ["jpg", "jpeg", "png", "gif", "bmp", "webp"].includes(extension);
};
-// 鍒ゆ柇鏄惁涓鸿棰戠被鍨�
-const isVideoType = (urlOrFileName: string) => {
- const extension = getExtension(urlOrFileName);
- return ["mp4", "mov", "avi", "wmv", "flv", "mkv", "webm"].includes(extension);
-};
-
// 鍥剧墖鍔犺浇鎴愬姛
const onImageLoad = (item: any) => {
item.loadError = false;
@@ -132,12 +109,6 @@
// 鍥剧墖鍔犺浇澶辫触
const onImageError = (item: any) => {
console.error("鍥剧墖鍔犺浇澶辫触:", item.url);
- item.loadError = true;
-};
-
-// 瑙嗛鍔犺浇澶辫触
-const onVideoError = (item: any) => {
- console.error("瑙嗛鍔犺浇澶辫触:", item.url);
item.loadError = true;
};
@@ -178,20 +149,14 @@
const addAttachment = () => {
// 鏄剧ず閫夋嫨鏂囦欢绫诲瀷鐨勫脊绐�
uni.showActionSheet({
- itemList: ["閫夋嫨鍥剧墖", "閫夋嫨瑙嗛", "鎷嶇収", "褰曞儚"],
+ itemList: ["閫夋嫨鍥剧墖", "鎷嶇収"],
success: (res) => {
switch (res.tapIndex) {
case 0: // 閫夋嫨鍥剧墖
chooseImages();
break;
- case 1: // 閫夋嫨瑙嗛
- chooseVideos();
- break;
- case 2: // 鎷嶇収
+ case 1: // 鎷嶇収
takePhoto();
- break;
- case 3: // 褰曞儚
- recordVideo();
break;
}
},
@@ -219,22 +184,6 @@
});
};
-// 閫夋嫨瑙嗛
-const chooseVideos = () => {
- uni.chooseVideo({
- sourceType: ["album"],
- maxDuration: 60,
- camera: "back",
- success: async (res) => {
- await handleFileUpload([res.tempFilePath]);
- },
- fail: (error) => {
- console.error("閫夋嫨瑙嗛澶辫触:", error);
- toast.show("閫夋嫨瑙嗛澶辫触");
- },
- });
-};
-
// 鎷嶇収
const takePhoto = () => {
uni.chooseImage({
@@ -248,22 +197,6 @@
fail: (error) => {
console.error("鎷嶇収澶辫触:", error);
toast.show("鎷嶇収澶辫触");
- },
- });
-};
-
-// 褰曞儚
-const recordVideo = () => {
- uni.chooseVideo({
- sourceType: ["camera"],
- maxDuration: 60,
- camera: "back",
- success: async (res) => {
- await handleFileUpload([res.tempFilePath]);
- },
- fail: (error) => {
- console.error("褰曞儚澶辫触:", error);
- toast.show("褰曞儚澶辫触");
},
});
};
@@ -382,14 +315,6 @@
case "bmp":
case "webp":
return "image";
- case "mp4":
- case "mov":
- case "avi":
- case "wmv":
- case "flv":
- case "mkv":
- case "webm":
- return "video";
case "pdf":
return "pdf";
case "doc":
--
Gitblit v1.9.3