消息免打扰
@@ -610,8 +782,8 @@ const showMemberInfo = (memberItem: any) => {
.b-box {
display: flex;
align-items: center;
- min-height: 30px;
- margin: 12px 0;
+ // min-height: 30px;
+ margin: 32px 0;
flex-direction: column;
&:first-child {
@@ -638,6 +810,27 @@ const showMemberInfo = (memberItem: any) => {
font-weight: bold;
}
+ .group-name-box {
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: flex-end;
+ gap: 0 10px;
+
+ span {
+ line-height: 20px;
+ font-size: 14px;
+ color: #999999;
+ font-weight: 400;
+ }
+
+ img {
+ width: 16px;
+ height: 16px;
+ cursor: pointer;
+ }
+ }
+
.text {
// height: 100%;
// line-height: 30px;
@@ -680,6 +873,7 @@ const showMemberInfo = (memberItem: any) => {
font-size: 14px;
line-height: 20px;
color: #999999;
+ margin: 10px 0 0;
}
.group-member-list {
@@ -689,10 +883,9 @@ const showMemberInfo = (memberItem: any) => {
justify-content: flex-start;
flex-wrap: wrap;
gap: 16px 24px;
- padding: 7px 0 16px;
+ padding: 7px 0 0;
width: 100%;
box-sizing: border-box;
- border-bottom: 1px solid #f0f0f2;
.group-member-list-each {
display: flex;
@@ -736,26 +929,27 @@ const showMemberInfo = (memberItem: any) => {
.group-member-list-each-box:nth-child(n + 19) {
display: none;
}
-
- .group-member-list-more {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- span {
- font-size: 14px;
- line-height: 20px;
- color: #747474;
- font-weight: 400;
- margin: 0 10px 0 0;
- display: inline-block;
- }
+ }
+ .group-member-list-more {
+ width: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ cursor: pointer;
+ border-bottom: 1px solid #f0f0f2;
+ padding: 16px 0;
+ span {
+ font-size: 14px;
+ line-height: 20px;
+ color: #747474;
+ font-weight: 400;
+ margin: 0 10px 0 0;
+ display: inline-block;
}
- .group-member-list-more:hover {
- span {
- color: #46299d;
- }
+ }
+ .group-member-list-more:hover {
+ span {
+ color: #46299d;
}
}
}
diff --git a/src/views/message/inner/IndexContent.vue b/src/views/message/inner/IndexContent.vue
index 3b573cb..f249cea 100644
--- a/src/views/message/inner/IndexContent.vue
+++ b/src/views/message/inner/IndexContent.vue
@@ -10,6 +10,8 @@ import GroupNotice from '@/components/group/GroupNotice.vue'
import UploadsModal from '@/components/base/UploadsModal.vue'
import customModal from '@/components/common/customModal.vue'
import historyRecord from '@/components/search/searchByCondition.vue'
+import { ServeEditGroupNotice, ServeGetGroupNotices, ServeDeleteGroupNotice } from '@/api/group'
+import avatarModule from '@/components/avatar-module/index.vue'
const userStore = useUserStore()
const dialogueStore = useDialogueStore()
@@ -44,7 +46,41 @@ const state = reactive({
}, //按条件搜索记录弹窗样式
searchRecordByConditionText: '', //按条件搜索记录文本
conditionTag: '', //当前条件标签
- conditionType: '' //当前条件类型
+ conditionType: '', //当前条件类型
+ isShowGroupNoticeModal: false, //是否显示群公告模态框
+ customGroupNoticeModalStyle: {
+ width: '997px',
+ height: '740px'
+ }, //群公告模态框样式
+ groupNoticeModalActionBtns: {
+ confirmBtn: {
+ text: '编辑',
+ doLoading: false,
+ disabled: false
+ },
+ cancelBtn: false
+ }, //群公告模态框操作按钮
+ groupNoticeModalActionBtnsStyle: 'padding: 20px 0;', //群公告模态框操作按钮样式
+ groupNoticeInEdit: '', //编辑中的公告
+ groupNoticeEditMode: 3, //群公告编辑模式:2=编辑;3=查看
+ groupNoticeModalConfirmBtnEvent: 'edit', //群公告模态框确认按钮事件:edit=编辑;fillIn=输入
+ isShowNoticeHintModal: false, //是否显示群公告提示模态框
+ customNoticeHintModalStyle: {
+ width: '724px',
+ height: '314px'
+ }, //群公告提示模态框样式
+ noticeHintModalActionBtns: {}, //群公告提示模态框操作按钮
+ noticeHintModalContent: '', //群公告提示模态框内容
+ noticeHintMode: 'publish', //群公告提示模式:publish=发布;cancel=取消
+ groupNoticeInfo: {
+ id: 0,
+ avatar: '',
+ updater_name: '',
+ updated_at: '',
+ content: ''
+ }, //群公告信息
+ isAdmin: false, //当前登录用户是否是该群管理员
+ groupNoticeContentChange: '' //群公告内容变化
})
const events = {
@@ -84,6 +120,255 @@ const changeConditionTag = (tag) => {
state.conditionTag = ''
}
}
+
+//取消群公告编辑并返回查看
+const cancelEditGroupNotice = () => {
+ //切换群公告编辑模式为查看
+ state.groupNoticeEditMode = 3
+ state.groupNoticeModalActionBtns = {
+ confirmBtn: {
+ text: '编辑',
+ doLoading: false,
+ disabled: false
+ },
+ cancelBtn: false
+ }
+ //切换确定按钮事件为编辑
+ state.groupNoticeModalConfirmBtnEvent = 'edit'
+}
+
+// 群公告模态框确定按钮事件
+const handleGroupNoticeModalConfirm = () => {
+ if (state.groupNoticeModalConfirmBtnEvent === 'edit') {
+ //点击切换群公告编辑模式为编辑
+ state.groupNoticeEditMode = 2
+ state.groupNoticeModalActionBtns = {
+ confirmBtn: {
+ text: '完成',
+ doLoading: false,
+ disabled: true
+ },
+ cancelBtn: true
+ }
+ //切换确定按钮事件为输入
+ state.groupNoticeModalConfirmBtnEvent = 'fillIn'
+ if (state.groupNoticeInfo?.id) {
+ state.groupNoticeInEdit = state.groupNoticeInfo.content
+ state.groupNoticeModalActionBtns.confirmBtn.disabled = false
+ }
+ } else if (state.groupNoticeModalConfirmBtnEvent === 'fillIn') {
+ //点击显示发布提示
+ state.isShowNoticeHintModal = true
+ if (state?.groupNoticeInfo?.id && !state.groupNoticeInEdit) {
+ //如果是在编辑中,但是没有输入内容,此时点击完成即为删除群公告
+ state.noticeHintModalContent = '确定清空群公告吗?'
+ state.noticeHintModalActionBtns = {
+ confirmBtn: {
+ text: '清空',
+ doLoading: true
+ },
+ cancelBtn: true
+ }
+ //切换公告提示模式为清空
+ state.noticeHintMode = 'clear'
+ } else {
+ state.noticeHintModalContent = '发布该公告会通知全部群成员'
+ state.noticeHintModalActionBtns = {
+ confirmBtn: {
+ text: '发布',
+ doLoading: true
+ },
+ cancelBtn: true
+ }
+ //切换公告提示模式为发布
+ state.noticeHintMode = 'publish'
+ }
+ }
+}
+
+// 群公告模态框取消按钮事件
+const handleGroupNoticeModalCancel = () => {
+ if (state.groupNoticeModalConfirmBtnEvent === 'fillIn') {
+ if (state.groupNoticeInEdit || (state.groupNoticeInfo?.id && !state.groupNoticeInEdit)) {
+ //如果有正在编辑中的公告或者编辑已发布的公告内容为空,显示确认取消编辑弹窗
+ state.isShowNoticeHintModal = true
+ state.noticeHintModalContent = '退出本次编辑'
+ state.noticeHintModalActionBtns = {
+ confirmBtn: {
+ text: '继续编辑',
+ doLoading: false
+ },
+ cancelBtn: {
+ text: '退出'
+ }
+ }
+ //切换公告提示模式为取消
+ state.noticeHintMode = 'cancel'
+ } else {
+ //没有正在编辑中的公告,退出编辑
+ cancelEditGroupNotice()
+ }
+ }
+}
+
+// 群公告模态框关闭事件
+const handleGroupNoticeModalClose = () => {
+ //关闭应与取消事件一致
+ handleGroupNoticeModalCancel()
+}
+
+// 群公告提示模态框确认按钮事件
+const handleNoticeHintModalConfirm = (closeLoading) => {
+ console.log('handleNoticeHintModalConfirm')
+ if (state.noticeHintMode === 'cancel') {
+ //不退出,回到编辑
+ state.isShowNoticeHintModal = false
+ } else if (state.noticeHintMode === 'publish') {
+ //发布
+ doPublishGroupNotice(closeLoading)
+ } else if (state.noticeHintMode === 'clear') {
+ //清空
+ doClearGroupNotice(closeLoading)
+ }
+}
+
+// 群公告提示模态框取消按钮事件
+const handleNoticeHintModalCancel = () => {
+ console.log('handleNoticeHintModalCancel')
+ if (state.noticeHintMode === 'publish') {
+ //取消发布,回到编辑
+ state.isShowNoticeHintModal = false
+ } else if (state.noticeHintMode === 'cancel') {
+ //清除正在编辑中的公告并退出编辑
+ state.groupNoticeInEdit = ''
+ state.isShowNoticeHintModal = false
+ cancelEditGroupNotice()
+ } else if (state.noticeHintMode === 'clear') {
+ //不清空,继续编辑
+ state.isShowNoticeHintModal = false
+ }
+}
+
+// 群公告模态框输入事件
+const handleGroupNoticeModalInput = (value) => {
+ console.log(value)
+ if (value.trim()) {
+ state.groupNoticeModalActionBtns.confirmBtn.disabled = false
+ } else {
+ if (!state.groupNoticeInfo?.id) {
+ state.groupNoticeModalActionBtns.confirmBtn.disabled = true
+ } else {
+ state.groupNoticeModalActionBtns.confirmBtn.disabled = false
+ }
+ }
+}
+
+// 发布群公告
+const doPublishGroupNotice = (closeLoading) => {
+ let params = {
+ notice_id: state?.groupNoticeInfo?.id || 0,
+ group_id: talkParams.receiver_id,
+ title: '',
+ content: state.groupNoticeInEdit,
+ is_top: 0,
+ is_confirm: 0
+ }
+ console.log(params)
+ const resp = ServeEditGroupNotice(params)
+ resp
+ .then((res) => {
+ closeLoading()
+ if (res.code == 200) {
+ // 发布成功,关闭群公告模态框
+ state.isShowGroupNoticeModal = false
+ state.isShowNoticeHintModal = false
+ state.groupNoticeContentChange = state.groupNoticeInEdit
+ state.groupNoticeInEdit = ''
+ cancelEditGroupNotice()
+ window['$message'].success(res.msg)
+ } else {
+ window['$message'].warning(res.msg)
+ }
+ })
+ .catch((err) => {
+ closeLoading()
+ window['$message'].warning(err.msg)
+ })
+}
+
+//获取群公告列表
+const getGroupNotices = () => {
+ ServeGetGroupNotices({
+ group_id: talkParams.receiver_id
+ }).then((res) => {
+ console.log(res)
+ if (res.code == 200) {
+ if (res?.data?.items[0]?.id) {
+ state.groupNoticeInfo = res.data.items[0]
+ } else {
+ state.groupNoticeInfo = {
+ id: 0,
+ avatar: '',
+ updater_name: '',
+ updated_at: '',
+ content: ''
+ }
+ }
+ } else {
+ window['$message'].warning(res.msg)
+ }
+ })
+}
+
+// 清空群公告
+const doClearGroupNotice = (closeLoading) => {
+ ServeDeleteGroupNotice({
+ notice_id: state.groupNoticeInfo.id,
+ group_id: talkParams.receiver_id
+ })
+ .then((res) => {
+ closeLoading()
+ if (res.code == 200) {
+ // 清空成功,关闭群公告模态框并恢复群公告模态框初始状态
+ state.groupNoticeInfo = {
+ id: 0,
+ avatar: '',
+ updater_name: '',
+ updated_at: '',
+ content: ''
+ }
+ state.isShowGroupNoticeModal = false
+ state.isShowNoticeHintModal = false
+ state.groupNoticeContentChange = ''
+ cancelEditGroupNotice()
+ window['$message'].success(res.msg)
+ } else {
+ window['$message'].warning(res.msg)
+ }
+ })
+ .catch((err) => {
+ closeLoading()
+ window['$message'].warning(err.msg)
+ })
+}
+// 群公告模态框显示事件
+const handleGroupNoticeModalShow = (isAdmin) => {
+ state.isAdmin = isAdmin
+ if (isAdmin) {
+ state.groupNoticeModalActionBtns = {
+ confirmBtn: {
+ text: '编辑',
+ doLoading: false,
+ disabled: false
+ },
+ cancelBtn: false
+ }
+ } else {
+ ;(state.groupNoticeModalActionBtns.confirmBtn as any) = false
+ }
+ state.isShowGroupNoticeModal = true
+ getGroupNotices()
+}
@@ -168,12 +453,16 @@ const changeConditionTag = (tag) => {
@close="state.isShowGroupAside = false"
:talkType="talkParams.type"
@handleSearchRecordByConditionModalShow="state.isShowSearchRecordByConditionModal = true"
+ @handleGroupNoticeModalShow="handleGroupNoticeModalShow"
+ :groupNoticeContentChange="state.groupNoticeContentChange"
/>
{
diff --git a/src/views/message/inner/IndexSider.vue b/src/views/message/inner/IndexSider.vue
index bf44238..54fbfa2 100644
--- a/src/views/message/inner/IndexSider.vue
+++ b/src/views/message/inner/IndexSider.vue
@@ -278,7 +278,7 @@ const items = computed((): ISession[] => {
watch(
() => talkStore,
(newValue, oldValue) => {
- console.log(newValue)
+ // console.log(newValue)
},
{ deep: true, immediate: true }
)
diff --git a/src/views/message/inner/panel/PanelHeader.vue b/src/views/message/inner/panel/PanelHeader.vue
index f84c31c..942807d 100644
--- a/src/views/message/inner/panel/PanelHeader.vue
+++ b/src/views/message/inner/panel/PanelHeader.vue
@@ -69,13 +69,13 @@ const onSetMenu = () => {