From 9bce51f651aad297ef9eb6df832bfdaf1de05d84 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 22 四月 2026 14:27:54 +0800
Subject: [PATCH] 青岛推送

---
 node_modules/@dcloudio/uni-ui/lib/uni-file-picker/uni-file-picker.vue |   86 ++++++++++++++++++++++++------------------
 1 files changed, 49 insertions(+), 37 deletions(-)

diff --git a/node_modules/@dcloudio/uni-ui/lib/uni-file-picker/uni-file-picker.vue b/node_modules/@dcloudio/uni-ui/lib/uni-file-picker/uni-file-picker.vue
index 785c7eb..cf67ac7 100644
--- a/node_modules/@dcloudio/uni-ui/lib/uni-file-picker/uni-file-picker.vue
+++ b/node_modules/@dcloudio/uni-ui/lib/uni-file-picker/uni-file-picker.vue
@@ -4,19 +4,13 @@
 			<text class="file-title">{{ title }}</text>
 			<text class="file-count">{{ filesList.length }}/{{ limitLength }}</text>
 		</view>
-		<upload-image v-if="fileMediatype === 'image' && showType === 'grid'" :readonly="readonly"
-			:image-styles="imageStyles" :files-list="filesList" :limit="limitLength" :disablePreview="disablePreview"
-			:delIcon="delIcon" @uploadFiles="uploadFiles" @choose="choose" @delFile="delFile">
+		<upload-image v-if="fileMediatype === 'image' && showType === 'grid'" :readonly="readonly" :image-styles="imageStyles" :files-list="filesList" :limit="limitLength" :disablePreview="disablePreview" :delIcon="delIcon" @uploadFiles="uploadFiles" @choose="choose" @delFile="delFile">
 			<slot>
-				<view class="is-add">
-					<view class="icon-add"></view>
-					<view class="icon-add rotate"></view>
-				</view>
+				<view class="icon-add"></view>
+				<view class="icon-add rotate"></view>
 			</slot>
 		</upload-image>
-		<upload-file v-if="fileMediatype !== 'image' || showType !== 'grid'" :readonly="readonly"
-			:list-styles="listStyles" :files-list="filesList" :showType="showType" :delIcon="delIcon"
-			@uploadFiles="uploadFiles" @choose="choose" @delFile="delFile">
+		<upload-file v-if="fileMediatype !== 'image' || showType !== 'grid'" :readonly="readonly" :list-styles="listStyles" :files-list="filesList" :showType="showType" :delIcon="delIcon" @uploadFiles="uploadFiles" @choose="choose" @delFile="delFile">
 			<slot><button type="primary" size="mini">閫夋嫨鏂囦欢</button></slot>
 		</upload-file>
 	</view>
