瀏覽代碼

fix : 1.修改写游记的bug 预览后不能写游记

suwenjiang 4 周之前
父節點
當前提交
b7c0d45b5e

+ 2 - 2
src/components/Profile/Collection/Topic.vue

@@ -17,9 +17,9 @@
         {{ itemData.name }}
       </div>
       <div class="mt-5 text-sm text-black-6">
-        <span class="iconfont icon-eye text-black-9 mr-8" style="font-size: 12px"></span>
+        <span class="iconfont icon-eye text-black-9 mr-5" style="font-size: 12px"></span>
 
-        {{ itemData.viewCount }}
+        {{ transferCount(itemData.viewCount) }}
       </div>
 
       <div

+ 1 - 1
src/components/Profile/Notes/Published/Item.vue

@@ -26,7 +26,7 @@
         <div class="flex space-x-4 text-sm text-[#FD9A00]">
           <div class="flex items-center space-x-2">
             <span class="iconfont icon-eye-fill text-[#FD9A00]" style="font-size: 15px"></span>
-            <div>{{ data?.pageViewCount ?? 0 }}</div>
+            <div>{{ transferCount(data?.pageViewCount) ?? 0 }}</div>
           </div>
           <div class="pl-20 flex items-center space-x-2">
             <van-icon @click="$emit('onShare')" name="share-o" color="#FD9A00" />

+ 15 - 6
src/components/Profile/Notes/Published/index.vue

@@ -137,14 +137,23 @@ async function getList() {
       }
     })
 
-    if (data.dataList.length == 0) noteList.value = []
+    // if (data.dataList.length == 0) noteList.value = []
 
-    // 去重处理
-    if (noteList.value.length > data.totalCount)
-      noteList.value = Array.from(new Set([...noteList.value, ...data.dataList]))
-    // 去重处理合并处理
-    if (noteList.value.length < data.totalCount)
+    // // 去重处理
+    // if (noteList.value.length > data.totalCount)
+    //   noteList.value = Array.from(new Set([...noteList.value, ...data.dataList]))
+    // // 去重处理合并处理
+    // if (noteList.value.length < data.totalCount)
+    //   noteList.value = noteList.value.concat(data.dataList)
+
+    if (Array.isArray(data?.dataList) && data.dataList.length) {
       noteList.value = noteList.value.concat(data.dataList)
+      nextTick(() => {
+        noteList.value = [...new Map(noteList.value.map((item) => [item?.id, item])).values()]
+      })
+    } else {
+      noteList.value = []
+    }
 
     loading.value = false
     if (noteList.value.length >= data.totalCount) {

+ 50 - 34
src/pages/note-create/index.client.vue

@@ -24,7 +24,7 @@
       <div class="border-b-[1px] mx-16"></div>
 
       <div style="overflow: hidden; overflow-y: scroll" class="h-200 mb-12">
-        <div ref="editorFather" :class="`min-h-160 mx-12 my-16 w-[93%] mb-20 text-sm  `">
+        <div ref="editorFather" :class="`min-h-160 mx-12 my-16 w-[93%] mb-20 text-base  `">
           <div
             ref="editor"
             class="inputSectionContent"
@@ -163,7 +163,9 @@
           size="large"
           type="primary"
           round
-          :color="handlePublishRule(noteJson?.imgUrls.length, noteJson.endPlace)"
+          :color="
+            handlePublishRule(noteJson?.imgUrls.length, noteJson.endPlace, noteJson.projectTitle)
+          "
           block
           :loading="publishLoading"
           @click="handlePublish"
@@ -319,7 +321,9 @@
             size="large"
             type="primary"
             round
-            :color="handlePublishRule(noteJson?.imgUrls.length, noteJson.endPlace)"
+            :color="
+              handlePublishRule(noteJson?.imgUrls.length, noteJson.endPlace, noteJson.projectTitle)
+            "
             block
             :loading="publishLoading"
             @click="handlePublish"
@@ -598,6 +602,7 @@ async function handleSaveDraft() {
       }
     })
     showToast('草稿保存成功')
