人脸比对
This commit is contained in:
17
hs-im-app-server/logs/mylog.log.2023-09-26.log
Normal file
17
hs-im-app-server/logs/mylog.log.2023-09-26.log
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
2023-09-26 09:28:26 -Starting AppServiceApplication on luojie with PID 35820 (E:\workplace\huashi_project\im-system\hs-im-app-server\target\classes started by coolp in E:\workplace\huashi_project\im-system\hs-im-app-server)
|
||||||
|
2023-09-26 09:28:26 -The following profiles are active: dev
|
||||||
|
2023-09-26 09:28:26 -Tomcat initialized with port(s): 8989 (http)
|
||||||
|
2023-09-26 09:28:26 -Initializing ProtocolHandler ["http-nio-8989"]
|
||||||
|
2023-09-26 09:28:26 -Starting service [Tomcat]
|
||||||
|
2023-09-26 09:28:26 -Starting Servlet engine: [Apache Tomcat/9.0.37]
|
||||||
|
2023-09-26 09:28:26 -Initializing Spring embedded WebApplicationContext
|
||||||
|
2023-09-26 09:28:26 -Root WebApplicationContext: initialization completed in 683 ms
|
||||||
|
2023-09-26 09:28:28 -Initializing ExecutorService 'applicationTaskExecutor'
|
||||||
|
2023-09-26 09:28:28 -Starting ProtocolHandler ["http-nio-8989"]
|
||||||
|
2023-09-26 09:28:28 -Tomcat started on port(s): 8989 (http) with context path ''
|
||||||
|
2023-09-26 09:28:28 -Started AppServiceApplication in 3.161 seconds (JVM running for 4.084)
|
||||||
|
2023-09-26 09:28:49 -Initializing Spring DispatcherServlet 'dispatcherServlet'
|
||||||
|
2023-09-26 09:28:49 -Initializing Servlet 'dispatcherServlet'
|
||||||
|
2023-09-26 09:28:49 -Completed initialization in 2 ms
|
||||||
|
2023-09-26 09:28:49 -HikariPool-1 - Starting...
|
||||||
|
2023-09-26 09:28:50 -HikariPool-1 - Start completed.
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,10 +1,93 @@
|
|||||||
import fc from '@/common/publicFc.js'
|
import config from "@/common/config.js"
|
||||||
let timer = null
|
let timer = null
|
||||||
let retimer = null
|
let retimer = null
|
||||||
|
|
||||||
|
|
||||||
|
import * as sdk from "@/common/imSdk/lim-sdk.js";
|
||||||
|
|
||||||
|
import lim from "@/common/imSdk/sdk-bridge.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
socketTask: null,
|
socketTask: null,
|
||||||
// 连接WebSocket
|
// 连接WebSocket
|
||||||
connectSocket() {
|
connectSocket() {
|
||||||
|
|
||||||
|
const ListenerMap = {
|
||||||
|
onSocketConnectEvent: (option, status, data) => {
|
||||||
|
console.log("已建立连接:" + JSON.stringify(status));
|
||||||
|
},
|
||||||
|
onSocketErrorEvent: (error) => {
|
||||||
|
console.log("连接出现错误:" + userId);
|
||||||
|
},
|
||||||
|
onSocketReConnectEvent: () => {
|
||||||
|
console.log("正在重连:");
|
||||||
|
},
|
||||||
|
onSocketCloseEvent: () => {
|
||||||
|
console.log("连接关闭:");
|
||||||
|
},
|
||||||
|
onSocketReConnectSuccessEvent: () => {
|
||||||
|
console.log("重连成功");
|
||||||
|
},
|
||||||
|
onTestMessage: (e) => {
|
||||||
|
console.log("onTestMessage :" + e);
|
||||||
|
},
|
||||||
|
onP2PMessage: (e) => {
|
||||||
|
console.log("onP2PMessage :" + e);
|
||||||
|
e = JSON.parse(e)
|
||||||
|
e.pushType="TEXT"
|
||||||
|
uni.$emit('onP2PMessage', e.data);
|
||||||
|
},
|
||||||
|
onLogin: (uid) => {
|
||||||
|
console.log("用户" + uid + "登陆sdk成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const userId = uni.getStorageSync("userId")
|
||||||
|
const imUserSign = uni.getStorageSync("imUserSign")
|
||||||
|
|
||||||
|
var listeners = {};
|
||||||
|
for (const v in ListenerMap) {
|
||||||
|
listeners[v] = ListenerMap[v];
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(lim)
|
||||||
|
|
||||||
|
if (this.socketTask != null) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
lim.lim.im.init(config.getImApiUrl(), config.getImAppId(), userId, imUserSign, listeners, (
|
||||||
|
sdk) => {
|
||||||
|
if (sdk) {
|
||||||
|
console.warn("====================")
|
||||||
|
this.socketTask = sdk;
|
||||||
|
console.log(this.socketTask)
|
||||||
|
|
||||||
|
console.log('sdk 成功连接的回调, 可以使用 sdk 请求数据了.');
|
||||||
|
sdk.getAllFriend().then(res => {
|
||||||
|
console.warn(res)
|
||||||
|
})
|
||||||
|
sdk.getUserSequence().then(res => {
|
||||||
|
console.warn(res)
|
||||||
|
})
|
||||||
|
|
||||||
|
sdk.getUserConversationList(0).then(res => {
|
||||||
|
console.warn(res)
|
||||||
|
})
|
||||||
|
|
||||||
|
return uni.switchTab({
|
||||||
|
url: "/pages/tabbar/index/index"
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
console.log('sdk 初始化失败.');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
this.socketTask = uni.connectSocket({
|
this.socketTask = uni.connectSocket({
|
||||||
url: 'wss://im-api.q3z3.com/ws?Authorization=' + uni.getStorageSync('Authorization'),
|
url: 'wss://im-api.q3z3.com/ws?Authorization=' + uni.getStorageSync('Authorization'),
|
||||||
complete: () => {}
|
complete: () => {}
|
||||||
@@ -56,6 +139,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
},
|
},
|
||||||
// 关闭WebSocket
|
// 关闭WebSocket
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ import http from '@/common/request'
|
|||||||
import store from './store'
|
import store from './store'
|
||||||
import md5 from "@/common/md5.js";
|
import md5 from "@/common/md5.js";
|
||||||
|
|
||||||
import * as sdk from "@/common/imSdk/lim-sdk.js";
|
|
||||||
|
|
||||||
import lim from "@/common/imSdk/sdk-bridge.js";
|
|
||||||
|
|
||||||
|
|
||||||
import publicFc from "@/common/publicFc.js";
|
import publicFc from "@/common/publicFc.js";
|
||||||
@@ -21,6 +18,9 @@ import App from './App'
|
|||||||
|
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
|
|
||||||
|
Vue.prototype.$socketTask = socketTask;
|
||||||
|
|
||||||
Vue.prototype.$http = http
|
Vue.prototype.$http = http
|
||||||
Vue.prototype.$store = store
|
Vue.prototype.$store = store
|
||||||
Vue.prototype.$fc = publicFc;
|
Vue.prototype.$fc = publicFc;
|
||||||
@@ -28,7 +28,7 @@ Vue.prototype.$md5 = md5
|
|||||||
Vue.prototype.$zmmFormCheck = zmmFormCheck;
|
Vue.prototype.$zmmFormCheck = zmmFormCheck;
|
||||||
Vue.prototype.$pinyin = pinyin;
|
Vue.prototype.$pinyin = pinyin;
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
Vue.prototype.$socketTask = socketTask;
|
|
||||||
|
|
||||||
// uni.lim = lim;
|
// uni.lim = lim;
|
||||||
|
|
||||||
@@ -50,15 +50,15 @@ import { createSSRApp } from 'vue'
|
|||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
export function createApp() {
|
export function createApp() {
|
||||||
const app = createSSRApp(App)
|
const app = createSSRApp(App)
|
||||||
|
app.config.globalProperties.$socketTask = socketTask
|
||||||
|
|
||||||
app.config.globalProperties.$http = http
|
app.config.globalProperties.$http = http
|
||||||
app.config.globalProperties.$fc = publicFc
|
app.config.globalProperties.$fc = publicFc
|
||||||
app.config.globalProperties.$md5 = md5
|
app.config.globalProperties.$md5 = md5
|
||||||
app.config.globalProperties.$zmmFormCheck = zmmFormCheck
|
app.config.globalProperties.$zmmFormCheck = zmmFormCheck
|
||||||
app.config.globalProperties.$pinyin = pinyin
|
app.config.globalProperties.$pinyin = pinyin
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
app.config.globalProperties.$socketTask = socketTask
|
|
||||||
|
|
||||||
app.config.globalProperties.imsdk = lim
|
|
||||||
|
|
||||||
// #endif
|
// #endif
|
||||||
app.use(store);
|
app.use(store);
|
||||||
|
|||||||
@@ -132,11 +132,12 @@ import { createStore } from 'vuex'
|
|||||||
uni.setStorageSync(context.state.userInfo.userId+'_'+'chatlistData', JSON.stringify(data2));
|
uni.setStorageSync(context.state.userInfo.userId+'_'+'chatlistData', JSON.stringify(data2));
|
||||||
// 初始化聊天数据
|
// 初始化聊天数据
|
||||||
var data1=publicFc.getKeyObjectStorage(context.state.userInfo.userId+'_'+'chatData')
|
var data1=publicFc.getKeyObjectStorage(context.state.userInfo.userId+'_'+'chatData')
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise((resolve, reject)=>{
|
||||||
if(!data1[userId]){
|
if(!data1[userId]){
|
||||||
console.log('初始化聊天')
|
console.log('初始化聊天')
|
||||||
switch (windowType){
|
switch (windowType){
|
||||||
case 'SINGLE':
|
case 'SINGLE':
|
||||||
|
|
||||||
http.request({
|
http.request({
|
||||||
url: '/friend/info/'+userId,
|
url: '/friend/info/'+userId,
|
||||||
complete:(res)=>{
|
complete:(res)=>{
|
||||||
|
|||||||
@@ -2,41 +2,62 @@
|
|||||||
<view>
|
<view>
|
||||||
<watermark></watermark>
|
<watermark></watermark>
|
||||||
<uni-popup ref="popup" type="center">
|
<uni-popup ref="popup" type="center">
|
||||||
<view class="popsendCard" :style="'height:' + windowHeight + 'px'"><sendCard @click="sendCardclick"></sendCard></view>
|
<view class="popsendCard" :style="'height:' + windowHeight + 'px'">
|
||||||
|
<sendCard @click="sendCardclick"></sendCard>
|
||||||
|
</view>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
<uni-popup ref="popupfavorites" type="center" background-color="#fff" style="background-color: #fff;">
|
<uni-popup ref="popupfavorites" type="center" background-color="#fff" style="background-color: #fff;">
|
||||||
<scroll-view scroll-y :style="'height:' + windowHeight + 'px'"><favorites type="2" @clickitem="clickitem"></favorites></scroll-view>
|
<scroll-view scroll-y :style="'height:' + windowHeight + 'px'">
|
||||||
|
<favorites type="2" @clickitem="clickitem"></favorites>
|
||||||
|
</scroll-view>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
<view class="zfb-tk-main">
|
<view class="zfb-tk-main">
|
||||||
<uni-list class="zfb-tk-conent" :border="false" style="background: none;"><chatItem v-for="(v, index) in chatWindowData" :key="'key' + index" :talkTo="talkTo" :itemKey="index" :item="v" @tryagin="tryagin" @longpressItem="longpressItem" :longTapItemKey="longTapItemKey"></chatItem></uni-list>
|
<uni-list class="zfb-tk-conent" :border="false" style="background: none;">
|
||||||
|
<chatItem v-for="(v, index) in chatWindowData" :key="'key' + index" :talkTo="talkTo" :itemKey="index"
|
||||||
|
:item="v" @tryagin="tryagin" @longpressItem="longpressItem" :longTapItemKey="longTapItemKey">
|
||||||
|
</chatItem>
|
||||||
|
</uni-list>
|
||||||
<view class="autodownView"></view>
|
<view class="autodownView"></view>
|
||||||
</view>
|
</view>
|
||||||
<view :style="'height: ' + keyboardHeight + 'px'"></view>
|
<view :style="'height: ' + keyboardHeight + 'px'"></view>
|
||||||
<view v-if="showtool || showEmojitool" :style="'height:558rpx'"></view>
|
<view v-if="showtool || showEmojitool" :style="'height:558rpx'"></view>
|
||||||
<view class="zfb-tk-send-tool" :style="'transform: translateY(-' + keyboardHeight + 'px)'">
|
<view class="zfb-tk-send-tool" :style="'transform: translateY(-' + keyboardHeight + 'px)'">
|
||||||
<view class="zfb-tk-send-tool-c">
|
<view class="zfb-tk-send-tool-c">
|
||||||
<view class="zfb-tk-send-tool-icon wxfont" @click="changeShowVice" :class="showVice ? 'jianpan' : 'yuyin2'"></view>
|
<view class="zfb-tk-send-tool-icon wxfont" @click="changeShowVice"
|
||||||
<view class="zfb-tk-send-tool-vioce" v-if="showVice"><view class="zfb-tk-send-tool-vioce-item" @longpress="startRecord" @touchend="endRecord">按住说话</view></view>
|
:class="showVice ? 'jianpan' : 'yuyin2'"></view>
|
||||||
<view v-else class="zfb-tk-send-tool-input-box" @click="msgFocus = true"><textarea @focus="showtool = false" :focus="msgFocus" class="zfb-tk-send-tool-input" :adjust-position="false" v-model="msg" placeholder="" hold-keyboard confirm-type="send" @confirm="sendMsg(msg, 'TEXT')" :maxlength="-1" auto-height /></view>
|
<view class="zfb-tk-send-tool-vioce" v-if="showVice">
|
||||||
|
<view class="zfb-tk-send-tool-vioce-item" @longpress="startRecord" @touchend="endRecord">按住说话</view>
|
||||||
|
</view>
|
||||||
|
<view v-else class="zfb-tk-send-tool-input-box" @click="msgFocus = true"><textarea
|
||||||
|
@focus="showtool = false" :focus="msgFocus" class="zfb-tk-send-tool-input"
|
||||||
|
:adjust-position="false" v-model="msg" placeholder="" hold-keyboard confirm-type="send"
|
||||||
|
@confirm="sendMsg(msg, 'TEXT')" :maxlength="-1" auto-height /></view>
|
||||||
<view @click="changeEmojiTool" class="zfb-tk-send-tool-more wxfont biaoqing"></view>
|
<view @click="changeEmojiTool" class="zfb-tk-send-tool-more wxfont biaoqing"></view>
|
||||||
<view v-if="msg !== ''" class="zfb-tk-send-tool-text" @touchend.prevent="sendMsg(msg, 'TEXT')" :style="{ background: msg !== '' ? '#1BC418' : '#F7F7F7', color: msg !== '' ? '#fff' : '#ddd', 'border-color': msg !== '' ? '#1BC418' : '#ddd' }">发送</view>
|
<view v-if="msg !== ''" class="zfb-tk-send-tool-text" @touchend.prevent="sendMsg(msg, 'TEXT')"
|
||||||
|
:style="{ background: msg !== '' ? '#1BC418' : '#F7F7F7', color: msg !== '' ? '#fff' : '#ddd', 'border-color': msg !== '' ? '#1BC418' : '#ddd' }">
|
||||||
|
发送</view>
|
||||||
<view v-else @click="changeTool" class="zfb-tk-send-tool-more wxfont gengduo"></view>
|
<view v-else @click="changeTool" class="zfb-tk-send-tool-more wxfont gengduo"></view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="showtool" class="zfb-tk-send-tools">
|
<view v-if="showtool" class="zfb-tk-send-tools">
|
||||||
<view class="zfb-tk-send-tools-item" v-for="(v, i) in toolist" @click="toolClick(v)">
|
<view class="zfb-tk-send-tools-item" v-for="(v, i) in toolist" @click="toolClick(v)">
|
||||||
<view class="zfb-tk-send-tools-icon"><view class="wxfont" :class="v.icon"></view></view>
|
<view class="zfb-tk-send-tools-icon">
|
||||||
|
<view class="wxfont" :class="v.icon"></view>
|
||||||
|
</view>
|
||||||
<view class="zfb-tk-send-tools-text">{{ v.title }}</view>
|
<view class="zfb-tk-send-tools-text">{{ v.title }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<scroll-view :scroll-y="true" v-if="showEmojitool" class="wxemojitool">
|
<scroll-view :scroll-y="true" v-if="showEmojitool" class="wxemojitool">
|
||||||
<view class="wxemojitool-content">
|
<view class="wxemojitool-content">
|
||||||
<view class="wxemojitool-item" @click="addMsg(v)" v-for="(v, i) in emojilist" :key="i">{{ v }}</view>
|
<view class="wxemojitool-item" @click="addMsg(v)" v-for="(v, i) in emojilist" :key="i">{{ v }}
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
<zmm-upload-image chooseType="chooseMedia" :show="false" ref="upload" @allComplete="upLoadallComplete" @oneComplete="upLoadoneComplete"></zmm-upload-image>
|
<zmm-upload-image chooseType="chooseMedia" :show="false" ref="upload" @allComplete="upLoadallComplete"
|
||||||
|
@oneComplete="upLoadoneComplete"></zmm-upload-image>
|
||||||
<!-- #ifndef H5 -->
|
<!-- #ifndef H5 -->
|
||||||
<view class="zfb-tk-recorder" v-show="showRecorder"><zmm-recorder :show="showRecorder" ref="rec" @recorderStop="recorderStop"></zmm-recorder></view>
|
<view class="zfb-tk-recorder" v-show="showRecorder"><zmm-recorder :show="showRecorder" ref="rec"
|
||||||
|
@recorderStop="recorderStop"></zmm-recorder></view>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -62,11 +83,14 @@ export default {
|
|||||||
isBottomHeight: '',
|
isBottomHeight: '',
|
||||||
clickToSubmitSure: null,
|
clickToSubmitSure: null,
|
||||||
autodown: true,
|
autodown: true,
|
||||||
emojilist: ['😁', '😂', '😃', '😄', '😅', '😆', '😉', '😊', '😋', '😌', '😍', '😏', '😒', '😓', '😔', '😖', '😘', '😚', '😜', '😝', '😞', '😠', '😡', '😢', '😣', '😤', '😥', '😨', '😩', '😪', '😫', '😭', '😰', '😱', '😲', '😳', '😵', '😷', '😸', '😹', '😺', '😻', '😼', '😽', '😾', '😿', '🙀', '🙅', '🙆', '🙇', '🙈', '🙉', '🙊', '🙋', '🙌', '🙍', '🙎', '🙏'],
|
emojilist: ['😁', '😂', '😃', '😄', '😅', '😆', '😉', '😊', '😋', '😌', '😍', '😏', '😒', '😓', '😔', '😖',
|
||||||
|
'😘', '😚', '😜', '😝', '😞', '😠', '😡', '😢', '😣', '😤', '😥', '😨', '😩', '😪', '😫', '😭',
|
||||||
|
'😰', '😱', '😲', '😳', '😵', '😷', '😸', '😹', '😺', '😻', '😼', '😽', '😾', '😿', '🙀', '🙅',
|
||||||
|
'🙆', '🙇', '🙈', '🙉', '🙊', '🙋', '🙌', '🙍', '🙎', '🙏'
|
||||||
|
],
|
||||||
showRecorder: false,
|
showRecorder: false,
|
||||||
showVice: false,
|
showVice: false,
|
||||||
toolist: [
|
toolist: [{
|
||||||
{
|
|
||||||
title: '相册',
|
title: '相册',
|
||||||
icon: 'tupian'
|
icon: 'tupian'
|
||||||
},
|
},
|
||||||
@@ -102,7 +126,8 @@ export default {
|
|||||||
longTapItemKey: '',
|
longTapItemKey: '',
|
||||||
// chatWindowData:[],
|
// chatWindowData:[],
|
||||||
localData: {},
|
localData: {},
|
||||||
showtitleNViewBtns: true
|
showtitleNViewBtns: true,
|
||||||
|
list:[]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -147,6 +172,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
|
|
||||||
|
// // 监听接收聊天信息
|
||||||
|
uni.$on('onP2PMessage', this.onMessage)
|
||||||
|
|
||||||
this.talkTo = e;
|
this.talkTo = e;
|
||||||
// 根据Id
|
// 根据Id
|
||||||
this.$store
|
this.$store
|
||||||
@@ -197,6 +226,10 @@ export default {
|
|||||||
100,
|
100,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
onPageScroll() {
|
onPageScroll() {
|
||||||
this.clickToSubmitSure();
|
this.clickToSubmitSure();
|
||||||
@@ -222,10 +255,37 @@ export default {
|
|||||||
}
|
}
|
||||||
if (this.chatListInfo) {
|
if (this.chatListInfo) {
|
||||||
this.chatListInfo.num = 0;
|
this.chatListInfo.num = 0;
|
||||||
this.$store.dispatch('updateChatListInfoById', { userId: this.talkTo.userId, data: this.chatListInfo });
|
this.$store.dispatch('updateChatListInfoById', {
|
||||||
|
userId: this.talkTo.userId,
|
||||||
|
data: this.chatListInfo
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
onMessage(message) {
|
||||||
|
console.log('[聊天页] 监听接收聊天信息', message);
|
||||||
|
if (message.fromId != this.talkTo.userId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('[聊天页] 监听接收聊天信息', message);
|
||||||
|
|
||||||
|
this.$fc.getPush(data);
|
||||||
|
|
||||||
|
// var messageBody = message
|
||||||
|
|
||||||
|
// let msg = {
|
||||||
|
// userId: message.fromId,
|
||||||
|
// avatar: "/static/images/userpic.png",
|
||||||
|
// data: messageBody.messageBody == '' ? '空消息' : messageBody.messageBody,
|
||||||
|
// nickname: message.fromId,
|
||||||
|
// type: "text",
|
||||||
|
// createTime: message.messageTime / 1000,
|
||||||
|
// isRemove: false
|
||||||
|
// }
|
||||||
|
// this.list.push(msg)
|
||||||
|
|
||||||
|
},
|
||||||
addMsg(e) {
|
addMsg(e) {
|
||||||
this.msg += e;
|
this.msg += e;
|
||||||
},
|
},
|
||||||
@@ -245,7 +305,9 @@ export default {
|
|||||||
this.$refs['rec'].stopRecord();
|
this.$refs['rec'].stopRecord();
|
||||||
},
|
},
|
||||||
recorderStop(e) {
|
recorderStop(e) {
|
||||||
uni.showLoading({ title: '发送中' });
|
uni.showLoading({
|
||||||
|
title: '发送中'
|
||||||
|
});
|
||||||
this.$http.uploadFile({
|
this.$http.uploadFile({
|
||||||
url: '/file/uploadAudio',
|
url: '/file/uploadAudio',
|
||||||
filePath: e.recordFilePath,
|
filePath: e.recordFilePath,
|
||||||
@@ -447,7 +509,8 @@ export default {
|
|||||||
uni.getSystemInfo({
|
uni.getSystemInfo({
|
||||||
success: res => {
|
success: res => {
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
this.windowHeight = res.windowHeight - res.statusBarHeight - res.safeArea.top - res.safeAreaInsets.top;
|
this.windowHeight = res.windowHeight - res.statusBarHeight - res.safeArea.top -
|
||||||
|
res.safeAreaInsets.top;
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef APP-PLUS
|
// #ifndef APP-PLUS
|
||||||
this.windowHeight = res.windowHeight;
|
this.windowHeight = res.windowHeight;
|
||||||
@@ -476,6 +539,7 @@ export default {
|
|||||||
console.log(res.errMsg);
|
console.log(res.errMsg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function getImage() {
|
function getImage() {
|
||||||
//拍照事件
|
//拍照事件
|
||||||
var cmr = plus.camera.getCamera();
|
var cmr = plus.camera.getCamera();
|
||||||
@@ -494,12 +558,12 @@ export default {
|
|||||||
},
|
},
|
||||||
function(e) {
|
function(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
filename: 'file:///storage/emulated/0/Documents/weiliao/'
|
filename: 'file:///storage/emulated/0/Documents/weiliao/'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getVideo() {
|
function getVideo() {
|
||||||
//拍摄视频
|
//拍摄视频
|
||||||
var cmr = plus.camera.getCamera();
|
var cmr = plus.camera.getCamera();
|
||||||
@@ -518,17 +582,16 @@ export default {
|
|||||||
},
|
},
|
||||||
function(e) {
|
function(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
filename: 'file:///storage/emulated/0/Documents/weiliao/'
|
filename: 'file:///storage/emulated/0/Documents/weiliao/'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function compressImage(url, filename) {
|
function compressImage(url, filename) {
|
||||||
//压缩图片
|
//压缩图片
|
||||||
var name = 'file:///storage/emulated/0/Documents/weiliao/' + filename;
|
var name = 'file:///storage/emulated/0/Documents/weiliao/' + filename;
|
||||||
plus.zip.compressImage(
|
plus.zip.compressImage({
|
||||||
{
|
|
||||||
src: url, //src: (String 类型 )压缩转换原始图片的路径
|
src: url, //src: (String 类型 )压缩转换原始图片的路径
|
||||||
dst: name, //压缩转换目标图片的路径
|
dst: name, //压缩转换目标图片的路径
|
||||||
quality: 60, //quality: (Number 类型 )压缩图片的质量.取值范围为1-100
|
quality: 60, //quality: (Number 类型 )压缩图片的质量.取值范围为1-100
|
||||||
@@ -537,7 +600,9 @@ export default {
|
|||||||
function(e) {
|
function(e) {
|
||||||
//压缩后
|
//压缩后
|
||||||
// openFile(e.target)
|
// openFile(e.target)
|
||||||
uni.showLoading({ title: '发送中' });
|
uni.showLoading({
|
||||||
|
title: '发送中'
|
||||||
|
});
|
||||||
sendPhoto(e.target); //发送
|
sendPhoto(e.target); //发送
|
||||||
},
|
},
|
||||||
function(error) {
|
function(error) {
|
||||||
@@ -545,11 +610,11 @@ export default {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function compressVideo(url, filename) {
|
function compressVideo(url, filename) {
|
||||||
//压缩视频
|
//压缩视频
|
||||||
// var name = 'file:///storage/emulated/0/Documents/weiliao/compress/' + filename;
|
// var name = 'file:///storage/emulated/0/Documents/weiliao/compress/' + filename;
|
||||||
plus.zip.compressVideo(
|
plus.zip.compressVideo({
|
||||||
{
|
|
||||||
src: url, //src: (String 类型 )压缩转换原始路径
|
src: url, //src: (String 类型 )压缩转换原始路径
|
||||||
// filename: name, //压缩后的路径
|
// filename: name, //压缩后的路径
|
||||||
quality: 'medium' //压缩级别low medium high
|
quality: 'medium' //压缩级别low medium high
|
||||||
@@ -557,7 +622,9 @@ export default {
|
|||||||
function(e) {
|
function(e) {
|
||||||
//压缩后
|
//压缩后
|
||||||
// openFile(e.tempFilePath)
|
// openFile(e.tempFilePath)
|
||||||
uni.showLoading({ title: '发送中' });
|
uni.showLoading({
|
||||||
|
title: '发送中'
|
||||||
|
});
|
||||||
sendVideo(e.tempFilePath); //发送
|
sendVideo(e.tempFilePath); //发送
|
||||||
},
|
},
|
||||||
function(error) {
|
function(error) {
|
||||||
@@ -565,6 +632,7 @@ export default {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function openFile(filePath) {
|
function openFile(filePath) {
|
||||||
//打开文件
|
//打开文件
|
||||||
let system = uni.getSystemInfoSync().platform;
|
let system = uni.getSystemInfoSync().platform;
|
||||||
@@ -598,6 +666,7 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendVideo(filePath) {
|
function sendVideo(filePath) {
|
||||||
//发送视频
|
//发送视频
|
||||||
_this.$http.uploadFile({
|
_this.$http.uploadFile({
|
||||||
@@ -629,7 +698,7 @@ export default {
|
|||||||
if (!e) {
|
if (!e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
this.$fc.pushOutMsg({
|
this.$fc.pushOutMsg({
|
||||||
msgContent: e,
|
msgContent: e,
|
||||||
msgType: msgType,
|
msgType: msgType,
|
||||||
@@ -637,7 +706,7 @@ export default {
|
|||||||
userId: this.talkTo.userId
|
userId: this.talkTo.userId
|
||||||
});
|
});
|
||||||
this.msg = '';
|
this.msg = '';
|
||||||
*/
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
this.msgFocus = false;
|
this.msgFocus = false;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
@@ -647,7 +716,7 @@ export default {
|
|||||||
console.log("==============sdk:")
|
console.log("==============sdk:")
|
||||||
console.log(this.talkTo.userId)
|
console.log(this.talkTo.userId)
|
||||||
|
|
||||||
this.imsdk.lim.im.sendP2PMessage(this.imsdk.lim.im.createP2PTextMessage(this.talkTo.userId, e))
|
// this.imsdk.lim.im.sendP2PMessage(this.imsdk.lim.im.createP2PTextMessage(this.talkTo.userId, e))
|
||||||
|
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
@@ -721,6 +790,7 @@ export default {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-list {
|
.uni-list {
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
@@ -738,6 +808,7 @@ export default {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
transition: all 0.1s;
|
transition: all 0.1s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zfb-tk-send-tools {
|
.zfb-tk-send-tools {
|
||||||
height: 558rpx;
|
height: 558rpx;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -747,12 +818,14 @@ export default {
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zfb-tk-send-tools-item {
|
.zfb-tk-send-tools-item {
|
||||||
padding: 35rpx;
|
padding: 35rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zfb-tk-send-tools-icon {
|
.zfb-tk-send-tools-icon {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
width: 110rpx;
|
width: 110rpx;
|
||||||
@@ -763,15 +836,18 @@ export default {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zfb-tk-send-tools-icon .wxfont {
|
.zfb-tk-send-tools-icon .wxfont {
|
||||||
color: #181818;
|
color: #181818;
|
||||||
font-size: 64rpx;
|
font-size: 64rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zfb-tk-send-tools-text {
|
.zfb-tk-send-tools-text {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
margin-top: 16rpx;
|
margin-top: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zfb-tk-send-tool-c {
|
.zfb-tk-send-tool-c {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
@@ -789,6 +865,7 @@ export default {
|
|||||||
.zfb-tk-send-tool-c .zfb-tk-send-tool-btn {
|
.zfb-tk-send-tool-c .zfb-tk-send-tool-btn {
|
||||||
transition: color 0.5s;
|
transition: color 0.5s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zfb-tk-send-tool-input-box {
|
.zfb-tk-send-tool-input-box {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -800,12 +877,14 @@ export default {
|
|||||||
max-height: 225rpx;
|
max-height: 225rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zfb-tk-send-tool .zfb-tk-send-tool-input {
|
.zfb-tk-send-tool .zfb-tk-send-tool-input {
|
||||||
padding: 0 24rpx;
|
padding: 0 24rpx;
|
||||||
box-sizing: border-box !important;
|
box-sizing: border-box !important;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zfb-tk-send-tool-vioce {
|
.zfb-tk-send-tool-vioce {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
margin: 0 12rpx;
|
margin: 0 12rpx;
|
||||||
@@ -817,15 +896,18 @@ export default {
|
|||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zfb-tk-send-tool-vioce-item {
|
.zfb-tk-send-tool-vioce-item {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
line-height: 75rpx;
|
line-height: 75rpx;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zfb-tk-send-tool-vioce-item:nth-child(1) {
|
.zfb-tk-send-tool-vioce-item:nth-child(1) {
|
||||||
border-right: 1px #eee solid;
|
border-right: 1px #eee solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zfb-tk-send-tool-text {
|
.zfb-tk-send-tool-text {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
padding: 10rpx 24rpx;
|
padding: 10rpx 24rpx;
|
||||||
@@ -834,14 +916,17 @@ export default {
|
|||||||
background: #f7f7f7;
|
background: #f7f7f7;
|
||||||
color: #ddd;
|
color: #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zfb-tk-send-tool-more {
|
.zfb-tk-send-tool-more {
|
||||||
font-size: 64rpx;
|
font-size: 64rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zfb-tk-send-tool-icon {
|
.zfb-tk-send-tool-icon {
|
||||||
font-size: 64rpx;
|
font-size: 64rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zfb-tk-recorder {
|
.zfb-tk-recorder {
|
||||||
width: 250rpx;
|
width: 250rpx;
|
||||||
height: 250rpx;
|
height: 250rpx;
|
||||||
@@ -860,11 +945,13 @@ export default {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.popsendCard {
|
.popsendCard {
|
||||||
display: flex;
|
display: flex;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.popsendCard-close {
|
.popsendCard-close {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -877,14 +964,17 @@ export default {
|
|||||||
left: 0;
|
left: 0;
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wxemojitool {
|
.wxemojitool {
|
||||||
height: 558rpx;
|
height: 558rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wxemojitool-content {
|
.wxemojitool-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wxemojitool-item {
|
.wxemojitool-item {
|
||||||
font-size: 44rpx;
|
font-size: 44rpx;
|
||||||
width: 93rpx;
|
width: 93rpx;
|
||||||
|
|||||||
@@ -45,9 +45,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// #ifdef APP-PLUS
|
|
||||||
const TUICalling = uni.requireNativePlugin("TUICallingUniPlugin-TUICallingModule");
|
|
||||||
// #endif
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -223,7 +221,9 @@
|
|||||||
uni.setStorageSync('appId', data.appId);
|
uni.setStorageSync('appId', data.appId);
|
||||||
uni.setStorageSync('userId', data.userId);
|
uni.setStorageSync('userId', data.userId);
|
||||||
uni.setStorageSync('imUserSign', data.imUserSign);
|
uni.setStorageSync('imUserSign', data.imUserSign);
|
||||||
uni.setStorageSync('userSign', data.userSign);
|
uni.setStorageSync('userCSign', data.userSign);
|
||||||
|
|
||||||
|
this.$socketTask.connectSocket()
|
||||||
|
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '../tabbar1/index'
|
url: '../tabbar1/index'
|
||||||
|
|||||||
@@ -21,41 +21,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import config from "@/common/config.js"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const ListenerMap = {
|
|
||||||
onSocketConnectEvent: (option, status, data) => {
|
|
||||||
console.log("已建立连接:" + JSON.stringify(status));
|
|
||||||
},
|
|
||||||
onSocketErrorEvent: (error) => {
|
|
||||||
console.log("连接出现错误:" + userId);
|
|
||||||
},
|
|
||||||
onSocketReConnectEvent: () => {
|
|
||||||
console.log("正在重连:");
|
|
||||||
},
|
|
||||||
onSocketCloseEvent: () => {
|
|
||||||
console.log("连接关闭:");
|
|
||||||
},
|
|
||||||
onSocketReConnectSuccessEvent: () => {
|
|
||||||
console.log("重连成功");
|
|
||||||
},
|
|
||||||
onTestMessage: (e) => {
|
|
||||||
console.log("onTestMessage :" + e);
|
|
||||||
},
|
|
||||||
onP2PMessage: (e) => {
|
|
||||||
console.log("onP2PMessage :" + e);
|
|
||||||
e = JSON.parse(e)
|
|
||||||
uni.$emit('P2PMessage', e.data);
|
|
||||||
},
|
|
||||||
onLogin: (uid) => {
|
|
||||||
console.log("用户" + uid + "登陆sdk成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -191,42 +159,9 @@
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
||||||
console.log(this.imsdk)
|
|
||||||
|
|
||||||
|
this.$socketTask.connectSocket()
|
||||||
|
|
||||||
var listeners = {};
|
|
||||||
for (const v in ListenerMap) {
|
|
||||||
listeners[v] = ListenerMap[v];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const userId=uni.getStorageSync("userId")
|
|
||||||
const imUserSign=uni.getStorageSync("imUserSign")
|
|
||||||
|
|
||||||
console.log(this.imsdk)
|
|
||||||
|
|
||||||
this.imsdk.lim.im.init(config.getImApiUrl(),config.getImAppId(),userId,imUserSign, listeners, function(
|
|
||||||
sdk) {
|
|
||||||
if (sdk) {
|
|
||||||
console.log('sdk 成功连接的回调, 可以使用 sdk 请求数据了.');
|
|
||||||
sdk.getAllFriend().then(res=>{
|
|
||||||
console.warn(res)
|
|
||||||
})
|
|
||||||
sdk.getUserSequence().then(res=>{
|
|
||||||
console.warn(res)
|
|
||||||
})
|
|
||||||
|
|
||||||
sdk.getUserConversationList(0).then(res=>{
|
|
||||||
console.warn(res)
|
|
||||||
})
|
|
||||||
|
|
||||||
return uni.switchTab({
|
|
||||||
url: "/pages/tabbar/index/index"
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
console.log('sdk 初始化失败.');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
})
|
})
|
||||||
*/
|
*/
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '../chatWindow/index?userId=' + e.item.data.userId + '&windowType=' + e.windowType
|
url: '../chatWindow/index?userId=' + e.item.data.userId + '&windowType=' + "SINGLE"
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getflist(){
|
getflist(){
|
||||||
|
|||||||
@@ -296,7 +296,6 @@ export class ImClient {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 2、心跳
|
// 2、心跳
|
||||||
private heartbeatLoop(conn) {
|
private heartbeatLoop(conn) {
|
||||||
let start = Date.now()
|
let start = Date.now()
|
||||||
@@ -306,7 +305,7 @@ export class ImClient {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (Date.now() - start >= heartbeatInterval) {
|
if (Date.now() - start >= heartbeatInterval) {
|
||||||
log.info(`>>> send ping ;`)
|
// log.info(`>>> send ping ;`)
|
||||||
start = Date.now()
|
start = Date.now()
|
||||||
let pingPack = imClient.buildMessagePack(SystemCommand.PING, {});
|
let pingPack = imClient.buildMessagePack(SystemCommand.PING, {});
|
||||||
conn.send(pingPack.pack(false));
|
conn.send(pingPack.pack(false));
|
||||||
|
|||||||
Reference in New Issue
Block a user