no message
parent
32a71ba4da
commit
bcb865f27a
@ -0,0 +1,285 @@
|
||||
<template>
|
||||
<div style="" class="g_bg_f_5">
|
||||
<view class="">
|
||||
<scroll-view @scroll="getScrollInfo" :scroll-top="resetScroll" :style="{ height: `calc(100vh - 0px)` }" :scroll-y="true">
|
||||
<view class="">
|
||||
<message :cmsIds="messageId" :update="update" />
|
||||
<view class="g_h_32"></view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</div>
|
||||
<!-- <g-tabbar class="tabbar" :isShow="tabbarShow"></g-tabbar> -->
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, onMounted, computed, getCurrentInstance } from "vue";
|
||||
// import ConversationList from "../NEUIKit/pages/Conversation/conversation-list/index.vue";
|
||||
// import { trackInit } from "../NEUIKit/utils/reporter.ts";
|
||||
import { onShow, onLoad } from "@dcloudio/uni-app";
|
||||
// import telPanel from "../NEUIKit/pages/Contact/contact-list/index.vue";
|
||||
import message from "./components/message.vue";
|
||||
const instance = getCurrentInstance();
|
||||
const G = instance.appContext.app.config.globalProperties.G;
|
||||
onMounted(() => {
|
||||
// console.log("mountedmountedmountedmountedmountedmounted");
|
||||
const query = uni.createSelectorQuery().in(instance);
|
||||
// console.log("query", query);
|
||||
// 选择指定的 DOM 元素
|
||||
query
|
||||
.select(".tabbar")
|
||||
.boundingClientRect((res) => {
|
||||
tabbarHeight.value = res.height;
|
||||
uni.setStorageSync("TABBAR_HEIGHT", res.height);
|
||||
})
|
||||
.exec();
|
||||
});
|
||||
const globalData = ref(getApp().globalData);
|
||||
const wyyxTabGroup = ref([]);
|
||||
const corpUserFlag = ref(false);
|
||||
const showService = ref(false);
|
||||
const update = ref(1);
|
||||
const contactList = ref(null);
|
||||
const AIList = ref(null);
|
||||
const cdnBaseImg = ref(G.store().cdnBaseImg);
|
||||
const tabbarShow = ref(true);
|
||||
const isLogin = ref(false);
|
||||
// 回到顶部
|
||||
const resetScroll = ref(0);
|
||||
const tabbarHeight = ref(uni.getStorageSync("TABBAR_HEIGHT"));
|
||||
const openTel2 = ref(null);
|
||||
const sname = ref("");
|
||||
const stel = ref("");
|
||||
|
||||
const typeGroup = ref([
|
||||
{
|
||||
name: "当前会话",
|
||||
},
|
||||
{
|
||||
name: "系统通知",
|
||||
count: "",
|
||||
},
|
||||
// {
|
||||
// name: "通讯录",
|
||||
// },
|
||||
]);
|
||||
const current = ref(0);
|
||||
const count = ref(0); // 系统消息未读
|
||||
const messageId = ref("");
|
||||
const userInfo = ref({});
|
||||
|
||||
onShow(() => {
|
||||
isLogin.value = uni.getStorageSync("apply-token") ? true : false;
|
||||
// console.log("count.value", count.value);
|
||||
corpUserFlag.value = uni.getStorageSync("apply-userinfo").corpUserFlag;
|
||||
userInfo.value = uni.getStorageSync("apply-userinfo");
|
||||
// 单独刷新系统通知
|
||||
update.value++;
|
||||
setTimeout(() => {
|
||||
count.value = uni.getStorageSync("notice_info").count;
|
||||
// if (!isLogin.value) {
|
||||
typeGroup.value = [
|
||||
{
|
||||
name: "系统通知",
|
||||
},
|
||||
];
|
||||
// } else {
|
||||
// typeGroup.value = [
|
||||
// {
|
||||
// name: "当前会话",
|
||||
// },
|
||||
// {
|
||||
// name: "系统通知",
|
||||
// count: count.value,
|
||||
// },
|
||||
// // {
|
||||
// // name: "通讯录",
|
||||
// // },
|
||||
// ];
|
||||
// }
|
||||
}, 200);
|
||||
|
||||
// if (isLogin.value && uni && uni.$UIKitStore) {
|
||||
// // trackInit("ConversationUIKit");
|
||||
// // 重置选中会话
|
||||
// uni.$UIKitStore?.uiStore.selectConversation("");
|
||||
// setTimeout(() => {
|
||||
// const unread = uni.$UIKitNIM.V2NIMConversationService.getTotalUnreadCount();
|
||||
// if(uni.getStorageSync("miniApp-info").openAIDock == 0){
|
||||
// if (unread === 0) {
|
||||
// uni.hideTabBarRedDot({
|
||||
// //隐藏数字
|
||||
// index: 3, //tabbar下标
|
||||
// });
|
||||
// } else {
|
||||
// uni.showTabBarRedDot({
|
||||
// index: 3, //tabbar下标
|
||||
// });
|
||||
// }
|
||||
// }else{
|
||||
// if (unread === 0) {
|
||||
// uni.hideTabBarRedDot({
|
||||
// //隐藏数字
|
||||
// index: 3, //tabbar下标
|
||||
// });
|
||||
// } else {
|
||||
// uni.showTabBarRedDot({
|
||||
// index: 3, //tabbar下标
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
// }, 1000);
|
||||
// current.value = 0;
|
||||
// messageId.value = globalData.value.messageId;
|
||||
// }
|
||||
if (isLogin.value) {
|
||||
current.value = 0;
|
||||
messageId.value = globalData.value.messageId;
|
||||
}
|
||||
});
|
||||
const goLogin = () => {
|
||||
uni.reLaunch({
|
||||
url: "/root/login/index",
|
||||
});
|
||||
};
|
||||
const goPage = ($path) => {
|
||||
if ($path) {
|
||||
uni.navigateTo({
|
||||
url: $path,
|
||||
});
|
||||
}
|
||||
};
|
||||
const openTel1 = ($tel) => {
|
||||
// console.log("openTel2", openTel2.value);
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds: ["UPYUMYWBtgWD3ZZHVEJC9qX04ahF81-yBPdsDzArp_4"],
|
||||
success(res) {},
|
||||
});
|
||||
};
|
||||
|
||||
const openTel = ($tel) => {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: $tel || "0371-6611 3723",
|
||||
});
|
||||
};
|
||||
|
||||
const simage = ref("");
|
||||
const serverPop = ref({
|
||||
isShow: false,
|
||||
});
|
||||
const openServer = () => {
|
||||
let image = uni.getStorageSync("bc-server-image");
|
||||
if (image && !image.includes("https")) {
|
||||
image = image.replace("http", "https");
|
||||
}
|
||||
simage.value = image;
|
||||
serverPop.value.isShow = true;
|
||||
};
|
||||
let timeout = ref(null);
|
||||
|
||||
const getScrollInfo = (e) => {
|
||||
resetScroll.value = 0;
|
||||
if (!timeout.value) {
|
||||
timeout.value = setTimeout(() => {
|
||||
uni.$emit("pageScroll", e);
|
||||
timeout.value = null;
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
|
||||
const updateType = (e) => {
|
||||
// console.log(e);
|
||||
resetScroll.value = 1;
|
||||
globalData.value.messageTab = e;
|
||||
};
|
||||
|
||||
const getEmptyDom = (text = "暂无数据", subText = "") => {
|
||||
G.getEmptyDom(text, subText);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #ededed;
|
||||
}
|
||||
.ok-btn {
|
||||
color: #fff;
|
||||
background-color: rgb(20, 146, 209);
|
||||
padding: 10px;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: calc(50% - 25vw);
|
||||
width: 50vw;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.ok-btn-mp {
|
||||
color: #fff;
|
||||
background-color: rgb(20, 146, 209);
|
||||
padding: 10px;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
position: fixed;
|
||||
bottom: 20px;
|
||||
left: calc(50% - 25vw);
|
||||
width: 50vw;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.button-box,
|
||||
.button-box-mp {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: fixed;
|
||||
z-index: 100;
|
||||
bottom: 120px;
|
||||
right: 30px;
|
||||
}
|
||||
|
||||
.button-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
}
|
||||
.button-box,
|
||||
.button-box-mp .button-icon {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.button-box {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
position: fixed;
|
||||
z-index: 100;
|
||||
bottom: 70px;
|
||||
right: 30px;
|
||||
}
|
||||
.g_bg_f_5 {
|
||||
background-color: #ededed;
|
||||
}
|
||||
|
||||
.i-items {
|
||||
position: relative;
|
||||
&:not(:first-child):after {
|
||||
content: "";
|
||||
display: block;
|
||||
height: 1rpx;
|
||||
width: calc(100% - 80px);
|
||||
background: #eee;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
.sticky {
|
||||
position: sticky;
|
||||
top: 0px;
|
||||
left: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,184 @@
|
||||
// import { NIM,
|
||||
// setAdapters,
|
||||
// uniAppAdapters,
|
||||
// V2NIMMessageService,
|
||||
// V2NIMMessageLogUtil,
|
||||
// V2NIMConversationService,
|
||||
// V2NIMConst
|
||||
// } from '../../../../dist/esm/nim'
|
||||
import {
|
||||
NIM,
|
||||
setAdapters,
|
||||
uniAppAdapters,
|
||||
V2NIMMessageService,
|
||||
V2NIMMessageLogUtil,
|
||||
// V2NIMLocalConversationService,
|
||||
V2NIMStorageService,
|
||||
// V2NIMTeamService,
|
||||
V2NIMUserService,
|
||||
V2NIMFriendService,
|
||||
V2NIMSettingService,
|
||||
V2NIMConst,
|
||||
V2NIMConversationService
|
||||
} from 'nim-web-sdk-ng/dist/esm/nim'
|
||||
|
||||
// 设置 uniapp 环境
|
||||
setAdapters(uniAppAdapters)
|
||||
|
||||
/**
|
||||
* 注册了消息服务和会话服务
|
||||
*
|
||||
* 具体有哪些模块可以注入, 请参照 SDK 使用说明: https://doc.yunxin.163.com/messaging2/guide/DcyMjA1Njk?platform=client#%E6%96%B9%E5%BC%8F%E4%BA%8Cesm-%E5%BC%95%E5%85%A5
|
||||
*/
|
||||
|
||||
/**
|
||||
* 消息模块.
|
||||
*
|
||||
* 影响 API 包含 V2NIMMessageService 下全部接口.
|
||||
*/
|
||||
NIM.registerService(V2NIMMessageService, 'V2NIMMessageService')
|
||||
|
||||
/**
|
||||
* 消息模块-消息记录相关工具类. 包含查询消息历史等功能.
|
||||
*
|
||||
* 影响 API 包含 V2NIMMessageService 的部分接口, 举例:
|
||||
* getMessageList, getMessageListEx,
|
||||
* getMessageListByRefers, clearHistoryMessage
|
||||
*/
|
||||
NIM.registerService(V2NIMMessageLogUtil, 'V2NIMMessageLogUtil')
|
||||
|
||||
/**
|
||||
* 消息模块-扩展功能. 包含 pin 消息, 收藏消息等功能
|
||||
*
|
||||
* 影响 API 包含 V2NIMMessageService 的部分接口, 举例:
|
||||
* pinMessage, unpinMessage, updatePinMessage, voiceToText,
|
||||
* getPinnedMessageList, addQuickComment, removeQuickComment, getQuickCommentList, addCollection,
|
||||
* removeCollections, updateCollectionExtension, getCollectionListByOption,
|
||||
* getCollectionListExByOption, searchCloudMessages, searchCloudMessagesEx
|
||||
*/
|
||||
// NIM.registerService(V2NIMMessageExtendUtil, 'V2NIMMessageExtendUtil')
|
||||
|
||||
/**
|
||||
* 消息序列化与反序列化工具
|
||||
*
|
||||
* 影响 API 包含 V2NIMMessageConverter 的全部接口.
|
||||
*/
|
||||
// NIM.registerService(V2NIMMessageConverter, 'V2NIMMessageConverter')
|
||||
|
||||
/**
|
||||
* 云端存储模块, 包含上传文件能力
|
||||
*
|
||||
* 影响 API 包含 V2NIMMessageService 的部分接口, 举例:
|
||||
* V2NIMMessageService.sendMessage (发图片/文件类型的消息时)
|
||||
* V2NIMMessageService.cancelMessageAttachmentUpload (取消文件消息的上传)
|
||||
*
|
||||
* 影响 API 包含 V2NIMStorageService 的全部接口.
|
||||
*/
|
||||
NIM.registerService(V2NIMStorageService, 'V2NIMStorageService')
|
||||
|
||||
/**
|
||||
* 云端会话模块.
|
||||
*
|
||||
* 影响 API 包含 V2NIMConversationService 的全部接口.
|
||||
*/
|
||||
NIM.registerService(V2NIMConversationService, 'V2NIMConversationService')
|
||||
|
||||
/**
|
||||
* 云端会话分组模块.
|
||||
*
|
||||
* 影响 API 包含 V2NIMConversationGroupService 的全部接口.
|
||||
*/
|
||||
// NIM.registerService(V2NIMConversationGroupService, 'V2NIMConversationGroupService')
|
||||
|
||||
/**
|
||||
* 本地会话模块.
|
||||
*
|
||||
* 影响 API 包含 V2NIMLocalConversationService 的全部接口.
|
||||
*/
|
||||
// NIM.registerService(V2NIMLocalConversationService, 'V2NIMLocalConversationService')
|
||||
|
||||
/**
|
||||
* 群组模块.
|
||||
*
|
||||
* 影响 API 包含 V2NIMSettingService 的部分接口, 举例:
|
||||
* setTeamMessageMuteMode, getTeamMessageMuteMode, getAllTeamMessageMuteMode
|
||||
*
|
||||
* 影响 API 包含 V2NIMTeamService 的全部接口.
|
||||
*/
|
||||
// NIM.registerService(V2NIMTeamService, 'V2NIMTeamService')
|
||||
|
||||
/**
|
||||
* 用户模块.
|
||||
*
|
||||
* 影响 API 包含 V2NIMSettingService 的部分接口, 举例:
|
||||
* getConversationMuteStatus, setP2PMessageMuteMode
|
||||
*
|
||||
* 影响 API 包含 V2NIMUserService 的全部接口.
|
||||
*/
|
||||
NIM.registerService(V2NIMUserService, 'V2NIMUserService') // 用户模块
|
||||
|
||||
/**
|
||||
* 好友模块.
|
||||
*
|
||||
* 影响 API 包含 V2NIMFriendService 的全部接口.
|
||||
*/
|
||||
NIM.registerService(V2NIMFriendService, 'V2NIMFriendService')
|
||||
|
||||
/**
|
||||
* 通知模块.
|
||||
*
|
||||
* 影响 API 包含 V2NIMNotificationService 的全部接口.
|
||||
*/
|
||||
// NIM.registerService(V2NIMNotificationService, 'V2NIMNotificationService')
|
||||
|
||||
/**
|
||||
* 设置模块.
|
||||
*
|
||||
* 影响 API 包含 V2NIMSettingService 的全部接口.
|
||||
* - 包含推送配置, 会话免打扰设置.
|
||||
* - 与会话免打扰有关的设置需要引入群, 用户模块
|
||||
*/
|
||||
NIM.registerService(V2NIMSettingService, 'V2NIMSettingService')
|
||||
|
||||
/**
|
||||
* AI 数字人模块.
|
||||
*
|
||||
* 影响 API 包含 V2NIMMessageService 的部分接口与事件:
|
||||
* sendMessage (发送参数 aiConfig, 配置 AI 相关)
|
||||
* onReceiveMessages (收消息事件, 回调的 V2NIMMessage 消息体参见属性 aiConfig 与 streamConfig 流式输出)
|
||||
* onReceiveMessagesModified (消息更新事件, 回调的 V2NIMMessage 消息体参见属性 aiConfig 与 streamConfig 流式输出)
|
||||
*
|
||||
* 影响 API 包含 V2NIMAIService 的全部接口.
|
||||
*/
|
||||
// NIM.registerService(V2NIMAIService, 'V2NIMAIService')
|
||||
|
||||
/**
|
||||
* 订阅模块, 如上下线状态通知订阅.
|
||||
*
|
||||
* 影响 API 包含 V2NIMSubscriptionService 的全部接口.
|
||||
*/
|
||||
// NIM.registerService(V2NIMSubscriptionService, 'V2NIMSubscriptionService')
|
||||
|
||||
/**
|
||||
* 信令模块
|
||||
*
|
||||
* 影响 API 包含 V2NIMSignallingService 的全部接口.
|
||||
*/
|
||||
// NIM.registerService(V2NIMSignallingService, 'V2NIMSignallingService')
|
||||
|
||||
/**
|
||||
* 服务代理相关
|
||||
*
|
||||
* 影响 API 包含 V2NIMPassthroughService 的全部接口.
|
||||
*/
|
||||
// NIM.registerService(V2NIMPassthroughService, 'V2NIMPassthroughService')
|
||||
|
||||
/**
|
||||
* 此外某些模块包含工具类, 只需要引入对应模块服务, 就能直接使用该工具类, 关系如下
|
||||
*
|
||||
* V2NIMConversationIdUtil(会话 id 工具类) => V2NIMMessageService, V2NIMConversationService
|
||||
* V2NIMClientAntispamUtil(客户端反垃圾工具类) => V2NIMMessageService
|
||||
* V2NIMMessageCreator(消息构造工具类) => V2NIMMessageService
|
||||
*/
|
||||
|
||||
export { NIM, V2NIMConst }
|
||||
Loading…
Reference in New Issue