This commit is contained in:
haomingming
2023-03-06 17:57:39 +08:00
parent 3794faceae
commit 1066e37c96
4230 changed files with 193453 additions and 0 deletions
+63
View File
@@ -0,0 +1,63 @@
// index.js
import TIM from '../../../TUIKit/lib/tim-wx-sdk';
import { genTestUserSig } from '../../../TUIKit/debug/GenerateTestUserSig';
import TIMUploadPlugin from '../../../TUIKit/lib/tim-upload-plugin';
const app = getApp()
Page({
data: {
config: {
userID: "xiaobeibei", //User ID
SDKAPPID: 1400793692, // Your SDKAppID
SECRETKEY: "44d97cf741fc758be98cdad100015582b6ad1dc5a3b6676c1997a57279eecfa9", // Your secretKey
EXPIRETIME: 604800,
},
patient_account: "ayu",
title: '患者姓名',
height: app.globalData.height,
},
onLoad() {
console.log("chat onload");
let sign = genTestUserSig(this.data.config);
console.log("sign: ", sign);
const userSig = sign.userSig;
console.log("userSig: ", userSig);
wx.$TUIKit = TIM.create({
SDKAppID: this.data.config.SDKAPPID
});
wx.$chat_SDKAppID = this.data.config.SDKAPPID;
wx.$chat_userID = this.data.config.userID;
wx.$chat_userSig = userSig;
wx.$TUIKitTIM = TIM;
wx.$TUIKit.registerPlugin({ 'tim-upload-plugin': TIMUploadPlugin });
wx.$TUIKit.login({
userID: this.data.config.userID,
userSig
});
wx.$TUIKit.setLogLevel(3);//设置日志级别
wx.setStorage({
key: 'currentUserID',
data: [],
});
wx.$TUIKit.on(wx.$TUIKitTIM.EVENT.SDK_READY, this.onSDKReady,this);
},
onUnload() {
console.log("chat onUnload");
wx.$TUIKit.off(wx.$TUIKitTIM.EVENT.SDK_READY, this.onSDKReady,this);
},
onShow(){
let _this = this;
let interval = setInterval(() => {
if(app.globalData.chat_sdk_ready){
_this.onSDKReady();
clearInterval(interval);
}
}, 100);
},
onSDKReady() {
console.error("chat js: onSDKReady")
const TUIChat = this.selectComponent('#TUIChat');
TUIChat.init();
app.globalData.chat_sdk_ready = true
}
})
+6
View File
@@ -0,0 +1,6 @@
{
"usingComponents": {
"TUIChat": "../../../TUIKit/components/TUIChat/index"
},
"navigationStyle": "custom"
}
+7
View File
@@ -0,0 +1,7 @@
<!-- 一对一聊天 -->
<view>
<TUIChat id="TUIChat" currentConversationID="C2C{{patient_account}}"
unreadCount="9" hasCallKit="{{ true }}" bind:handleCall="handleCall"
></TUIChat>
</view>
+8
View File
@@ -0,0 +1,8 @@
.container{
background-color: #F4F4F4;
width: 100vw;
height: 100vh;
}
.top{
}