IM
This commit is contained in:
@@ -6,29 +6,24 @@
|
||||
import {
|
||||
versionName
|
||||
} from '@/manifest.json'
|
||||
import {appInit} from "@/common/utils.js"
|
||||
import {
|
||||
appInit
|
||||
} from "@/common/utils.js"
|
||||
import consoleImgs from '@/common/consoleImgs.js'
|
||||
// #ifdef APP-PLUS
|
||||
import appUpgrade from '@/common/appUpgrade.js';
|
||||
const TUICalling = uni.requireNativePlugin("TUICallingUniPlugin-TUICallingModule");
|
||||
// #endif
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
timer: null
|
||||
}
|
||||
},
|
||||
onLaunch: function() {
|
||||
localStorage.setItem("appId",10000)
|
||||
|
||||
appInit(500).then((res)=>{
|
||||
console.log("获取到token,创建长链接")
|
||||
this.$store.dispatch('getAddressList');
|
||||
setTimeout(()=>{
|
||||
this.$socketTask.connectSocket()
|
||||
uni.setStorageSync("initReady",1)
|
||||
},1000)
|
||||
}).then((error)=>{
|
||||
console.log("未获取到IM的token")
|
||||
console.log(error)
|
||||
})
|
||||
|
||||
|
||||
localStorage.setItem("appId", 10000)
|
||||
|
||||
|
||||
console.log(consoleImgs.fz)
|
||||
// todo 下列两行
|
||||
uni.setStorageSync('device', 'H5');
|
||||
@@ -37,37 +32,59 @@
|
||||
},
|
||||
onShow: function() {
|
||||
console.log('App Show')
|
||||
|
||||
|
||||
appInit(500).then((res) => {
|
||||
console.log("获取到token,创建长链接")
|
||||
this.$store.dispatch('getAddressList');
|
||||
setTimeout(() => {
|
||||
this.$socketTask.connectSocket(() => {
|
||||
if (this.timer != null) {
|
||||
console.log("连接成功,清除定时器")
|
||||
clearInterval(this.timer)
|
||||
this.timer = null
|
||||
}
|
||||
}, () => {
|
||||
|
||||
})
|
||||
uni.setStorageSync("initReady", 1)
|
||||
}, 1000)
|
||||
}).then((error) => {
|
||||
console.log("未获取到IM的token")
|
||||
console.log(error)
|
||||
})
|
||||
|
||||
|
||||
uni.getStorage({
|
||||
key: 'call',
|
||||
success: (res) => {
|
||||
var callx=res.data
|
||||
if(callx){
|
||||
var call=JSON.parse(callx)
|
||||
function getInervalHour(startDate) {//获取两个时间之间的小时
|
||||
var callx = res.data
|
||||
if (callx) {
|
||||
var call = JSON.parse(callx)
|
||||
|
||||
function getInervalHour(startDate) { //获取两个时间之间的小时
|
||||
if (!startDate) {
|
||||
return '0秒'
|
||||
}
|
||||
var ms = new Date().getTime() - startDate;
|
||||
if (ms < 0) return '0秒';
|
||||
if((ms/1000)<60){
|
||||
return Math.floor(ms / 1000)+'秒';
|
||||
}else{
|
||||
return Math.floor(ms / 1000 /60)+'分';
|
||||
if ((ms / 1000) < 60) {
|
||||
return Math.floor(ms / 1000) + '秒';
|
||||
} else {
|
||||
return Math.floor(ms / 1000 / 60) + '分';
|
||||
}
|
||||
}
|
||||
var msgType=''
|
||||
if(call.type=='audio'){
|
||||
msgType='TRTC_VOICE_END'
|
||||
var msgType = ''
|
||||
if (call.type == 'audio') {
|
||||
msgType = 'TRTC_VOICE_END'
|
||||
}
|
||||
if(call.type=='video'){
|
||||
msgType='TRTC_VIDEO_END'
|
||||
if (call.type == 'video') {
|
||||
msgType = 'TRTC_VIDEO_END'
|
||||
}
|
||||
this.$fc.pushOutMsg({
|
||||
msgContent:getInervalHour(call.startTime),
|
||||
msgType:msgType,
|
||||
windowType:'SINGLE',
|
||||
userId:call.userId,
|
||||
msgContent: getInervalHour(call.startTime),
|
||||
msgType: msgType,
|
||||
windowType: 'SINGLE',
|
||||
userId: call.userId,
|
||||
})
|
||||
uni.removeStorageSync('call')
|
||||
}
|
||||
@@ -93,7 +110,6 @@
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
|
||||
// 以下内容最好转移到单页
|
||||
|
||||
</style>
|
||||
</style>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -593,6 +593,7 @@ export default {
|
||||
msgTypeLabel = '[视频通话]'
|
||||
}
|
||||
var userInfo = store.state.userInfo;
|
||||
const _userInfo = uni.getStorageSync("userInfo")
|
||||
store.dispatch('createChatObj', {
|
||||
userId: userId,
|
||||
windowType: windowType,
|
||||
@@ -655,7 +656,7 @@ export default {
|
||||
userId: userInfo.userId,
|
||||
personId: userInfo.userId,
|
||||
nickName: userInfo.nickName,
|
||||
portrait: userInfo.portrait,
|
||||
portrait: _userInfo.photo,
|
||||
msgType: msgType,
|
||||
content: msgContent,
|
||||
time: time,
|
||||
|
||||
@@ -8,15 +8,14 @@ import lim from "@/common/imSdk/sdk-bridge.js";
|
||||
import publicFc from '@/common/publicFc';
|
||||
import localForage from 'localforage';
|
||||
|
||||
import { getCurrentInstance } from 'vue'
|
||||
|
||||
let __that = this
|
||||
|
||||
export default {
|
||||
socketTask: null,
|
||||
retimer: null,
|
||||
// 连接WebSocket
|
||||
connectSocket() {
|
||||
|
||||
connectSocket(successCallBack = null, errorCallBack = null) {
|
||||
|
||||
const ListenerMap = {
|
||||
onSocketConnectEvent: (option, status, data) => {
|
||||
@@ -24,16 +23,26 @@ export default {
|
||||
},
|
||||
onSocketErrorEvent: (error) => {
|
||||
console.log("连接出现错误:" + userId);
|
||||
this.socketTask = null
|
||||
clearInterval(this.retimer)
|
||||
this.retimer = null
|
||||
console.log("开始定时重连");
|
||||
this.retimer = setInterval(() => {
|
||||
this.connectSocket()
|
||||
}, 2000)
|
||||
},
|
||||
onSocketReConnectEvent: () => {
|
||||
console.log("正在重连:");
|
||||
},
|
||||
onSocketCloseEvent: () => {
|
||||
console.log("连接关闭:");
|
||||
console.log(__that)
|
||||
__that.$socketTask.socketTask=null;
|
||||
__that.$socketTask.connectSocket()
|
||||
|
||||
this.socketTask = null
|
||||
clearInterval(this.retimer)
|
||||
this.retimer = null
|
||||
console.log("开始定时重连");
|
||||
this.retimer = setInterval(() => {
|
||||
this.connectSocket()
|
||||
}, 2000)
|
||||
},
|
||||
onSocketReConnectSuccessEvent: () => {
|
||||
console.log("重连成功");
|
||||
@@ -72,7 +81,7 @@ export default {
|
||||
console.log(e)
|
||||
console.log("接收到的ws格式化之后数据")
|
||||
const _data = publicFc.formatMessage(e.data)
|
||||
console.log(_data)
|
||||
console.log(_data)
|
||||
uni.$emit('onP2PMessage', _data);
|
||||
store.dispatch('onP2PMessage', _data)
|
||||
},
|
||||
@@ -96,6 +105,8 @@ export default {
|
||||
|
||||
// 防止多次建立ws链接,貌似还没有生效,需要检查
|
||||
if (this.socketTask != null) {
|
||||
clearInterval(this.retimer)
|
||||
this.retimer = null
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -108,6 +119,11 @@ export default {
|
||||
|
||||
console.log('sdk 成功连接的回调, 可以使用 sdk 请求数据了.');
|
||||
|
||||
if (this.retimer != null) {
|
||||
clearInterval(this.retimer)
|
||||
this.retimer = null
|
||||
}
|
||||
|
||||
sdk.getSingleUserInfo(userId).then(res => {
|
||||
console.log("获取到自己的用户信息")
|
||||
console.log(res)
|
||||
@@ -199,4 +215,8 @@ export default {
|
||||
console.log('关闭WebSocket!');
|
||||
}
|
||||
},
|
||||
reconnect() {
|
||||
this.socketTask = null;
|
||||
this.connectSocket()
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<script type="text/javascript" src="https://172.16.3.18/static_file/vconsole.min.js"></script>
|
||||
<!-- <script type="text/javascript" src="https://172.16.3.18/static_file/vconsole.min.js"></script>
|
||||
<script>
|
||||
var vConsole = new VConsole();
|
||||
</script>
|
||||
</script> -->
|
||||
<title></title>
|
||||
<!--preload-links-->
|
||||
<!--app-context-->
|
||||
|
||||
@@ -22,16 +22,17 @@
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// "path": "wx/tabbar1/index",
|
||||
// "name": "wxindex",
|
||||
// "aliasPath": "/wxindex",
|
||||
// "requireAuth": true,
|
||||
// "style": {
|
||||
// "navigationBarTitleText": "微信首页",
|
||||
// "navigationStyle": "custom"
|
||||
// }
|
||||
// },
|
||||
{
|
||||
"path": "pages/wxindex/index",
|
||||
"name": "wxindex",
|
||||
"aliasPath": "/wxindex",
|
||||
"requireAuth": true,
|
||||
"style": {
|
||||
"navigationBarTitleText": "微信首页",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/agreement/index",
|
||||
"name": "agreement",
|
||||
"aliasPath": "/agreement",
|
||||
@@ -104,16 +105,7 @@
|
||||
"aliasPath": "/wxchatWindow",
|
||||
"requireAuth": true,
|
||||
"style": {
|
||||
"navigationBarTitleText": "聊天窗口",
|
||||
"app-plus": {
|
||||
"titleNView": {
|
||||
"buttons": [{
|
||||
"text": "\ue623",
|
||||
"fontSrc": "/static/wx_iconfont.ttf",
|
||||
"fontSize": "28px"
|
||||
}]
|
||||
}
|
||||
}
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
, {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -141,6 +141,7 @@ const store = new Vuex.Store({
|
||||
|
||||
updateChartHistoryFromServer(context, data) {
|
||||
const _userId = uni.getStorageSync("userId")
|
||||
const _userInfo = uni.getStorageSync("userInfo")
|
||||
var retdata = publicFc.getKeyObjectStorage(_userId + '_' + 'chatData')
|
||||
|
||||
var currentUserMsgList = retdata[data.userId].list
|
||||
@@ -167,6 +168,7 @@ const store = new Vuex.Store({
|
||||
messageKey:item.messageKey,
|
||||
msgType:item.messageBody.msgType,
|
||||
nickName:_userId==item.fromId?"我":detail.nickName,
|
||||
portrait:_userId==item.fromId?_userInfo.photo:detail.photo,
|
||||
personId:item.fromId,
|
||||
sendtype:"waiting",
|
||||
time:item.createTime,
|
||||
@@ -191,6 +193,7 @@ const store = new Vuex.Store({
|
||||
uni.setStorageSync(_userId + '_' + 'chatData', JSON.stringify(
|
||||
retdata));
|
||||
|
||||
context.dispatch('getchatDatalist');
|
||||
|
||||
const _obj=_serverMsgList[_serverMsgList.length-1]
|
||||
|
||||
@@ -203,6 +206,7 @@ const store = new Vuex.Store({
|
||||
if(_obj.msgType=="CALL_voice"){
|
||||
_obj.content="【语音通话】"
|
||||
}
|
||||
//判断头像是谁的
|
||||
|
||||
context.dispatch('updateChatListInfoById',{
|
||||
userId:data.userId,
|
||||
@@ -211,7 +215,7 @@ const store = new Vuex.Store({
|
||||
userId: data.userId,
|
||||
personId: _userId,
|
||||
nickName: detail.nickName,
|
||||
portrait: detail.photo,
|
||||
portrait:_userId==_obj.fromId?_userInfo.photo:detail.photo,
|
||||
time: dayjs(_obj.createTime).format("YYYY/MM/DD HH:mm:ss"),
|
||||
num: 0,
|
||||
windowType: 'SINGLE',
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
## 1.3.11(2023-03-29)
|
||||
- 修复 自定义状态栏高度闪动BUG
|
||||
## 1.3.10(2023-03-29)
|
||||
- 修复 暗黑模式下边线颜色错误的bug
|
||||
## 1.3.9(2022-10-13)
|
||||
- 修复 条件编译错误的bug
|
||||
## 1.3.8(2022-10-12)
|
||||
- 修复 nvue 环境 fixed 为 true 的情况下,无法置顶的 bug
|
||||
## 1.3.7(2022-08-11)
|
||||
- 修复 nvue 环境下 fixed 为 true 的情况下,无法置顶的 bug
|
||||
## 1.3.6(2022-06-30)
|
||||
- 修复 组件示例中插槽用法无法显示内容的bug
|
||||
## 1.3.5(2022-05-24)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="uni-navbar" :class="{'uni-dark':dark}">
|
||||
<view :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }"
|
||||
:style="{ 'background-color': themeBgColor }" class="uni-navbar__content">
|
||||
<view class="uni-navbar" :class="{'uni-dark':dark, 'uni-nvue-fixed': fixed}">
|
||||
<view class="uni-navbar__content" :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }"
|
||||
:style="{ 'background-color': themeBgColor, 'border-bottom-color':themeColor }" >
|
||||
<status-bar v-if="statusBar" />
|
||||
<view :style="{ color: themeColor,backgroundColor: themeBgColor ,height:navbarHeight}"
|
||||
class="uni-navbar__header">
|
||||
@@ -38,10 +38,12 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #ifndef APP-NVUE -->
|
||||
<view class="uni-navbar__placeholder" v-if="fixed">
|
||||
<status-bar v-if="statusBar" />
|
||||
<view class="uni-navbar__placeholder-view" :style="{ height:navbarHeight}" />
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -50,6 +52,8 @@
|
||||
const getVal = (val) => typeof val === 'number' ? val + 'px' : val;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* NavBar 自定义导航栏
|
||||
* @description 导航栏组件,主要用于头部导航
|
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=52
|
||||
@@ -196,6 +200,11 @@
|
||||
<style lang="scss" scoped>
|
||||
$nav-height: 44px;
|
||||
|
||||
.uni-nvue-fixed {
|
||||
/* #ifdef APP-NVUE */
|
||||
position: sticky;
|
||||
/* #endif */
|
||||
}
|
||||
.uni-navbar {
|
||||
// box-sizing: border-box;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,8 @@
|
||||
name: 'UniStatusBar',
|
||||
data() {
|
||||
return {
|
||||
statusBarHeight: 20
|
||||
statusBarHeight: uni.getSystemInfoSync().statusBarHeight + 'px'
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "uni-nav-bar",
|
||||
"displayName": "uni-nav-bar 自定义导航栏",
|
||||
"version": "1.3.6",
|
||||
"version": "1.3.11",
|
||||
"description": "自定义导航栏组件,主要用于头部导航。",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
@@ -16,11 +16,7 @@
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
@@ -37,7 +33,8 @@
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
:class="[{ 'zfb-tk-msgleft': item.type == 1 }, { 'zfb-tk-msgright': item.type == 2 }, { 'zfb-tk-msgcenter': item.type == 3 }]">
|
||||
<openTool :class="[{ 'openTool-msgleft': item.type == 1 }, { 'openTool-msgright': item.type == 2 }]"
|
||||
:talkTo="talkTo" :ref="'toolx'+itemKey" :data="item" :itemKey="itemKey"></openTool>
|
||||
<image class="zfb-tk-avatar" @click="gochatOne(item)" v-if="item.type !== 3" :src="item.portrait"
|
||||
<image class="zfb-tk-avatar" v-if="item.type !== 3" :src="item.portrait"
|
||||
mode="aspectFill"></image>
|
||||
<view class="zfb-tk-item-contentx" @longpress="longpressItem($event,itemKey,item)">
|
||||
<view class="zfb-tk-item-contentx-c">
|
||||
@@ -730,6 +730,7 @@
|
||||
.zfb-tk-item-contentx-c-tool {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.zfb-tk-msgleft .zfb-tk-item-contentx-c-tool {
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="chatNavBar">
|
||||
<uni-nav-bar :leftIcon="isMobile==true?'left':''"
|
||||
@clickLeft="clickLeftHandler">
|
||||
<view class="navBarTitle">{{title}}</view></uni-nav-bar>
|
||||
</view>
|
||||
<watermark></watermark>
|
||||
<uni-popup ref="popup" type="center">
|
||||
<view class="popsendCard" :style="'height:' + windowHeight + 'px'">
|
||||
@@ -43,7 +48,7 @@
|
||||
:style="{ background: msg !== '' ? '#1BC418' : '#F7F7F7', color: msg !== '' ? '#fff' : '#ddd', 'border-color': msg !== '' ? '#1BC418' : '#ddd' }">
|
||||
发送</view>
|
||||
</template>
|
||||
|
||||
|
||||
<view v-else @click="changeTool" class="zfb-tk-send-tool-more wxfont gengduo"></view>
|
||||
</view>
|
||||
<view v-if="showtool" class="zfb-tk-send-tools">
|
||||
@@ -93,6 +98,7 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: "聊天窗口",
|
||||
isBottomHeight: '',
|
||||
clickToSubmitSure: null,
|
||||
autodown: true,
|
||||
@@ -147,7 +153,7 @@
|
||||
localData: {},
|
||||
showtitleNViewBtns: true,
|
||||
list: [],
|
||||
isMobile:false,
|
||||
isMobile: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -216,6 +222,7 @@
|
||||
console.log(res.data)
|
||||
|
||||
if (e.windowType == 'SINGLE') {
|
||||
this.title = this.localData.fromInfo.nickName
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.localData.fromInfo.nickName
|
||||
});
|
||||
@@ -270,21 +277,45 @@
|
||||
},
|
||||
onShow() {
|
||||
const hd_gps_location = localStorage.getItem("hd_gps_location")
|
||||
if(hd_gps_location!=null){
|
||||
this.isMobile=true
|
||||
if (hd_gps_location != null) {
|
||||
this.isMobile = true
|
||||
}
|
||||
|
||||
|
||||
if (this.chatListInfo && this.chatListInfo.nickName) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.chatListInfo.nickName
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
this.$store.dispatch('updateChartHistoryFromServer', {
|
||||
userId: this.talkTo.userId,
|
||||
data: this.chatListInfo
|
||||
});
|
||||
|
||||
|
||||
var times = 0
|
||||
var timer = null
|
||||
|
||||
console.log("开始定时拉取最新聊天记录")
|
||||
timer = setInterval(() => {
|
||||
times = times + 1
|
||||
if (times > 2) {
|
||||
clearInterval(timer);
|
||||
timer = null
|
||||
return;
|
||||
}
|
||||
console.log("开始定时拉取最新聊天记录:", times)
|
||||
|
||||
this.$store.dispatch('updateChartHistoryFromServer', {
|
||||
userId: this.talkTo.userId,
|
||||
data: this.chatListInfo
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$store.dispatch('getchatDatalist');
|
||||
this.$store.dispatch('getChatList');
|
||||
}, 1000)
|
||||
this.scrolltoBottom();
|
||||
}, 2000)
|
||||
|
||||
},
|
||||
mounted() {
|
||||
// #ifdef APP-PLUS
|
||||
@@ -306,6 +337,11 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickLeftHandler() {
|
||||
if (this.isMobile) {
|
||||
uni.navigateBack()
|
||||
}
|
||||
},
|
||||
onMessage(message) {
|
||||
//判断当前是单聊还是群聊
|
||||
if (this.talkTo.windowType != 'SINGLE') {
|
||||
@@ -463,9 +499,9 @@
|
||||
uni.showLoading({
|
||||
title: '发起通话'
|
||||
});
|
||||
|
||||
|
||||
var formdata = null;
|
||||
|
||||
|
||||
if (hasVideo == 1) {
|
||||
formdata = {
|
||||
userId: this.talkTo.userId,
|
||||
@@ -479,7 +515,7 @@
|
||||
content: 'TRTC_VOICE_START'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// this.sendMsg(formdata,formdata.msgType)
|
||||
|
||||
@@ -487,8 +523,8 @@
|
||||
|
||||
const roomId = userId
|
||||
|
||||
const userInfo = uni.getStorageSync("userInfo")
|
||||
|
||||
const userInfo = uni.getStorageSync("userInfo")
|
||||
|
||||
const roomInfo = {
|
||||
roomId: userId, //后面改成发起人的手机号或者id
|
||||
roomName: `${userInfo.nickName}发起的视频聊天`,
|
||||
@@ -501,8 +537,8 @@
|
||||
type: "webrtc",
|
||||
offline: 0,
|
||||
invitedUserList: [this.talkTo.userId],
|
||||
hasVideo:hasVideo,
|
||||
isForce:0
|
||||
hasVideo: hasVideo,
|
||||
isForce: 0
|
||||
}
|
||||
|
||||
this.$store
|
||||
@@ -519,7 +555,8 @@
|
||||
target: "znzq"
|
||||
},
|
||||
}).then((res1) => {
|
||||
location.href = config.getVideoRoomUrl(roomInfo.roomId, roomInfo.creatorId, 1, 1,hasVideo,userInfo.nickName,this.talkTo.userId)
|
||||
location.href = config.getVideoRoomUrl(roomInfo.roomId, roomInfo.creatorId, 1, 1,
|
||||
hasVideo, userInfo.nickName, this.talkTo.userId)
|
||||
})
|
||||
})
|
||||
if (1 > 0) {
|
||||
@@ -920,6 +957,25 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.navBarTitle{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 16px !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
.chatNavBar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 100;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.autodownView {
|
||||
height: 1px;
|
||||
width: 100%;
|
||||
@@ -931,7 +987,7 @@
|
||||
}
|
||||
|
||||
.zfb-tk-main {
|
||||
padding: 0 12px;
|
||||
padding: 55rpx 12px;
|
||||
padding-bottom: 112rpx;
|
||||
}
|
||||
|
||||
|
||||
@@ -102,32 +102,46 @@ export class ImClient {
|
||||
this.userSign = userSign
|
||||
this.imeiLength = self.imeiLength;
|
||||
if (Beans.isEmpty(this.url)) {
|
||||
log.info("获取im地址")
|
||||
let api = new HttpApi(this.httpUrl);
|
||||
let resp = await api.call("/user/login", {}, { clientType: this.clientType, appId: this.appId, userId: this.userId })
|
||||
// console.log(resp)
|
||||
if (resp.isFailed()) {
|
||||
log.info("登录失败:获取im地址失败")
|
||||
return;
|
||||
}
|
||||
let ip = resp.data.ip;
|
||||
let port = resp.data.port;
|
||||
console.log("获取im地址")
|
||||
try {
|
||||
let api = new HttpApi(this.httpUrl);
|
||||
let resp = await api.call("/user/login", {}, { clientType: this.clientType, appId: this.appId, userId: this.userId })
|
||||
// console.log(resp)
|
||||
if (resp.isFailed()) {
|
||||
console.error("登录失败:获取im地址失败")
|
||||
console.log("登录失败:获取im地址失败")
|
||||
if (typeof imClient.listeners.onSocketErrorEvent === 'function') {
|
||||
imClient.listeners.onSocketErrorEvent("登录失败:获取im地址失败");
|
||||
}
|
||||
return;
|
||||
}
|
||||
let ip = resp.data.ip;
|
||||
let port = resp.data.port;
|
||||
|
||||
var protocolStr = document.location.protocol;
|
||||
if(protocolStr == "http:")
|
||||
{
|
||||
this.url = "ws://" + ip + ":" + port + "/ws";
|
||||
var protocolStr = document.location.protocol;
|
||||
if(protocolStr == "http:")
|
||||
{
|
||||
this.url = "ws://" + ip + ":" + port + "/ws";
|
||||
}
|
||||
else if(protocolStr == "https:")
|
||||
{
|
||||
this.url = "wss://" + ip + "/hs_ws";
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("获取im地址 捕获到异常")
|
||||
console.error(e)
|
||||
if (typeof imClient.listeners.onSocketErrorEvent === 'function') {
|
||||
imClient.listeners.onSocketErrorEvent("登录失败:获取im地址失败");
|
||||
}
|
||||
}
|
||||
else if(protocolStr == "https:")
|
||||
{
|
||||
this.url = "wss://" + ip + "/hs_ws";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
var req = new LoginPack(self.appId, self.userId, 1);
|
||||
let { success, err, conn } = await limLogin(self.url, req, self);
|
||||
|
||||
console.warn(success)
|
||||
console.warn(err)
|
||||
|
||||
if (success) {
|
||||
if (!firstMonitorSocket) {
|
||||
firstMonitorSocket = true;
|
||||
@@ -193,6 +207,10 @@ export class ImClient {
|
||||
|
||||
} else {
|
||||
log.error(err?.message)
|
||||
// 加入socket 连接事件
|
||||
if (typeof imClient.listeners.onSocketErrorEvent === 'function') {
|
||||
imClient.listeners.onSocketErrorEvent(err?.message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user