Bläddra i källkod

fix: 1.单聊的问题

suwenjiang 1 månad sedan
förälder
incheckning
54f6cce732
3 ändrade filer med 198 tillägg och 205 borttagningar
  1. 3 3
      src/pages/chat/set-single.vue
  2. 2 1
      src/pages/chat/set.vue
  3. 193 201
      src/pages/profile/my-news/index.vue

+ 3 - 3
src/pages/chat/set-single.vue

@@ -162,8 +162,8 @@ const getFriendInfo = async () => {
   const { list } = data || {}
   if (Array.isArray(list) && list?.length) {
     itemData.value = list.filter((el) => el.toUserId == toUserId.value)[0]
-    isNotDisturb.value = itemData.value
-    isTop.value = itemData.value
+    isNotDisturb.value = itemData.value?.isNotDisturb
+    isTop.value = itemData.value?.isTop
   }
 }
 
@@ -249,7 +249,7 @@ const handleBoolean = async (params) => {
         isTop.value ? showToast('已置顶') : showToast('置顶取消')
       }
       if (Object.keys(params)[0] == 'isNotDisturb') {
-        isNotDisturb.value ? showToast('已开启面打扰') : showToast('已关闭面打扰')
+        isNotDisturb.value ? showToast('已开启免打扰') : showToast('已关闭免打扰')
       }
     }
   } catch (error) {}

+ 2 - 1
src/pages/chat/set.vue

@@ -758,8 +758,9 @@ const handleBoolean = async (params) => {
         isTop.value ? showToast('已置顶') : showToast('置顶取消')
       }
       if (Object.keys(params)[0] == 'isNotDisturb') {
-        isNotDisturb.value ? showToast('已开启面打扰') : showToast('已关闭面打扰')
+        isNotDisturb.value ? showToast('已开启免打扰') : showToast('已关闭免打扰')
       }
+      getGroupSetData()
     }
   } catch (error) {}
 }

+ 193 - 201
src/pages/profile/my-news/index.vue

@@ -1,4 +1,5 @@
 <template>
+  <!-- <van-pull-refresh v-model="refreshing" head-height="50" @refresh="onRefresh"> -->
   <div class="w-full h-[100vh]">
     <van-sticky :offset-top="48">
       <div class="w-full text-xl font-semibold px-16 h-48 flex justify-start items-center bg-white">
@@ -25,35 +26,22 @@
       </div>
     </van-sticky>
 
-    <van-pull-refresh v-model="refreshing" head-height="100" @refresh="onRefresh">
-      <div class="h-[100vh] overflow-y-auto">
-        <van-list class="h-full" :finished="true" finished-text="">
-          <div
-            @click="
-              onChatPage('/profile/system-message', {
-                groupId: chatList[0]?.groupId
-              })
-            "
-            class="w-full relative h-82 flex justify-start items-center px-16"
+    <div class="h-[100vh] overflow-y-auto">
+      <van-list class="h-full" :finished="true" finished-text="">
+        <div
+          @click="
+            onChatPage('/profile/system-message', {
+              groupId: chatList[0]?.groupId
+            })
+          "
+          class="w-full relative h-82 flex justify-start items-center px-16"
+        >
+          <van-badge
+            v-if="chatList[0]?.unreadMessageCount"
+            v-bind="messageNumber(chatList[0]?.unreadMessageCount)"
+            max="99"
           >
-            <van-badge
-              v-if="chatList[0]?.unreadMessageCount"
-              v-bind="messageNumber(chatList[0]?.unreadMessageCount)"
-              max="99"
-            >
-              <div
-                class="w-48 h-48 bg-[#0052D9] rounded-full overflow-hidden flex justify-center items-center"
-              >
-                <img
-                  class="w-24 h-24 shrink-0 object-cover"
-                  src="~/assets/img/chat/remind.svg"
-                  alt=""
-                />
-              </div>
-            </van-badge>
-
             <div
-              v-else
               class="w-48 h-48 bg-[#0052D9] rounded-full overflow-hidden flex justify-center items-center"
             >
               <img
@@ -62,60 +50,59 @@
                 alt=""
               />
             </div>
+          </van-badge>
 
-            <div class="h-48 w-245 shrink-0 ml-12 flex flex-wrap items-start">
-              <h1 class="line-clamp-1 w-full text-base text-black-3 font-semibold mb-4">
-                {{ chatList[0]?.groupName }}
-              </h1>
-              <p class="line-clamp-1 h-20 text-sm text-black-6 leading-3xl">
-                {{
-                  chatList[0]?.lastMessage
-                    ? chatList[0]?.lastMessage?.messageContent?.messageContent
-                    : '暂无系统消息'
-                }}
-              </p>
-            </div>
-
-            <div class="w-35 h-48 shrink-0">
-              <p class="text-black/[0.6] text-sm text-end">
-                {{
-                  chatList[0]?.lastMessage
-                    ? createTimeSplit(chatList[0]?.lastMessage?.createTime)
-                    : ''
-                }}
-              </p>
-            </div>
-            <div class="absolute bottom-0 right-0 w-[96%] h-1 border-b-[1px]"></div>
-          </div>
-          <!-- navigateTo('/follow?listType=fans') -->
           <div
