Commit e49bb4e064a9cbc2da9541ae838d1cf525e0179b

Authored by 杨泽宇
1 parent 464eb892

活动总结

src/views/event/handwork/edit.vue
... ... @@ -303,11 +303,6 @@ onMounted(() => {
303 303 });
304 304 }
305 305 }
306   - // setTimeout(() => {
307   - // console.log(window.tinymce.get(Tinymce.props.id.default))
308   - // console.log(Tinymce.props.id.default)
309   - // window.tinymce.get(Tinymce.props.id.default).setContent('tengxi')
310   - // }, 500)
311 306 });
312 307 </script>
313 308  
... ...
src/views/event/handwork/index.vue
... ... @@ -315,7 +315,7 @@ onMounted(() =&gt; {
315 315 <!-- 活动结束以后可以填写活动总结 -->
316 316 <el-button type="text" v-show="new Date(scope.row.endTime) < new Date()"
317 317 ><router-link
318   - :to="{ path: '/event/summary', query: { id: scope.row.id } }"
  318 + :to="{ path: '/event/summary', query: scope.row }"
319 319 >活动总结</router-link
320 320 ></el-button
321 321 >
... ...
src/views/event/handwork/summary.vue
1 1 <script setup lang="ts">
2 2 import { reactive, ref, getCurrentInstance, onMounted } from "vue";
3   -// import { eventCategory, handworkEdit } from "@/api/event";
  3 +import { handworkEdit } from "@/api/event";
4 4 import { useRoute } from "vue-router";
5 5 import { back } from "@/utils/tool";
  6 +import { useLoginStore } from "@/pinia/login";
6 7 import Photowall from "@/components/Photowall/index.vue";
7 8 import Tinymce from "@/components/Tinymce/index.vue";
8 9 import type { ElForm } from "element-plus";
9 10 let form = reactive({
10 11 data: {
  12 + name: "",
  13 + craftId: null,
  14 + startTime: "",
  15 + endTime: "",
  16 + signupStartTime: "",
  17 + signupEndTime: "",
  18 + duration: null,
  19 + location: "",
  20 + unitPrice: null,
  21 + description: "",
  22 + id: null,
  23 + oid: useLoginStore()?.getOid ?? 0,
  24 + personLimit: null,
  25 + publicityPic: "",
  26 + status: null,
  27 + processDesc: "",
  28 + neighborhoodId: "",
11 29 summary: "",
12   - imgs: "",
  30 + summaryPic: "",
13 31 },
14 32 publicityPic: [],
15 33 dataType: "",
... ... @@ -49,7 +67,22 @@ const submitForm = (
49 67 if (!formEl) return;
50 68 formEl.validate(async (valid) => {
51 69 if (valid) {
52   - console.log("post api");
  70 + form.data.summaryPic = form.publicityPic
  71 + .map((item) => item.url)
  72 + .join(",");
  73 + handworkEdit(form.data)
  74 + .then((res) => {
  75 + if (res) {
  76 + instance?.proxy?.$message.success("操作成功");
  77 + history.go(-1);
  78 + }
  79 + })
  80 + .catch((error) => {
  81 + console.log(error);
  82 + })
  83 + .finally(() => {
  84 + form.loading = false;
  85 + });
53 86 } else {
54 87 instance?.proxy?.$message.error("请检查表单格式");
55 88 form.loading = false;
... ... @@ -73,7 +106,16 @@ const handleFinish = (images) =&gt; {
73 106 }, 500);
74 107 };
75 108 onMounted(() => {
76   - console.log(useRoute().query);
  109 + form.data = useRoute().query;
  110 + if (useRoute().query.summaryPic) {
  111 + useRoute()
  112 + .query.summaryPic.split(",")
  113 + .map((item) => {
  114 + form.publicityPic.push({
  115 + url: item,
  116 + });
  117 + });
  118 + }
77 119 });
78 120 </script>
79 121  
... ... @@ -92,7 +134,7 @@ onMounted(() =&gt; {
92 134 <el-form-item label="活动总结" prop="summary" style="width: 100%">
93 135 <Tinymce v-model="form.data.summary"></Tinymce>
94 136 </el-form-item>
95   - <el-form-item label="宣传图片" prop="imgs" style="width: 100%">
  137 + <el-form-item label="宣传图片" prop="summaryPic" style="width: 100%">
96 138 <Photowall
97 139 @finish="handleFinish"
98 140 :fileList="form.publicityPic"
... ...