OA体制内聊天项目完成修改群名称功能;完成群公告创建、修改、删除、查看;完成群内禁言添加人、解除禁言、全局禁言;全局维护群管理员部门与岗位对应关系

This commit is contained in:
wangyifeng 2025-01-20 19:03:57 +08:00
parent 03c30c2945
commit 65eaefdbc3
13 changed files with 568 additions and 71 deletions

View File

@ -141,6 +141,15 @@ export const ServeEditGroupNotice = (data) => {
}) })
} }
//删除群公告
export const ServeDeleteGroupNotice = (data) => {
return request({
url: '/api/v1/group/notice/delete',
method: 'POST',
data,
})
}
export const ServeGetGroupApplyList = (data) => { export const ServeGetGroupApplyList = (data) => {
return request({ return request({
url: '/api/v1/group/apply/list', url: '/api/v1/group/apply/list',

View File

@ -11,12 +11,19 @@ defineProps<{
let show = ref(false) let show = ref(false)
</script> </script>
<template> <template>
<section class="im-message-group-notice pointer" @click="show = !show"> <section
class="im-message-group-notice pointer"
@click="show = !show"
:class="{
left: data.float === 'left',
right: data.float === 'right',
}"
>
<div class="title"> <div class="title">
<n-tag :bordered="false" size="small" type="primary"> 群公告 </n-tag> <n-tag :bordered="false" size="small" type="primary">群公告</n-tag>
{{ extra.title }} <!-- {{ extra.title }} -->
</div> </div>
<div class="content" :class="{ ellipsis: !show }"> <div class="title" :class="{ ellipsis: !show }">
{{ extra.content }} {{ extra.content }}
</div> </div>
</section> </section>
@ -30,14 +37,14 @@ let show = ref(false)
padding: 8px 10px; padding: 8px 10px;
border: 1px solid var(--im-message-border-color); border: 1px solid var(--im-message-border-color);
user-select: none; user-select: none;
background-color: #fff;
.title { .title {
height: 30px; line-height: 44rpx;
line-height: 30px; font-size: 32rpx;
font-size: 14px; // overflow: hidden;
overflow: hidden; // text-overflow: ellipsis;
text-overflow: ellipsis; // white-space: nowrap;
white-space: nowrap;
font-weight: 400; font-weight: 400;
margin-bottom: 5px; margin-bottom: 5px;
position: relative; position: relative;
@ -56,5 +63,18 @@ let show = ref(false)
white-space: nowrap; white-space: nowrap;
} }
} }
&.left {
background-color: #fff;
border-radius: 0 16rpx 16rpx 16rpx;
}
&.right {
background-color: #46299d;
border-radius: 16rpx 0 16rpx 16rpx;
.title {
color: #fff;
}
}
} }
</style> </style>

View File

@ -34,10 +34,10 @@
</div> </div>
<div class="operate-btns"> <div class="operate-btns">
<div class="btn-undo-silence"> <div class="btn-undo-silence">
<span v-if="props?.memberItem?.is_mute === 1"> <span
{{ $t('chatSettings.btn.undoSilence') }} v-if="props?.memberItem?.is_mute === 1"
</span> class="text-[28rpx] font-regular"
<span v-if="props?.memberItem?.is_mute === 1"> >
{{ $t('silence.tag.hasDone') }} {{ $t('silence.tag.hasDone') }}
</span> </span>
</div> </div>
@ -126,6 +126,8 @@ const clickItem = () => {
.operate-btns { .operate-btns {
.btn-undo-silence { .btn-undo-silence {
span { span {
color: #b4b4b4;
line-height: 40rpx;
} }
} }
} }

View File

@ -11,8 +11,7 @@
<img <img
v-if=" v-if="
props?.item?.hasPointer && props?.item?.hasPointer &&
((props?.isManager && (props?.isManager ||
props?.item?.label === $t('chat.settings.groupName')) ||
(!props?.isManager && (!props?.isManager &&
props?.item?.label !== $t('chat.settings.groupName'))) props?.item?.label !== $t('chat.settings.groupName')))
" "
@ -26,6 +25,7 @@
color="#46299D" color="#46299D"
unCheckedColor="#EEEEEE" unCheckedColor="#EEEEEE"
:modelValue="modelValue" :modelValue="modelValue"
:defaultValue="modelValue"
@change="changeSwitch($event, props?.item)" @change="changeSwitch($event, props?.item)"
></tm-switch> ></tm-switch>
</div> </div>
@ -77,6 +77,12 @@ const modelValue = computed(() => {
) { ) {
switchStatus = true switchStatus = true
} }
if (
props?.item?.label === t('chat.manage.silenceAll') &&
props?.sessionInfo?.is_mute == 1
) {
switchStatus = true
}
return switchStatus return switchStatus
}) })