-            @click="
-              onChatPage('/follow', {
-                listType: 'fans',
-                groupId: chatList[1]?.groupId
-              })
-            "
-            class="w-full relative h-82 flex justify-start items-center px-16"
+            v-else
+            class="w-48 h-48 bg-[#0052D9] rounded-full overflow-hidden flex justify-center items-center"
           >
-            <van-badge
-              v-if="chatList[1]?.unreadMessageCount"
-              v-bind="messageNumber(chatList[1]?.unreadMessageCount)"
-              max="99"
-            >
-              <div
-                class="w-48 h-48 bg-[#FF9300] rounded-full overflow-hidden flex justify-center items-center"
-              >
-                <img
-                  class="w-24 h-24 shrink-0 object-cover"
-                  src="~/assets/img/chat/user.svg"
-                  alt=""
-                />
-              </div>
-            </van-badge>
+            <img
+              class="w-24 h-24 shrink-0 object-cover"
+              src="~/assets/img/chat/remind.svg"
+              alt=""
+            />
+          </div>
 
+          <div class="h-48 w-245 shrink-0 ml-12 flex flex-wrap items-start">
+            <h1 class="line-clamp-1 w-full text-base text-black-3 font-semibold mb-4">
+              {{ chatList[0]?.groupName }}
+            </h1>
+            <p class="line-clamp-1 h-20 text-sm text-black-6 leading-3xl">
+              {{
+                chatList[0]?.lastMessage
+                  ? chatList[0]?.lastMessage?.messageContent?.messageContent
+                  : '暂无系统消息'
+              }}
+            </p>
+          </div>
+
+          <div class="w-35 h-48 shrink-0">
+            <p class="text-black/[0.6] text-sm text-end">
+              {{
+                chatList[0]?.lastMessage
+                  ? createTimeSplit(chatList[0]?.lastMessage?.createTime)
+                  : ''
+              }}
+            </p>
+          </div>
+          <div class="absolute bottom-0 right-0 w-[96%] h-1 border-b-[1px]"></div>
+        </div>
+        <!-- navigateTo('/follow?listType=fans') -->
+        <div
+          @click="
+            onChatPage('/follow', {
+              listType: 'fans',
+              groupId: chatList[1]?.groupId
+            })
+          "
+          class="w-full relative h-82 flex justify-start items-center px-16"
+        >
+          <van-badge
+            v-if="chatList[1]?.unreadMessageCount"
+            v-bind="messageNumber(chatList[1]?.unreadMessageCount)"
+            max="99"
+          >
             <div
-              v-else
-              @click="navigateTo('/follow?listType=fans')"
               class="w-48 h-48 bg-[#FF9300] rounded-full overflow-hidden flex justify-center items-center"
             >
               <img
@@ -124,58 +111,55 @@
                 alt=""
               />
             </div>
+          </van-badge>
 
-            <div class="h-48 w-245 shrink-0 ml-12 flex flex-wrap items-start">
-              <h1 class="line-clamp-1 w-full text-base text-black-3 font-semibold mb-4">
-                {{ chatList[1]?.groupName }}
-              </h1>
-              <p class="line-clamp-1 h-20 text-sm text-black-6 leading-3xl">
-                {{
-                  chatList[1]?.lastMessage
-                    ? chatList[1]?.lastMessage?.messageContent?.messageContent
-                    : '暂无新增关注消息'
-                }}
-              </p>
-            </div>
+          <div
+            v-else
+            @click="navigateTo('/follow?listType=fans')"
+            class="w-48 h-48 bg-[#FF9300] rounded-full overflow-hidden flex justify-center items-center"
+          >
+            <img class="w-24 h-24 shrink-0 object-cover" src="~/assets/img/chat/user.svg" alt="" />
+          </div>
 
-            <div class="w-35 h-48 shrink-0">
-              <p class="text-black/[0.6] text-sm text-end">
-                {{
-                  chatList[1]?.lastMessage
-                    ? createTimeSplit(chatList[1]?.lastMessage?.createTime)
-                    : ''
-                }}
-              </p>
-            </div>
-            <div class="absolute bottom-0 right-0 w-[96%] h-1 border-b-[1px]"></div>
+          <div class="h-48 w-245 shrink-0 ml-12 flex flex-wrap items-start">
+            <h1 class="line-clamp-1 w-full text-base text-black-3 font-semibold mb-4">
+              {{ chatList[1]?.groupName }}
+            </h1>
+            <p class="line-clamp-1 h-20 text-sm text-black-6 leading-3xl">
+              {{
+                chatList[1]?.lastMessage
+                  ? chatList[1]?.lastMessage?.messageContent?.messageContent
+                  : '暂无新增关注消息'
+              }}
+            </p>
           </div>
 
