|
@@ -86,7 +86,7 @@
|
|
|
</Draggable>
|
|
|
</div>
|
|
|
<div class="imgUpTit">
|
|
|
- 可拖动图片调整顺序,首张图将作为封面。<br />最多可上传5张图片。
|
|
|
+ 可拖动图片调整顺序,首张图将作为封面。<br />最大支持5M,最多可上传5张图片。
|
|
|
</div>
|
|
|
<!-- 发布按钮 -->
|
|
|
<div class="issueBtn" @click="issueDone">发 布</div>
|
|
@@ -97,16 +97,17 @@
|
|
|
@closeLoc="LocationShow = false"
|
|
|
@setLocationInfo="setLocationInfo"
|
|
|
/>
|
|
|
- <!-- 上传出现的loading -->
|
|
|
- <div class="loading" v-show="loading">
|
|
|
- <van-loading color="#1989fa" />
|
|
|
- </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { baseURL } from "@/utils/request";
|
|
|
-import { uploadImgAPI, shareSaveAPI,delImgAPI } from "@/api/interact.js";
|
|
|
+import {
|
|
|
+ uploadImgAPI,
|
|
|
+ shareSaveAPI,
|
|
|
+ delImgAPI,
|
|
|
+ getDictAPI,
|
|
|
+} from "@/api/interact.js";
|
|
|
import Location from "./interactLocation.vue";
|
|
|
import { Toast } from "vant";
|
|
|
//导入draggable组件
|
|
@@ -121,16 +122,15 @@ export default {
|
|
|
txt1: "",
|
|
|
txt2: "",
|
|
|
topicData: [
|
|
|
- { id: 1, name: "景点" },
|
|
|
- { id: 2, name: "美食" },
|
|
|
- { id: 3, name: "游玩" },
|
|
|
- { id: 4, name: "酒店" },
|
|
|
+ // { id: 1, name: "景点" },
|
|
|
+ // { id: 2, name: "美食" },
|
|
|
+ // { id: 3, name: "游玩" },
|
|
|
+ // { id: 4, name: "酒店" },
|
|
|
],
|
|
|
topic: 1,
|
|
|
locationInfo: {},
|
|
|
LocationShow: false,
|
|
|
// 上传相关
|
|
|
- loading: false,
|
|
|
imgList: [
|
|
|
// {
|
|
|
// id: 65,
|
|
@@ -159,14 +159,12 @@ export default {
|
|
|
e.target.value = "";
|
|
|
return Toast.fail("最大支持5M!");
|
|
|
}
|
|
|
- this.loading = true;
|
|
|
// 创建FormData对象
|
|
|
const fd = new FormData();
|
|
|
// 把files添加进FormData对象(‘photo’为后端需要的字段)
|
|
|
fd.append("file", filesInfo);
|
|
|
fd.append("type", "img");
|
|
|
const res = await uploadImgAPI(fd);
|
|
|
- this.loading = false;
|
|
|
if (res.code === 0) {
|
|
|
Toast.success("上传成功!");
|
|
|
} else Toast.fail(res.msg);
|
|
@@ -194,7 +192,7 @@ export default {
|
|
|
description: this.txt2
|
|
|
.replaceAll("\n", "<br/>")
|
|
|
.replaceAll(" ", " "),
|
|
|
- dictPlaceId: this.locationInfo.id,
|
|
|
+ positionId: this.locationInfo.id,
|
|
|
dictTopicId: this.topic,
|
|
|
fileIds: imgArr.join(","),
|
|
|
name: this.txt1,
|
|
@@ -203,7 +201,7 @@ export default {
|
|
|
const res = await shareSaveAPI(obj);
|
|
|
if (res.code === 0) {
|
|
|
Toast.success("发布成功!");
|
|
|
- this.$router.push('/layout/interact')
|
|
|
+ this.$router.push("/layout/interact");
|
|
|
} else Toast.fail(res.msg);
|
|
|
},
|
|
|
// 拖拽图片
|
|
@@ -219,9 +217,9 @@ export default {
|
|
|
delImg(id) {
|
|
|
Dialog.confirm({
|
|
|
title: "确定删除吗?",
|
|
|
- beforeClose: async(action, done) => {
|
|
|
+ beforeClose: async (action, done) => {
|
|
|
if (action === "confirm") {
|
|
|
- await delImgAPI(id)
|
|
|
+ await delImgAPI(id);
|
|
|
// 点击了确定
|
|
|
this.imgList = this.imgList.filter((v) => v.id !== id);
|
|
|
Toast.success("删除成功!");
|
|
@@ -231,7 +229,11 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
},
|
|
|
- created() {},
|
|
|
+ async created() {
|
|
|
+ // 获取话题列表
|
|
|
+ const res = await getDictAPI("topic");
|
|
|
+ this.topicData = res.data;
|
|
|
+ },
|
|
|
mounted() {},
|
|
|
beforeCreate() {}, //生命周期 - 创建之前
|
|
|
beforeMount() {}, //生命周期 - 挂载之前
|
|
@@ -248,18 +250,7 @@ export default {
|
|
|
height: 100%;
|
|
|
padding: 20px 15px;
|
|
|
overflow-y: auto;
|
|
|
- .loading {
|
|
|
- background-color: rgba(0, 0, 0, 0.4);
|
|
|
- position: fixed;
|
|
|
- top: 0;
|
|
|
- left: 0;
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- z-index: 11;
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
- }
|
|
|
+
|
|
|
/deep/.van-cell {
|
|
|
width: 100%;
|
|
|
height: 36px;
|