...
 
Commits (18)
    https://gitcode.net/dcloud/uni-im/-/commit/f620de3948e28c88dbf4a20c8dbc2795dcdc88b6 Update index.scss 2024-06-21T21:21:25+08:00 DCloud_JSON linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/b6b5fef5978a8bcbd6f6c02e2b462bd3c58d658e 优化样式 2024-06-21T21:21:25+08:00 DCloud_JSON linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/6142e4283ed8fc8b7a8a78e2660fcf9302e7dceb 修复 会话列表的 note 存在 的问题 2024-06-21T21:21:25+08:00 DCloud_JSON linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/fb10e2eb90825eb27efdb79c8c2a56c88660c921 新增 支持用户设置自己的会话为已读/未读 2024-06-21T21:21:25+08:00 DCloud_JSON linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/2fe5e71111fd685479d4ba338489f7efa403a2e5 修复 web-pc 端群成员显示不全的问题 2024-06-21T21:21:25+08:00 DCloud_JSON linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/76497dafa8a94ce6dcf3a7b3825c675e6ca29eb6 Update index.scss 2024-06-21T21:21:25+08:00 DCloud_JSON linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/454d67adb0259ab25513ceb16abf4567d084746f 修复 部分情况下,APP 端所登录的账号于其他端同时进行登录后发送消息时,也会在 APP端创建通知栏消息的问题 2024-06-21T21:21:25+08:00 DCloud_JSON linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/43d10d6c35ffd70581e0070365370ddafb5f4586 新增 unipush 的channel相关配置,防止应用被避免被限量推送、静默推送(静音且需下拉系统通知栏才可见通知内容) 2024-06-21T21:21:25+08:00 DCloud_JSON linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/d4d069ab5aba2efbe82ff008cad5b4b86c4f86a7 修复 由于将“user_id”错误地改为“uid”而导致在群聊场景下“@用户”的功能中,消息内容里的已读未读图标无法显示的问题。 2024-06-21T21:21:25+08:00 DCloud_JSON linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/7fd2ae430204ca08a3651faeb040df45b233e4ba Update chat.vue 2024-06-21T21:21:25+08:00 DCloud_JSON linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/aa46a0d438b3c49ca24996054e3bb08dd620e261 优化样式 2024-06-21T21:21:25+08:00 DCloud_JSON linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/a77ab62ebc4c5141031560789287743ad19030bc Update index.scss 2024-06-21T21:21:25+08:00 DCloud_JSON linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/881fc5aae1348e769840cbf056b28dfe8f5bac3a 修复 微信小程序端仅插入表情包的情况下,消息发送按钮不可用的问题 2024-06-21T21:21:25+08:00 DCloud_JSON linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/ce325279b07f318293350d209873a44809653e3b 更新 删除过期的代码 2024-06-21T21:21:25+08:00 DCloud_JSON linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/e131ae99dce88e437857d42071f6c2ad7cbb8dce Update index.scss 2024-06-21T21:21:25+08:00 DCloud_JSON linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/12e89108214b3985e3055e58bedd4a69a56fe66d 更新 修复部分情况下,消息操作菜单的选择更多功能的样式错误的问题 2024-06-21T21:21:25+08:00 DCloud_JSON linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/f9ae434be21f84ce576ed305e2a4dd87e2709dc7 新增 索引 2024-06-21T21:21:25+08:00 DCloud_JSON linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/c76149cc37c7b6052b425c0d43995a3b512b2dd8 3.1.5 2024-06-21T21:56:07+08:00 DCloud_JSON linju@dcloud.io