@@ -183,18 +177,23 @@
 			sourceType: {
 				type: Array,
 				default () {
-					return  ['album', 'camera']
+					return ['album', 'camera']
 				}
 			},
 			provider: {
 				type: String,
 				default: '' // 榛樿涓婁紶鍒� unicloud 鍐呯疆瀛樺偍 extStorage 鎵╁睍瀛樺偍
+			},
+			dir: {
+				type: String,
+				default: ''
 			}
 		},
 		data() {
 			return {
 				files: [],
-				localValue: []
+				localValue: [],
+				dirPath: ''
 			}
 		},
 		watch: {
@@ -207,6 +206,12 @@
 			modelValue: {
 				handler(newVal, oldVal) {
 					this.setValue(newVal, oldVal)
+				},
+				immediate: true
+			},
+			dir: {
+				handler(newVal) {
+					this.dirPath = newVal
 				},
 				immediate: true
 			},
@@ -284,19 +289,19 @@
 				return this.uploadFiles(files)
 			},
 			async setValue(newVal, oldVal) {
-				const newData =  async (v) => {
+				const newData = async (v) => {
 					const reg = /cloud:\/\/([\w.]+\/?)\S*/
 					let url = ''
-					if(v.fileID){
+					if (v.fileID) {
 						url = v.fileID
-					}else{
+					} else {
 						url = v.url
 					}
 					if (reg.test(url)) {
 						v.fileID = url
 						v.url = await this.getTempFileURL(url)
 					}
-					if(v.url) v.path = v.url
+					if (v.url) v.path = v.url
 					return v
 				}
 				if (this.returnType === 'object') {
@@ -307,13 +312,13 @@
 					}
 				} else {
 					if (!newVal) newVal = []
-					for(let i =0 ;i < newVal.length ;i++){
+					for (let i = 0; i < newVal.length; i++) {
 						let v = newVal[i]
 						await newData(v)
 					}
 				}
 				this.localValue = newVal
-				if (this.form && this.formItem &&!this.is_reset) {
+				if (this.form && this.formItem && !this.is_reset) {
 					this.is_reset = false
 					this.formItem.setValue(this.localValue)
 				}
@@ -370,7 +375,9 @@
 			 * @param {Object} res
 			 */
 			async chooseFileCallback(res) {
+
 				const _extname = get_extname(this.fileExtname)
+
 				const is_one = (Number(this.limitLength) === 1 &&
 						this.disablePreview &&
 						!this.disabled) ||
@@ -396,11 +403,13 @@
 					let filedata = await get_file_data(files[i], this.fileMediatype)
 					filedata.progress = 0
 					filedata.status = 'ready'
-					this.files.push(filedata)
-					currentData.push({
+					// fix by mehaotian ,缁熶竴杩斿洖锛屽垹闄や篃鍖呭惈file瀵硅薄
+					let fileTempData = {
 						...filedata,
 						file: files[i]
-					})
+					}
+					this.files.push(fileTempData)
+					currentData.push(fileTempData)
 				}
 				this.$emit('select', {
 					tempFiles: currentData,
@@ -411,13 +420,24 @@
 				if (!this.autoUpload || this.noSpace) {
 					res.tempFiles = []
 				}
-				res.tempFiles.forEach((fileItem, index) => {
+				res.tempFiles.map((fileItem, index) => {
 					this.provider && (fileItem.provider = this.provider);
 					const fileNameSplit = fileItem.name.split('.')
 					const ext = fileNameSplit.pop()
 					const fileName = fileNameSplit.join('.').replace(/[\s\/\?<>\\:\*\|":]/g, '_')
-					fileItem.cloudPath = fileName + '_' + Date.now() + '_' + index + '.' + ext
+					// 閫夋嫨鏂囦欢鐩綍涓婁紶
+					let dir = this.dirPath || ''; // 闃叉鐢ㄦ埛浼犲叆鐨� dir 涓嶆甯�
+					// 妫�鏌ユ渶鍚庝竴涓瓧绗︽槸鍚︿负 '/'锛堝悓鏃跺鐞嗙┖瀛楃涓叉儏鍐碉級
+					if (dir && dir[dir.length - 1] !== '/') {
+						dir += '/';
+					}
+
+					fileItem.cloudPath = dir + fileName + '_' + Date.now() + '_' + index + '.' + ext
+					fileItem.cloudPathAsRealPath = true
+
+					return fileItem
 				})
+				return res
 			},
 
 			/**
@@ -464,7 +484,7 @@
 						const reg = /cloud:\/\/([\w.]+\/?)\S*/
 						if (reg.test(item.url)) {
 							this.files[index].url = await this.getTempFileURL(item.url)
-						}else{
+						} else {
 							this.files[index].url = item.url
 						}
 
@@ -553,7 +573,7 @@
 				let data = []
 				if (this.returnType === 'object') {
 					data = this.backObject(this.files)[0]
-					this.localValue = data?data:null
+					this.localValue = data ? data : null
 				} else {
 					data = this.backObject(this.files)
 					if (!this.localValue) {
@@ -583,12 +603,12 @@
 						name: v.name,
 						path: v.path,
 						size: v.size,
-						fileID:v.fileID,
+						fileID: v.fileID,
 						url: v.url,
 						// 淇敼鍒犻櫎涓�涓枃浠跺悗涓嶈兘鍐嶄笂浼犵殑bug, #694
-            uuid: v.uuid,
-            status: v.status,
-            cloudPath: v.cloudPath
+						uuid: v.uuid,
+						status: v.status,
+						cloudPath: v.cloudPath
 					})
 				})
 				return newFilesData
@@ -644,14 +664,6 @@
 	.file-count {
 		font-size: 14px;
 		color: #999;
-	}
-
-	.is-add {
-		/* #ifndef APP-NVUE */
-		display: flex;
-		/* #endif */
-		align-items: center;
-		justify-content: center;
 	}
 
 	.icon-add {

--
Gitblit v1.9.3