-          <div
-            @click="
-              onChatPage('/profile/interaction-message', {
-                groupId: chatList[2]?.groupId
-              })
-            "
-            class="w-full relative h-82 flex justify-start items-center px-16"
+          <div class="w-35 h-48 shrink-0">
+            <p class="text-black/[0.6] text-sm text-end">
+              {{
+                chatList[1]?.lastMessage
+                  ? createTimeSplit(chatList[1]?.lastMessage?.createTime)
+                  : ''
+              }}
+            </p>
+          </div>
+          <div class="absolute bottom-0 right-0 w-[96%] h-1 border-b-[1px]"></div>
+        </div>
+
+        <div
+          @click="
+            onChatPage('/profile/interaction-message', {
+              groupId: chatList[2]?.groupId
+            })
+          "
+          class="w-full relative h-82 flex justify-start items-center px-16"
+        >
+          <van-badge
+            v-if="chatList[2]?.unreadMessageCount > 0"
+            v-bind="messageNumber(chatList[2]?.unreadMessageCount)"
+            max="99"
           >
-            <van-badge
-              v-if="chatList[2]?.unreadMessageCount > 0"
-              v-bind="messageNumber(chatList[2]?.unreadMessageCount)"
-              max="99"
-            >
-              <div
-                class="w-48 h-48 bg-[#FF476A] rounded-full overflow-hidden flex justify-center items-center"
-              >
-                <img
-                  class="w-24 h-24 shrink-0 object-cover"
-                  src="~/assets/img/chat/weixin-shake.svg"
-                  alt=""
-                />
-              </div>
-            </van-badge>
-
             <div
-              v-else
               class="w-48 h-48 bg-[#FF476A] rounded-full overflow-hidden flex justify-center items-center"
             >
               <img
@@ -184,86 +168,49 @@
                 alt=""
               />
             </div>
+          </van-badge>
 
-            <div class="h-48 w-245 shrink-0 ml-12 flex flex-wrap items-start">
-              <h1 class="line-clamp-1 w-full text-base text-black-3 font-semibold mb-4">
-                {{ chatList[2]?.groupName }}
-              </h1>
-              <p class="line-clamp-1 h-20 text-sm text-black-6 leading-3xl">
-                {{
-                  chatList[2]?.lastMessage
-                    ? chatList[2]?.lastMessage?.messageContent?.messageContent
-                    : '暂无互动消息'
-                }}
-              </p>
-            </div>
-
-            <div class="w-35 h-48 shrink-0">
-              <p class="text-black/[0.6] text-sm text-end">
-                {{
-                  chatList[2]?.lastMessage
-                    ? createTimeSplit(chatList[2]?.lastMessage?.createTime)
-                    : ''
-                }}
-              </p>
-            </div>
-            <div class="absolute bottom-0 right-0 w-[96%] h-1 border-b-[1px]"></div>
+          <div
+            v-else
+            class="w-48 h-48 bg-[#FF476A] rounded-full overflow-hidden flex justify-center items-center"
+          >
+            <img
+              class="w-24 h-24 shrink-0 object-cover"
+              src="~/assets/img/chat/weixin-shake.svg"
+              alt=""
+            />
           </div>
 
-          <!-- 置顶绘画列表  "-->
-          <div v-if="isTopList?.length && activeNames" class="w-full">
-            <template v-for="(item, index) in isTopList" :key="item?.id">
-              <!-- <template v-if="index > 2"> -->
-              <!-- 群聊会话 -->
-              <ProfileNewsGroupChat
-                v-if="item?.noticeType == 2"
-                :item-data="{
-                  ...item,
-                  updateTime: item?.lastMessage
-                    ? createTimeSplit(item?.lastMessage?.updateTime)
-                    : ''
-                }"
-                @on-chat-page="goDetails('group', item)"
-                @on-no-bother="noBother(item)"
-                @on-is-top="onIsTop(item)"
-                @on-conv-delete="onIsShow(item)"
-              />
-
-              <!-- 单聊会话 -->
-              <ProfileNewsSingleChat
-                v-if="item?.noticeType == 1"
-                :item-data="{
-                  ...item,
-                  updateTime: item?.lastMessage
-                    ? createTimeSplit(item?.lastMessage?.updateTime)
-                    : ''
-                }"
-                @on-chat-page="goDetails('single', item)"
-                @on-no-bother="noBother(item)"
-                @on-is-top="onIsTop(item)"
-                @on-conv-delete="onIsShow(item)"
-              />
-              <!-- </template> -->
-              <!-- <template v-else></template> -->
-            </template>
+          <div class="h-48 w-245 shrink-0 ml-12 flex flex-wrap items-start">
+            <h1 class="line-clamp-1 w-full text-base text-black-3 font-semibold mb-4">
+              {{ chatList[2]?.groupName }}
+            </h1>
+            <p class="line-clamp-1 h-20 text-sm text-black-6 leading-3xl">
+              {{
+                chatList[2]?.lastMessage
+                  ? chatList[2]?.lastMessage?.messageContent?.messageContent
+                  : '暂无互动消息'
+              }}
+            </p>
           </div>
 
