Explorar o código

Merge branch 'gym-20240920' into test-daya

lex-xin hai 1 ano
pai
achega
605d37d50f

+ 1 - 1
src/TUIKit/TUIComponents/container/TUIChat/components/message-bubble.vue

@@ -512,7 +512,7 @@ export default messageBubble;
     word-break: break-all;
     width: fit-content;
     &-in {
-      background: #fbfbfb;
+      background: #fff;
       border-radius: 10px 10px 10px 10px;
     }
     &-out {

+ 1 - 1
src/TUIKit/TUIComponents/container/TUIChat/components/message-custom.vue

@@ -257,7 +257,7 @@ a {
   }
 
   .notice-message {
-    max-width: 376px;
+    width: 376px;
     cursor: pointer;
     .notice-title {
       display: flex;

+ 0 - 2
src/TUIKit/TUIComponents/container/TUIChat/components/message-reference.vue

@@ -115,8 +115,6 @@ const MessageReference = defineComponent({
       data.url = props.url;
       data.allMessageID = props.allMessageID;
       data.type = props.type;
-
-      console.log(data, '-----------------')
     });
     watch(
       () => props.referenceForShow,

+ 65 - 46
src/TUIKit/TUIComponents/container/TUIChat/manage-components/manage-notification-detail.vue

@@ -8,17 +8,16 @@
           <div class="username">
             <div class="users">
               <span class="name">{{ groupDetail.username }}</span>
-              <span class="tag">{{ formatJobType(groupDetail.jobType) }}</span>
             </div>
             <div class="userTime">
               <span class="time">{{ groupDetail.createTime }}</span>
-              <span class="tag" v-if="groupDetail.topFlag">置顶</span>
+              <span class="tag" v-if="groupDetail.isTop">置顶</span>
             </div>
           </div>
 
           <n-popover
             v-if="isAuth"
-            trigger="click"
+            trigger="hover"
             ref="popoverRef"
             :to="false"
             placement="bottom-end"
@@ -27,14 +26,15 @@
             class="popoverContainer"
           >
             <template #trigger>
-              <i class="iconMorePoint iconMore"></i>
+            <span class="iconMore"><i class="iconMorePoint "></i></span>
+              
             </template>
             <div class="p-list">
               <div class="p-item" @click="onOperation(groupDetail, 'edit')">
                 编辑公告
               </div>
               <div class="p-item" @click="onOperation(groupDetail, 'top')">
-                设为置顶
+                {{ groupDetail.isTop ? '取消置顶' : '设为置顶' }}
               </div>
               <div
                 class="p-item p-red"
@@ -116,9 +116,9 @@
       </div>
       <div class="input-section">
         <div class="input-title input-slider">
-          <span>设为置顶</span>
+          <span>设为置顶</span>
 
-          <Slider :open="topFlag" @change="onTopFlag" />
+          <Slider :open="isTop" @change="onisTop" />
         </div>
       </div>
       <div
@@ -172,7 +172,7 @@ const ManageNotification = defineComponent({
       id: "",
       title: "",
       input: "",
-      topFlag: true, // 是否置顶
+      isTop: true, // 是否置顶
       loading: false,
       groupDetail: {},
       isEdit: false,
@@ -204,15 +204,6 @@ 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) => {
       try {
@@ -221,25 +212,35 @@ const ManageNotification = defineComponent({
           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({
             imGroupId: data.groupProfile.groupID,
-            topFlag: true,
+            isTop: item.isTop ? false : true,
             id: item.id,
           });
           getNotification();
+          TUIMessage({
+            message: item.topFlag ? '取消置顶成功' : '设为置顶成功',
+            isH5: false,
+            type: "success",
+          });
         } else if (type === "delete") {
           await imGroupNoticeRemove({
             id: item.id,
           });
+          TUIMessage({
+            message: '删除成功',
+            isH5: false,
+            type: "success",
+          });
           ctx.emit("changeStatus", "deleteDetail");
         } else if (type === "add") {
           data.isEdit = true;
           data.title = "";
           data.input = "";
-          data.topFlag = true;
+          data.isTop = true;
           data.id = "";
           ctx.emit("changeStatus", "addDetail");
         }
@@ -263,7 +264,7 @@ const ManageNotification = defineComponent({
         if (data.id) {
           await imGroupNoticeUpdate({
             imGroupId: data.groupProfile.groupID,
-            topFlag: data.topFlag,
+            isTop: data.isTop,
             title: data.title,
             content: data.input,
             id: data.id,
@@ -273,10 +274,15 @@ const ManageNotification = defineComponent({
             imGroupId: data.groupProfile.groupID,
             title: data.title,
             content: data.input,
-            topFlag: data.topFlag,
+            isTop: data.isTop,
           });
         }
 
+        TUIMessage({
+          message: '发布成功',
+          isH5: false,
+          type: "success",
+        });
         data.isEdit = false;
         ctx.emit("changeStatus", "submitDetail");
         data.page = 1;
@@ -292,9 +298,9 @@ const ManageNotification = defineComponent({
       }
     };
 
-    const onTopFlag = (val: any) => {
-      console.log(val, 'onTopFlag')
-      data.topFlag = val
+    const onisTop = (val: any) => {
+      console.log(val, 'onisTop')
+      data.isTop = val
     }
 
     const onCloseEdit = () => {
@@ -308,9 +314,8 @@ const ManageNotification = defineComponent({
     return {
       ...toRefs(data),
       popoverRef,
-      formatJobType,
       onMore,
-      onTopFlag,
+      onisTop,
       // updateProfile,
       onOperation,
       onSubmit,
@@ -326,14 +331,13 @@ export default ManageNotification;
 .notification {
   position: relative;
   flex: 1;
-  background: #ffffff;
-    overflow-y: auto;
-    overflow-x: hidden;
-    height: 100%;
+  overflow-y: auto;
+  overflow-x: hidden;
+  height: 100%;
   // padding: 20px;
   display: flex;
   flex-direction: column;
-  background: #f8f9fc;
+  background: rgb(244, 245, 249) !important;
 
   &.overflowHidden {
     overflow: hidden;
@@ -369,12 +373,26 @@ export default ManageNotification;
     }
 
     .iconMore {
-      width: 23px;
-      height: 17px;
+      width: 25px;
+      height: 25px;
       position: absolute;
       right: 0;
       top: 5px;
       cursor: pointer;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+
+      .iconMorePoint {
+        display: inline-block;
+        width: 23px;
+        height: 17px;
+      }
+
+      &:hover {
+        background: #f2f2f2;
+        border-radius: 4px;
+      }
     }
   }
   .users {
@@ -382,7 +400,7 @@ export default ManageNotification;
     align-items: center;
     .name {
       font-weight: 600;
-      font-size: 16px;
+      font-size: 14px;
       color: #333333;
       line-height: 22px;
     }
@@ -419,14 +437,14 @@ export default ManageNotification;
   .section-content {
     h2 {
       font-weight: 600;
-      font-size: 16px;
+      font-size: 14px;
       color: #333333;
       line-height: 24px;
       word-wrap: break-word;
       word-break: break-all;
     }
     .content {
-      font-size: 16px;
+      font-size: 14px;
       color: #777777;
       line-height: 24px;
       word-wrap: break-word;
@@ -459,7 +477,7 @@ export default ManageNotification;
   }
 
   p {
-    font-size: 16px;
+    font-size: 14px;
     color: #aaaaaa;
     line-height: 22px;
   }
@@ -488,20 +506,21 @@ export default ManageNotification;
   .input-title {
     display: flex;
     align-items: center;
-    font-size: 16px;
+    font-size: 14px;
     color: #333333;
-    line-height: 22px;
+    font-weight: 600;
+    line-height: 20px;
     padding-bottom: 10px;
     .iconNotifit1,
     .iconNotifit2 {
-      width: 22px;
-      height: 22px;
+      width: 20px;
+      height: 20px;
       margin-right: 6px;
       flex-shrink: 0;
     }
     span {
       line-height: 1;
-      padding-bottom: 4px;
+      padding-bottom: 2px;
     }
   }
 
@@ -559,11 +578,11 @@ export default ManageNotification;
   margin-top: 8px !important;
 
   .p-item {
-    margin-bottom: 8px;
-    font-size: 16px;
+    margin-bottom: 6px;
+    font-size: 14px;
     color: #131415;
     border-radius: 8px;
-    padding: 12px 0;
+    padding: 8px 0;
     text-align: center;
     cursor: pointer;
     &:hover {

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

@@ -10,14 +10,14 @@
               <span class="name">{{ item.username }}</span>
             </div>
             <div class="userTime">
-              <span class="time">{{ item.createTime }}</span>
+              <span class="time">{{ item.updateTime }}</span>
               <span class="tag" v-if="item.isTop">置顶</span>
             </div>
           </div>
 
           <n-popover
             v-if="isAuth"
-            trigger="click"
+            trigger="hover"
             ref="popoverRef"
             :to="false"
             placement="bottom-end"
@@ -26,14 +26,14 @@
             class="popoverContainer"
           >
             <template #trigger>
-              <i class="iconMorePoint iconMore"></i>
+              <span class="iconMore"><i class="iconMorePoint "></i></span>
             </template>
             <div class="p-list">
               <div class="p-item" @click="onOperation(item, 'edit', index)">
                 编辑公告
               </div>
               <div class="p-item" @click="onOperation(item, 'top', index)">
-                设为置顶
+                {{item.isTop ? '取消置顶': '设为置顶'}}
               </div>
               <div
                 class="p-item p-red"
@@ -130,7 +130,7 @@
       </div>
       <div class="input-section">
         <div class="input-title input-slider">
-          <span>设为置顶</span>
+          <span>设为置顶</span>
 
           <Slider :open="isTop" @change="onIsTop" />
         </div>
@@ -236,11 +236,16 @@ const ManageNotification = defineComponent({
         } else if (type === "top") {
           await imGroupNoticeUpdate({
             imGroupId: data.groupProfile.groupID,
-            isTop: true,
+            isTop: item.isTop ? false : true,
             id: item.id,
           });
           data.page = 1;
           data.groupList = [];
+          TUIMessage({
+            message: item.isTop ? '取消置顶成功' : '设为置顶成功',
+            isH5: false,
+            type: "success",
+          });
           getNotification();
         } else if (type === "delete") {
           await imGroupNoticeRemove({
@@ -248,6 +253,11 @@ const ManageNotification = defineComponent({
           });
           data.page = 1;
           data.groupList = [];
+          TUIMessage({
+            message: '删除成功',
+            isH5: false,
+            type: "success",
+          });
           getNotification();
         } else if (type === "add") {
           data.isEdit = true;
@@ -282,6 +292,7 @@ const ManageNotification = defineComponent({
             content: data.input,
             id: data.id,
           });
+          
         } else {
           await imGroupNoticeSave({
             imGroupId: data.groupProfile.groupID,
@@ -291,6 +302,12 @@ const ManageNotification = defineComponent({
           });
         }
 
+        TUIMessage({
+          message: '发布成功',
+          isH5: false,
+          type: "success",
+        });
+
         data.isEdit = false;
         ctx.emit("changeStatus", "submit");
         data.page = 1;
@@ -338,14 +355,13 @@ export default ManageNotification;
 .notification {
   position: relative;
   flex: 1;
-  background: #ffffff;
-    overflow-y: auto;
-    overflow-x: hidden;
-    height: 100%;
+  overflow-y: auto;
+  overflow-x: hidden;
+  height: 100%;
   // padding: 20px;
   display: flex;
   flex-direction: column;
-  background: #f8f9fc;
+  background: rgb(244, 245, 249) !important;
 
   &.overflowHidden {
     overflow: hidden;
@@ -381,12 +397,26 @@ export default ManageNotification;
     }
 
     .iconMore {
-      width: 23px;
-      height: 17px;
+      width: 25px;
+      height: 25px;
       position: absolute;
       right: 0;
       top: 5px;
       cursor: pointer;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+
+      .iconMorePoint {
+        display: inline-block;
+        width: 23px;
+        height: 17px;
+      }
+
+      &:hover {
+        background: #f2f2f2;
+        border-radius: 4px;
+      }
     }
   }
   .users {
@@ -431,14 +461,14 @@ export default ManageNotification;
   .section-content {
     h2 {
       font-weight: 600;
-      font-size: 16px;
+      font-size: 14px;
       color: #333333;
       line-height: 24px;
       word-wrap: break-word;
       word-break: break-all;
     }
     .content {
-      font-size: 16px;
+      font-size: 14px;
       color: #777777;
       line-height: 24px;
       word-wrap: break-word;
@@ -471,7 +501,7 @@ export default ManageNotification;
   }
 
   p {
-    font-size: 16px;
+    font-size: 14px;
     color: #aaaaaa;
     line-height: 22px;
   }
@@ -500,20 +530,21 @@ export default ManageNotification;
   .input-title {
     display: flex;
     align-items: center;
-    font-size: 16px;
+    font-size: 14px;
     color: #333333;
-    line-height: 22px;
+    font-weight: 600;
+    line-height: 20px;
     padding-bottom: 10px;
     .iconNotifit1,
     .iconNotifit2 {
-      width: 22px;
-      height: 22px;
+      width: 20px;
+      height: 20px;
       margin-right: 6px;
       flex-shrink: 0;
     }
     span {
       line-height: 1;
-      padding-bottom: 4px;
+      padding-bottom: 2px;
     }
   }
 
@@ -571,11 +602,11 @@ export default ManageNotification;
   margin-top: 8px !important;
 
   .p-item {
-    margin-bottom: 8px;
-    font-size: 16px;
+    margin-bottom: 6px;
+    font-size: 14px;
     color: #131415;
     border-radius: 8px;
-    padding: 12px 0;
+    padding: 8px 0;
     text-align: center;
     cursor: pointer;
     &:hover {

+ 2 - 1
src/TUIKit/TUIComponents/container/TUIChat/manage-components/style/web.scss

@@ -161,7 +161,8 @@
         cursor: pointer;
         width: 100%;
         font-size: 14Px;
-        padding: 11Px 0;
+        padding: 10px 0;
+        font-weight: 600;
         text-align: center;
         background: #198CFE;
         border-radius: 8px;

+ 52 - 3
src/TUIKit/TUIComponents/container/TUIChat/plugin-components/replies/replies-item.vue

@@ -5,7 +5,7 @@
       <main class="message-area">
         <div class="message-area-title">
           <label class="name">
-            {{ isRoot ? message.nameCard || message.nick || message.from : message.messageSender }}
+            {{ isRoot ? message.nameCard || message.nick || message.from : message.messageSenderName || message.messageSender }}
           </label>
           <label class="time">
             {{ caculateTimeago((isRoot ? message?.time : message?.messageTime) * 1000) }}
@@ -14,7 +14,19 @@
         <div class="content content-in">
           <MessageText v-if="message.messageType === constant.typeText || message.type === TIM.TYPES.MSG_TEXT || !isRoot" :data="handleTextMessageShowContext(isRoot ? message : { payload: { text: message?.messageAbstract } })" />
           <span v-if="message.messageType === constant.typeCustom || message.type === TIM.TYPES.MSG_CUSTOM">
-            {{ handleCustomMessageShowContext(message)?.custom }}
+            <div class="notice-message" @click="handleNotice" v-if="isCustom.businessID === constant.TC_GROUP_NOTICE">
+              <div class="notice-title">
+                <i class="iconNotice"></i>
+                <span>群公告</span>
+              </div>
+              <div class="content">
+                <div class="content-title">
+                {{isCustom.msgTitle}}
+                </div>
+                <div class="content-text">{{isCustom.msgContent}}</div>
+              </div>
+            </div>
+            <span v-else>{{ handleCustomMessageShowContext(message)?.custom }}</span>
           </span>
           <img v-if="message.messageType === constant.typeImage || message.type === TIM.TYPES.MSG_IMAGE" class="message-img" :src="message?.payload?.imageInfoArray[1].url" />
           <div v-if="message.messageType === constant.typeAudio || message.type === TIM.TYPES.MSG_AUDIO" class="message-audio" :style="`width: ${message?.payload?.second * 10 + 40}Px`">
@@ -48,6 +60,7 @@ import { MessageText, MessageEmojiReact } from "../../components";
 import { caculateTimeago } from "../../../utils";
 import constant from "../../../constant";
 import TIM from "../../../../../TUICore/tim/index";
+import { JSONToObject } from '../../utils/utils'
 const RepliesItem = defineComponent({
   props: {
     message: {
@@ -70,6 +83,7 @@ const RepliesItem = defineComponent({
   setup(props: any, ctx: any) {
     const data = reactive({
       message: {} as Message,
+      isCustom: {} as any,
       isH5: false,
       url: "",
       isRoot: false,
@@ -78,6 +92,9 @@ const RepliesItem = defineComponent({
     });
     watchEffect(() => {
       data.message = props.message;
+      const { payload } = props.message
+      data.isCustom = payload?.data || ''
+      data.isCustom = payload ? JSONToObject(payload?.data) : {}
       data.isH5 = props.isH5;
       data.isRoot = props.isRoot;
       if (data.message.type === TIM.TYPES.MSG_FACE) {
@@ -99,6 +116,38 @@ export default RepliesItem;
 .replies-item {
   padding: 15px;
   width: auto;
+  .notice-message {
+    max-width: 376px;
+    cursor: pointer;
+    .notice-title {
+      display: flex;
+      align-items: center;
+      padding-bottom: 6px;
+      span {
+        font-weight: 600;
+        font-size: 14Px;
+        color: #198CFE;
+        line-height: 24px;
+      }
+            
+      .iconNotice {
+        width: 18px;
+        height: 18px;
+        display: inline-block;
+        margin-right: 6px;
+      }
+    }
+    .content {
+      font-size: 14Px;
+      padding: 0 !important;
+      color: #131415;
+      line-height: 24px;
+      .content-title {
+        font-weight: 600;
+        
+      }
+    }
+  }
   &-normal {
     padding: 12.8px 15px 0 17px;
     .message-bubble {
@@ -182,7 +231,7 @@ export default RepliesItem;
       word-break: break-all;
       width: fit-content;
       &-in {
-        background: #f2f2f2;
+        background: #fff;
         border-radius: 0px 10px 10px 10px;
         .message-img,
         .message-videoimg {

+ 9 - 1
src/TUIKit/TUIComponents/container/TUIChat/plugin-components/replies/replies.vue

@@ -38,6 +38,7 @@ import { Message } from '../../interface';
 import TIM from '../../../../../TUICore/tim';
 import RepliesItem from './replies-item.vue';
 import { JSONToObject } from '../../utils/utils';
+import { imGroupMemberUserDetail } from '../../../../../api'
 const ReadReceiptDialog = defineComponent({
   type: 'custom',
   components: {
@@ -121,12 +122,19 @@ const ReadReceiptDialog = defineComponent({
         if (!cloudCustomData) return;
         const cloudCustomObject = JSONToObject(cloudCustomData);
         data.replies = cloudCustomObject?.messageReplies?.replies;
-        data?.replies?.forEach((item: any) => {
+        data?.replies?.forEach(async (item: any) => {
           const { messageID, messageSender } = item;
           const message = data.messageList.find((item: Message) => 
             (item.ID === messageID || item.from === messageSender)
           );
           item.avatar = message ? (message as Message)?.avatar : '';
+          try {
+            const res = await imGroupMemberUserDetail({ imUserId: messageSender })
+            item.messageSenderName = res.data?.friendNickname || res.data?.imUserId
+            item.avatar = res.data?.friendAvatar || '' 
+          } catch {
+            // 
+          }
         });
       } catch (err) {
         console.log(err);

+ 8 - 1
src/TUIKit/TUIComponents/container/TUIChat/utils/utils.ts

@@ -63,7 +63,14 @@ export function handleReferenceForShow(message: any) {
       data.referenceMessageType = 1;
       break;
     case TIM.TYPES.MSG_CUSTOM:
-      data.referenceMessageForShow = "[自定义消息]";
+      const { payload } = message;
+      const isCom = payload.data ? JSONToObject(payload.data) : {};
+      if(isCom.businessID === 'TC_GROUP_NOTICE') {
+        data.referenceMessageForShow = "[群公告]";
+      } else {
+        data.referenceMessageForShow = "[自定义消息]";
+      }
+       
       data.referenceMessageType = 2;
       break;
     case TIM.TYPES.MSG_IMAGE:

+ 4 - 1
src/TUIKit/api.ts

@@ -54,6 +54,7 @@ export const imGroupChangeGroupOwner = (params?: object) => {
 export const imGroupNoticePage = (params?: object) => {
   if (platform == "daya") {
     return request.post(api + "/imGroupNotice/queryNoticePage", {
+      requestType: 'form',
       data: params,
     });
   }
@@ -107,7 +108,9 @@ export const imGroupNoticeUpdate = (params?: object) => {
  * 即时通讯 - 详情
  */
 export const imGroupNoticeDetail = (id?: any) => {
-  return request.get(api + "/imGroupNotice/detail/" + id);
+  return request.get(api + "/imGroupNotice/getNotice", { 
+    params: { id}
+   });
 };