IM
This commit is contained in:
@@ -6,28 +6,23 @@
|
|||||||
import {
|
import {
|
||||||
versionName
|
versionName
|
||||||
} from '@/manifest.json'
|
} from '@/manifest.json'
|
||||||
import {appInit} from "@/common/utils.js"
|
import {
|
||||||
|
appInit
|
||||||
|
} from "@/common/utils.js"
|
||||||
import consoleImgs from '@/common/consoleImgs.js'
|
import consoleImgs from '@/common/consoleImgs.js'
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
import appUpgrade from '@/common/appUpgrade.js';
|
import appUpgrade from '@/common/appUpgrade.js';
|
||||||
const TUICalling = uni.requireNativePlugin("TUICallingUniPlugin-TUICallingModule");
|
const TUICalling = uni.requireNativePlugin("TUICallingUniPlugin-TUICallingModule");
|
||||||
// #endif
|
// #endif
|
||||||
export default {
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
timer: null
|
||||||
|
}
|
||||||
|
},
|
||||||
onLaunch: function() {
|
onLaunch: function() {
|
||||||
localStorage.setItem("appId", 10000)
|
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)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
console.log(consoleImgs.fz)
|
console.log(consoleImgs.fz)
|
||||||
// todo 下列两行
|
// todo 下列两行
|
||||||
@@ -38,12 +33,34 @@
|
|||||||
onShow: function() {
|
onShow: function() {
|
||||||
console.log('App Show')
|
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({
|
uni.getStorage({
|
||||||
key: 'call',
|
key: 'call',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
var callx = res.data
|
var callx = res.data
|
||||||
if (callx) {
|
if (callx) {
|
||||||
var call = JSON.parse(callx)
|
var call = JSON.parse(callx)
|
||||||
|
|
||||||
function getInervalHour(startDate) { //获取两个时间之间的小时
|
function getInervalHour(startDate) { //获取两个时间之间的小时
|
||||||
if (!startDate) {
|
if (!startDate) {
|
||||||
return '0秒'
|
return '0秒'
|
||||||
@@ -95,5 +112,4 @@
|
|||||||
/* #endif */
|
/* #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 = '[视频通话]'
|
msgTypeLabel = '[视频通话]'
|
||||||
}
|
}
|
||||||
var userInfo = store.state.userInfo;
|
var userInfo = store.state.userInfo;
|
||||||
|
const _userInfo = uni.getStorageSync("userInfo")
|
||||||
store.dispatch('createChatObj', {
|
store.dispatch('createChatObj', {
|
||||||
userId: userId,
|
userId: userId,
|
||||||
windowType: windowType,
|
windowType: windowType,
|
||||||
@@ -655,7 +656,7 @@ export default {
|
|||||||
userId: userInfo.userId,
|
userId: userInfo.userId,
|
||||||
personId: userInfo.userId,
|
personId: userInfo.userId,
|
||||||
nickName: userInfo.nickName,
|
nickName: userInfo.nickName,
|
||||||
portrait: userInfo.portrait,
|
portrait: _userInfo.photo,
|
||||||
msgType: msgType,
|
msgType: msgType,
|
||||||
content: msgContent,
|
content: msgContent,
|
||||||
time: time,
|
time: time,
|
||||||
|
|||||||
@@ -8,15 +8,14 @@ import lim from "@/common/imSdk/sdk-bridge.js";
|
|||||||
import publicFc from '@/common/publicFc';
|
import publicFc from '@/common/publicFc';
|
||||||
import localForage from 'localforage';
|
import localForage from 'localforage';
|
||||||
|
|
||||||
import { getCurrentInstance } from 'vue'
|
|
||||||
|
|
||||||
let __that = this
|
let __that = this
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
socketTask: null,
|
socketTask: null,
|
||||||
|
retimer: null,
|
||||||
// 连接WebSocket
|
// 连接WebSocket
|
||||||
connectSocket() {
|
connectSocket(successCallBack = null, errorCallBack = null) {
|
||||||
|
|
||||||
|
|
||||||
const ListenerMap = {
|
const ListenerMap = {
|
||||||
onSocketConnectEvent: (option, status, data) => {
|
onSocketConnectEvent: (option, status, data) => {
|
||||||
@@ -24,16 +23,26 @@ export default {
|
|||||||
},
|
},
|
||||||
onSocketErrorEvent: (error) => {
|
onSocketErrorEvent: (error) => {
|
||||||
console.log("连接出现错误:" + userId);
|
console.log("连接出现错误:" + userId);
|
||||||
|
this.socketTask = null
|
||||||
|
clearInterval(this.retimer)
|
||||||
|
this.retimer = null
|
||||||
|
console.log("开始定时重连");
|
||||||
|
this.retimer = setInterval(() => {
|
||||||
|
this.connectSocket()
|
||||||
|
}, 2000)
|
||||||
},
|
},
|
||||||
onSocketReConnectEvent: () => {
|
onSocketReConnectEvent: () => {
|
||||||
console.log("正在重连:");
|
console.log("正在重连:");
|
||||||
},
|
},
|
||||||
onSocketCloseEvent: () => {
|
onSocketCloseEvent: () => {
|
||||||
console.log("连接关闭:");
|
console.log("连接关闭:");
|
||||||
console.log(__that)
|
this.socketTask = null
|
||||||
__that.$socketTask.socketTask=null;
|
clearInterval(this.retimer)
|
||||||
__that.$socketTask.connectSocket()
|
this.retimer = null
|
||||||
|
console.log("开始定时重连");
|
||||||
|
this.retimer = setInterval(() => {
|
||||||
|
this.connectSocket()
|
||||||
|
}, 2000)
|
||||||
},
|
},
|
||||||
onSocketReConnectSuccessEvent: () => {
|
onSocketReConnectSuccessEvent: () => {
|
||||||
console.log("重连成功");
|
console.log("重连成功");
|
||||||
@@ -96,6 +105,8 @@ export default {
|
|||||||
|
|
||||||
// 防止多次建立ws链接,貌似还没有生效,需要检查
|
// 防止多次建立ws链接,貌似还没有生效,需要检查
|
||||||
if (this.socketTask != null) {
|
if (this.socketTask != null) {
|
||||||
|
clearInterval(this.retimer)
|
||||||
|
this.retimer = null
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,6 +119,11 @@ export default {
|
|||||||
|
|
||||||
console.log('sdk 成功连接的回调, 可以使用 sdk 请求数据了.');
|
console.log('sdk 成功连接的回调, 可以使用 sdk 请求数据了.');
|
||||||
|
|
||||||
|
if (this.retimer != null) {
|
||||||
|
clearInterval(this.retimer)
|
||||||
|
this.retimer = null
|
||||||
|
}
|
||||||
|
|
||||||
sdk.getSingleUserInfo(userId).then(res => {
|
sdk.getSingleUserInfo(userId).then(res => {
|
||||||
console.log("获取到自己的用户信息")
|
console.log("获取到自己的用户信息")
|
||||||
console.log(res)
|
console.log(res)
|
||||||
@@ -199,4 +215,8 @@ export default {
|
|||||||
console.log('关闭WebSocket!');
|
console.log('关闭WebSocket!');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
reconnect() {
|
||||||
|
this.socketTask = null;
|
||||||
|
this.connectSocket()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,10 +3,10 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<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>
|
<script>
|
||||||
var vConsole = new VConsole();
|
var vConsole = new VConsole();
|
||||||
</script>
|
</script> -->
|
||||||
<title></title>
|
<title></title>
|
||||||
<!--preload-links-->
|
<!--preload-links-->
|
||||||
<!--app-context-->
|
<!--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",
|
"path": "pages/agreement/index",
|
||||||
"name": "agreement",
|
"name": "agreement",
|
||||||
"aliasPath": "/agreement",
|
"aliasPath": "/agreement",
|
||||||
@@ -104,16 +105,7 @@
|
|||||||
"aliasPath": "/wxchatWindow",
|
"aliasPath": "/wxchatWindow",
|
||||||
"requireAuth": true,
|
"requireAuth": true,
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "聊天窗口",
|
"navigationStyle": "custom"
|
||||||
"app-plus": {
|
|
||||||
"titleNView": {
|
|
||||||
"buttons": [{
|
|
||||||
"text": "\ue623",
|
|
||||||
"fontSrc": "/static/wx_iconfont.ttf",
|
|
||||||
"fontSize": "28px"
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, {
|
, {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -141,6 +141,7 @@ const store = new Vuex.Store({
|
|||||||
|
|
||||||
updateChartHistoryFromServer(context, data) {
|
updateChartHistoryFromServer(context, data) {
|
||||||
const _userId = uni.getStorageSync("userId")
|
const _userId = uni.getStorageSync("userId")
|
||||||
|
const _userInfo = uni.getStorageSync("userInfo")
|
||||||
var retdata = publicFc.getKeyObjectStorage(_userId + '_' + 'chatData')
|
var retdata = publicFc.getKeyObjectStorage(_userId + '_' + 'chatData')
|
||||||
|
|
||||||
var currentUserMsgList = retdata[data.userId].list
|
var currentUserMsgList = retdata[data.userId].list
|
||||||
@@ -167,6 +168,7 @@ const store = new Vuex.Store({
|
|||||||
messageKey:item.messageKey,
|
messageKey:item.messageKey,
|
||||||
msgType:item.messageBody.msgType,
|
msgType:item.messageBody.msgType,
|
||||||
nickName:_userId==item.fromId?"我":detail.nickName,
|
nickName:_userId==item.fromId?"我":detail.nickName,
|
||||||
|
portrait:_userId==item.fromId?_userInfo.photo:detail.photo,
|
||||||
personId:item.fromId,
|
personId:item.fromId,
|
||||||
sendtype:"waiting",
|
sendtype:"waiting",
|
||||||
time:item.createTime,
|
time:item.createTime,
|
||||||
@@ -191,6 +193,7 @@ const store = new Vuex.Store({
|
|||||||
uni.setStorageSync(_userId + '_' + 'chatData', JSON.stringify(
|
uni.setStorageSync(_userId + '_' + 'chatData', JSON.stringify(
|
||||||
retdata));
|
retdata));
|
||||||
|
|
||||||
|
context.dispatch('getchatDatalist');
|
||||||
|
|
||||||
const _obj=_serverMsgList[_serverMsgList.length-1]
|
const _obj=_serverMsgList[_serverMsgList.length-1]
|
||||||
|
|
||||||
@@ -203,6 +206,7 @@ const store = new Vuex.Store({
|
|||||||
if(_obj.msgType=="CALL_voice"){
|
if(_obj.msgType=="CALL_voice"){
|
||||||
_obj.content="【语音通话】"
|
_obj.content="【语音通话】"
|
||||||
}
|
}
|
||||||
|
//判断头像是谁的
|
||||||
|
|
||||||
context.dispatch('updateChatListInfoById',{
|
context.dispatch('updateChatListInfoById',{
|
||||||
userId:data.userId,
|
userId:data.userId,
|
||||||
@@ -211,7 +215,7 @@ const store = new Vuex.Store({
|
|||||||
userId: data.userId,
|
userId: data.userId,
|
||||||
personId: _userId,
|
personId: _userId,
|
||||||
nickName: detail.nickName,
|
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"),
|
time: dayjs(_obj.createTime).format("YYYY/MM/DD HH:mm:ss"),
|
||||||
num: 0,
|
num: 0,
|
||||||
windowType: 'SINGLE',
|
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)
|
## 1.3.6(2022-06-30)
|
||||||
- 修复 组件示例中插槽用法无法显示内容的bug
|
- 修复 组件示例中插槽用法无法显示内容的bug
|
||||||
## 1.3.5(2022-05-24)
|
## 1.3.5(2022-05-24)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="uni-navbar" :class="{'uni-dark':dark}">
|
<view class="uni-navbar" :class="{'uni-dark':dark, 'uni-nvue-fixed': fixed}">
|
||||||
<view :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }"
|
<view class="uni-navbar__content" :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }"
|
||||||
:style="{ 'background-color': themeBgColor }" class="uni-navbar__content">
|
:style="{ 'background-color': themeBgColor, 'border-bottom-color':themeColor }" >
|
||||||
<status-bar v-if="statusBar" />
|
<status-bar v-if="statusBar" />
|
||||||
<view :style="{ color: themeColor,backgroundColor: themeBgColor ,height:navbarHeight}"
|
<view :style="{ color: themeColor,backgroundColor: themeBgColor ,height:navbarHeight}"
|
||||||
class="uni-navbar__header">
|
class="uni-navbar__header">
|
||||||
@@ -38,10 +38,12 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- #ifndef APP-NVUE -->
|
||||||
<view class="uni-navbar__placeholder" v-if="fixed">
|
<view class="uni-navbar__placeholder" v-if="fixed">
|
||||||
<status-bar v-if="statusBar" />
|
<status-bar v-if="statusBar" />
|
||||||
<view class="uni-navbar__placeholder-view" :style="{ height:navbarHeight}" />
|
<view class="uni-navbar__placeholder-view" :style="{ height:navbarHeight}" />
|
||||||
</view>
|
</view>
|
||||||
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -50,6 +52,8 @@
|
|||||||
const getVal = (val) => typeof val === 'number' ? val + 'px' : val;
|
const getVal = (val) => typeof val === 'number' ? val + 'px' : val;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
* NavBar 自定义导航栏
|
* NavBar 自定义导航栏
|
||||||
* @description 导航栏组件,主要用于头部导航
|
* @description 导航栏组件,主要用于头部导航
|
||||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=52
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=52
|
||||||
@@ -196,6 +200,11 @@
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
$nav-height: 44px;
|
$nav-height: 44px;
|
||||||
|
|
||||||
|
.uni-nvue-fixed {
|
||||||
|
/* #ifdef APP-NVUE */
|
||||||
|
position: sticky;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
.uni-navbar {
|
.uni-navbar {
|
||||||
// box-sizing: border-box;
|
// box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,8 @@
|
|||||||
name: 'UniStatusBar',
|
name: 'UniStatusBar',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
statusBarHeight: 20
|
statusBarHeight: uni.getSystemInfoSync().statusBarHeight + 'px'
|
||||||
}
|
}
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-nav-bar",
|
"id": "uni-nav-bar",
|
||||||
"displayName": "uni-nav-bar 自定义导航栏",
|
"displayName": "uni-nav-bar 自定义导航栏",
|
||||||
"version": "1.3.6",
|
"version": "1.3.11",
|
||||||
"description": "自定义导航栏组件,主要用于头部导航。",
|
"description": "自定义导航栏组件,主要用于头部导航。",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-ui",
|
"uni-ui",
|
||||||
@@ -17,10 +17,6 @@
|
|||||||
"example": "../../temps/example_temps"
|
"example": "../../temps/example_temps"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
"category": [
|
|
||||||
"前端组件",
|
|
||||||
"通用组件"
|
|
||||||
],
|
|
||||||
"sale": {
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
@@ -37,7 +33,8 @@
|
|||||||
"data": "无",
|
"data": "无",
|
||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||||
|
"type": "component-vue"
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
:class="[{ 'zfb-tk-msgleft': item.type == 1 }, { 'zfb-tk-msgright': item.type == 2 }, { 'zfb-tk-msgcenter': item.type == 3 }]">
|
: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 }]"
|
<openTool :class="[{ 'openTool-msgleft': item.type == 1 }, { 'openTool-msgright': item.type == 2 }]"
|
||||||
:talkTo="talkTo" :ref="'toolx'+itemKey" :data="item" :itemKey="itemKey"></openTool>
|
: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>
|
mode="aspectFill"></image>
|
||||||
<view class="zfb-tk-item-contentx" @longpress="longpressItem($event,itemKey,item)">
|
<view class="zfb-tk-item-contentx" @longpress="longpressItem($event,itemKey,item)">
|
||||||
<view class="zfb-tk-item-contentx-c">
|
<view class="zfb-tk-item-contentx-c">
|
||||||
@@ -730,6 +730,7 @@
|
|||||||
.zfb-tk-item-contentx-c-tool {
|
.zfb-tk-item-contentx-c-tool {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zfb-tk-msgleft .zfb-tk-item-contentx-c-tool {
|
.zfb-tk-msgleft .zfb-tk-item-contentx-c-tool {
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
|
<view class="chatNavBar">
|
||||||
|
<uni-nav-bar :leftIcon="isMobile==true?'left':''"
|
||||||
|
@clickLeft="clickLeftHandler">
|
||||||
|
<view class="navBarTitle">{{title}}</view></uni-nav-bar>
|
||||||
|
</view>
|
||||||
<watermark></watermark>
|
<watermark></watermark>
|
||||||
<uni-popup ref="popup" type="center">
|
<uni-popup ref="popup" type="center">
|
||||||
<view class="popsendCard" :style="'height:' + windowHeight + 'px'">
|
<view class="popsendCard" :style="'height:' + windowHeight + 'px'">
|
||||||
@@ -93,6 +98,7 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
title: "聊天窗口",
|
||||||
isBottomHeight: '',
|
isBottomHeight: '',
|
||||||
clickToSubmitSure: null,
|
clickToSubmitSure: null,
|
||||||
autodown: true,
|
autodown: true,
|
||||||
@@ -216,6 +222,7 @@
|
|||||||
console.log(res.data)
|
console.log(res.data)
|
||||||
|
|
||||||
if (e.windowType == 'SINGLE') {
|
if (e.windowType == 'SINGLE') {
|
||||||
|
this.title = this.localData.fromInfo.nickName
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: this.localData.fromInfo.nickName
|
title: this.localData.fromInfo.nickName
|
||||||
});
|
});
|
||||||
@@ -285,6 +292,30 @@
|
|||||||
data: this.chatListInfo
|
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() {
|
mounted() {
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
@@ -306,6 +337,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
clickLeftHandler() {
|
||||||
|
if (this.isMobile) {
|
||||||
|
uni.navigateBack()
|
||||||
|
}
|
||||||
|
},
|
||||||
onMessage(message) {
|
onMessage(message) {
|
||||||
//判断当前是单聊还是群聊
|
//判断当前是单聊还是群聊
|
||||||
if (this.talkTo.windowType != 'SINGLE') {
|
if (this.talkTo.windowType != 'SINGLE') {
|
||||||
@@ -519,7 +555,8 @@
|
|||||||
target: "znzq"
|
target: "znzq"
|
||||||
},
|
},
|
||||||
}).then((res1) => {
|
}).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) {
|
if (1 > 0) {
|
||||||
@@ -920,6 +957,25 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<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 {
|
.autodownView {
|
||||||
height: 1px;
|
height: 1px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -931,7 +987,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.zfb-tk-main {
|
.zfb-tk-main {
|
||||||
padding: 0 12px;
|
padding: 55rpx 12px;
|
||||||
padding-bottom: 112rpx;
|
padding-bottom: 112rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,12 +102,17 @@ export class ImClient {
|
|||||||
this.userSign = userSign
|
this.userSign = userSign
|
||||||
this.imeiLength = self.imeiLength;
|
this.imeiLength = self.imeiLength;
|
||||||
if (Beans.isEmpty(this.url)) {
|
if (Beans.isEmpty(this.url)) {
|
||||||
log.info("获取im地址")
|
console.log("获取im地址")
|
||||||
|
try {
|
||||||
let api = new HttpApi(this.httpUrl);
|
let api = new HttpApi(this.httpUrl);
|
||||||
let resp = await api.call("/user/login", {}, { clientType: this.clientType, appId: this.appId, userId: this.userId })
|
let resp = await api.call("/user/login", {}, { clientType: this.clientType, appId: this.appId, userId: this.userId })
|
||||||
// console.log(resp)
|
// console.log(resp)
|
||||||
if (resp.isFailed()) {
|
if (resp.isFailed()) {
|
||||||
log.info("登录失败:获取im地址失败")
|
console.error("登录失败:获取im地址失败")
|
||||||
|
console.log("登录失败:获取im地址失败")
|
||||||
|
if (typeof imClient.listeners.onSocketErrorEvent === 'function') {
|
||||||
|
imClient.listeners.onSocketErrorEvent("登录失败:获取im地址失败");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let ip = resp.data.ip;
|
let ip = resp.data.ip;
|
||||||
@@ -122,12 +127,21 @@ export class ImClient {
|
|||||||
{
|
{
|
||||||
this.url = "wss://" + ip + "/hs_ws";
|
this.url = "wss://" + ip + "/hs_ws";
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error("获取im地址 捕获到异常")
|
||||||
|
console.error(e)
|
||||||
|
if (typeof imClient.listeners.onSocketErrorEvent === 'function') {
|
||||||
|
imClient.listeners.onSocketErrorEvent("登录失败:获取im地址失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var req = new LoginPack(self.appId, self.userId, 1);
|
var req = new LoginPack(self.appId, self.userId, 1);
|
||||||
let { success, err, conn } = await limLogin(self.url, req, self);
|
let { success, err, conn } = await limLogin(self.url, req, self);
|
||||||
|
|
||||||
|
console.warn(success)
|
||||||
|
console.warn(err)
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
if (!firstMonitorSocket) {
|
if (!firstMonitorSocket) {
|
||||||
firstMonitorSocket = true;
|
firstMonitorSocket = true;
|
||||||
@@ -193,6 +207,10 @@ export class ImClient {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
log.error(err?.message)
|
log.error(err?.message)
|
||||||
|
// 加入socket 连接事件
|
||||||
|
if (typeof imClient.listeners.onSocketErrorEvent === 'function') {
|
||||||
|
imClient.listeners.onSocketErrorEvent(err?.message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user