+
     // 后端保存草稿没有对 topics 做新增的处理
     navigateTo({
       path: '/profile/notes?tab=draft',
@@ -607,20 +612,6 @@ async function handleSaveDraft() {
   }
 }
 
-// 预览
-const previewOptions = reactive({
-  show: false
-})
-
-function handlePreview() {
-  previewOptions.show = !previewOptions.show
-  const innerHTML = editor.value.innerHTML
-    .replace('ql-editor', '')
-    .replace('contenteditable', 'true')
-
-  noteJson.tourTourismProjectTravelNotesWriteContentDto.content = innerHTML ?? ''
-}
-
 // 收集个人信息
 const userInfoOptions = reactive({
   show: false
@@ -632,8 +623,8 @@ function handleCollectUserInfoOk() {
 
 const publishResultModalOptions = ref(false)
 
-function handlePublishRule(length, endPlace) {
-  if (!length || !endPlace) {
+function handlePublishRule(length, endPlace, title) {
+  if (!length || !endPlace || !title) {
     return '#999999'
   } else {
     return '#FD9A00'
@@ -659,7 +650,14 @@ async function handlePublish() {
     })
     return
   }
-
+  if (!noteJson.projectTitle) {
+    showNotify({
+      type: 'warning',
+      message: '请输入游记标题',
+      duration: 3000
+    })
+    return
+  }
   if (!noteJson.endPlace) {
     showNotify({
       type: 'warning',
@@ -761,14 +759,14 @@ const topicList = ref([])
 const eitList = ref([])
 const showTopicEit = ref(null)
 
-// 记录点击话题和@ 后的几个数字。
-const queryParmas = reactive({
-  pageNum: 1,
-  pageSize: 10,
-  name: ''
-})
+// // 记录点击话题和@ 后的几个数字。
+// const queryParmas = reactive({
+//   pageNum: 1,
+//   pageSize: 10,
+//   name: ''
+// })
 
-const topicLoading = ref(false)
+// const topicLoading = ref(false)
 // async function getTopicList(parmas, searchText) {
 //   try {
 //     // if (!topicLoading.value) return
@@ -996,8 +994,8 @@ const handleClickOutside = (event) => {
   let projectTitleRefCompEl = projectTitleRef.value
   const isChatInputCompEl =
     [checkboxRefs.value[0], checkboxRefs.value[1]].some((o) => o === event.target) ||
-    editorFather.value.contains(event.target) ||
-    projectTitleRefCompEl.contains(event.target)
+    editorFather.value?.contains(event.target) ||
+    projectTitleRefCompEl?.contains(event.target)
 
   if (!isChatInputCompEl) {
     // 不是点输入框部分
@@ -1005,10 +1003,28 @@ const handleClickOutside = (event) => {
   }
 }
 
+// 预览
+const previewOptions = reactive({
+  show: false
+})
+
+function handlePreview() {
+  previewOptions.show = !previewOptions.show
+
+  if (previewOptions.show) {
+    const innerHTML = editor.value?.innerHTML
+      ?.replace('ql-editor', '')
+      ?.replace('contenteditable', 'true')
+
+    defaultNoteJson.tourTourismProjectTravelNotesWriteContentDto.content = innerHTML ?? ''
+  }
+}
+
 watch(
   editor,
   (val) => {
-    if (val && !quillContent) initEdit()
+    // && !quillContent
+    if (val) initEdit()
   },
   { immediate: true }
 )
@@ -1021,7 +1037,7 @@ onMounted(() => {
 </script>
 
 <style lang="scss" scoped>
-/* @import '../../assets/css/quill.snow.css'; */
+// @import '../../assets/css/quill.snow.css';
 
 ::v-deep .van-field:focus {
   caret-color: #ff9300 !important;
@@ -1038,7 +1054,7 @@ onMounted(() => {
 }
 
 ::v-deep .mention {
-  color: #2c405b;
+  color: #356eff;
   font-weight: bold;
   margin-left: 4px;
   background-color: transparent;
@@ -1058,8 +1074,8 @@ onMounted(() => {
   color: #606266;
 }
 
-.ql-mention-list-item.selected {
-  background-color: #f5f7fa !important;
+::v-deep .ql-mention-list-item.selected {
+  background-color: #fff7e6 !important;
 }
 
 .member-item {

+ 31 - 22
src/pages/topic/index.vue

@@ -87,6 +87,7 @@
       error-text="获取失败"
       @load="loadMore"
     >
+      <!-- @load="loadMore" -->
       <div class="flex justify-between flex-wrap px-12">
         <template v-for="itemData in dataList">
           <NuxtLink
@@ -220,18 +221,29 @@ async function getTravelNotesTopicList() {
 
   if (data) {
     topicData.value = data
-    dataList.value = data.tourTravelNotesTopicNotesSearchVoList
-    loading.value = false
+    dataList.value = dataList.value.concat(data.tourTravelNotesTopicNotesSearchVoList)
+    // 去重相同的游记
+    nextTick(() => {
+      dataList.value = [...new Map(dataList.value.map((item) => [item?.id, item])).values()]
+    })
     showSearch.value = false
   } else {
     topicData.value = {}
     dataList.value = []
     showSearch.value = true
   }
+
+  loading.value = false
+  if (dataList.value.length >= data.travelNotesCount) {
+    finished.value = true
+  } else {
+    finished.value = false
+  }
 }
 // 切换最新和最热
 function changeIsHotAndIsNew(index) {
   isHot.value = index
+  dataList.value = []
   getTravelNotesTopicList()
 }
 
@@ -278,8 +290,6 @@ function loadMore() {
 
 // 分享
 const copyLink = () => {
-  // let origin = location.origin
-  // let url = `${origin}/topic?topicName=${topicData.name}`
   let url = location.href
 
   navigator.clipboard.writeText(url).then(
@@ -293,24 +303,23 @@ const copyLink = () => {
 }
 
 // 游记得喜欢
-const canDoStar = ref(true)
-async function doStar(params) {
-  if (!canDoStar.value) return
-  canDoStar.value = false
-  request(`/website/tourism/projectTravelNotes/userLikeTravelNotesUpdate`, {
-    method: 'post',
-    body: { travelNotesId: params.id }
-  })
-    .then(() => {
-      getTravelNotesTopicList()
-      nextTick(async () => {
-        let objData = await dataList.value.find((item) => item.id == params.id)
-        objData.isLike = true
-        // objData.likeCount += 1
-      })
-    })
-    .finally(() => (canDoStar.value = true))
-}
+// const canDoStar = ref(true)
+// async function doStar(params) {
+//   if (!canDoStar.value) return
+//   canDoStar.value = false
+//   request(`/website/tourism/projectTravelNotes/userLikeTravelNotesUpdate`, {
+//     method: 'post',
+//     body: { travelNotesId: params.id }
+//   })
+//     .then(() => {
+//       getTravelNotesTopicList()
+//       nextTick(async () => {
+//         let objData = await dataList.value.find((item) => item.id == params.id)
+//         objData.isLike = true
+//       })
+//     })
+//     .finally(() => (canDoStar.value = true))
+// }
 
 onMounted(() => {
   getTravelNotesTopicList()

+ 10 - 13
src/pages/view-group-chat/[id].vue

@@ -68,7 +68,7 @@ const { userInfo } = storeToRefs(userInfoStore)
 const FANS_STATUS = {
   0: { status: 0, text: '申请加入 ', describe: '未关注', bg: '#FD9A00' },
   1: { status: 1, text: '立即聊天', describe: '已关注', bg: '#FD9A00' },
-  4: { status: 4, text: '已申请', describe: '相互关注', bg: '#999' }
+  2: { status: 2, text: '已申请', describe: '相互关注', bg: '#999' }
 }
 const loading = ref(true)
 const finished = ref(false)
@@ -78,9 +78,6 @@ const pageSize = ref(10)
 const othersUserInfo = ref(null) //他人信息
 const groupList = ref([]) //下方游记
 
-// 关注
-const saveLoading = ref(false)
-
 // 加入群聊
 const handleJoinGroup = (item) => {
   if (item.status == 0) {
@@ -93,25 +90,22 @@ const handleJoinGroup = (item) => {
       replace: true
     })
   }
-  // if (item.status == 2) {
-  //   navigateTo('/chat/group-chat', {
-  //     query: { groupId: item.id },
-  //     replace: true
-  //   })
-  // }
+  if (item.status == 2) {
+    showToast('已申请,请等待群主同意')
+  }
 }
 
 // 加群聊
 const getGroupAdd = async (groupId) => {
-  let { data } = await request('/website/tourMember/invite', {
+  let res = await request('/website/tourMember/invite', {
     method: 'post',
     body: {
       groupId,
       ids: [userInfo.value.userId]
     }
   })
-  if (data) {
-    getList()
+  if (res && res.data) {
+    getUserGroup()
   }
 }
 
@@ -156,6 +150,9 @@ async function getUserGroup() {
 
     if (Array.isArray(dataList) && dataList.length) {
       groupList.value = groupList.value.concat(dataList)
+      nextTick(() => {
+        groupList.value = [...new Map(groupList.value.map((item) => [item?.id, item])).values()]
+      })
     } else {
       groupList.value = []
     }

+ 7 - 18
src/pages/yj/[id].vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <div v-if="['success'].includes(status)" @click="pageClick">
-      <van-cell center size="large" :title="detailData?.createName">
+      <van-cell center size="large">
         <template #icon>
           <div class="w-30 h-30 rounded-full mr-8 overflow-hidden">
             <img
@@ -13,6 +13,9 @@
             <img v-else class="w-full h-full object-cover" :src="defaultAvatar" alt="" />
           </div>
         </template>
+        <template #title>
+          <h1 class="w-180 line-clamp-1">{{ detailData?.createName }}</h1>
+        </template>
         <template #label>
           <span class="mr-8">{{ detailData?.endArea || '' }}</span>
           <span>{{ detailData?.endPlaceDictMap?.name || '' }}</span>
@@ -80,14 +83,6 @@
           </div>
         </div>
 
-        <!-- <div class="mt-10 w-full" v-for="con in detailData.travelNotesContent" :key="con.id">
-          <template v-if="con.type == 'image'">
-            <img :src="con.content" class="w-full rounded-xl" alt="" />
-          </template>
-          <template v-if="con.type !== 'image'">
-            <div class="w-full" style="word-wrap: break-word" v-html="con.content"></div>
-          </template>
-        </div>     @click="bindFn"-->
         <div
           id="view-note"
           ref="editor"
@@ -273,9 +268,7 @@
             </div>
             <template v-if="Array.isArray(item.childrenList) && item.childrenList.length">
               <div class="pl-[32px] mt-10">
-                <!--  style="border-left: 1px solid #ccc" -->
                 <div class="pl-14">
-                  <!-- class="flex justify-start mr-8 flex-wrap" -->
                   <div v-for="subItem in item.childrenList" :key="subItem.id">
                     <div class="flex justify-start items-start mb-8">
                       <div class="w-30 h-30 bg-[#ddd] rounded-full shrink-0 mr-8">
@@ -321,12 +314,6 @@
                             size="20px"
                             color="#666"
                           />
-                          <!-- <van-icon
-                            @click.stop="addReply(subItem, item.id)"
-                            name="comment-o"
-                            size="20px"
-                            color="#666"
-                          /> -->
                         </div>
                       </div>
                     </div>
@@ -1040,7 +1027,9 @@ onMounted(() => {
 
 <style lang="scss" scoped>
 ::v-deep .mention {
-  color: #2c405b;
+  color: #356eff;
   font-weight: bold;
+  padding-left: 4px;
+  padding-right: 4px;
 }
 </style>