浏览代码

图片上传接口修改upload改为aliyunUpload

htc 3 月之前
父节点
当前提交
92cf74a77d

文件差异内容过多而无法显示
+ 536 - 536
pages/HotelMerchandise/addCommodity.vue


+ 1 - 1
pages/my/houseList.vue

@@ -157,7 +157,7 @@
 				console.log(url)
 				return new Promise((resolve, reject) => {
 					let a = uni.uploadFile({
-						url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload',
+						url: 'https://i.ringzle.com/island-cloud-server/oss/file/aliyunUpload',
 						filePath: url,
 						name: 'file',
 						header: {

文件差异内容过多而无法显示
+ 618 - 618
pages/my/houseList1.vue


+ 6 - 6
pagesHouse/Mine/Businesses/Businesses.vue

@@ -293,7 +293,7 @@
 					success: chooseImageRes => {
 						const tempFilePaths = chooseImageRes.tempFilePaths;
 						uni.uploadFile({
-							url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
+							url: 'https://i.ringzle.com/island-cloud-server/oss/file/aliyunUpload', // 仅为示例,非真实的接口地址
 							filePath: tempFilePaths[0],
 							name: 'file',
 							header: {
@@ -320,7 +320,7 @@
 					success: chooseImageRes => {
 						const tempFilePaths = chooseImageRes.tempFilePaths;
 						uni.uploadFile({
-							url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
+							url: 'https://i.ringzle.com/island-cloud-server/oss/file/aliyunUpload', // 仅为示例,非真实的接口地址
 							filePath: tempFilePaths[0],
 							name: 'file',
 							header: {
@@ -346,7 +346,7 @@
 					success: chooseImageRes => {
 						const tempFilePaths = chooseImageRes.tempFilePaths;
 						uni.uploadFile({
-							url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
+							url: 'https://i.ringzle.com/island-cloud-server/oss/file/aliyunUpload', // 仅为示例,非真实的接口地址
 							filePath: tempFilePaths[0],
 							name: 'file',
 							header: {
@@ -372,7 +372,7 @@
 			// 		success: chooseImageRes => {
 			// 			const tempFilePaths = chooseImageRes.tempFilePaths;
 			// 			uni.uploadFile({
-			// 				url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
+			// 				url: 'https://i.ringzle.com/island-cloud-server/oss/file/aliyunUpload', // 仅为示例,非真实的接口地址
 			// 				filePath: tempFilePaths[0],
 			// 				name: 'file',
 			// 				header: {
@@ -398,7 +398,7 @@
 					success: chooseImageRes => {
 						const tempFilePaths = chooseImageRes.tempFilePaths;
 						uni.uploadFile({
-							url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
+							url: 'https://i.ringzle.com/island-cloud-server/oss/file/aliyunUpload', // 仅为示例,非真实的接口地址
 							filePath: tempFilePaths[0],
 							name: 'file',
 							header: {
@@ -424,7 +424,7 @@
 					success: chooseImageRes => {
 						const tempFilePaths = chooseImageRes.tempFilePaths;
 						uni.uploadFile({
-							url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
+							url: 'https://i.ringzle.com/island-cloud-server/oss/file/aliyunUpload', // 仅为示例,非真实的接口地址
 							filePath: tempFilePaths[0],
 							name: 'file',
 							header: {

+ 6 - 6
pagesHouse/Mine/Businesses/Catering.vue

@@ -301,7 +301,7 @@
 					success: chooseImageRes => {
 						const tempFilePaths = chooseImageRes.tempFilePaths;
 						uni.uploadFile({
-							url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
+							url: 'https://i.ringzle.com/island-cloud-server/oss/file/aliyunUpload', // 仅为示例,非真实的接口地址
 							filePath: tempFilePaths[0],
 							name: 'file',
 							header: {
@@ -328,7 +328,7 @@
 					success: chooseImageRes => {
 						const tempFilePaths = chooseImageRes.tempFilePaths;
 						uni.uploadFile({
-							url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
+							url: 'https://i.ringzle.com/island-cloud-server/oss/file/aliyunUpload', // 仅为示例,非真实的接口地址
 							filePath: tempFilePaths[0],
 							name: 'file',
 							header: {
@@ -354,7 +354,7 @@
 					success: chooseImageRes => {
 						const tempFilePaths = chooseImageRes.tempFilePaths;
 						uni.uploadFile({
-							url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
+							url: 'https://i.ringzle.com/island-cloud-server/oss/file/aliyunUpload', // 仅为示例,非真实的接口地址
 							filePath: tempFilePaths[0],
 							name: 'file',
 							header: {
@@ -380,7 +380,7 @@
 			// 		success: chooseImageRes => {
 			// 			const tempFilePaths = chooseImageRes.tempFilePaths;
 			// 			uni.uploadFile({
-			// 				url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
+			// 				url: 'https://i.ringzle.com/island-cloud-server/oss/file/aliyunUpload', // 仅为示例,非真实的接口地址
 			// 				filePath: tempFilePaths[0],
 			// 				name: 'file',
 			// 				header: {
@@ -406,7 +406,7 @@
 					success: chooseImageRes => {
 						const tempFilePaths = chooseImageRes.tempFilePaths;
 						uni.uploadFile({
-							url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
+							url: 'https://i.ringzle.com/island-cloud-server/oss/file/aliyunUpload', // 仅为示例,非真实的接口地址
 							filePath: tempFilePaths[0],
 							name: 'file',
 							header: {
@@ -432,7 +432,7 @@
 					success: chooseImageRes => {
 						const tempFilePaths = chooseImageRes.tempFilePaths;
 						uni.uploadFile({
-							url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
+							url: 'https://i.ringzle.com/island-cloud-server/oss/file/aliyunUpload', // 仅为示例,非真实的接口地址
 							filePath: tempFilePaths[0],
 							name: 'file',
 							header: {

+ 1 - 1
pagesHouse/Mine/PersonalEditing/PersonalEditing.vue

@@ -126,7 +126,7 @@
 						this.$api.detectionContent(tempFilePaths[0], 2).then(result => {
 							if (result.code === 0) {
 								uni.uploadFile({
-									url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
+									url: 'https://i.ringzle.com/island-cloud-server/oss/file/aliyunUpload', // 仅为示例,非真实的接口地址
 									filePath: tempFilePaths[0],
 									name: 'file',
 									header: {

+ 1 - 1
pagesMy/stayInfo/roomPosition.vue

@@ -234,7 +234,7 @@
 			uploadFilePromise(url) {
 				return new Promise((resolve, reject) => {
 					let a = uni.uploadFile({
-						url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
+						url: 'https://i.ringzle.com/island-cloud-server/oss/file/aliyunUpload', // 仅为示例,非真实的接口地址
 						filePath: url,
 						name: 'file',
 						formData: {

+ 270 - 270
pagesMy/stayInfo/stayInfo.vue

@@ -1,271 +1,271 @@
-<template>
-	<view class="pages" :style="{'height':(h)+'px','padding-top':mt+'px'}">
-		<c-nav-bar title="酒店民宿信息" :showIcon="true"></c-nav-bar>
-		<view class="content">
-			<view class="card" @click="goToPosition()">
-				<text class="label">位置定位</text>
-				<u-icon name="arrow-right" size="24"></u-icon>
-			</view>
-			<view class="card">
-				<text class="label">联系电话</text>
-				<u--input inputAlign="right" placeholder="请输入内容" border="none" v-model="stayInfo.landlinePhone"
-					style="text-align: right;"></u--input>
-			</view>
-			<view class="card c2">
-				<view class="tit">酒店简介</view>
-				<view>
-					<u--textarea customStyle="font-size:28rpx;line-height:28rpx" border='none' maxlength="300" count
-						v-model="stayInfo.introduction" :value="stayInfo.introduction" placeholder="请输入酒店简介"
-						height='360'></u--textarea>
-				</view>
-			</view>
-			<view class="card c2">
-				<view class="tit">内饰照片</view>
-				<view class="imgs">
-					<!-- <image src="" v-for="(item,index) in imgUrlList" :key="index"></image> -->
-					<u-upload ref="uUpload" uploadText="上传图片" :fileList="imgUrlList" :maxSize="10 * 1024 * 1024"
-						width="180" height="120" @afterRead="afterRead" @delete="deletePic">
-					</u-upload>
-				</view>
-			</view>
-		</view>
-		<view class="bottom">
-			<view class="btn" @click="save()">
-				确定
-			</view>
-		</view>
-	</view>
-</template>
-
-<script>
-	export default {
-		data() {
-			return {
-				homestayId: uni.getStorageSync('homestayId') || 0,
-				value: '',
-				value1: '',
-				fileList: [],
-				fileList1: [],
-				imgUrlList: [],
-				fileList2: [],
-				stayInfo: {
-					picList: []
-				},
-
-			}
-		},
-		onLoad() {
-			this.getStayInfo()
-		},
-		filters: {
-			// 去除富文本标签样式
-			removeHtmlStyle(html) {
-				const relStyle = /style\s*?=\s*?(['"])[\s\S]*?\1/g
-				const relTag = /<.+?>/g
-				const relClass = /class\s*?=\s*?(['"])[\s\S]*?\1/g
-				let newHtml = ''
-				if (html) {
-					newHtml = html.replace(relStyle, '')
-					newHtml = newHtml.replace(relTag, '')
-					newHtml = newHtml.replace(relClass, '')
-				}
-				return newHtml
-			}
-		},
-		methods: {
-
-			goToPosition() {
-				const qwe = JSON.stringify(this.stayInfo)
-				uni.navigateTo({
-					url: '/pagesMy/stayInfo/roomPosition?item=' + JSON.stringify(this.stayInfo)
-				})
-			},
-			getStayInfo() {
-				this.$api.get('/merchant/hotel/mine/getMerchantHomestayInfo/' + this.homestayId).then(res => {
-					if (res.data.code == 0) {
-						this.stayInfo = res.data.data;
-						this.stayInfo.picList.forEach((item) => {
-							this.imgUrlList.push({
-								url: item
-							})
-						})
-					}
-				})
-			},
-			// 删除图片
-			deletePic(event) {
-				this.imgUrlList.splice(event.index, 1)
-			},
-			// 新增图片
-			async afterRead(event) {
-				let lists = [].concat(event.file)
-				let fileListLen = this.imgUrlList.length
-				lists.map((item) => {
-					this.imgUrlList.push({
-						...item,
-						status: 'uploading',
-						message: '上传中'
-					})
-				})
-				for (let i = 0; i < lists.length; i++) {
-					const result = await this.uploadFilePromise(lists[i].url)
-					let item = this.imgUrlList[fileListLen]
-					this.imgUrlList.splice(fileListLen, 1, Object.assign(item, {
-						status: 'success',
-						message: '',
-						url: result
-					}))
-					fileListLen++
-				}
-				console.log(this.imgUrlList)
-			},
-			uploadFilePromise(url) {
-				return new Promise((resolve, reject) => {
-					let a = uni.uploadFile({
-						url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
-						filePath: url,
-						name: 'file',
-						formData: {
-							user: 'test'
-						},
-						success: (res) => {
-							console.log(res)
-							let data = JSON.parse(res.data);
-							console.log(data)
-							resolve(data.data.url)
-						}
-					});
-				})
-			},
-			// 确定保存
-			save() {
-				// if (!this.$u.test.mobile(this.stayInfo.landlinePhone)) {
-				// 	this.$showToast('请输入正确手机号');
-				// 	return
-				// }
-				this.stayInfo.picList = [];
-				this.imgUrlList.forEach((i) => {
-					if (i.url) {
-						this.stayInfo.picList.push(i.url)
-					}
-				})
-				this.$api.post('/merchant/hotel/mine/updMHomestayInfo', this.stayInfo).then(res => {
-					console.log(res)
-				})
-			}
-
-		}
-	}
-</script>
-<style lang="less">
-	.u-upload__wrap__preview__image {
-		width: 190rpx !important;
-		height: 120rpx !important;
-	}
-
-	.u-upload__button {
-		width: 190rpx !important;
-		height: 120rpx !important;
-	}
-</style>
-
-<style lang="scss" scoped>
-	/deep/.u-cell__body {
-		padding: 0;
-	}
-
-	::v-deep .u-icon__icon {
-		font-size: 30rpx !important;
-		margin-bottom: 10rpx;
-		left: 2rpx !important;
-		top: 6rpx !important;
-	}
-
-	::v-deep .u-upload__button__text {
-		color: #B9C2D0 !important;
-		font-size: 20rpx !important;
-	}
-
-	::v-deep .u-cell__body {
-		padding: 0;
-	}
-
-	.pages {
-		background: #F9FAFC;
-
-		.content {
-			padding: 20rpx 30rpx;
-			height: 100vh;
-
-			.card {
-				background: #fff;
-				border-radius: 16rpx;
-				padding: 30rpx;
-				margin-bottom: 20rpx;
-				display: flex;
-				align-items: center;
-				justify-content: space-between;
-
-				&.c2 {
-					display: block;
-				}
-
-				.label {
-					font-size: 30rpx;
-				}
-
-				.tit {
-					font-size: 30rpx;
-					font-weight: bold;
-					margin-bottom: 20rpx;
-				}
-
-				.upload {
-					margin-top: 48rpx;
-					width: 100%;
-					height: 200rpx;
-					border-radius: 16rpx;
-					background-color: #F5F8FA;
-					display: flex;
-					align-items: center;
-					text-align: center;
-
-					.upload-one {
-						margin: 0 245rpx;
-						width: 200rpx;
-						height: 200rpx;
-
-						image {
-							width: 100%;
-							height: 100%;
-						}
-					}
-				}
-			}
-		}
-
-		.bottom {
-			z-index: 99999;
-			position: fixed;
-			bottom: 0;
-			background: #fff;
-			width: 100%;
-			padding: 20rpx 0 30rpx;
-			box-sizing: border-box;
-			z-index: 99999999;
-
-			.btn {
-				background: #33AFFC;
-				color: white;
-				text-align: center;
-				height: 96rpx;
-				margin: 0 auto;
-				font-size: 34rpx;
-				line-height: 96rpx;
-				align-self: center;
-				border-radius: 48rpx;
-				width: 690rpx;
-			}
-		}
-	}
+<template>
+	<view class="pages" :style="{'height':(h)+'px','padding-top':mt+'px'}">
+		<c-nav-bar title="酒店民宿信息" :showIcon="true"></c-nav-bar>
+		<view class="content">
+			<view class="card" @click="goToPosition()">
+				<text class="label">位置定位</text>
+				<u-icon name="arrow-right" size="24"></u-icon>
+			</view>
+			<view class="card">
+				<text class="label">联系电话</text>
+				<u--input inputAlign="right" placeholder="请输入内容" border="none" v-model="stayInfo.landlinePhone"
+					style="text-align: right;"></u--input>
+			</view>
+			<view class="card c2">
+				<view class="tit">酒店简介</view>
+				<view>
+					<u--textarea customStyle="font-size:28rpx;line-height:28rpx" border='none' maxlength="300" count
+						v-model="stayInfo.introduction" :value="stayInfo.introduction" placeholder="请输入酒店简介"
+						height='360'></u--textarea>
+				</view>
+			</view>
+			<view class="card c2">
+				<view class="tit">内饰照片</view>
+				<view class="imgs">
+					<!-- <image src="" v-for="(item,index) in imgUrlList" :key="index"></image> -->
+					<u-upload ref="uUpload" uploadText="上传图片" :fileList="imgUrlList" :maxSize="10 * 1024 * 1024"
+						width="180" height="120" @afterRead="afterRead" @delete="deletePic">
+					</u-upload>
+				</view>
+			</view>
+		</view>
+		<view class="bottom">
+			<view class="btn" @click="save()">
+				确定
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				homestayId: uni.getStorageSync('homestayId') || 0,
+				value: '',
+				value1: '',
+				fileList: [],
+				fileList1: [],
+				imgUrlList: [],
+				fileList2: [],
+				stayInfo: {
+					picList: []
+				},
+
+			}
+		},
+		onLoad() {
+			this.getStayInfo()
+		},
+		filters: {
+			// 去除富文本标签样式
+			removeHtmlStyle(html) {
+				const relStyle = /style\s*?=\s*?(['"])[\s\S]*?\1/g
+				const relTag = /<.+?>/g
+				const relClass = /class\s*?=\s*?(['"])[\s\S]*?\1/g
+				let newHtml = ''
+				if (html) {
+					newHtml = html.replace(relStyle, '')
+					newHtml = newHtml.replace(relTag, '')
+					newHtml = newHtml.replace(relClass, '')
+				}
+				return newHtml
+			}
+		},
+		methods: {
+
+			goToPosition() {
+				const qwe = JSON.stringify(this.stayInfo)
+				uni.navigateTo({
+					url: '/pagesMy/stayInfo/roomPosition?item=' + JSON.stringify(this.stayInfo)
+				})
+			},
+			getStayInfo() {
+				this.$api.get('/merchant/hotel/mine/getMerchantHomestayInfo/' + this.homestayId).then(res => {
+					if (res.data.code == 0) {
+						this.stayInfo = res.data.data;
+						this.stayInfo.picList.forEach((item) => {
+							this.imgUrlList.push({
+								url: item
+							})
+						})
+					}
+				})
+			},
+			// 删除图片
+			deletePic(event) {
+				this.imgUrlList.splice(event.index, 1)
+			},
+			// 新增图片
+			async afterRead(event) {
+				let lists = [].concat(event.file)
+				let fileListLen = this.imgUrlList.length
+				lists.map((item) => {
+					this.imgUrlList.push({
+						...item,
+						status: 'uploading',
+						message: '上传中'
+					})
+				})
+				for (let i = 0; i < lists.length; i++) {
+					const result = await this.uploadFilePromise(lists[i].url)
+					let item = this.imgUrlList[fileListLen]
+					this.imgUrlList.splice(fileListLen, 1, Object.assign(item, {
+						status: 'success',
+						message: '',
+						url: result
+					}))
+					fileListLen++
+				}
+				console.log(this.imgUrlList)
+			},
+			uploadFilePromise(url) {
+				return new Promise((resolve, reject) => {
+					let a = uni.uploadFile({
+						url: 'https://i.ringzle.com/island-cloud-server/oss/file/aliyunUpload', // 仅为示例,非真实的接口地址
+						filePath: url,
+						name: 'file',
+						formData: {
+							user: 'test'
+						},
+						success: (res) => {
+							console.log(res)
+							let data = JSON.parse(res.data);
+							console.log(data)
+							resolve(data.data.url)
+						}
+					});
+				})
+			},
+			// 确定保存
+			save() {
+				// if (!this.$u.test.mobile(this.stayInfo.landlinePhone)) {
+				// 	this.$showToast('请输入正确手机号');
+				// 	return
+				// }
+				this.stayInfo.picList = [];
+				this.imgUrlList.forEach((i) => {
+					if (i.url) {
+						this.stayInfo.picList.push(i.url)
+					}
+				})
+				this.$api.post('/merchant/hotel/mine/updMHomestayInfo', this.stayInfo).then(res => {
+					console.log(res)
+				})
+			}
+
+		}
+	}
+</script>
+<style lang="less">
+	.u-upload__wrap__preview__image {
+		width: 190rpx !important;
+		height: 120rpx !important;
+	}
+
+	.u-upload__button {
+		width: 190rpx !important;
+		height: 120rpx !important;
+	}
+</style>
+
+<style lang="scss" scoped>
+	/deep/.u-cell__body {
+		padding: 0;
+	}
+
+	::v-deep .u-icon__icon {
+		font-size: 30rpx !important;
+		margin-bottom: 10rpx;
+		left: 2rpx !important;
+		top: 6rpx !important;
+	}
+
+	::v-deep .u-upload__button__text {
+		color: #B9C2D0 !important;
+		font-size: 20rpx !important;
+	}
+
+	::v-deep .u-cell__body {
+		padding: 0;
+	}
+
+	.pages {
+		background: #F9FAFC;
+
+		.content {
+			padding: 20rpx 30rpx;
+			height: 100vh;
+
+			.card {
+				background: #fff;
+				border-radius: 16rpx;
+				padding: 30rpx;
+				margin-bottom: 20rpx;
+				display: flex;
+				align-items: center;
+				justify-content: space-between;
+
+				&.c2 {
+					display: block;
+				}
+
+				.label {
+					font-size: 30rpx;
+				}
+
+				.tit {
+					font-size: 30rpx;
+					font-weight: bold;
+					margin-bottom: 20rpx;
+				}
+
+				.upload {
+					margin-top: 48rpx;
+					width: 100%;
+					height: 200rpx;
+					border-radius: 16rpx;
+					background-color: #F5F8FA;
+					display: flex;
+					align-items: center;
+					text-align: center;
+
+					.upload-one {
+						margin: 0 245rpx;
+						width: 200rpx;
+						height: 200rpx;
+
+						image {
+							width: 100%;
+							height: 100%;
+						}
+					}
+				}
+			}
+		}
+
+		.bottom {
+			z-index: 99999;
+			position: fixed;
+			bottom: 0;
+			background: #fff;
+			width: 100%;
+			padding: 20rpx 0 30rpx;
+			box-sizing: border-box;
+			z-index: 99999999;
+
+			.btn {
+				background: #33AFFC;
+				color: white;
+				text-align: center;
+				height: 96rpx;
+				margin: 0 auto;
+				font-size: 34rpx;
+				line-height: 96rpx;
+				align-self: center;
+				border-radius: 48rpx;
+				width: 690rpx;
+			}
+		}
+	}
 </style>