Эх сурвалжийг харах

社区 发布评论 添加上传图片接口

zxl 1 жил өмнө
parent
commit
5e8e370f22

+ 10 - 6
src/pages/client/clientPackage/communityPublish.vue

@@ -29,6 +29,7 @@
 	import { addClientContent } from '@/api/client/community.js';
 	import { getCurrentLocation } from '@/api/client/home';
 	import { mapGetters } from "vuex"
+  import { uploadFile } from "@/utils/upload"
 	export default {
 		data() {
 			return {
@@ -36,6 +37,7 @@
 				fileList: [],
 				uploadCount: 0,
 				address:'' ,//当前位置
+        uploadImgList:[]
 			};
 		},
 		mounted() {
@@ -50,7 +52,7 @@
 			handlerInitLocation(latitude , longitude){
 				let point = `${latitude},${longitude}`
 				getCurrentLocation({ point }).then(res=>{
-					this.address = res.data.name	
+					this.address = res.data.name
 				})
 			},
 			// 手动选择城市	获取位置
@@ -66,7 +68,6 @@
 			},
 			// 点击发布按钮
 			handlerPublishBtn() {
-				return 
 				let params = {
 					textContent: this.textContent,
 					status: 0, // 状态:0-正常;1-屏蔽
@@ -77,7 +78,7 @@
 				if (this.fileList.length != 0) {
 					params.type = 'PHOTO';
 					params.list = [];
-					this.fileList.map((rs, idx) => {
+					this.uploadImgList.map((rs, idx) => {
 						params.list.push({
 							resourceKey: rs,
 							sort: idx,
@@ -94,6 +95,7 @@
 						setTimeout(() => {
 							uni.navigateBack(-1);
 						}, 1500);
+            this.uploadImgList = []
 					} else {
 						uni.showToast({
 							title: res.msg,
@@ -156,11 +158,13 @@
 				});
 			},
 			// 上传头像
-			uploadAvatar(filePath) {
+			async uploadAvatar(filePath) {
 				// 在这里实现上传头像的逻辑,将filePath作为参数传入
+        let res = await uploadFile(filePath)
+        let data = JSON.parse(res.data)
 				this.fileList.push(filePath);
+        this.uploadImgList.push(data.data.url)
 				this.uploadCount = this.fileList.length;
-				console.log('@@@filePath', this.fileList);
 				// this.queryParams.avatar = filePath;
 				this.$forceUpdate(); // 手动触发组件的重新渲染
 			},
@@ -257,4 +261,4 @@
 			margin-left: 10rpx;
 		}
 	}
-</style>
+</style>

+ 5 - 0
src/pages/client/clientPackage/storeDetail.vue

@@ -265,6 +265,11 @@
       handlerMakeCall() {
         uni.makePhoneCall({
           phoneNumber: this.merchant.mobile,
+          success:res=>{
+            console.log("@@@res",res)
+          },fail:err =>{
+            console.log("@@@err",err)
+          }
         });
       },
       // 点击跳转到商品详情