Эх сурвалжийг харах

feat:1.聊天群聊的添加成员的修改设置的修改

suwenjiang 2 сар өмнө
parent
commit
c3e51b74a6

+ 1 - 1
src/pages/chat/announcement.vue

@@ -132,7 +132,7 @@ const getAnnouncement = async () => {
     }
   })
   if (data) {
-    queryDataName.groupNotice = data.groupNotice
+    queryDataName.groupNotice = data.groupNotice.messageContent
   } else {
   }
 }

+ 1 - 50
src/pages/chat/create-group.vue

@@ -87,61 +87,13 @@
         </div>
       </template>
 
-      <!-- <div class="w-full px-16 py-20" >
-        <van-row :gutter="[12, 16]">
-          <template v-for="(subItem, subIndex) in groupTypeList" :key="subIndex">
-            <van-col @click="handleTypeClick(subItem)" span="12" class="h-40 mb-16">
-              <div
-                :class="` relative ${showIndex == subItem.id ? ' border-[#FF9300] border-2  shadow-[0_4px_4px_0px_rgba(0,0,0,0.1)]' : ''} h-40 pl-22 flex justify-start items-center shrink-0 text-xl text-black-6 font-semibold bg-[#F7F8FA] rounded-md`"
-              >
-                <div class="w-24 h-24 border shrink-0 mr-6">
-                  <img class="w-full h-full object-cover" :src="city" alt="" />
-                </div>
-                {{ subItem.typeName }}
-
-                <div
-                  v-if="showIndex == subItem.id"
-                  class="absolute rounded-t-md square1 -top-2 left-0 z-1"
-                ></div>
-                <div v-if="showIndex == subItem.id" class="w-14 h-14 absolute top-2 left-2 z-2">
-                  <img
-                    class="w-full h-full object-cover"
-                    alt=""
-                    src="~/assets/img/chat/check.svg"
-                  />
-                </div>
-              </div>
-            </van-col>
-
-            <div
-              v-if="showIndex == subItem.id"
-              class="w-full relative flex justify-start box-border flex-wrap pl-21 mb-18 pt-14 bg-[#F7F7F7] rounded-md"
-            >
-              <div
-                :class="`w-32 h-8 absolute -top-[8px] ${subIndex % 2 != 0 ? 'right-[23px]' : 'left-[23px]'} `"
-              >
-                <img class="w-full h-full" src="~/assets/img/chat/polygon.svg" alt="" />
-              </div>
-              <template v-for="(el, index2) in subItem.children" :key="`ss${index2}`">
-                <div
-                  @click="childrenHandleTypeClick(el)"
-                  :class="`${childrenIndex == el.id ? 'text-[#FF9300] border-[#FF9300]  border-[2px] bg-[#FF9300]/[0.08]' : 'bg-white border text-black-6'} py-5 mr-8 mb-12 rounded-[4px] text-sm  box-border px-12`"
-                >
-                  {{ el.typeName }}
-                </div>
-              </template>
-            </div>
-          </template>
-        </van-row>
-      </div> -->
-
       <div class="w-full px-16 py-20 card-list">
         <template v-for="(subItem, subIndex) in groupTypeList" :key="subItem?.id">
           <div
             :class="` h-40 mb-4  relative ${showIndex == subItem.id ? ' border-[#FF9300] border-2  shadow-[0_4px_4px_0px_rgba(0,0,0,0.1)]' : ''}  pl-22 flex justify-start items-center shrink-0 text-xl text-black-6 font-semibold bg-[#F7F8FA] rounded-md`"
             @click="handleTypeClick(subItem)"
           >
-            <div class="w-24 h-24 border shrink-0 mr-6">
+            <div class="w-24 h-24 shrink-0 mr-6">
               <img
                 class="w-full h-full object-cover"
                 :src="item?.typeIcon ? item?.typeIcon : city"
@@ -262,7 +214,6 @@ async function getTreeType() {
   }
 }
 