## 3.1.5(2024-06-21)
- 新增 数据库索引文件
- 新增 支持用户设置自己的会话为已读/未读
- 新增 unipush 的channel相关配置,防止应用被避免被限量推送、静默推送(静音且需下拉系统通知栏才可见通知内容)
- 修复 由于将“user_id”错误地改为“uid”而导致在群聊场景下“@用户”的功能中,消息内容里的已读未读图标无法显示的问题。
- 修复 部分情况下,APP 端所登录的账号于其他端同时进行登录后发送消息时,也会在 APP端创建通知栏消息的问题
- 修复 会话列表的 note 存在 的问题
- 优化样式
## 3.1.4(2024-06-19) ## 3.1.4(2024-06-19)
- 优化 web-pc 端样式 - 优化 web-pc 端样式
- 修复 web-pc 的消息菜单扩展点,传入的会话数据找不到的问题 - 修复 web-pc 的消息菜单扩展点,传入的会话数据找不到的问题
......
export default {
uniPush: {
// 消息渠道设置,避免被限量推送、静默推送(静音且需下拉系统通知栏才可见通知内容)详情文档:https://doc.dcloud.net.cn/uniCloud/uni-cloud-push/api.html#channel
channel:{
// 渠道id
id: "114240",
// 消息渠道描述,会显示在手机系统关于当前应用的通知设置中
desc: "客服消息"
}
}
}
\ No newline at end of file
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<view class="editor-box-parent"> <view class="editor-box-parent">
<view class="editor-box"> <view class="editor-box">
<uni-im-sound v-show="soundIsShow" @sendSoundMsg="sendSoundMsg" class="uni-im-sound"></uni-im-sound> <uni-im-sound v-show="soundIsShow" @sendSoundMsg="sendSoundMsg" class="uni-im-sound"></uni-im-sound>
<uni-im-editor v-show="!soundIsShow" @input="oninput" @confirm="confirm" class="editor" ref="editor"></uni-im-editor> <uni-im-editor v-show="!soundIsShow" @input="oninput" @confirm="confirm" @change="updateModelValue" class="editor" ref="editor"></uni-im-editor>
</view> </view>
<slot name="about-msg"></slot> <slot name="about-msg"></slot>
</view> </view>
...@@ -199,11 +199,14 @@ ...@@ -199,11 +199,14 @@
this.$emit('update:modelValue', e.value) this.$emit('update:modelValue', e.value)
this.$emit('input',e) this.$emit('input',e)
}, },
updateModelValue({value}) {
this.$emit('update:modelValue', value)
},
focus() { focus() {
// console.log('focus'); // console.log('focus');
this.$refs.editor.callRmd('$focus') this.$refs.editor.callRmd('$focus')
}, },
async addCallUser({uid, nickname},needDeleteLeftART = true,DL=0) { async addCallUser({user_id, nickname},needDeleteLeftART = true,DL=0) {
// 隐藏发送语音消息模式 // 隐藏发送语音消息模式
this.soundIsShow = false; this.soundIsShow = false;
...@@ -222,7 +225,7 @@ ...@@ -222,7 +225,7 @@
await uniIm.utils.sleep(10) await uniIm.utils.sleep(10)
// 提醒末尾的此空格在margin-right: -3px;内,用于解决办法浏览器非文本节点后的光标定位不正确的问题 // 提醒末尾的此空格在margin-right: -3px;内,用于解决办法浏览器非文本节点后的光标定位不正确的问题
const html =`<span class="nickname" contenteditable="false" uid="${uid}">@${nickname}</span>&nbsp;` const html =`<span class="nickname" contenteditable="false" user_id="${user_id}">@${nickname}</span>&nbsp;`
this.addHtmlToCursor(html) this.addHtmlToCursor(html)
// setTimeout(()=>this.$refs.editor.callRmd('$restoreCursor'),500) // setTimeout(()=>this.$refs.editor.callRmd('$restoreCursor'),500)
}, },
......
...@@ -170,7 +170,7 @@ export default { ...@@ -170,7 +170,7 @@ export default {
"left": clientX "left": clientX
} }
let menuList = [{ let menuList = [{
"title": "置顶", "title": conversation.pinned ? "取消置顶" : "置顶",
"action": () => { "action": () => {
conversation.pinned = !conversation.pinned conversation.pinned = !conversation.pinned
db.collection('uni-im-conversation') db.collection('uni-im-conversation')
...@@ -190,6 +190,12 @@ export default { ...@@ -190,6 +190,12 @@ export default {
}) })
} }
}, },
{
"title": "标为" + (conversation.unread_count ? "已读" : "未读"),
"action": () => {
conversation.setUnreadCount(conversation.unread_count ? 0 : 1)
}
},
{ {
"title": conversation.mute ? "允许消息通知" : "消息免打扰", "title": conversation.mute ? "允许消息通知" : "消息免打扰",
"action": () => { "action": () => {
...@@ -211,9 +217,6 @@ export default { ...@@ -211,9 +217,6 @@ export default {
"action": () => conversation.hide() "action": () => conversation.hide()
} }
] ]
if (conversation.pinned) {
menuList[0].title = "取消置顶"
}
myContextmenu.show(position, menuList) myContextmenu.show(position, menuList)
myContextmenu.onClose(() => { myContextmenu.onClose(() => {
conversation.focus = false conversation.focus = false
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<script> <script>
import uniIm from '@/uni_modules/uni-im/sdk/index.js'; import uniIm from '@/uni_modules/uni-im/sdk/index.js';
export default { export default {
emits: ["input", "confirm"], emits: ["input", "confirm", "change"],
data() { data() {
return { return {
callRmdParam: [], callRmdParam: [],
...@@ -42,7 +42,16 @@ ...@@ -42,7 +42,16 @@
type: Number, type: Number,
default: 140 default: 140
} }
}, },
// #ifdef MP
watch: {
textareaValue(val){
this.$emit("change",{
value:val
})
}
},
// #endif
mounted() { mounted() {
// 与rmd通讯专用 // 与rmd通讯专用
this.callRmd = async (funcName, ...params) => { this.callRmd = async (funcName, ...params) => {
...@@ -360,7 +369,7 @@ ...@@ -360,7 +369,7 @@
// "rich-text": //uniIm.utils.parseHtml( 执行比较消耗内存,改为chat页面 confirm时执行, // "rich-text": //uniIm.utils.parseHtml( 执行比较消耗内存,改为chat页面 confirm时执行,
"html": val, "html": val,
"text": uniImEditor.innerText, "text": uniImEditor.innerText,
"aboutUserIds": Array.from(uniImEditor.querySelectorAll('.nickname')).map(i=>i.getAttribute('uid')) "aboutUserIds": Array.from(uniImEditor.querySelectorAll('.nickname')).map(i=>i.getAttribute('user_id'))
} }
} else { } else {
param = this.$inputText() param = this.$inputText()
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
:contentText='{"contentrefresh": "正在加载历史消息","contentnomore": "没有更多历史消息"}'></uni-im-load-state> :contentText='{"contentrefresh": "正在加载历史消息","contentnomore": "没有更多历史消息"}'></uni-im-load-state>
</view> </view>
<view :class="['item',msg.type]" :id="'item-'+index" @click="clickItem"> <view :class="['item',msg.type]" :id="'item-'+index" @click="clickItem">
<label class="msg-box" :class="{'active-msg':msg._id === activeMsgId || msg.unique_id === activeMsgId}" @click="checkMsg(msg)"> <view class="msg-box" :class="{'active-msg':msg._id === activeMsgId || msg.unique_id === activeMsgId,'pointer':chooseMore}" @click="checkMsg(msg)">
<template v-if="chooseMore"> <template v-if="chooseMore">
<checkbox :checked="checkedMsgList.find(i=>i._id == msg._id) != undefined" class="checkbox" /> <checkbox :checked="checkedMsgList.find(i=>i._id == msg._id) != undefined" class="checkbox" />
<view class="mask"></view> <view class="mask"></view>
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
@viewMsg="viewMsg" :ref="'uni-im-msg'" class="uni-im-msg" @viewMsg="viewMsg" :ref="'uni-im-msg'" class="uni-im-msg"
> >
</uni-im-msg> </uni-im-msg>
</label> </view>
</view> </view>
</view> </view>
</template> </template>
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
components: { components: {
uniImList uniImList
}, },
emits:['checkedMsgList','longpressMsgAvatar','showControl','clickItem','retriesSendMsg','putChatInputContent'], emits:['checkedMsgList','update:checkedMsgList','longpressMsgAvatar','showControl','clickItem','retriesSendMsg','putChatInputContent'],
computed: { computed: {
...uniIm.mapState(['systemInfo', 'isWidescreen']), ...uniIm.mapState(['systemInfo', 'isWidescreen']),
loadState() { loadState() {
...@@ -693,5 +693,10 @@ ...@@ -693,5 +693,10 @@
cursor: pointer; cursor: pointer;
/* #endif */ /* #endif */
} }
/* #ifdef H5 */
.pointer {
cursor: pointer;
}
/* #endif */
} }
</style> </style>
\ No newline at end of file
...@@ -189,7 +189,6 @@ ...@@ -189,7 +189,6 @@
/* #endif */ /* #endif */
.text { .text {
display: inline-flex;
word-break: break-all; word-break: break-all;
cursor: text; cursor: text;
/* #ifdef H5 */ /* #ifdef H5 */
......
{ {
"id": "uni-im", "id": "uni-im",
"displayName": "uni-im", "displayName": "uni-im",
"version": "3.1.4", "version": "3.1.5",
"description": "uni-im是云端一体的、全平台的、免费的、开源即时通讯系统", "description": "uni-im是云端一体的、全平台的、免费的、开源即时通讯系统",
"keywords": [ "keywords": [
"im,即时通讯,客服,聊天" "im,即时通讯,客服,聊天"
......
...@@ -39,6 +39,40 @@ ...@@ -39,6 +39,40 @@
</view> </view>
</template> </template>
</uni-im-chat-input> </uni-im-chat-input>
<view v-if="chooseMoreMsg" class="toolbar">
<view class="item" @click="shareMsg(checkedMsgList)">
<view class="icons-box">
<uni-icons size="35" type="redo"></uni-icons>
</view>
<text class="title">逐条转发</text>
</view>
<view class="item" @click="shareMsg(checkedMsgList,true)">
<view class="icons-box">
<uni-icons size="35" type="paperplane"></uni-icons>
</view>
<text class="title">合并转发</text>
</view>
<view class="item" @click="toolBarNext">
<view class="icons-box">
<uni-icons size="35" type="folder-add"></uni-icons>
</view>
<text class="title">收藏</text>
</view>
<view class="item" @click="toolBarNext">
<view class="icons-box">
<uni-icons size="35" type="download"></uni-icons>
</view>
<text class="title">保存至电脑</text>
</view>
<view class="item" @click="toolBarNext">
<view class="icons-box">
<uni-icons size="35" type="trash"></uni-icons>
</view>
<text class="title">删除</text>
</view>
<uni-icons @click="chooseMoreMsg = false" color="#999" size="35" type="closeempty"></uni-icons>
</view>
</view> </view>
<msg-popup-control ref="msg-popup-control" @answer="setAnswerMsg" @share="shareMsg" @chooseMore="chooseMoreMsg = true;checkedMsgList = $event"></msg-popup-control> <msg-popup-control ref="msg-popup-control" @answer="setAnswerMsg" @share="shareMsg" @chooseMore="chooseMoreMsg = true;checkedMsgList = $event"></msg-popup-control>
...@@ -81,40 +115,6 @@ ...@@ -81,40 +115,6 @@
chooseMoreMsg:{{chooseMoreMsg}} chooseMoreMsg:{{chooseMoreMsg}}
checkedMsgList:{{checkedMsgList}} --> checkedMsgList:{{checkedMsgList}} -->
</view> </view>
<view v-if="chooseMoreMsg" class="toolbar" @click="chooseMoreMsg = false">
<view class="item" @click="shareMsg(checkedMsgList)">
<view class="icons-box">
<uni-icons size="35" type="redo"></uni-icons>
</view>
<text class="title">逐条转发</text>
</view>
<view class="item" @click="shareMsg(checkedMsgList,true)">
<view class="icons-box">
<uni-icons size="35" type="paperplane"></uni-icons>
</view>
<text class="title">合并转发</text>
</view>
<view class="item" @click="toolBarNext">
<view class="icons-box">
<uni-icons size="35" type="folder-add"></uni-icons>
</view>
<text class="title">收藏</text>
</view>
<view class="item" @click="toolBarNext">
<view class="icons-box">
<uni-icons size="35" type="download"></uni-icons>
</view>
<text class="title">保存至电脑</text>
</view>
<view class="item" @click="toolBarNext">
<view class="icons-box">
<uni-icons size="35" type="trash"></uni-icons>
</view>
<text class="title">删除</text>
</view>
<uni-icons @click="chooseMoreMsg = false" color="#999" size="35" type="closeempty"></uni-icons>
</view>
</view> </view>
</template> </template>
...@@ -151,8 +151,6 @@ ...@@ -151,8 +151,6 @@
leave:false, leave:false,
title: '' title: ''
}, },
//聊天输入框高度
textareaHeight: 26,
navTitle:"",//导航栏标题 navTitle:"",//导航栏标题
keyboardHeight: 0, keyboardHeight: 0,
keyboardMaxHeight: 0, keyboardMaxHeight: 0,
...@@ -752,7 +750,7 @@ ...@@ -752,7 +750,7 @@
cloudPath: Date.now() + uniCloud.getCurrentUserInfo().uid + '.' + name.split('.').pop(), cloudPath: Date.now() + uniCloud.getCurrentUserInfo().uid + '.' + name.split('.').pop(),
}).then(res=>{ }).then(res=>{
item.attrs.src = res.fileID item.attrs.src = res.fileID
console.log('上传成功',res); // console.log('上传成功',res);
resolve() resolve()
}).catch(e=>{ }).catch(e=>{
reject() reject()
...@@ -849,7 +847,6 @@ ...@@ -849,7 +847,6 @@
}, },
resetChatInput() { resetChatInput() {
this.chatInputContent = '' this.chatInputContent = ''
this.textareaHeight = 26
// 关闭引用的消息 // 关闭引用的消息
this.answerMsg = false this.answerMsg = false
}, },
...@@ -943,10 +940,10 @@ ...@@ -943,10 +940,10 @@
msgListRef.showLast(duration) msgListRef.showLast(duration)
} }
}, },
onLongpressMsgAvatar(uid){ onLongpressMsgAvatar(user_id){
// 当前输入框已经@了的用户id 要过滤掉 // 当前输入框已经@了的用户id 要过滤掉
let callUidList = this.getCallUid() let callUidList = this.getCallUid()
if(callUidList.includes(uid)){ if(callUidList.includes(user_id)){
console.log('此用户id已经@过'); console.log('此用户id已经@过');
uni.showToast({ uni.showToast({
title: '此用户已经@过', title: '此用户已经@过',
...@@ -955,30 +952,17 @@ ...@@ -955,30 +952,17 @@
}else{ }else{
this.$refs['chat-input'].raiseEditor = true this.$refs['chat-input'].raiseEditor = true
this.$nextTick(()=>{ this.$nextTick(()=>{
this.setCallAboutUid(uid,false) this.setCallAboutUid(user_id,false)
}) })
} }
}, },
setCallAboutUid(uid,needDeleteLeftART = true) { setCallAboutUid(user_id,needDeleteLeftART = true) {
this.aboutMenberIsShow = false this.aboutMenberIsShow = false
this.$refs['chat-input'].addCallUser({ this.$refs['chat-input'].addCallUser({
uid, user_id,
nickname: this.group_member[uid].users.nickname nickname: this.group_member[user_id].users.nickname
},needDeleteLeftART,this.aboutUserKeyword.length) },needDeleteLeftART,this.aboutUserKeyword.length)
}, },
linechange(e) {
//console.log(e.detail);
let {
height,
lineCount
} = e.detail;
// console.log(height,lineCount);
if (lineCount === 1) {
this.textareaHeight = 26;
} else if (height <= 100) {
this.textareaHeight = height - 2;
}
},
async showControl({ async showControl({
msgId, msgId,
msgContentDomInfo msgContentDomInfo
...@@ -1032,6 +1016,7 @@ ...@@ -1032,6 +1016,7 @@
}, },
shareMsg(msgList,merge = false) { shareMsg(msgList,merge = false) {
this.$refs['share-msg'].open(msgList,merge) this.$refs['share-msg'].open(msgList,merge)
this.chooseMoreMsg = false
}, },
toolBarNext(){ toolBarNext(){
uni.showToast({ uni.showToast({
...@@ -1041,34 +1026,9 @@ ...@@ -1041,34 +1026,9 @@
}); });
this.chooseMoreMsg = false this.chooseMoreMsg = false
}, },
clickMenu(index, e) {
// console.log('clickMenu-',index);
if (index < 2) {
this.chooseFileSendMsg(index === 0 ? 'image' : 'video')
}
if (index === 2) {
// #ifdef APP-PLUS
return uni.showToast({
title: '暂不支持,发送文件',
icon: 'none'
});
// #endif
this.chooseFileSendMsg('all')
}
e.stopPropagation()
},
clickEmojiItem(emojiUniCode, e) {
this.chatInputContent += emojiUniCode
e.stopPropagation()
},
tapUnreadCount() { tapUnreadCount() {
//点击未读消息文字按钮事件 //点击未读消息文字按钮事件
if (this.isWidescreen) { uni.navigateBack();
// this.$emit('tapUnreadCount') //点击后会话列表自动滚动 置顶 待读项
// console.log('tapUnreadCount');
} else {
uni.navigateBack();
}
}, },
updateNavTitle(){ updateNavTitle(){
this.navTitle = this.conversation.title this.navTitle = this.conversation.title
...@@ -1305,7 +1265,7 @@ page { ...@@ -1305,7 +1265,7 @@ page {
bottom: 0; bottom: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 260px; height: 100%;
background-color: #ededed; background-color: #ededed;
border-top: solid 1px #ededed; border-top: solid 1px #ededed;
flex-direction: row; flex-direction: row;
......
...@@ -424,16 +424,9 @@ ...@@ -424,16 +424,9 @@
@import "@/uni_modules/uni-im/common/baseStyle.scss"; @import "@/uni_modules/uni-im/common/baseStyle.scss";
page, page,
.group-info-box { .group-info-box {
width: 750rpx; width: 100%;
flex: 1; height: 100%;
background-color: #f5f5f5; background-color: #f5f5f5;
/* #ifdef H5 */
@media screen and (min-device-width:960px) {
height: calc(95vh - 70px);
overflow-y: auto;
flex: none;
}
/* #endif */
.logo { .logo {
width: 50px; width: 50px;
height: 50px; height: 50px;
......
...@@ -81,7 +81,8 @@ ...@@ -81,7 +81,8 @@
}) })
// laterRenderIndex // laterRenderIndex
.filter((item, index) => { .filter((item, index) => {
return index < this.laterRenderIndex * 50 // web-pc端有显示更多按钮,不需要延迟渲染
return this.showMoreBtn ? true : index < this.laterRenderIndex * 50
}) })
const memberCount = memberList.length const memberCount = memberList.length
......
...@@ -2,11 +2,13 @@ ...@@ -2,11 +2,13 @@
// flex: 1; // flex: 1;
// } // }
page { page {
width: 100%;
height: 100vh; height: 100vh;
background-color: #2e2e3e; background-color: #2e2e3e;
/* #ifdef H5 */ /* #ifdef H5 */
@media screen and (min-device-width:960px){ @media screen and (min-device-width:960px){
padding: 20px; padding: 20px;
padding-bottom: 60px;
.pointer { .pointer {
cursor: pointer; cursor: pointer;
} }
...@@ -61,8 +63,17 @@ page { ...@@ -61,8 +63,17 @@ page {
} }
} }
#conversation-list-box { #conversation-list-box {
height: 100%; height: 0;
flex: 1; flex: 1;
/* #ifdef H5 */
@media screen and (min-device-width:960px){
::v-deep {
.conversation-list-item {
margin: 5px;
}
}
}
/* #endif */
} }
#uni-im-contacts-box { #uni-im-contacts-box {
position: absolute; position: absolute;
...@@ -119,26 +130,29 @@ page { ...@@ -119,26 +130,29 @@ page {
} }
} }
} }
} .chatInfoBox {
z-index: 9;
.chatInfoBox { position: absolute;
z-index: 9; right:0;
position: absolute; background-color: rgba(0,0,0,0.2);
right:0; height: 100%;
top: 70px; width: 100%;
background-color: rgba(0,0,0,0.2); align-items: flex-end;
height: calc(95vh - 70px); .group-info-parent{
align-items: flex-end; height: 100%;
width: 100%; overflow-y: auto;
.group-info-text { background-color: #f5f5f5;
max-width: 250px !important; }
text-align: left; .group-info-text {
word-break: break-all; max-width: 250px !important;
text-align: left;
word-break: break-all;
}
} }
} }
} }
#ccid-is-null-tip { #ccid-is-null-tip {
height: 95vh; flex: 1;
padding-top: 30vh; padding-top: 30vh;
align-items: center; align-items: center;
background-color: #efefef; background-color: #efefef;
...@@ -176,19 +190,21 @@ page { ...@@ -176,19 +190,21 @@ page {
} }
} }
#foot { #foot {
display: none;
position: fixed; position: fixed;
width: 100%;
height: 50px;
bottom: 0; bottom: 0;
flex-direction: row; flex-direction: row;
color: #FFFFFF; justify-content: center;
.uni-link:hover{ color: #FFFFFF;
color: #00aa55 !important; .uni-link:hover{
} color: #00aa55 !important;
.item { }
.item {
flex-direction: row; flex-direction: row;
margin:0 50px; margin:0 50px;
align-items: center; align-items: center;
.icon { .icon {
width: 20px; width: 20px;
height: 20px; height: 20px;
margin-right: 5px; margin-right: 5px;
......
...@@ -74,14 +74,17 @@ ...@@ -74,14 +74,17 @@
<view class="header"> <view class="header">
<uni-icons @click="showChatInfo" class="more" type="more-filled" size="20"></uni-icons> <uni-icons @click="showChatInfo" class="more" type="more-filled" size="20"></uni-icons>
</view> </view>
<chat-view class="content" ref="chat-view"></chat-view> <view class="content">
</template> <chat-view ref="chat-view"></chat-view>
<view v-if="chatInfoIsShow" class="chatInfoBox" @click.stop="chatInfoIsShow = false"> <view v-if="chatInfoIsShow" class="chatInfoBox" @click.stop="chatInfoIsShow = false">
<view @click.native.stop> <view @click.stop class="group-info-parent">
<uni-im-group-info v-if="currentConversation.group_id" ref="group-info"></uni-im-group-info> <uni-im-group-info v-if="currentConversation.group_id" ref="group-info"></uni-im-group-info>
<uni-im-chat-info v-else ref="chat-info"></uni-im-chat-info> <uni-im-chat-info v-else ref="chat-info"></uni-im-chat-info>
</view>
</view>
</view> </view>
</view> </template>
</template> </template>
<view v-else id="ccid-is-null-tip"> <view v-else id="ccid-is-null-tip">
......
import config from '@/uni_modules/uni-im/common/config.js';
import $state from '@/uni_modules/uni-im/sdk/state/index.js'; import $state from '@/uni_modules/uni-im/sdk/state/index.js';
import $methods from '@/uni_modules/uni-im/sdk/methods/index.js'; import $methods from '@/uni_modules/uni-im/sdk/methods/index.js';
import {init as initIndexDB} from '@/uni_modules/uni-im/sdk/ext/indexDB.js'; import {init as initIndexDB} from '@/uni_modules/uni-im/sdk/ext/indexDB.js';
...@@ -15,6 +16,7 @@ import onSocketStateChange from './onSocketStateChange' ...@@ -15,6 +16,7 @@ import onSocketStateChange from './onSocketStateChange'
import imData from './imData' import imData from './imData'
import onlyOneWebTab from './onlyOneWebTab' import onlyOneWebTab from './onlyOneWebTab'
// #ifdef APP // #ifdef APP
// import sqlite from './sqlite.js' // import sqlite from './sqlite.js'
// #endif // #endif
...@@ -165,8 +167,8 @@ export default async function (initParam) { ...@@ -165,8 +167,8 @@ export default async function (initParam) {
plugin.setCustomPushChannel( plugin.setCustomPushChannel(
{ {
// soundName: "pushsound", // soundName: "pushsound",
channelId: "114240", channelId: config.uniPush.channel.id,
channelDesc: "客服消息", channelDesc: config.uniPush.channel.desc,
enableLights: true, enableLights: true,
enableVibration: true, enableVibration: true,
importance: 4, importance: 4,
......
import config from '@/uni_modules/uni-im/common/config.js';
import $utils from '@/uni_modules/uni-im/sdk/utils/index.js'; import $utils from '@/uni_modules/uni-im/sdk/utils/index.js';
import $extensions from '@/uni_modules/uni-im/sdk/methods/extensions.js'; import $extensions from '@/uni_modules/uni-im/sdk/methods/extensions.js';
import $state from '../state/index.js'; import $state from '../state/index.js';
...@@ -174,7 +175,7 @@ msgEvent.onMsg(async res=>{ ...@@ -174,7 +175,7 @@ msgEvent.onMsg(async res=>{
'uni_modules/uni-im/pages/userList/userList', 'uni_modules/uni-im/pages/userList/userList',
'uni_modules/uni-im/pages/contacts/contacts' 'uni_modules/uni-im/pages/contacts/contacts'
] ]
if (canCreateNotification && !$state.ext.appIsActive || !pathList.includes(topViewRoute)) { if (canCreateNotification && (!$state.ext.appIsActive || !pathList.includes(topViewRoute)) ) {
// console.log('payload',payload); // console.log('payload',payload);
let { let {
content, content,
...@@ -193,9 +194,13 @@ msgEvent.onMsg(async res=>{ ...@@ -193,9 +194,13 @@ msgEvent.onMsg(async res=>{
icon = downloadFileRes[1]?.tempFilePath icon = downloadFileRes[1]?.tempFilePath
} }
} }
plus.push.createMessage(content, payload, { uni.createPushMessage({
title, title,
icon content,
payload,
icon,
channelId: config.uniPush.channel.id,
category: 'IM',
}) })
} else if (conversation_id != $state.currentConversationId) { } else if (conversation_id != $state.currentConversationId) {
// uni.showToast({ // uni.showToast({
......
...@@ -308,9 +308,9 @@ class Conversation { ...@@ -308,9 +308,9 @@ class Conversation {
// console.error('last_visible_msg',_last_visible_msg) // console.error('last_visible_msg',_last_visible_msg)
note = $utils.getMsgNote(_last_visible_msg) note = $utils.getMsgNote(_last_visible_msg)
} }
// 去掉\\n \\r \n \r 换行符 // 替换\\n \\r \n \r &nbsp; &lt; &gt; &amp; 为 空格
note = note.replace(/\\n|\\r|\n|\r/g, ' ') note = note.replace(/\\n|\\r|\n|\r|&nbsp;|&lt;|&gt;|&amp;/g, ' ')
return note return note.trim()
}, },
// 刷新会话的更新时间 // 刷新会话的更新时间
update_time:{ update_time:{
...@@ -389,6 +389,25 @@ class Conversation { ...@@ -389,6 +389,25 @@ class Conversation {
console.log('updated hidden', res) console.log('updated hidden', res)
return res return res
} }
// 设置未读消息数
async setUnreadCount(count) {
// console.log('setUnreadCount', count);
const oldCount = this.unread_count
this.unread_count = count
let res = await db.collection('uni-im-conversation')
.doc(this._id)
.update({
"unread_count": count
})
.catch(err => {
console.error('setUnreadCount err', err);
this.unread_count = oldCount
})
.then(e => {
// console.log('setUnreadCount updated', e.result.updated);
})
return res
}
} }
export default Conversation export default Conversation
[
{
"IndexName": "user_id_1",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "user_id",
"Direction": "1"
}
],
"MgoIsUnique": false
}
},
{
"IndexName": "friend_uid_1",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "friend_uid",
"Direction": "-1"
}
],
"MgoIsUnique": false
}
},
{
"IndexName": "group_id_1",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "group_id",
"Direction": "-1"
}
],
"MgoIsUnique": false
}
},
{
"IndexName": "update_time_1",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "update_time",
"Direction": "-1"
}
],
"MgoIsUnique": false
}
},
{
"IndexName": "id_1_user_id_1",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "user_id",
"Direction": "-1"
},
{
"Name": "id",
"Direction": "-1"
}
],
"MgoIsUnique": false
}
},
{
"IndexName": "id_1",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "id",
"Direction": "-1"
}
],
"MgoIsUnique": false
}
},
{
"IndexName": "leave_1",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "leave",
"Direction": "-1"
}
],
"MgoIsUnique": false
}
},
{
"IndexName": "unread_count_1",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "unread_count",
"Direction": "-1"
}
],
"MgoIsUnique": false
}
},
{
"IndexName": "leave_1",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "leave",
"Direction": "-1"
}
],
"MgoIsUnique": false
}
}
]
\ No newline at end of file
[
{
"IndexName": "user_id_1",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "user_id",
"Direction": "1"
}
],
"MgoIsUnique": false
}
},
{
"IndexName": "type_muteAllMembers_createTime",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "type",
"Direction": "1"
},{
"Name": "mute_all_members",
"Direction": "1"
},
{
"Name": "create_time",
"Direction": "-1"
}
],
"MgoIsUnique": false
}
}
]
\ No newline at end of file
[
{
"IndexName": "group_id_1",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "group_id",
"Direction": "1"
}
],
"MgoIsUnique": false
}
},
{
"IndexName": "conversation_id_1",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "conversation_id",
"Direction": "1"
}
],
"MgoIsUnique": false
}
},
{
"IndexName": "conversation_id_1_update_time_1",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "conversation_id",
"Direction": "1"
},{
"Name": "update_time",
"Direction": "1"
}
],
"MgoIsUnique": false
}
},
{
"IndexName": "type_1",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "type",
"Direction": "1"
}
],
"MgoIsUnique": false
}
},
{
"IndexName": "groupId_type_createTime",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "group_id",
"Direction": "1"
},
{
"Name": "type",
"Direction": "1"
},
{
"Name": "create_time",
"Direction": "1"
}
],
"MgoIsUnique": false
}
}
]
\ No newline at end of file