Bläddra i källkod

添加群公告

lex-xin 9 månader sedan
förälder
incheckning
c2f413dab9

+ 26 - 26
src/TUIKit/TUIComponents/container/TUIChat/manage-components/manage-notification.vue

@@ -8,11 +8,10 @@
           <div class="username">
             <div class="users">
               <span class="name">{{ item.username }}</span>
-              <span class="tag">{{ formatJobType(item.jobType) }}</span>
             </div>
             <div class="userTime">
               <span class="time">{{ item.createTime }}</span>
-              <span class="tag" v-if="item.topFlag">置顶</span>
+              <span class="tag" v-if="item.isTop">置顶</span>
             </div>
           </div>
 
@@ -133,7 +132,7 @@
         <div class="input-title input-slider">
           <span>设置为置顶</span>
 
-          <Slider :open="topFlag" @change="onTopFlag" />
+          <Slider :open="isTop" @change="onIsTop" />
         </div>
       </div>
       <div
@@ -162,6 +161,7 @@ import {
   imGroupNoticeRemove,
 } from "../../../../api";
 import Slider from "../../../components/sliderTUI/index.vue";
+import TUIMessage from "../../../components/messageTUI/index";
 const ManageNotification = defineComponent({
   components: {
     Slider,
@@ -183,7 +183,7 @@ const ManageNotification = defineComponent({
       id: "",
       title: "",
       input: "",
-      topFlag: true, // 是否置顶
+      isTop: true, // 是否置顶
       loading: false,
       groupList: [],
       isEdit: false,
@@ -212,8 +212,8 @@ const ManageNotification = defineComponent({
     };
 
     const onMore = () => {
+      if(data.loading) return
       data.page = data.page + 1;
-      getNotification();
     };
 
     watchEffect(() => {
@@ -223,29 +223,20 @@ const ManageNotification = defineComponent({
       getNotification();
     });
 
-    const formatJobType = (jobType: string) => {
-      const template = {
-        TEACHER: "音乐老师",
-        ADMIN: "管理员",
-        HEADMASTER: "校长",
-      } as any;
-      return template[jobType];
-    };
 
 
     const onOperation = async (item: any, type: string, index?: number) => {
       try {
         if (type === "edit") {
-          ctx.emit("changeStatus", "edit");
           data.isEdit = true;
           data.title = item.title;
           data.input = item.content;
-          data.topFlag = item.topFlag;
+          data.isTop = item.isTop;
           data.id = item.id;
         } else if (type === "top") {
           await imGroupNoticeUpdate({
             groupId: data.groupProfile.groupID,
-            topFlag: true,
+            isTop: true,
             id: item.id,
           });
           data.page = 1;
@@ -262,12 +253,17 @@ const ManageNotification = defineComponent({
           data.isEdit = true;
           data.title = "";
           data.input = "";
-          data.topFlag = true;
+          data.isTop = true;
           data.id = "";
           ctx.emit("changeStatus", "add");
         }
-      } catch (e) {
+      } catch(e) {
         //
+        TUIMessage({
+          message: e.message,
+          isH5: false,
+          type: "error",
+        });
       }
       popoverRef.value[index]?.setShow(false);
     };
@@ -281,7 +277,7 @@ const ManageNotification = defineComponent({
         if (data.id) {
           await imGroupNoticeUpdate({
             groupId: data.groupProfile.groupID,
-            topFlag: data.topFlag,
+            isTop: data.isTop,
             title: data.title,
             content: data.input,
             id: data.id,
@@ -291,7 +287,7 @@ const ManageNotification = defineComponent({
             groupId: data.groupProfile.groupID,
             title: data.title,
             content: data.input,
-            topFlag: data.topFlag,
+            isTop: data.isTop,
           });
         }
 
@@ -299,15 +295,20 @@ const ManageNotification = defineComponent({
         ctx.emit("changeStatus", "submit");
         data.page = 1;
         data.groupList = [];
+        console.log('55555555555555555')
         getNotification();
-      } catch {
+      } catch(e) {
         //
+        TUIMessage({
+          message: e.message,
+          isH5: false,
+          type: "error",
+        });
       }
     };
 
-    const onTopFlag = (val: any) => {
-      console.log(val, 'onTopFlag')
-      data.topFlag = val
+    const onIsTop = (val: any) => {
+      data.isTop = val
     }
 
     const onCloseEdit = () => {
@@ -321,9 +322,8 @@ const ManageNotification = defineComponent({
     return {
       ...toRefs(data),
       popoverRef,
-      formatJobType,
       onMore,
-      onTopFlag,
+      onIsTop,
       // updateProfile,
       onOperation,
       onSubmit,

+ 6 - 10
src/TUIKit/TUIComponents/container/TUIChat/manage-components/manage.vue

@@ -19,7 +19,7 @@
       </header>
       <main class="main" style="background-color: #f4f5f9; height: 100%" v-if="!currentTab">
         <ManageName class="space-top" :isAuth="isAuth" :isH5="isH5" :data="conversation.groupProfile" @update="updateProfile" style="background-color: #fff" />
-        <div class="userInfo space-top" style="background-color: #fff">
+        <!-- <div class="userInfo space-top" style="background-color: #fff">
           <header class="userInfo-header" @click="setTab('member')">
             <label>{{ $t(`TUIChat.manage.群成员`) }}</label>
             <p>
@@ -28,22 +28,17 @@
             </p>
           </header>
           <ol>
-            <!-- @click="handleMemberProfileShow(item)" -->
             <dl v-for="(item, index) in userInfo?.list?.slice(0, showUserNum)" :key="index">
               <dt>
                 <img class="avatar" :src="item?.avatar || 'https://oss.dayaedu.com/news-info/07/1690787574969.png'" onerror="this.src='https://oss.dayaedu.com/news-info/07/1690787574969.png'" />
               </dt>
               <dd>{{ item?.nickname || item?.userID }}</dd>
             </dl>
-            <!-- v-if="isShowAddMember" -->
             <dl v-if="currentUserDetail.groupRoleType === 'Owner'">
               <dt class="avatar" @click="toggleMask('add')">+</dt>
             </dl>
-            <!-- <dl v-if="conversation.groupProfile.selfInfo.role === 'Owner'">
-              <dt class="avatar" @click="toggleMask('remove')">-</dt>
-            </dl> -->
           </ol>
-        </div>
+        </div> -->
         <ul class="content space-top" @click="editLableName = ''" style="background-color: #fff">
           <li @click.stop="setTab('notification')">
             <aside>
@@ -100,7 +95,7 @@
           </li> -->
         </ul>
 
-        <div v-if="currentUserDetail.groupRoleType === 'Owner'" class="admin-content space-top" style="background-color: #fff; padding-top: 12px">
+       <!-- <div v-if="currentUserDetail.groupRoleType === 'Owner'" class="admin-content space-top" style="background-color: #fff; padding-top: 12px">
           <aside>
             <label>学生禁言</label>
           </aside>
@@ -110,7 +105,7 @@
           <li v-if="currentUserDetail.groupRoleType === 'Owner' && userInfo?.list.length > 1" @click.stop="toggleMask('changeOwner')">移交群主</li>
           <li v-if="currentUserDetail.groupRoleType === 'Owner'" @click.stop="dismiss(conversation.groupProfile)">解散群聊</li>
           <li v-else @click.stop="quit(conversation.groupProfile)">退出群组</li>
-        </ul>
+        </ul>-->
       </main>
       <ManageMember v-else-if="currentTab === 'member'" :self="conversation.groupProfile.selfInfo" :list="userInfo.list" :total="~~conversation.groupProfile.memberCount" @more="getMember('more')" @del="submit" @handleMemberProfileShow="handleMemberProfileShow" />
       <!-- :isShowDel="conversation.groupProfile.selfInfo.role === 'Owner'" -->
@@ -880,7 +875,6 @@ const manage = defineComponent({
 
     const getGroupMemberUserDetail = async () => {
       try {
-        console.log(data?.conversation?.groupProfile, "data?.conversation?.groupProfile?");
         const res = await imGroupMemberUserDetail({
           groupId: data?.conversation?.groupProfile?.groupID,
           imUserId: data?.conversation?.groupProfile?.selfInfo.userID,
@@ -914,6 +908,8 @@ const manage = defineComponent({
           } catch {
             //
           }
+        } else {
+          data.currentTab = ""
         }
       }
     );

+ 6 - 2
src/TUIKit/api.ts

@@ -53,10 +53,9 @@ export const imGroupChangeGroupOwner = (params?: object) => {
  */
 export const imGroupNoticePage = (params?: object) => {
   if (platform == "daya") {
-    return request.post(api + "/imGroup/queryNoticeList", {
+    return request.post(api + "/imGroupNotice/queryNoticePage", {
       data: params,
     });
-  } else {
   }
   return request.post(api + "/imGroupNotice/page", {
     data: params,
@@ -80,6 +79,11 @@ export const imGroupNoticeSave = (params?: object) => {
  * 即时通讯 - 删除公告
  */
 export const imGroupNoticeRemove = (params?: any) => {
+  if (platform == "daya") {
+    return request.post(api + "/imGroupNotice/del", {
+      data: params,
+    });
+  }
   return request.post(api + "/imGroupNotice/remove", {
     requestType: 'form',
     data: params,

+ 1 - 1
src/index.scss

@@ -435,7 +435,7 @@
   flex-direction: column;
   width: 100%;
   background-size: contain;
-
+  height: 100vh;
   &-header {
     width: 100%;
     position: sticky;

+ 1 - 0
src/main.ts

@@ -14,6 +14,7 @@ import {
   NInput,
   NEmpty,
   NImage,
+  NSpin,
   NScrollbar,
   NPopover,
   NTooltip

+ 2 - 2
src/style.css

@@ -25,8 +25,8 @@ a:hover {
 
 body {
   margin: 0;
-  display: flex;
-  place-items: center;
+  /* display: flex;
+  place-items: center; */
   min-width: 320px;
   min-height: 100vh;
 }