-//
 const handleTypeClick = (item) => {
   if (showIndex.value == item?.id) {
     showIndex.value = null

+ 3 - 7
src/pages/chat/examine.vue

@@ -4,8 +4,9 @@
     <ChatSearch placeholder="请输入关键词" v-model:searchString="searchString" @search="search" />
 
     <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
-      <!-- <ChatEmpty v-if="!addDataList?.length && !loading" image="search" title="暂无数据" /> -->
+      <ChatEmpty v-if="!addDataList?.length && !loading" image="search" title="暂无数据" />
       <van-list
+        v-else-if="addDataList.length"
         v-model:loading="loading"
         error-text="获取失败"
         finished-text="-- 没有更多了 --"
@@ -13,11 +14,8 @@
         :immediate-check="false"
         @load="getLoadList"
       >
-        <!-- addDataList v-else-if="addDataList.length" -->
-        <!--  v-for="(item, index) in addDataList"
-              :key="item?.id" -->
         <van-checkbox-group v-model="checked">
-          <template v-for="(item, index) in 12" :key="item?.id">
+          <template v-for="(item, index) in addDataList" :key="item?.id">
             <van-cell center clickable @click="toggle(item?.id)" disabled>
               <template #icon>
                 <div class="flex justify-start">
@@ -35,7 +33,6 @@
               </template>
               <template #title>
                 <div class="flex items-center">
-                  <!-- <h1 class="text-xl text-black-3">{{ item?.visaTitle }}</h1> -->
                   <h1 class="text-xl text-black-3">{{ item }}</h1>
                 </div>
               </template>
@@ -124,7 +121,6 @@ const getList = async () => {
 
     loading.value = true
     let { data } = await request(url, {
-      method: 'post',
       query: {
         groupId: route.query.groupId
       }

+ 99 - 36
src/pages/chat/group-add.vue

@@ -2,12 +2,11 @@
   <div class="w-full h-[100vh]">
     <ChatHeaderBar title="添加成员" />
 
-    <ChatSearch v-model:searchString="searchString" @search="search" placeholder="请输入关键词" />
-
-    <div class="h-118"></div>
+    <ChatSearch v-model:searchString="showName" @search="search" placeholder="请输入关键词" />
 
     <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
       <Empty v-if="!addDataList?.length && !loading" title="暂无数据" top="100" />
+
       <van-list
         v-else-if="addDataList.length"
         v-model:loading="loading"
@@ -15,46 +14,59 @@
         finished-text="-- 没有更多了 --"
         :finished="finished"
         :immediate-check="false"
-        @load="getLoadList"
       >
-        <van-checkbox-group v-model="checked">
-          <van-index-bar highlight-color="#FD9A00" index-list :sticky="false">
-            <template v-for="(item, index) in addDataList" :key="item?.id">
-              <van-index-anchor index="A" />
-              <van-cell
-                v-for="(item, index) in addDataList"
-                :key="item?.id"
-                center
-                clickable
-                @click="toggle(index)"
-                disabled
-              >
+        <!--    @load="getLoadList"  -->
+        <div style="height: calc(100vh - 170px)">
+          <van-checkbox-group v-model="checked">
+            <!-- <van-index-bar highlight-color="#FD9A00" index-list :sticky="false"> -->
+            <template v-for="(item, index) in addDataList" :key="item?.attentionIdDictMap?.userId">
+              <!-- <van-index-anchor index="A" /> -->
+              <van-cell center clickable @click="toggle(item?.attentionIdDictMap?.userId)" disabled>
                 <template #icon>
                   <div class="flex justify-start">
                     <van-checkbox
                       checked-color="#FD9A00"
-                      :name="item.id"
-                      :ref="(el) => (checkboxRefs[index] = el)"
+                      :name="item?.attentionIdDictMap?.userId"
+                      :ref="(el) => (checkboxRefs[item?.attentionIdDictMap?.userId] = el)"
                       @click.stop
                     />
 
                     <div class="w-40 h-40 ml-13 mr-12 rounded-full overflow-hidden">
-                      <img class="w-full h-full shrink-0 object-cover" :src="item?.img" alt="" />
+                      <img
+                        v-if="item?.attentionIdDictMap?.headImageUrl"
+                        class="w-full h-full shrink-0 object-cover"
+                        :src="item?.attentionIdDictMap?.headImageUrl"
+                        alt=""
+                      />
+
+                      <img
+                        class="w-full h-full shrink-0 object-cover"
+                        src="~/assets/img/default_avatar.png"
+                        alt=""
+                      />
                     </div>
                   </div>
                 </template>
                 <template #title>
                   <div class="flex items-center">
-                    <h1 class="text-xl text-black-3">{{ item?.visaTitle }}</h1>
-                    <van-tag style="margin-left: 5px" color="#F7F8FA" text-color="#666666">
+                    <h1 class="text-xl text-black-3">
+                      {{ item?.attentionIdDictMap?.showName }}
+                    </h1>
+                    <van-tag
+                      v-if="item.fansStatus == 2"
+                      style="margin-left: 5px; padding: 3px 6px"
+                      color="#F7F8FA"
+                      text-color="#666666"
+                    >
                       相互关注
                     </van-tag>
                   </div>
                 </template>
               </van-cell>
             </template>
-          </van-index-bar>
-        </van-checkbox-group>
+            <!-- </van-index-bar> -->
+          </van-checkbox-group>
+        </div>
       </van-list>
     </van-pull-refresh>
   </div>
@@ -62,6 +74,8 @@
 <script setup>
 import { pinyin } from 'pinyin-pro'
 
+const route = useRoute()
+
 definePageMeta({
   layout: false
 })
@@ -75,7 +89,7 @@ const loading = ref(false)
 const finished = ref(false)
 
 const checked = ref([])
-const searchString = ref('')
+const showName = ref('')
 const checkboxRefs = ref([])
 
 // 字母的数组
@@ -88,40 +102,89 @@ const toggle = (index) => {
 const queryParams = reactive({
   pageNum: 1,
   pageSize: 10,
-  searchString: ''
+  flagPage: 1
 })
 
 const addDataList = ref([])
+const filterDataList = ref([])
 
 useSeoMeta({
   title: '添加成员'
 })
 
 const search = () => {
-  addDataList.value = []
-  queryParams.pageNum = 1
-  queryParams.searchString = searchString.value
-  getList()
+  finished.value = true
+  if (showName.value) {
+    addDataList.value = filterDataList.value.filter((item) =>
+      item.attentionIdDictMap.name.includes(showName.value)
+    )
+  } else {
+    addDataList.value = filterDataList.value
+  }
 }
 
+// 获取全局搜索的用户
+// const getAllList = async () => {
+//   try {
+//     loading.value = true
+
+//     const {
+//       data: { dataList, totalCount }
+//     } = await request('/website/tourism/fans/getUserListByNickname', {
+//       query: {
+//         ...queryParams,
+//         showName: showName.value
+//       }
+//     })
+
+//     if (Array.isArray(dataList) && dataList?.length) {
+//       addDataList.value = dataList
+//       // arr = addDataList.value
+//       // arr = arr.map((item, index) => {
+//       //   let letter = pinyin(item?.visaTitle, { pattern: 'first', toneType: 'none' })
+//       //   console.log(letter, '123')
+
+//       //   item.letter = letter
+//       //   return item
+//       // })
+//       // console.log(arr, 'addDataList.value .value')
+//     } else {
+//       addDataList.value = []
+//     }
+
+//     loading.value = false
+//     refreshing.value = false
+//     if (addDataList.value.length >= totalCount) {
+//       finished.value = true
+//     } else {
+//       finished.value = false
+//     }
+//   } catch (err) {
+//   } finally {
+//     refreshing.value = false
+//     loading.value = false
+//   }
+// }
+
 // 刷新
 const onRefresh = () => {
   queryParams.pageNum = 1
   addDataList.value = []
+  filterDataList.value = []
   getList()
 }
 
 // 触底加载
-const getLoadList = () => {
-  queryParams.pageNum++
-  finished.value = true
-  getList()
-}
+// const getLoadList = () => {
+//   queryParams.pageNum++
+//   finished.value = true
+//   showName.value ? search() : getList()
+// }
 
 // 获取数据
 const getList = async () => {
   try {
-    let url = `/website/tourism/visa/list/page`
+    let url = `/website/tourism/fans/getFriends`
 
     loading.value = true
     let {
@@ -133,7 +196,7 @@ const getList = async () => {
     })
     let arr = []
     if (Array.isArray(dataList) && dataList?.length) {
-      addDataList.value = addDataList.value.concat(dataList)
+      addDataList.value = dataList
       arr = addDataList.value
       arr = arr.map((item, index) => {
         let letter = pinyin(item?.visaTitle, { pattern: 'first', toneType: 'none' })

+ 107 - 22
src/pages/chat/qr-results.vue

@@ -40,15 +40,28 @@
 
     <div class="fixed bottom-0 left-0 w-full box-border pb-40 pt-16 bg-white px-16">
       <!-- <van-button
+        v-if="loading"
         round
         type="primary"
         block
         :color="colorList[itemData?.codeShowStatus]"
         @click="chageState(itemData?.codeShowStatus)?.fn"
       >
+        {{ showIsExist ? '立即聊天' : '加入' }}
         {{ chageState(itemData?.codeShowStatus)?.text }}
       </van-button> -->
       <van-button
+        v-model:loading="loading"
+        round
+        type="primary"
+        block
+        :color="buttonColor"
+        @click="handleQrcode"
+      >
+        {{ buttonText }}
+      </van-button>
+
+      <!-- <van-button
         v-if="itemData?.codeShowStatus == 1"
         round
         type="primary"
@@ -102,7 +115,7 @@
         @click=""
       >
         此群已解散
-      </van-button>
+      </van-button> -->
     </div>
   </div>
 </template>
@@ -113,6 +126,12 @@ const userInfoStore = useUserInfoStore()
 const { userInfo } = storeToRefs(userInfoStore)
 
 const itemData = ref({})
+const loading = ref(false)
+// 是否存在
+const showIsExist = ref(false)
+
+const buttonText = ref('')
+const buttonColor = ref('#FF9300')
 
 definePageMeta({
   layout: false
@@ -128,6 +147,7 @@ onMounted(() => {
 
 async function getGroupInfo() {
   try {
+    loading.value = true
     let { data } = await request('/website/tourGroup/getGroupInfoAndMemberByGroupId', {
       query: {
         groupId: route.query?.groupId
@@ -136,6 +156,22 @@ async function getGroupInfo() {
 
     if (typeof data == 'object') {
       itemData.value = data
+      if (data.bannedStatus) {
+        // showIsExist.value = data?.memberList.some((item) => item?.userId == userInfo.value.userId)
+
+        if (showIsExist.value) {
+          buttonText.value = '立即聊天'
+          buttonColor.value = '#FF9300'
+        } else {
+          buttonText.value = '加入'
+          buttonColor.value = '#FF9300'
+        }
+      } else {
+        buttonText.value = '此群已解散'
+        buttonColor.value = '#FF9300'
+      }
+
+      loading.value = false
     }
   } catch (error) {}
 }
@@ -183,15 +219,8 @@ async function getGroupInfo() {
 
 // 申请加入群聊
 const handleQrcode = async () => {
-  try {
-    let { data } = await request('/website/tourMember/invite', {
-      query: {
-        groupId: itemData.value.id,
-        userId: userInfo.value.userId
-      }
-    })
-
-    if (data == 3) {
+  if (itemData.value.bannedStatus) {
+    if (showIsExist.value) {
       navigateTo({
         path: '/chat/group',
         query: {
@@ -199,20 +228,76 @@ const handleQrcode = async () => {
         },
         replace: true
       })
-    }
-    if (data == 2) {
-      itemData.value.codeShowStatus = 4
-    }
+    } else {
+      if (itemData.value.bannedStatus) {
+        if (itemData.value.dataState) {
+        }
+        loading.value = true
+        try {
+          let { data } = await request('/website/tourMember/invite', {
+            method: 'post',
+            body: {
+              groupId: itemData.value.id,
+              ids: [userInfo.value.userId]
+            }
+          })
 
-    if (data == 1) {
-      showDialog({
-        width: 260,
-        title: '提示',
-        message: '该群聊异常,无法加入',
-        confirmButtonColor: '#FF9300'
-      }).then(() => {})
+          if (data) {
+            buttonText.value = '已申请'
+            buttonColor.value = '#D9D9D9'
+            loading.value = false
+          }
+        } catch (error) {
+        } finally {
+          loading.value = false
+        }
+      } else {
+        showDialog({
+          width: 260,
+          title: '提示',
+          message: '该群聊异常,无法加入',
+          confirmButtonColor: '#FF9300'
+        }).then(() => {
+          buttonText.value = '此群异常,暂不能加入'
+          buttonColor.value = '#D9D9D9'
+        })
+      }
     }
-  } catch (error) {}
+  } else {
+    return
+  }
+
+  // try {
+  //   let { data } = await request('/website/tourMember/invite', {
+  //     method: 'post',
+  //     body: {
+  //       groupId: itemData.value.id,
+  //       ids: [userInfo.value.userId]
+  //     }
+  //   })
+
+  //   if (data == 3) {
+  //     navigateTo({
+  //       path: '/chat/group',
+  //       query: {
+  //         groupId: itemData.value.id
+  //       },
+  //       replace: true
+  //     })
+  //   }
+  //   if (data == 2) {
+  //     itemData.value.codeShowStatus = 4
+  //   }
+
+  //   if (data == 1) {
+  // showDialog({
+  //   width: 260,
+  //   title: '提示',
+  //   message: '该群聊异常,无法加入',
+  //   confirmButtonColor: '#FF9300'
+  // }).then(() => {})
+  //   }
+  // } catch (error) {}
 }
 </script>
 <style scoped lang="scss"></style>

+ 256 - 70
src/pages/chat/set.vue

@@ -127,15 +127,21 @@
           center
           is-link
           title="群公告"
-          :value="setData?.groupNotice ? '' : '未设置'"
+          :value="setData?.groupNotice?.messageContent ? '' : '未设置'"
         ></van-cell>
 
-        <van-cell size="large" center>
+        <van-cell @click="handleDescription" size="large" center>
           <template #title>
             <p class="w-full line-clamp-1">群介绍:{{ setData?.description }}</p>
           </template>
         </van-cell>
-        <van-cell size="large" center title="群聊类型">
+        <van-cell
+          @click="getTreeType"
+          size="large"
+          :is-link="isRankAndFiler(userGroupData?.groupRole)"
+          center
+          title="群聊类型"
+        >
           <template #value>
             <p class="w-full line-clamp-1">{{ setData?.belongTypeIdDictMap?.name }}</p>
           </template>
@@ -174,18 +180,27 @@
             <span>开启后,在群聊广场和个人主页</span>
           </template>
           <template #right-icon>
-            <van-switch v-model="isPublic" active-color="#FF9300" inactive-color="#dcdee0" />
+            <van-switch
+              v-model="isPublic"
+              @click="changeIsPublic"
+              active-color="#FF9300"
+              inactive-color="#dcdee0"
+            />
           </template>
         </van-cell>
         <van-cell size="large" center title="群聊邀请确认">
           <template #label>
-            <!-- class="text-base text-black/[0.4]" -->
             <span>
               启用后,群成员需群主或群管理员确认才能邀请朋友进群。扫描二维码进群将同时停用
             </span>
           </template>
           <template #right-icon>
-            <van-switch v-model="isNeedConfirm" active-color="#FF9300" inactive-color="#dcdee0" />
+            <van-switch
+              v-model="isNeedConfirm"
+              @click="changeIsNeedConfirm"
+              active-color="#FF9300"
+              inactive-color="#dcdee0"
+            />
           </template>
         </van-cell>
 
@@ -335,15 +350,94 @@
           clearable
           :placeholder="dialogPlaceholder"
           v-model="groupName"
-          maxlength="12"
+          maxlength="30"
         />
       </div>
     </ChatDialog>
+
+    <van-dialog width="90%" v-model:show="showBelongTypeId" show-cancel-button>
+      <template #title>
+        <div class="w-full flex justify-between items-center px-16 py-11 border-b-[1px]">
+          <h1>群类型</h1>
+          <div class="w-32 h-32 -mt-3 shrink-0" @click="showBelongTypeId = false">
+            <img
+              @click="visible = false"
+              class="w-full h-full object-cover"
+              src="~/assets/img/note-create/close.svg"
+              alt=""
+            />
+          </div>
+        </div>
+      </template>
+
+      <div class="w-full px-16 py-20 card-list">
+        <template v-for="(subItem, subIndex) in groupTypeList" :key="subItem?.id">
+          <div
+            :class="` h-40 mb-4  relative ${showIndex == subItem.id ? ' border-[#FF9300] border-2  shadow-[0_4px_4px_0px_rgba(0,0,0,0.1)]' : ''}  pl-22 flex justify-start items-center shrink-0 text-xl text-black-6 font-semibold bg-[#F7F8FA] rounded-md`"
+            @click="handleTypeClick(subItem)"
+          >
+            <div class="w-24 h-24 shrink-0 mr-6">
+              <img
+                class="w-full h-full object-cover"
+                :src="item?.typeIcon ? item?.typeIcon : city"
+                alt=""
+              />
+            </div>
+            <span class="line-clamp-1">
+              {{ subItem.typeName }}
+            </span>
+
+            <div
+              v-if="showIndex == subItem.id"
+              class="absolute rounded-t-md square1 -top-2 -left-2 z-1"
+            ></div>
+            <div v-if="showIndex == subItem.id" class="w-14 h-14 absolute top-0 left-0 z-2">
+              <img class="w-full h-full object-cover" alt="" src="~/assets/img/chat/check.svg" />
+            </div>
+          </div>
+
+          <div
+            v-if="showIndex == subItem.id && subItem?.children.length > 0"
+            class="item__child mb-4 w-full relative flex justify-start box-border flex-wrap pl-21 pt-14 bg-[#F7F7F7] rounded-md"
+          >
+            <div
+              :class="`w-32 h-8 absolute -top-[8px] ${subIndex % 2 != 0 ? 'right-[23px]' : 'left-[23px]'} `"
+            >
+              <img class="w-full h-full" src="~/assets/img/chat/polygon.svg" alt="" />
+            </div>
+            <template v-for="el in subItem.children" :key="el?.id">
+              <div
+                @click="childrenHandleTypeClick(el)"
+                :class="`${childrenIndex == el.id ? 'text-[#FF9300] border-[#FF9300]  border-[2px] bg-[#FF9300]/[0.08]' : 'bg-white border text-black-6'} py-5 mr-8 mb-12 rounded-[4px] text-sm  box-border px-12`"
+              >
+                {{ el.typeName }}
+              </div>
+            </template>
+          </div>
+        </template>
+      </div>
+
+      <template #footer>
+        <div class="w-full px-40 pb-30">
+          <van-button
+            style="font-size: 16px"
+            type="primary"
+            color="#FF9300"
+            round
+            block
+            @click="changeBelongTypeId"
+          >
+            确认
+          </van-button>
+        </div>
+      </template>
+    </van-dialog>
   </div>
 </template>
 <script setup>
+import city from '~/assets/img/chat/city-one.svg'
+
 const route = useRoute()
-const router = useRouter()
 
 const userInfoStore = useUserInfoStore()
 const { userInfo } = storeToRefs(userInfoStore)
@@ -360,14 +454,10 @@ onMounted(() => {
   userInfoStore.getUserInfo()
   getGroupSetData()
 })
-// computed(() => route.query.userId ?? '')
 
 let setData = reactive({
-  // groupId: computed(() => route.query.groupId ?? ''),
-  userId: userInfo.value.userId
-  // groupRole: 1
-  // groupNotice:
-  //   '群公告模版 1.本群提倡友好理性交流,鼓励群友多发言,多互动 2.禁止无意义刷屏、发送广告信息以及谩骂等不良消息 3.为了保证群活跃不经常发言的群友,可能会被定时清理出群'
+  userId: userInfo.value.userId,
+  belongTypeIdDictMap: {}
 })
 
 watch([() => route.query.groupId, () => route.query.userId], () => {}, {
@@ -384,6 +474,7 @@ const groupName = ref('')
 const isPublic = ref(false)
 const isNeedConfirm = ref(false)
 const isNotDisturb = ref(false)
+const showBelongTypeId = ref(false)
 const isTop = ref(false)
 
 // 弹出窗
@@ -404,63 +495,135 @@ const openDialog = (item) => {
 }
 // 弹窗确认的事件
 const confirm = () => {
-  if (userGroupData.value?.groupRole == 1 && isRemark.value == 0) {
-    changeGroupName()
-  } else {
-  }
+  if (userGroupData.value?.groupRole == 1 && isRemark.value == 0)
+    changeGroupName({ groupName: groupName.value })
 
   if (isRemark.value == 1) changeTourMember({ groupId: setData.id, remark: groupName.value })
 
   if (isRemark.value == 2)
     changeGroupName({
-      groupId: setData.id,
       groupNickname: groupName.value
     })
 
   // showDialog.value = false
 }
 
-// 修改群名称
-const changeGroupName = async () => {
+// groupName 修改群名称
+// belongTypeId 群聊类型
+// groupAvatar 群头像
+// isNeedConfirm  是否开启群验证 0 否 1 是
+// isPublic 是否公开展示 0隐藏 1公开
+
+// 修我在群里的昵称 修改群名称
+const changeGroupName = async (body) => {
   try {
     const { data } = await request('/website/tourGroup/updateGroup', {
       method: 'post',
       body: {
         groupId: setData.id,
-        groupName: groupName.value
+        ...body
       }
     })
 
     if (data) {
-      showSuccessToast('修改成功')
+      userGroupData.value[Object.keys(body)[0]] = groupName.value
+
+      // showSuccessToast('修改成功')
     } else {
-      showFailToast('修改失败')
+      // showFailToast('修改失败')
     }
   } catch (error) {}
 }
-// 修改群名称
-const changeGroup2 = async () => {
-  let body = { isNeedConfirm: changeStateBoolean(isNeedConfirm.value) }
-  // changeGroupName()
+
+// 是否开启群验证
+const changeIsNeedConfirm = async () => {
+  changeGroupBelongTypeIdIsNeedConfirm({ isNeedConfirm: changeStateBoolean(isNeedConfirm.value) })
+}
+
+// 是否公开展示
+const changeIsPublic = async () => {
+  changeGroupBelongTypeIdIsNeedConfirm({ isPublic: changeStateBoolean(isPublic.value) })
+}
+
+const showIndex = ref(null)
+const childrenIndex = ref(null)
+
+const groupTypeList = ref([])
+const subTypeList = ref([])
+const groupTypeName = ref('')
+
+// 选中群类型的方法
+const handleTypeClick = (item) => {
+  if (showIndex.value == item?.id) {
+    showIndex.value = null
+    subTypeList.value = []
+  } else {
+    showIndex.value = item.id
+    subTypeList.value = item.children
+  }
+}
+// 选中群类型子集的方法
+const childrenHandleTypeClick = (item) => {
+  childrenIndex.value = item.id
+  groupTypeName.value = item.typeName
 }
 
-// async function changeGroupName(params) {
-//   try {
-//     const { data } = await request('/website/tourGroup/updateGroup', {
-//       method: 'post',
-//       body: {
-//         groupId: setData.id,
-//         ...params
-//       }
-//     })
-
-//     if (data) {
-//       showSuccessToast('修改成功')
-//     } else {
-//       showFailToast('修改失败')
-//     }
-//   } catch (error) {}
-// }
+// 获取群类型
+async function getTreeType() {
+  if (isRankAndFiler(userGroupData.value?.groupRole)) {
+    try {
+      const { data } = await request('/website/tourGroupType/treeType')
+      if (Array.isArray(data) && data.length) {
+        groupTypeList.value = data
+
+        data.map((item) => {
+          item.children.map((el) => {
+            if (el.id == setData?.belongTypeId) {
+              showIndex.value = item.id
+              childrenIndex.value = setData.belongTypeId
+              subTypeList.value = item.children
+            }
+          })
+        })
+
+        showBelongTypeId.value = true
+      } else {
+        groupTypeList.value = []
+      }
+    } finally {
+    }
+  } else {
+    return
+  }
+}
+
+// 群聊类型
+const changeBelongTypeId = async () => {
+  if (childrenIndex.value != setData.belongTypeId) {
+    changeGroupBelongTypeIdIsNeedConfirm({ belongTypeId: childrenIndex.value })
+  }
+  showBelongTypeId = false
+}
+
+// 修改 群聊类型  是否开启群验证
+async function changeGroupBelongTypeIdIsNeedConfirm(body) {
+  try {
+    const { data } = await request('/website/tourGroup/updateGroup', {
+      method: 'post',
+      body: {
+        groupId: setData.id,
+        ...body
+      }
+    })
+    if (data) {
+      if ((userGroupData.value[Object.keys(body)[0]] = 'belongTypeId')) {
+        setData.belongTypeIdDictMap.name = groupTypeName.value
+      }
+      // showSuccessToast('修改成功')
+      return
+    }
+  } catch (error) {}
+}
 
 // 修改备注名 和修改自己在群里的备注
 const changeTourMember = async (body) => {
@@ -474,9 +637,9 @@ const changeTourMember = async (body) => {
     if (data) {
       //修改成功
       if ((Object.keys(body)[1] = 'remark')) {
-        userGroupData.groupRemark = groupName.value
+        userGroupData.value.groupRemark = groupName.value
       } else {
-        userGroupData[Object.keys(body)[1]] = groupName.value
+        userGroupData.value[Object.keys(body)[1]] = groupName.value
       }
       showSuccessToast('操作成功')
     } else {
@@ -485,16 +648,18 @@ const changeTourMember = async (body) => {
   } catch (error) {}
 }
 
+// 弹窗的取消
 const cancel = () => {
   showDialog.value = false
 }
 
-// 改变状态的公用方法
+// 数字转换成布尔值
 const changeState = (state) => {
   if (state == 1) return true
   if (state == 0) return false
 }
 
+// 布尔值转换成数字
 const changeStateBoolean = (state) => {
   if (state) {
     return 1
@@ -513,6 +678,7 @@ const handleIsNotDisturb = () => {
   handleBoolean({ isNotDisturb: changeStateBoolean(isNotDisturb.value) })
 }
 
+// 是否免打扰和 是否置顶 公共
 const handleBoolean = async (params) => {
   try {
     let { data } = await request('/website/tourMember/updateSingleTourMember', {
@@ -532,6 +698,7 @@ const handleBoolean = async (params) => {
     }
   } catch (error) {}
 }
+
 // 获取群设置的配置信息
 const getGroupSetData = async () => {
   const { data } = await request('/website/tourGroup/getGroupInfoAndMemberByGroupId', {
@@ -548,7 +715,6 @@ const getGroupSetData = async () => {
     console.log(userInfo.value.userId, 'userInfo')
 
     userGroupData.value = data.memberList.find((item) => item.userId == userInfo.value.userId)
-    console.log()
 
     console.log(userGroupData.value, '4444')
     console.log(userGroupData.value.groupRole, 'userGroupData groupRole')
@@ -561,11 +727,6 @@ const getGroupSetData = async () => {
   }
 }
 
-// 返回上一页
-const onClickLeft = () => {
-  router.back()
-}
-
 // 是否是普通成员
 const isRankAndFiler = (role) => {
   return role == 1 || role == 2 ? true : false
@@ -594,10 +755,6 @@ const clearChatHistory = () => {
 
 // 点击公告
 const handleAnnouncement = () => {
-  console.log(userGroupData.value?.groupRole, 'userGroupData?.groupRole')
-  console.log(!isRankAndFiler(3))
-  //  && !setData?.groupNotice
-  // if (isRankAndFiler(userGroupData.value?.groupRole)) {
   navigateTo({
     path: '/chat/announcement',
     query: {
@@ -606,16 +763,29 @@ const handleAnnouncement = () => {
       groupRole: userGroupData.value?.groupRole
     }
   })
-  // } else {
-  // showConfirmDialog({
-  //   width: 260,
-  //   message: `只有群主${setData?.groupName ? setData?.groupName : ''}或群管理员才能修改公告`,
-  //   showCancelButton: false,
-  //   confirmButtonColor: '#FF9300',
-  //   confirmButtonText: '我知道了'
-  // }).then(() => {})
-  // return
-  // }
+}
+
+// 修改群介绍
+const handleDescription = () => {
+  if (isRankAndFiler(userGroupData.value?.groupRole)) {
+    showDialog({
+      width: 260,
+      title: '群介绍',
+      message: setData.description,
+      confirmButtonColor: '#FF9400'
+    }).then(() => {
+      // on close
+    })
+  } else {
+    showDialog({
+      width: 260,
+      title: '群介绍',
+      message: setData.description,
+      confirmButtonColor: '#FF9400'
+    }).then(() => {
+      // on close
+    })
+  }
 }
 
 // 退出群聊
@@ -624,9 +794,7 @@ function handleExitGroupChat() {
     width: 260,
     title: '提示',
     message: `是否${isRankAndFiler(userGroupData?.groupRole) ? '解散' : '退出'}当前群聊${setData?.groupName ? `"${setData?.groupName}"` : ''}`,
-    // showCancelButton: false,
     confirmButtonColor: '#FF9300'
-    // confirmButtonText: '我知道了'
   })
     .then(async () => {
       const res = await request('/website/tourGroup/exitGroup', {
@@ -648,4 +816,22 @@ function handleExitGroupChat() {
 ::v-deep .van-dialog__header {
   padding-top: 21px;
 }
+
+.card-list {
+  display: grid;
+  grid-template-columns: repeat(2, 1fr);
+  grid-auto-flow: dense; /* 确保项目会填充所有的网格单元 */
+  grid-gap: 12px;
+
+  .item__child {
+    grid-column: span 2;
+  }
+
+  .square1 {
+    width: 0;
+    height: 0;
+    border-bottom: 28px solid transparent; /* 创建三角形 */
+    border-left: 28px solid #ff9300; /* 三角形的颜色 */
+  }
+}
 </style>

+ 0 - 54
src/pages/chat/sweep3.vue

@@ -1,54 +0,0 @@
-<template>
-  <div>
-    <van-button @click="handleQrcode">扫一扫</van-button>
-    <div id="qr-reader" style="width:500px"></div>
-    <div id="qr-reader-results">
-      {{ results }}
-    </div>
-  </div>
-</template>
-<script setup>
-import {Html5QrcodeScanner, Html5Qrcode, Html5QrcodeScanType} from "html5-qrcode";
-
-let results = ref(null)
-const state = reactive({
-  html5QrCode: null,
-  fileList: []
-})
-
-const handleQrcode = () => {
-  Html5Qrcode.getCameras()
-      .then(devices => {
-        if (devices && devices.length) {
-          // 当前环境下能识别出摄像头,并且摄像头的数据可能不止一个
-          state.html5QrCode = new Html5Qrcode('qr-reader')//  reader  放置扫码功能的元素ID
-          alert('摄像头识别成功')
-          state.html5QrCode.start(
-              //  environment后置摄像头 user前置摄像头
-              {facingMode: 'environment'},
-              {
-                fps: 1, // 可选,每n秒帧扫描一次
-                qrbox: {
-                  width: 250,
-                  height: 250
-                } // 扫描的UI框
-              },
-              (decodedText, decodedResult) => {
-                // 扫描结果
-                results.value = {
-                  decodedText,
-                  decodedResult
-                }
-              }
-          )
-        }
-      })
-      .catch((e) => {
-        // 摄像头无访问权限
-        alert(e)
-      })
-}
-</script>
-<style scoped lang="scss">
-
-</style>

+ 35 - 15
src/pages/profile/my-news/index.vue

@@ -132,7 +132,7 @@
           <ProfileNewsGroupChat
             :item-data="{ title: item }"
             @on-chat-page="
-              onChatPage('/chat/group', { userId: userInfo.userId, groupId: '1877542109622431746' })
+              onChatPage('/chat/group', { userId: userInfo.userId, groupId: '1877696775305945089' })
             "
             @on-no-bother="noBother(item)"
             @on-conv-delete="convDelete()"
@@ -141,7 +141,7 @@
       </div>
 
       <div
-        v-if="pinnedList.length >= 7"
+        v-if="pinnedList.length >= 6"
         @click="activeNames = !activeNames"
         class="flex justify-between border items-center h-20 w-full p-16 box-border"
       >
@@ -182,11 +182,31 @@ const actionsList = [
   { text: '加入群聊', icon: plaza },
   { text: '添加用户', icon: userAdd }
 ]
-
-const chatStore = useChatStore()
-
 const userInfoStore = useUserInfoStore()
 const { userInfo } = storeToRefs(userInfoStore)
+const uploadUrl = `${import.meta.env.VITE_APP_BASE_URL}/website/tourMessage/upload`
+const chatStore = useChatStore()
+const { ws, curConversiton, receive, receiveGetter, connectSta, onNewMessage } =
+  storeToRefs(chatStore)
+const user = computed(() => chatStore.user)
+
+// 消息接收者的用户id
+const getUserId = computed(() => curConversiton.value.toUserId)
+
+// 消息发送者:当前登录用户的加密id
+const sendUserId = computed(() => user.value.pass)
+
+// 会话id
+const groupId = computed(() => curConversiton.value.groupId)
+
+// 用户在群聊中艾特的人
+const specialUserId = ref('')
+
+// 用户输入的文本消息
+const messageContent = ref('')
+
+// 聊天类型 1单聊 2群聊 3系统消息 4关注信息
+const noticeType = computed(() => curConversiton.value.noticeType)
 
 onMounted(() => {
   userInfoStore.getUserInfo()
@@ -200,22 +220,22 @@ useSeoMeta({
 const isConnected = computed(() => chatStore.isConnected)
 
 // 连接 WebSocket
-const connectSocket = () => {
-  chatStore.connect(`?userId=${userInfo.value.userId}`)
-}
+// const connectSocket = () => {
+//   chatStore.connect(`?userId=${userInfo.value.userId}`)
+// }
 
 // 发送测试消息
-const sendTestMessage = () => {
-  chatStore.sendMessage({ message: 'Hello WebSocket!' })
-}
+// const sendTestMessage = () => {
+//   chatStore.sendMessage({ message: 'Hello WebSocket!' })
+// }
 
 // 断开 WebSocket
-const disconnectSocket = () => {
-  chatStore.disconnect()
-}
+// const disconnectSocket = () => {
+//   chatStore.disconnect()
+// }
 
 // 消息历史
-const messages = computed(() => chatStore.wsService.value?.messages || [])
+// const messages = computed(() => chatStore.wsService.value?.messages || [])
 
 const finished = ref(false)