-          <div
-            v-if="isTopList.length >= 6"
-            @click="activeNames = !activeNames"
-            class="flex justify-between items-center h-20 -mt-20 w-full p-16 box-border"
-          >
-            <div class="shrink-0 flex items-center">
-              <van-icon name="bars" size="16" class="mr-5" />
-              <span class="text-sm">{{ collapseTitle }}</span>
-            </div>
-            <div class="w-16 h-16 shrink-0">
-              <van-icon name="arrow" size="16" />
-            </div>
+          <div class="w-35 h-48 shrink-0">
+            <p class="text-black/[0.6] text-sm text-end">
+              {{
+                chatList[2]?.lastMessage
+                  ? createTimeSplit(chatList[2]?.lastMessage?.createTime)
+                  : ''
+              }}
+            </p>
           </div>
-
-          <!-- 不置顶的会话列表 -->
-          <template v-for="(item, index) in pinnedList" :key="item?.id">
+          <div class="absolute bottom-0 right-0 w-[96%] h-1 border-b-[1px]"></div>
+        </div>
+
+        <!-- 置顶绘画列表  "-->
+        <div v-if="isTopList?.length && activeNames" class="w-full">
+          <template v-for="(item, index) in isTopList" :key="item?.id">
+            <!-- <template v-if="index > 2"> -->
+            <!-- 群聊会话 -->
             <ProfileNewsGroupChat
               v-if="item?.noticeType == 2"
               :item-data="{
@@ -275,6 +222,8 @@
               @on-is-top="onIsTop(item)"
               @on-conv-delete="onIsShow(item)"
             />
+
+            <!-- 单聊会话 -->
             <ProfileNewsSingleChat
               v-if="item?.noticeType == 1"
               :item-data="{
@@ -286,11 +235,54 @@
               @on-is-top="onIsTop(item)"
               @on-conv-delete="onIsShow(item)"
             />
+            <!-- </template> -->
+            <!-- <template v-else></template> -->
           </template>
-        </van-list>
-      </div>
-    </van-pull-refresh>
+        </div>
+
+        <div
+          v-if="isTopList.length >= 6"
+          @click="activeNames = !activeNames"
+          class="flex justify-between items-center h-20 -mt-20 w-full p-16 box-border"
+        >
+          <div class="shrink-0 flex items-center">
+            <van-icon name="bars" size="16" class="mr-5" />
+            <span class="text-sm">{{ collapseTitle }}</span>
+          </div>
+          <div class="w-16 h-16 shrink-0">
+            <van-icon name="arrow" size="16" />
+          </div>
+        </div>
+
+        <!-- 不置顶的会话列表 -->
+        <template v-for="(item, index) in pinnedList" :key="item?.id">
+          <ProfileNewsGroupChat
+            v-if="item?.noticeType == 2"
+            :item-data="{
+              ...item,
+              updateTime: item?.lastMessage ? createTimeSplit(item?.lastMessage?.updateTime) : ''
+            }"
+            @on-chat-page="goDetails('group', item)"
+            @on-no-bother="noBother(item)"
+            @on-is-top="onIsTop(item)"
+            @on-conv-delete="onIsShow(item)"
+          />
+          <ProfileNewsSingleChat
+            v-if="item?.noticeType == 1"
+            :item-data="{
+              ...item,
+              updateTime: item?.lastMessage ? createTimeSplit(item?.lastMessage?.updateTime) : ''
+            }"
+            @on-chat-page="goDetails('single', item)"
+            @on-no-bother="noBother(item)"
+            @on-is-top="onIsTop(item)"
+            @on-conv-delete="onIsShow(item)"
+          />
+        </template>
+      </van-list>
+    </div>
   </div>
+  <!-- </van-pull-refresh> -->
 </template>
 
 <script setup>
@@ -443,8 +435,8 @@ const goDetails = (type, item) => {
       navigateTo({
         path: '/chat/single-chat',
         query: {
-          getUserId: item?.toUserId,
-          headImage: item?.headImage
+          getUserId: item?.toUserId
+          // headImage: item?.headImage
         }
       })
       break