- {{ data.nickname }}
+
+ 管理员
修改群名为
"{{ extra.group_name }}"
diff --git a/src/components/talk/message/system/SysGroupMemberRemovedMessage.vue b/src/components/talk/message/system/SysGroupMemberRemovedMessage.vue
new file mode 100644
index 0000000..f26af8b
--- /dev/null
+++ b/src/components/talk/message/system/SysGroupMemberRemovedMessage.vue
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ {{ user.nickname }}
+ 、
+
+
已离开此群
+
+
+
diff --git a/src/constant/message.ts b/src/constant/message.ts
index 11e0e2f..a421418 100644
--- a/src/constant/message.ts
+++ b/src/constant/message.ts
@@ -60,7 +60,7 @@ export const ChatMsgTypeMapping = {
[ChatMsgSysGroupTransfer]: '[转让群主]',
[ChatMsgSysGroupAdmin]: '[设置管理员]',
[ChatMsgSysGroupMemberRemoved]: '[移出群成员消息]',
- [ChatMsgSysGroupInfoChange]: '[修改群名称]'
+ [ChatMsgSysGroupInfoChange]: '[群信息更新]'
}
// 消息类型 - 消息组件 映射关系
diff --git a/src/pages/chatSettings/index.vue b/src/pages/chatSettings/index.vue
index ae15279..0afb54d 100644
--- a/src/pages/chatSettings/index.vue
+++ b/src/pages/chatSettings/index.vue
@@ -167,7 +167,6 @@
@click="showConfirmPrompt(3)"
class="clear-chat-record-btn-each"
v-if="
- groupParams?.groupInfo?.is_manager === false &&
dialogueParams.type === 2 &&
(groupParams?.groupInfo?.group_type === 1 ||
groupParams?.groupInfo?.group_type === 3)
@@ -226,6 +225,7 @@ const dialogueParams = reactive({
keyboard: computed(() => dialogueStore.keyboard),
num: computed(() => dialogueStore.members.length),
memberList: computed(() => dialogueStore.members),
+ adminList: computed(() => dialogueStore.getAdminList),
})
const talkParams = reactive({
topItems: computed(() => talkStore.topItems),
@@ -563,14 +563,20 @@ const showConfirmPrompt = (flag) => {
confirmContent = t('ok') + t('chat.settings.clearChatRecord')
} else if (flag === 2) {
//解散群聊
- confirmContent = t('ok') + t('group.quit.btn')
- subContent = t('groupManage.disband.hint')
- subContentColor = '#CF3050'
+ confirmContent = t('group.dismiss.confirm')
} else if (flag === 3) {
- //退出群聊
- confirmContent = t('ok') + t('group.quit.btn')
- subContent = t('groupManage.quit.hint')
- subContentColor = '#B4B4B4'
+ //最后一个管理员退群就解散群聊
+ if (dialogueParams.adminList.length === 1 && dialogueParams.adminList[0].id === dialogueParams.uid) {
+ //解散群聊
+ confirmContent = t('ok') + t('group.quit.btn')
+ subContent = t('groupManage.disband.hint')
+ subContentColor = '#CF3050'
+ } else {
+ //退出群聊
+ confirmContent = t('ok') + t('group.quit.btn')
+ subContent = t('groupManage.quit.hint')
+ subContentColor = '#B4B4B4'
+ }
}
showConfirm({
subContent: subContent,
@@ -597,14 +603,32 @@ const showConfirmPrompt = (flag) => {
})
}
} else if (flag === 3) {
- ServeSecedeGroup({
- group_id: dialogueParams.receiver_id,
- }).then(({ code, message }) => {
- if (code == 200) {
- // dialogueStore.apiClearRecord()
- } else {
+ //最后一个管理员退群就解散群聊
+ if (dialogueParams.adminList.length === 1 && dialogueParams.adminList[0].id === dialogueParams.uid) {
+ //解散群聊
+ let params = {
+ group_id: dialogueParams.receiver_id, //群id
}
- })
+ console.log(params)
+ const res = await ServeDismissGroup(params)
+ if (res.code === 200) {
+ dialogueStore.updateGroupMembers()
+ groupStore.ServeGroupDetail()
+ uni.navigateBack({
+ delta: 2,
+ })
+ }
+ } else {
+ //退出群聊
+ ServeSecedeGroup({
+ group_id: dialogueParams.receiver_id,
+ }).then(({ code, message }) => {
+ if (code == 200) {
+ // dialogueStore.apiClearRecord()
+ } else {
+ }
+ })
+ }
}
},
onCancel: () => {},
diff --git a/src/pages/dialog/index.vue b/src/pages/dialog/index.vue
index b31887a..0e11345 100644
--- a/src/pages/dialog/index.vue
+++ b/src/pages/dialog/index.vue
@@ -26,7 +26,7 @@
dialogueStore.keyboard),
num: computed(() => dialogueStore.members.length),
isDismiss: computed(() => dialogueStore.isDismiss),
+ isQuit: computed(() => dialogueStore.isQuit),
adminList: computed(() => dialogueStore.getAdminList),
})
@@ -877,6 +878,9 @@ const editorOption = {
return el
},
source: function (searchTerm, renderList, mentionChar) {
+ if (talkParams.type === 1) {
+ return
+ }
// 在失焦前保存光标位置
const quill = getQuill()
const range = quill.getSelection()
@@ -1107,11 +1111,14 @@ watch(
newValue[newValue.length - 1]?.sequence ===
dialogueList?.records?.[0]?.sequence
) {
- //相同意味着分页加载缓存中的聊天记录完毕
- state.value.localPageLoadDone = true
- if (dialogueList?.records?.[0]?.sequence !== 1) {
+ if (
+ dialogueList?.records?.[0]?.sequence !== 1 &&
+ !state.value.localPageLoadDone
+ ) {
loadConfig.status = 1
}
+ //相同意味着分页加载缓存中的聊天记录完毕
+ state.value.localPageLoadDone = true
} else {
state.value.localPageLoadDone = false
}
@@ -1149,8 +1156,10 @@ const onScrollToLower = async () => {
}))
virtualList.value = formattedMoreRecords.concat(tempVirtualList).reverse()
-
- console.log(virtualList.value)
+ loadConfig.status =
+ dialogueList?.records?.[0]?.sequence > 1 && moreRecords.length > 0
+ ? 1
+ : 2
} else {
if (tempVirtualList[0].sequence > dialogueList.records[0].sequence) {
virtualList.value = dialogueList.records
@@ -1224,8 +1233,8 @@ const onScrollToUpper = async () => {
.concat(
dialogueList.records.slice(
recordIndex + 1,
- Math.min(recordIndex + 11, dialogueList.records.length)
- )
+ Math.min(recordIndex + 11, dialogueList.records.length),
+ ),
)
.reverse()
@@ -1330,7 +1339,7 @@ const getMentionSelectLists = (mentionSelectList) => {
{
id: mentionSelectItem?.id,
denotationChar: '@',
- value: mentionSelectItem?.nickname,
+ value: mentionSelectItem?.nickname + ' ',
},
true,
)
@@ -1401,7 +1410,8 @@ const queryRecordsByMsgInfo = async (msgInfo) => {
nextTick(() => {
zpagingRef.value.complete(recordsList.reverse())
- loadConfig.status = dialogueList?.records?.[0]?.sequence > 1 ? 1 : 2
+ loadConfig.status =
+ dialogueList?.records?.[0]?.sequence > 1 && recordsList.length > 0 ? 1 : 2
nextTick(() => {
let offset = uni.getSystemInfoSync().windowHeight
const navBarAreaQuery = uni.createSelectorQuery()
@@ -1492,8 +1502,11 @@ const findTalkRecords = (record, isMiddle, sequence, appointParams) => {
resolve(JSON.parse(JSON.stringify(state.value.serveFindRecord)))
state.value.serveFindRecord = []
}
+ } else {
+ resolve([])
}
} else {
+ resolve([])
}
})
resp.catch(() => {})
diff --git a/src/pages/search/components/searchList.vue b/src/pages/search/components/searchList.vue
index 25a7acb..f320a15 100644
--- a/src/pages/search/components/searchList.vue
+++ b/src/pages/search/components/searchList.vue
@@ -317,6 +317,8 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
data.last_id,
data.last_group_id,
data.last_member_id,
+ data.last_receiver_user_name,
+ data.last_receiver_group_name,
)
let total = data.count
if (props.searchRecordDetail) {
diff --git a/src/pages/search/moreResult/moreResult.vue b/src/pages/search/moreResult/moreResult.vue
index 6890668..4cff530 100644
--- a/src/pages/search/moreResult/moreResult.vue
+++ b/src/pages/search/moreResult/moreResult.vue
@@ -62,6 +62,8 @@ onLoad((options) => {
receiver_id: 0, //查详情的时候需传入
last_group_id: 0, //最后一条群id
last_member_id: 0, //最后一条用户id
+ last_receiver_user_name: '', //最后一条用户名
+ last_receiver_group_name: '', //最后一条群名
}),
)
state.apiRequest = ServeTalkRecord
@@ -73,11 +75,13 @@ onLoad((options) => {
})
//分页查询时,最后一条id变化
-const lastIdChange = (last_id, last_group_id, last_member_id) => {
+const lastIdChange = (last_id, last_group_id, last_member_id, last_receiver_user_name, last_receiver_group_name) => {
let idChanges = {
last_id,
last_group_id,
last_member_id,
+ last_receiver_user_name,
+ last_receiver_group_name,
}
state.apiParams = encodeURIComponent(
JSON.stringify(
diff --git a/src/store/modules/dialogue.js b/src/store/modules/dialogue.js
index 51d8f71..69844b7 100644
--- a/src/store/modules/dialogue.js
+++ b/src/store/modules/dialogue.js
@@ -51,6 +51,9 @@ export const useDialogueStore = defineStore('dialogue', {
//是否已被解散
isDismiss: false,
+ //是否退群/移出群
+ isQuit: false,
+
// 群成员列表
members: [],
@@ -102,6 +105,7 @@ export const useDialogueStore = defineStore('dialogue', {
this.isShowEditor = data?.is_robot === 0
this.isDismiss = data?.is_dismiss === 1 ? true : false
+ this.isQuit = data?.is_quit === 1 ? true : false
this.members = []
if (data.talk_type == 2) {
diff --git a/src/store/modules/dialogueList.js b/src/store/modules/dialogueList.js
index 1114290..bb9c073 100644
--- a/src/store/modules/dialogueList.js
+++ b/src/store/modules/dialogueList.js
@@ -41,6 +41,7 @@ export const useDialogueListStore = createGlobalState(() => {
isShowEditor: dialogue.isShowEditor,
isShowSessionList: dialogue.isShowSessionList,
isDismiss: dialogue.isDismiss,
+ isQuit: dialogue.isQuit,
members: dialogue.members.map(member => ({
id: member.id,
nickname: member.nickname,
diff --git a/src/uni_modules/tmui/locale/zh-Hans.json b/src/uni_modules/tmui/locale/zh-Hans.json
index 53be61f..32fae35 100644
--- a/src/uni_modules/tmui/locale/zh-Hans.json
+++ b/src/uni_modules/tmui/locale/zh-Hans.json
@@ -154,5 +154,6 @@
"chat.mention.select": "选择提醒的人",
"do.phone.call": "拨打",
"popup.title.phone": "电话",
- "pageTitle.view.deps": "查看部门"
+ "pageTitle.view.deps": "查看部门",
+ "group.dismiss.confirm": "确定解散本群"
}
diff --git a/src/utils/talk.js b/src/utils/talk.js
index 83557bd..16a4976 100644
--- a/src/utils/talk.js
+++ b/src/utils/talk.js
@@ -33,6 +33,7 @@ export function formatTalkItem(params) {
is_top: 0,
is_online: 0,
is_dismiss: 0,
+ is_quit: 0,
is_robot: 0,
unread_num: 0,
content: '......',