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