add file
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
// 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,
|
||||
},
|
||||
title: '患者姓名',
|
||||
height: app.globalData.height,
|
||||
},
|
||||
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() {
|
||||
wx.$TUIKit.off(wx.$TUIKitTIM.EVENT.SDK_READY, this.onSDKReady,this);
|
||||
},
|
||||
onSDKReady() {
|
||||
console.warn("chat js: onSDKReady")
|
||||
const TUIKit = this.selectComponent('#TUIKit');
|
||||
TUIKit.init();
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"TUIKit": "../../../TUIKit/index"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<!-- 最近回话列表 -->
|
||||
<view>
|
||||
<TUIKit config="{{config}}" id="TUIKit"></TUIKit>
|
||||
</view>
|
||||
@@ -0,0 +1,8 @@
|
||||
.container{
|
||||
background-color: #F4F4F4;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
.top{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user