View File

@ -47,9 +47,21 @@
</template> </template>
<script setup> <script setup>
import customBtn from '@/components/custom-btn/custom-btn.vue' import customBtn from '@/components/custom-btn/custom-btn.vue'
import { ServeEditGroup } from '@/api/group/index.js'
import { useGroupStore, useDialogueStore } from '@/store'
import ZPaging from '@/uni_modules/z-paging/components/z-paging/z-paging.vue' import ZPaging from '@/uni_modules/z-paging/components/z-paging/z-paging.vue'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { reactive } from 'vue' import { reactive, computed } from 'vue'
const groupStore = useGroupStore()
const groupParams = reactive({
groupInfo: computed(() => groupStore.groupInfo),
})
const dialogueStore = useDialogueStore()
const dialogueParams = reactive({
talk_type: computed(() => dialogueStore.talk.talk_type),
receiver_id: computed(() => dialogueStore.talk.receiver_id),
})
const state = reactive({ const state = reactive({
pageTitle: '', // pageTitle: '', //
@ -62,6 +74,7 @@ onLoad((options) => {
if (options.groupAvatar) { if (options.groupAvatar) {
state.groupAvatar = options.groupAvatar state.groupAvatar = options.groupAvatar
} }
state.groupName = groupParams.groupInfo.group_name
}) })
// //
@ -72,6 +85,33 @@ const clearGroupNameInput = () => {
// //
const confirmEdit = () => { const confirmEdit = () => {
console.log(state.groupName) console.log(state.groupName)
if (!state.groupName) {
return
}
let params = {
group_id: dialogueParams.receiver_id,
group_name: state.groupName,
}
console.log(params)
const resp = ServeEditGroup(params)
resp.then(({ code, data }) => {
console.log(data)
if (code == 200) {
groupStore.updateGroupInfo({
group_name: state.groupName,
})
dialogueStore.setDialogue({
name: state.groupName,
talk_type: dialogueParams.talk_type,
receiver_id: dialogueParams.receiver_id,
})
uni.navigateBack({
delta: 1,
})
} else {
}
})
resp.catch(() => {})
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -15,6 +15,35 @@
<span class="manage-group-silence-title text-[28rpx] font-regular"> <span class="manage-group-silence-title text-[28rpx] font-regular">
{{ $t('chat.manage.silenceMember') }} {{ $t('chat.manage.silenceMember') }}
</span> </span>
<div class="group-silence-list chat-settings-card">
<div
class="group-silence-list-each"
v-for="(item, index) in dialogueParams.silenceMembersList"
:key="index"
>
<div class="group-silence-list-each-info">
<img :src="item.avatar" />
<span class="text-[28rpx] font-medium">
{{ item.nickname }}
</span>
</div>
<div class="group-silence-list-each-btns">
<div
class="group-silence-list-each-btns-each"
:class="[
groupParams?.groupInfo?.is_mute === 1
? 'group-silence-list-each-btns-each-inActive'
: '',
]"
@click="undoSilence(item)"
>
<span class="text-[28rpx] font-regular">
{{ $t('chatSettings.btn.undoSilence') }}
</span>
</div>
</div>
</div>
</div>
<div <div
class="add-silence-member-btn chat-settings-card" class="add-silence-member-btn chat-settings-card"
@click="toSelectMembersPage" @click="toSelectMembersPage"
@ -27,7 +56,7 @@
<div class="silence-all-btn chat-settings-card"> <div class="silence-all-btn chat-settings-card">
<settingFormItem <settingFormItem
:item="state.silenceAllBtn" :item="state.silenceAllBtn"
:sessionInfo="state?.sessionInfo" :sessionInfo="groupParams?.groupInfo"
@changeSwitch="changeSwitch" @changeSwitch="changeSwitch"
></settingFormItem> ></settingFormItem>
</div> </div>
@ -43,15 +72,20 @@ import { onLoad } from '@dcloudio/uni-app'
import { computed, onMounted, reactive } from 'vue' import { computed, onMounted, reactive } from 'vue'
import { useGroupStore, useDialogueStore } from '@/store' import { useGroupStore, useDialogueStore } from '@/store'
import { ServeGroupNoSpeak, ServeMuteGroup } from '@/api/group/index.js'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
const { t } = useI18n() const { t } = useI18n()
const groupStore = useGroupStore() const groupStore = useGroupStore()
const dialogueStore = useDialogueStore() const groupParams = reactive({
groupInfo: computed(() => groupStore.groupInfo),
})
const dialogueStore = useDialogueStore()
const dialogueParams = reactive({ const dialogueParams = reactive({
silenceMembersList: computed(() => dialogueStore.getAdminList), receiverId: computed(() => dialogueStore.talk.receiver_id),
silenceMembersList: computed(() => dialogueStore.getSilenceMember),
}) })
const state = reactive({ const state = reactive({
@ -73,9 +107,24 @@ onMounted(() => {
} }
}) })
// //-
const changeSwitch = (switchStatus, label) => { const changeSwitch = (switchStatus, label) => {
console.log(switchStatus, label) console.log(switchStatus, label)
let params = {
group_id: dialogueParams.receiverId,
mode: switchStatus ? 1 : 2, //12
}
const resp = ServeMuteGroup(params)
resp.then(({ code, data }) => {
console.log(data)
if (code == 200) {
groupStore.updateGroupInfo({
is_mute: switchStatus ? 1 : 2,
})
} else {
}
})
resp.catch(() => {})
} }
// //
@ -84,6 +133,29 @@ const toSelectMembersPage = () => {
url: '/pages/chatSettings/groupManage/selectMembers?manageType=silence', url: '/pages/chatSettings/groupManage/selectMembers?manageType=silence',
}) })
} }
//
const undoSilence = (userInfo) => {
console.log(userInfo)
if (groupParams?.groupInfo?.is_mute === 1) {
return
}
let params = {
mode: 2, //12
group_id: dialogueParams.receiverId, //id
user_ids: String(userInfo.id), //ids
}
console.log(params)
const resp = ServeGroupNoSpeak(params)
resp.then(({ code, data }) => {
console.log(data)
if (code == 200) {
useDialogueStore().updateGroupMembers()
} else {
}
})
resp.catch(() => {})
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.outer-layer { .outer-layer {
@ -99,7 +171,62 @@ const toSelectMembersPage = () => {
line-height: 40rpx; line-height: 40rpx;
color: #959598; color: #959598;
} }
.group-silence-list {
padding: 0 16rpx;
.group-silence-list-each {
padding: 18rpx 14rpx;
border-bottom: 1px solid $theme-border-color;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
.group-silence-list-each-info {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
img {
width: 72rpx;
height: 72rpx;
border-radius: 50%;
}
span {
margin: 0 0 0 20rpx;
line-height: 40rpx;
}
}
.group-silence-list-each-btns {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
.group-silence-list-each-btns-each {
padding: 10rpx 30rpx;
border: 2rpx solid #eeeeee;
border-radius: 8rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
span {
line-height: 40rpx;
}
}
.group-silence-list-each-btns-each-inActive {
background-color: #f3f3f3;
border: 0;
span {
color: #bababa;
}
}
}
}
}
.add-silence-member-btn { .add-silence-member-btn {
margin: 0 !important;
padding: 32rpx; padding: 32rpx;
display: flex; display: flex;
flex-direction: row; flex-direction: row;

View File

@ -3,8 +3,13 @@
<div class="root"> <div class="root">
<ZPaging ref="zPaging" :show-scrollbar="false"> <ZPaging ref="zPaging" :show-scrollbar="false">
<template #top> <template #top>
<tm-navbar :hideBack="true" hideHome title="" :leftWidth="220"> <tm-navbar
<template #left> :hideBack="state.editMode === 3 ? false : true"
hideHome
title=""
:leftWidth="220"
>
<template #left v-if="state.editMode !== 3">
<div class="nav-bar-cancel-btn"> <div class="nav-bar-cancel-btn">
<span class="text-[34rpx] font-regular" @click="toPrevPage"> <span class="text-[34rpx] font-regular" @click="toPrevPage">
{{ $t('cancel') }} {{ $t('cancel') }}
@ -18,55 +23,203 @@
</div> </div>
<template #right> <template #right>
<div <div
v-if="state.editMode !== 3"
class="nav-bar-done-btn" class="nav-bar-done-btn"
:class="state.canDoComplete ? 'nav-bar-done-btn-can-do' : ''" :class="state.canDoComplete ? 'nav-bar-done-btn-can-do' : ''"
@click="showCompleteModel"
> >
<span class="text-[34rpx] font-regular"> <span class="text-[34rpx] font-regular">
{{ $t('button.text.done') }} {{ $t('button.text.done') }}
</span> </span>
</div> </div>
<div
class="nav-bar-edit-btn"
v-if="state.editMode === 3"
@click="changeToEditMode"
>
<span class="text-[34rpx] font-regular">
{{ $t('groupNotice.mode.edit') }}
</span>
</div>
</template> </template>
</tm-navbar> </tm-navbar>
</template> </template>
<div class="notice-text-area"> <div class="notice-text-area">
<wd-textarea <div class="notice-view-area">
style="height: 100%;" <div class="notice-view-info" v-if="state.editMode !== 1">
v-model="state.groupNotice" <div class="notice-creater-avatar">
:placeholder="$t('input.placeholder.enter')" <img :src="state?.groupNoticeObj?.avatar" />
:maxlength="500" </div>
:show-word-limit="true" <div class="notice-creater-info">
@input="inputGroupNotice" <span class="text-[32rpx] font-medium">
/> {{ state?.groupNoticeObj?.updater_name }}
</span>
<span class="text-[24rpx] font-medium notice-create-date">
{{ state?.groupNoticeObj?.updated_at }}
</span>
</div>
</div>
<div class="notice-view-content" v-if="state.editMode === 3">
<span class="text-[32rpx] font-regular">
{{ state?.groupNoticeObj?.content }}
</span>
</div>
<wd-textarea
size="large"
v-if="state.editMode !== 3"
v-model="state.groupNotice"
:placeholder="$t('input.placeholder.enter')"
:maxlength="500"
:show-word-limit="true"
@input="inputGroupNotice"
/>
</div>
</div> </div>
</ZPaging> </ZPaging>
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
import useConfirm from '@/components/x-confirm/useConfirm.js'
import ZPaging from '@/uni_modules/z-paging/components/z-paging/z-paging.vue' import ZPaging from '@/uni_modules/z-paging/components/z-paging/z-paging.vue'
import { reactive } from 'vue' import { reactive, computed, onMounted } from 'vue'
import { useGroupStore, useDialogueStore } from '@/store'
import {
ServeEditGroupNotice,
ServeDeleteGroupNotice,
} from '@/api/group/index.js'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const { showConfirm } = useConfirm()
const groupStore = useGroupStore()
const groupParams = reactive({
groupNotice: computed(() => groupStore.groupNotice),
})
const dialogueStore = useDialogueStore()
const dialogueParams = reactive({
receiver_id: computed(() => dialogueStore.talk.receiver_id),
})
const state = reactive({ const state = reactive({
groupNoticeObj: null, //
groupNotice: '', // groupNotice: '', //
canDoComplete: false, // canDoComplete: false, //
editMode: 1, // 123
})
onMounted(() => {
console.log(groupParams.groupNotice)
if (groupParams?.groupNotice?.length > 0) {
state.editMode = 3
state.groupNoticeObj = groupParams.groupNotice[0]
inputGroupNotice(groupParams?.groupNotice[0]?.content)
}
}) })
// //
const toPrevPage = () => { const toPrevPage = () => {
uni.navigateBack({ if (state.groupNotice) {
delta: 1, showConfirm({
}) content: t('groupNotice.quit.edit'),
contentText: t('groupNotice.continue.edit'),
confirmText: t('groupNotice.continue.edit'),
cancelText: t('groupNotice.confirm.quit'),
onConfirm: () => {},
onCancel: () => {
if (state.editMode === 2) {
state.editMode = 3
} else {
uni.navigateBack({
delta: 1,
})
}
},
})
} else {
uni.navigateBack({
delta: 1,
})
}
} }
// //
const inputGroupNotice = (e) => { const inputGroupNotice = (e) => {
state.groupNotice = e state.groupNotice = e
if (e.trim()) { if (e.trim() || state.editMode === 2) {
state.canDoComplete = true state.canDoComplete = true
} else { } else {
state.canDoComplete = false state.canDoComplete = false
} }
} }
//
const showCompleteModel = () => {
if (!state.canDoComplete) {
return
}
showConfirm({
content: state.groupNotice
? t('groupNotice.publish.prompt')
: t('groupNotice.clear.prompt'),
contentText: state.groupNotice
? t('prompt.confirm.publish')
: t('groupNotice.confirm.clear'),
confirmText: state.groupNotice
? t('prompt.confirm.publish')
: t('groupNotice.confirm.clear'),
cancelText: t('cancel'),
onConfirm: () => {
if (state.groupNotice) {
let params = {
notice_id: state?.groupNoticeObj?.id || 0,
group_id: dialogueParams.receiver_id,
title: '',
content: state.groupNotice,
is_top: 0,
is_confirm: 0,
}
console.log(params)
const resp = ServeEditGroupNotice(params)
resp.then(({ code, data }) => {
console.log(data)
if (code == 200) {
groupStore.updateGroupNotice([data])
uni.navigateBack({
delta: 1,
})
} else {
}
})
resp.catch(() => {})
} else {
let params = {
notice_id: state?.groupNoticeObj?.id,
group_id: dialogueParams.receiver_id,
}
console.log(params)
const resp = ServeDeleteGroupNotice(params)
resp.then(({ code, data }) => {
console.log(data)
if (code == 200) {
groupStore.updateGroupNotice([])
uni.navigateBack({
delta: 1,
})
} else {
}
})
resp.catch(() => {})
}
},
onCancel: () => {},
})
}
//
const changeToEditMode = () => {
state.editMode = 2
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.outer-layer { .outer-layer {
@ -112,30 +265,98 @@ const inputGroupNotice = (e) => {
} }
} }
.nav-bar-edit-btn {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
margin: 0 36rpx 0 0;
padding: 6rpx 0 6rpx 24rpx;
border-radius: 8rpx;
span {
line-height: 40rpx;
}
}
.notice-text-area {
display: flex;
.notice-view-area {
padding: 0 20rpx;
background-color: #fff;
border-radius: 8rpx;
box-shadow: 0 6px 12px 2px rgba(188, 188, 188, 0.08);
flex: 1;
display: flex;
flex-direction: column;
.notice-view-info {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
padding: 32rpx 0;
border-bottom: 1px solid $theme-border-color;
.notice-creater-avatar {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
width: 96rpx;
height: 96rpx;
border-radius: 50%;
overflow: hidden;
img {
width: 100%;
height: 100%;
}
}
.notice-creater-info {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
margin: 0 0 0 30rpx;
text {
line-height: 44rpx;
}
.notice-create-date {
color: #bababa;
line-height: 34rpx;
margin: 8rpx 0 0;
}
}
}
.notice-view-content {
padding: 24rpx 0;
span {
line-height: 44rpx;
}
}
}
}
.notice-text-area { .notice-text-area {
padding: 20rpx 32rpx; padding: 20rpx 32rpx;
height: 100%; height: 100%;
display: flex;
flex: 1;
::v-deep .wd-textarea { ::v-deep .wd-textarea {
height: 100%; // height: 100%;
display: flex;
flex: 1;
padding: 22rpx 0 0;
} }
::v-deep .wd-textarea__value { ::v-deep .wd-textarea__value {
padding-right: 0; padding-right: 0;
height: 100%; // height: 100%;
display: flex;
flex: 1;
} }
::v-deep .wd-textarea__inner { ::v-deep .wd-textarea__inner {
height: 100%; height: 100%;
} }
::v-deep .uni-textarea-compute {
div {
font-size: 32rpx;
font-weight: 400;
line-height: 44rpx;
}
}
} }
} }
</style> </style>

View File

@ -118,7 +118,14 @@
> >
<tm-checkbox <tm-checkbox
:round="10" :round="10"
color="#46299d" :color="
item?.checkArr?.length > 0 ? '#46299d' : '#B4B4B4'
"
:outlined="
item?.checkArr?.length > 0 || item.is_mute === 1
? false
: true
"
:value="item.id" :value="item.id"
:disabled="item.is_mute === 1" :disabled="item.is_mute === 1"
></tm-checkbox> ></tm-checkbox>
@ -149,7 +156,7 @@ import ZPaging from '@/uni_modules/z-paging/components/z-paging/z-paging.vue'
import useZPaging from '@/uni_modules/z-paging/components/z-paging/js/hooks/useZPaging.js' import useZPaging from '@/uni_modules/z-paging/components/z-paging/js/hooks/useZPaging.js'
import { computed, onMounted, reactive, ref, watch, nextTick } from 'vue' import { computed, onMounted, reactive, ref, watch, nextTick } from 'vue'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { ServeGroupNoSpeak } from '@/api/group/index.js'
import { useDialogueStore } from '@/store' import { useDialogueStore } from '@/store'
const zPaging = ref() const zPaging = ref()
@ -265,6 +272,9 @@ const inputSearchText = (e) => {
//item //item
const handleClickItem = (item) => { const handleClickItem = (item) => {
if (item.is_mute === 1) {
return
}
dialogueParams.memberList.forEach((ele) => { dialogueParams.memberList.forEach((ele) => {
if (ele.id == item.id) { if (ele.id == item.id) {
ele.checkArr = ele.checkArr?.length > 0 ? [] : [item.id] ele.checkArr = ele.checkArr?.length > 0 ? [] : [item.id]
@ -278,7 +288,7 @@ const confirmSilenceMember = () => {
dialogueParams.memberList.forEach((ele) => { dialogueParams.memberList.forEach((ele) => {
if (ele.checkArr?.length > 0) { if (ele.checkArr?.length > 0) {
if (!selectedUserIds) { if (!selectedUserIds) {
selectedUserIds = ele.checkArr[0] selectedUserIds = String(ele.checkArr[0])
} else { } else {
selectedUserIds += ',' + ele.checkArr[0] selectedUserIds += ',' + ele.checkArr[0]
} }
@ -292,6 +302,15 @@ const confirmSilenceMember = () => {
user_ids: selectedUserIds, //ids user_ids: selectedUserIds, //ids
} }
console.log(params) console.log(params)
const resp = ServeGroupNoSpeak(params)
resp.then(({ code, data }) => {
console.log(data)
if (code == 200) {
useDialogueStore().updateGroupMembers()
} else {
}
})
resp.catch(() => {})
} }
} }

View File

@ -164,7 +164,7 @@ import recordSearchTypeIcon_link from '@/static/image/chatSettings/recordSearchT
import ZPaging from '@/uni_modules/z-paging/components/z-paging/z-paging.vue' import ZPaging from '@/uni_modules/z-paging/components/z-paging/z-paging.vue'
import settingFormItem from './components/settingFormItem.vue' import settingFormItem from './components/settingFormItem.vue'
import groupMemberList from './components/groupMembersList.vue' import groupMemberList from './components/groupMembersList.vue'
import { computed, onMounted, reactive } from 'vue' import { computed, onMounted, reactive, watch } from 'vue'
import { import {
useUserStore, useUserStore,
useTalkStore, useTalkStore,
@ -209,6 +209,14 @@ const state = reactive({
sessionId: '', //id sessionId: '', //id
}) })
watch(
[() => groupParams.groupInfo, () => groupParams.groupNotice],
([newGroupInfo, newGroupNotice]) => {
updateGroupInfos()
},
{ deep: true },
)
onLoad(async (options) => { onLoad(async (options) => {
console.log(dialogueParams) console.log(dialogueParams)
if (options.groupId) { if (options.groupId) {
@ -216,7 +224,6 @@ onLoad(async (options) => {
state.groupId = Number(options.groupId) state.groupId = Number(options.groupId)
await groupStore.ServeGroupDetail() await groupStore.ServeGroupDetail()
await groupStore.ServeGetGroupNotices() await groupStore.ServeGetGroupNotices()
updateGroupInfos()
} }
if (options.sessionId) { if (options.sessionId) {
state.sessionId = Number(options.sessionId) state.sessionId = Number(options.sessionId)
@ -238,7 +245,6 @@ onLoad(async (options) => {
}) })
onMounted(() => { onMounted(() => {
updateGroupInfos()
state.recordSearchTypeList = [ state.recordSearchTypeList = [
{ {
value: t('chat.settings.groupMember'), value: t('chat.settings.groupMember'),
@ -277,22 +283,6 @@ onMounted(() => {
customInfo: 'switch', customInfo: 'switch',
}, },
] ]
state.chatManagement = [
{
label: t('chat.settings.groupGag'),
hasPointer: true,
value: '',
subValue: '',
customInfo: '',
},
{
label: t('chat.settings.groupAdmin'),
hasPointer: true,
value: '',
subValue: '总经理室-总经理,苏州站-出纳,常熟站…',
customInfo: '',
},
]
}) })
// //
@ -366,7 +356,7 @@ const updateGroupInfos = () => {
label: t('chat.settings.groupNotice'), label: t('chat.settings.groupNotice'),
hasPointer: true, hasPointer: true,
value: '', value: '',
subValue: groupParams.groupNotice[0], subValue: groupParams?.groupNotice[0]?.content,
customInfo: '', customInfo: '',
}, },
{ {
@ -377,6 +367,32 @@ const updateGroupInfos = () => {
customInfo: '', customInfo: '',
}, },
] ]
let groupAdmins = ''
if (groupParams?.groupInfo.groupAdminList?.length > 0) {
groupParams?.groupInfo.groupAdminList.forEach((item) => {
if (!groupAdmins) {
groupAdmins = item
} else {
groupAdmins += ',' + item
}
})
}
state.chatManagement = [
{
label: t('chat.settings.groupGag'),
hasPointer: true,
value: '',
subValue: '',
customInfo: '',
},
{
label: t('chat.settings.groupAdmin'),
hasPointer: true,
value: '',
subValue: groupAdmins,
customInfo: '',
},
]
} }
// //

View File

@ -8,3 +8,4 @@ export * from '@/store/modules/uploads'
export * from '@/store/modules/dialogueList' export * from '@/store/modules/dialogueList'
// export * from '@/store/modules/note' // export * from '@/store/modules/note'
export * from '@/store/modules/group' export * from '@/store/modules/group'
export * from '@/store/groupType/index'

View File

@ -120,6 +120,7 @@ export const useDialogueStore = defineStore('dialogue', {
value: o.nickname, value: o.nickname,
key: o.key, key: o.key,
erp_user_id: o.erp_user_id, erp_user_id: o.erp_user_id,
is_mute: o.is_mute,
})) }))
}, },

View File

@ -4,7 +4,7 @@ import {
ServeGetGroupMembers, ServeGetGroupMembers,
ServeGetGroupNotices, ServeGetGroupNotices,
} from '@/api/group/index' } from '@/api/group/index'
import { useDialogueStore } from '@/store' import { useDialogueStore, useGroupTypeStore } from '@/store'
export const useGroupStore = defineStore('group', { export const useGroupStore = defineStore('group', {
state: () => { state: () => {
@ -24,11 +24,30 @@ export const useGroupStore = defineStore('group', {
//获取群聊信息 //获取群聊信息
async ServeGroupDetail() { async ServeGroupDetail() {
const dialogueStore = useDialogueStore() const dialogueStore = useDialogueStore()
const groupTypeStore = useGroupTypeStore()
await groupTypeStore.getPositionsTree()
let { code, data } = await ServeGroupDetail({ let { code, data } = await ServeGroupDetail({
group_id: dialogueStore.talk.receiver_id, group_id: dialogueStore.talk.receiver_id,
}) })
if (code == 200) { if (code == 200) {
console.log(data) console.log(data)
let deptPosArr = []
if (data.deptInfos?.length > 0) {
if (data.positionInfos?.length > 0) {
data.deptInfos.forEach((deptInfo) => {
data.positionInfos.forEach(async (positionInfo) => {
let deptPosItem = groupTypeStore.getDepartmentPositionsById(
deptInfo.dept_id,
positionInfo.position_id,
)
if (deptPosItem) {
deptPosArr.push(deptPosItem)
}
})
})
}
}
data.groupAdminList = deptPosArr
this.groupInfo = data this.groupInfo = data
} }
}, },
@ -43,5 +62,13 @@ export const useGroupStore = defineStore('group', {
} else { } else {
} }
}, },
//更新群聊信息
updateGroupInfo(params) {
params && Object.assign(this.groupInfo, params)
},
//更新群公告信息
updateGroupNotice(params) {
this.groupNotice = params
},
}, },
}) })

View File

@ -122,5 +122,13 @@
"user.detail.ringBell": "打电话", "user.detail.ringBell": "打电话",
"user.detail.sendMsg": "发消息", "user.detail.sendMsg": "发消息",
"user.info.jobNum": "工号", "user.info.jobNum": "工号",
"record.share.link": "分享链接" "record.share.link": "分享链接",
"prompt.confirm.publish": "发布",
"groupNotice.publish.prompt": "发布该公告会通知全部群成员",
"groupNotice.mode.edit": "编辑",
"groupNotice.clear.prompt": "确定清空群公告",
"groupNotice.confirm.clear": "清空",
"groupNotice.quit.edit": "退出本次编辑",
"groupNotice.continue.edit": "继续编辑",
"groupNotice.confirm.quit": "退出"
} }