|
@@ -2,7 +2,21 @@
|
|
|
<div v-if="!loading" class="box-border pb-85">
|
|
|
<div v-if="!previewOptions.show">
|
|
|
<CreateNoteHeaderBanner v-model:bannerUrl="noteJson.travelNotesBanner" />
|
|
|
-
|
|
|
+ <div class="mt-12">
|
|
|
+ <van-cell-group class="border" inset>
|
|
|
+ <van-field
|
|
|
+ v-model="noteJson.projectTitle"
|
|
|
+ rows="1"
|
|
|
+ autosize
|
|
|
+ clearable
|
|
|
+ type="textarea"
|
|
|
+ @update:model-value="handleInsertOrEditProjectTitle"
|
|
|
+ placeholder="从这里开始游记大标题..."
|
|
|
+ maxlength="50"
|
|
|
+ show-word-limit
|
|
|
+ ></van-field>
|
|
|
+ </van-cell-group>
|
|
|
+ </div>
|
|
|
<CreateNoteForm
|
|
|
v-model:departureTime="noteJson.departureTime"
|
|
|
v-model:countTimes="noteJson.countTimes"
|
|
@@ -18,25 +32,11 @@
|
|
|
<div class="w-2 h-14 bg-[#FF9300] mr-16"></div>
|
|
|
<h1 class="text-sm font-bold">编辑游记文章</h1>
|
|
|
</div>
|
|
|
- <div class="mb-12">
|
|
|
- <van-cell-group class="border" inset>
|
|
|
- <van-field
|
|
|
- v-model="noteJson.projectTitle"
|
|
|
- rows="1"
|
|
|
- autosize
|
|
|
- clearable
|
|
|
- type="textarea"
|
|
|
- @update:model-value="handleInsertOrEditProjectTitle"
|
|
|
- placeholder="从这里开始游记大标题..."
|
|
|
- maxlength="50"
|
|
|
- show-word-limit
|
|
|
- ></van-field>
|
|
|
- </van-cell-group>
|
|
|
- </div>
|
|
|
+
|
|
|
<VueDraggable v-model="noteJson.travelNotesContent" :options="dragOptions">
|
|
|
<template v-for="(item, index) in noteJson.travelNotesContent" :key="item.tmpId">
|
|
|
- <div v-if="item.type === defaultSectionTitle.type" class="h-50 mb-12 relative box-border">
|
|
|
- <van-cell-group class="border h-full" inset>
|
|
|
+ <div v-if="item.type === defaultSectionTitle.type" class="h-50 mb-12 box-border">
|
|
|
+ <van-cell-group class="border h-full focus:border-[#FF9300]" inset>
|
|
|
<van-field
|
|
|
v-model="item.content"
|
|
|
rows="1"
|
|
@@ -68,7 +68,10 @@
|
|
|
class="h-100 mb-12 relative box-border"
|
|
|
>
|
|
|
<!-- focus:outline-none focus:caret-[#FF9300] active:border-[#FF9300] focus:border-[#FF9300]-->
|
|
|
- <van-cell-group class="border h-full" inset>
|
|
|
+ <van-cell-group
|
|
|
+ class="border h-full active:shadow-[_0px_6px_4px_0px_rgba(0,0,0,0.25)]"
|
|
|
+ inset
|
|
|
+ >
|
|
|
<van-field
|
|
|
autofocus
|
|
|
v-model="item.content"
|
|
@@ -148,7 +151,7 @@
|
|
|
<div
|
|
|
class="w-86 flex justify-between items-center h-16 absolute top-10 right-26 z-100"
|
|
|
>
|
|
|
- <span @click="handleSaveCover(item)" class="text-sm text-black-3">
|
|
|
+ <span @click="showToast('请上传图片')" class="text-sm text-black-3">
|
|
|
设为封面图
|
|
|
</span>
|
|
|
<div class="w-16 h-16 inline-block">
|
|
@@ -397,8 +400,7 @@ import draft from '~/assets/img/note-create/draft.svg'
|
|
|
// import { cloneDeep } from 'lodash-es'
|
|
|
import { VueDraggable } from 'vue-draggable-plus'
|
|
|
import { nanoid } from 'nanoid'
|
|
|
-const useAuth = useAuthStore()
|
|
|
-const { token } = storeToRefs(useAuth)
|
|
|
+
|
|
|
|
|
|
const dragOptions = {
|
|
|
disabled: false, // 是否禁用拖拽
|
|
@@ -429,6 +431,7 @@ const defaultNoteJson = {
|
|
|
travelNotesBanner: null,
|
|
|
projectTitle: null,
|
|
|
departureTime: null,
|
|
|
+ endPlaceId: null,
|
|
|
countTimes: null,
|
|
|
endPlace: null,
|
|
|
role: null,
|
|
@@ -472,7 +475,6 @@ const draftDialogContent = {
|
|
|
const showDialog = (parmas) => {
|
|
|
showConfirmDialog(parmas)
|
|
|
.then(() => {
|
|
|
- // getNoteDetail()
|
|
|
handleSaveDraft()
|
|
|
})
|
|
|
.catch(() => {})
|
|
@@ -595,15 +597,6 @@ async function handleCropperOk(data) {
|
|
|
|
|
|
/******************插入图片逻辑*******************/
|
|
|
|
|
|
-// function handleInsertImageOk(fileUrlList) {
|
|
|
-// const imageList = fileUrlList.map((e) => ({
|
|
|
-// type: defaultSectionImage.type,
|
|
|
-// content: e.fileUrl,
|
|
|
-// tmpId: nanoid()
|
|
|
-// }))
|
|
|
-// noteJson.travelNotesContent = (noteJson.travelNotesContent ?? []).concat(imageList)
|
|
|
-// }
|
|
|
-
|
|
|
function handleDeleteImage(index) {
|
|
|
showConfirmDialog(deleteDialogContent)
|
|
|
.then(() => {
|
|
@@ -625,7 +618,12 @@ function handleSaveCover(item) {
|
|
|
showToast('设置封面成功')
|
|
|
}
|
|
|
|
|
|
+// 保存草稿
|
|
|
async function handleSaveDraft() {
|
|
|
+ noteJson.endPlace = noteJson?.endPlaceId
|
|
|
+ delete noteJson.endPlaceId
|
|
|
+
|
|
|
+
|
|
|
try {
|
|
|
await request('/website/tourism/publishTravelNotes/saveDraft', {
|
|
|
method: 'post',
|
|
@@ -704,9 +702,14 @@ async function handlePublish() {
|
|
|
}
|
|
|
|
|
|
const publishLoading = ref(false)
|
|
|
+// async
|
|
|
async function requestPublish() {
|
|
|
try {
|
|
|
publishLoading.value = true
|
|
|
+
|
|
|
+ noteJson.endPlace = noteJson.endPlaceId
|
|
|
+ delete noteJson.endPlaceId
|
|
|
+
|
|
|
await request('/website/tourism/publishTravelNotes/publishDraft', {
|
|
|
method: 'post',
|
|
|
body: {
|