From 1e71dd86f6d0c4fc7e5143600d4bc4b50992a2a7 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Thu, 04 Jul 2024 14:51:28 +0800
Subject: [PATCH] fix: 高德密钥修改

---
 pages/actionChange/components/fileUpload.vue |   78 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 78 insertions(+), 0 deletions(-)

diff --git a/pages/actionChange/components/fileUpload.vue b/pages/actionChange/components/fileUpload.vue
new file mode 100644
index 0000000..b09c5b2
--- /dev/null
+++ b/pages/actionChange/components/fileUpload.vue
@@ -0,0 +1,78 @@
+<template>
+	<view class="">
+		<cl-upload v-model="fileList" :action="uploadTermExcelUrl" cloud-type="other" :data="{ sysCode }"
+			:headers="hearder" :image-form-data="{
+				compress: true,
+			}" :list-style="{
+				columns: 3,
+				columnGap: '10rpx',
+				rowGap: '10rpx',
+				padding: '10rpx',
+				radius: '20rpx'
+			}" use-before-delete @beforeDelete="beforeDelete" @onSuccess="onSuccess" />
+		</cl-upload>
+	</view>
+</template>
+<script>
+	export default {
+		props: {
+			sysCode: {
+				type: String,
+			},
+		},
+		data() {
+			return {
+				fileList: [],
+				upLoadList: [],
+				beforFileList: [],
+				baseUrl: this.$storage.get('baseUrl'),
+				token: '',
+			}
+		},
+		created() {
+			this.token = uni.getStorageSync('tonken')
+		},
+		computed: {
+			uploadTermExcelUrl() {
+				return `${this.baseUrl}/file/upload` || ''
+			},
+			hearder() {
+				let obj = {
+					token: this.token,
+					Authorization: this.token
+				}
+				return obj
+			},
+		},
+		methods: {
+			onSuccess(res) {
+				let fileId = res.data.fileId
+				let name = res.data.fileType === 1 ? 'name.png' : ''
+				this.fileList.push(`${this.baseUrl}/file/preview/${fileId}?${name}`) // ������
+				this.upLoadList.push(res.data)
+				this.$emit('handleFile', this.upLoadList)
+			},
+			/**
+			 * ���������������
+			 * @param {Object} item ���������������������������������������
+			 * @param {Number} index ������������������������������������
+			 * @param {Function} next ���������������������������������������������
+			 * */
+			beforeDelete(item, index, next) {
+				uni.showModal({
+					title: '������������',
+					content: '���������������������������������',
+					success: res => {
+						if (res.confirm) {
+							this.fileList.splice(index, 1)
+							this.upLoadList.splice(index, 1)
+							console.log('this.fileList', this.upLoadList)
+							this.$emit('handleFile', this.upLoadList)
+						}
+					}
+				})
+			},
+		},
+	}
+</script>
+<style></style>
\ No newline at end of file

--
Gitblit v1.8.0