人脸比对
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,33 +1,116 @@
|
||||
import fc from '@/common/publicFc.js'
|
||||
let timer=null
|
||||
let retimer=null
|
||||
import config from "@/common/config.js"
|
||||
let timer = null
|
||||
let retimer = null
|
||||
|
||||
|
||||
import * as sdk from "@/common/imSdk/lim-sdk.js";
|
||||
|
||||
import lim from "@/common/imSdk/sdk-bridge.js";
|
||||
|
||||
export default {
|
||||
socketTask:null,
|
||||
socketTask: null,
|
||||
// 连接WebSocket
|
||||
connectSocket() {
|
||||
this.socketTask=uni.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({
|
||||
url: 'wss://im-api.q3z3.com/ws?Authorization=' + uni.getStorageSync('Authorization'),
|
||||
complete: () => {}
|
||||
});
|
||||
this.socketTask.onOpen(res => {
|
||||
console.log('WebSocket连接已打开!');
|
||||
// 设置心跳
|
||||
timer=setInterval(()=>{
|
||||
timer = setInterval(() => {
|
||||
uni.sendSocketMessage({
|
||||
data:'isConnact',
|
||||
success:res=>{
|
||||
if(res.errMsg=='sendSocketMessage:ok'){
|
||||
data: 'isConnact',
|
||||
success: res => {
|
||||
if (res.errMsg == 'sendSocketMessage:ok') {
|
||||
console.log('WebSocket已连接')
|
||||
}else{
|
||||
} else {
|
||||
this.connectSocket()
|
||||
}
|
||||
}
|
||||
})
|
||||
},5000)
|
||||
}, 5000)
|
||||
})
|
||||
// 监听接收
|
||||
this.socketTask.onMessage(res => {
|
||||
if(res.data=='ok'){
|
||||
if (res.data == 'ok') {
|
||||
return
|
||||
}
|
||||
var data = JSON.parse(res.data);
|
||||
@@ -37,30 +120,31 @@ export default {
|
||||
// 监听关闭
|
||||
this.socketTask.onClose(res => {
|
||||
console.log('WebSocket连接已关闭!');
|
||||
let token= uni.getStorageSync('Authorization');
|
||||
if(this.socketTask&&token){
|
||||
let token = uni.getStorageSync('Authorization');
|
||||
if (this.socketTask && token) {
|
||||
this.socketTaskClose()
|
||||
retimer=setTimeout(()=>{
|
||||
retimer = setTimeout(() => {
|
||||
this.connectSocket()
|
||||
},5000)
|
||||
}, 5000)
|
||||
}
|
||||
})
|
||||
// 监听异常
|
||||
this.socketTask.onError(res => {
|
||||
console.log('WebSocket连接打开失败,正在尝试重新打开!');
|
||||
if(this.socketTask){
|
||||
if (this.socketTask) {
|
||||
this.socketTaskClose()
|
||||
retimer=setTimeout(()=>{
|
||||
retimer = setTimeout(() => {
|
||||
this.connectSocket()
|
||||
},5000)
|
||||
}, 5000)
|
||||
}
|
||||
|
||||
});
|
||||
*/
|
||||
|
||||
},
|
||||
// 关闭WebSocket
|
||||
socketTaskClose() {
|
||||
if(this.socketTask){
|
||||
if (this.socketTask) {
|
||||
this.socketTask.close()
|
||||
clearInterval(timer)
|
||||
clearTimeout(retimer)
|
||||
|
||||
@@ -2,9 +2,6 @@ import http from '@/common/request'
|
||||
import store from './store'
|
||||
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";
|
||||
@@ -21,6 +18,9 @@ import App from './App'
|
||||
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
Vue.prototype.$socketTask = socketTask;
|
||||
|
||||
Vue.prototype.$http = http
|
||||
Vue.prototype.$store = store
|
||||
Vue.prototype.$fc = publicFc;
|
||||
@@ -28,7 +28,7 @@ Vue.prototype.$md5 = md5
|
||||
Vue.prototype.$zmmFormCheck = zmmFormCheck;
|
||||
Vue.prototype.$pinyin = pinyin;
|
||||
// #ifdef H5
|
||||
Vue.prototype.$socketTask = socketTask;
|
||||
|
||||
|
||||
// uni.lim = lim;
|
||||
|
||||
@@ -50,15 +50,15 @@ import { createSSRApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
app.config.globalProperties.$socketTask = socketTask
|
||||
|
||||
app.config.globalProperties.$http = http
|
||||
app.config.globalProperties.$fc = publicFc
|
||||
app.config.globalProperties.$md5 = md5
|
||||
app.config.globalProperties.$zmmFormCheck = zmmFormCheck
|
||||
app.config.globalProperties.$pinyin = pinyin
|
||||
// #ifdef H5
|
||||
app.config.globalProperties.$socketTask = socketTask
|
||||
|
||||
app.config.globalProperties.imsdk = lim
|
||||
|
||||
// #endif
|
||||
app.use(store);
|
||||
|
||||
@@ -132,11 +132,12 @@ import { createStore } from 'vuex'
|
||||
uni.setStorageSync(context.state.userInfo.userId+'_'+'chatlistData', JSON.stringify(data2));
|
||||
// 初始化聊天数据
|
||||
var data1=publicFc.getKeyObjectStorage(context.state.userInfo.userId+'_'+'chatData')
|
||||
return new Promise(function(resolve, reject) {
|
||||
return new Promise((resolve, reject)=>{
|
||||
if(!data1[userId]){
|
||||
console.log('初始化聊天')
|
||||
switch (windowType){
|
||||
case 'SINGLE':
|
||||
|
||||
http.request({
|
||||
url: '/friend/info/'+userId,
|
||||
complete:(res)=>{
|
||||
|
||||
@@ -2,56 +2,77 @@
|
||||
<view>
|
||||
<watermark></watermark>
|
||||
<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 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>
|
||||
<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>
|
||||
<view :style="'height: ' + keyboardHeight + 'px'"></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-c">
|
||||
<view class="zfb-tk-send-tool-icon wxfont" @click="changeShowVice" :class="showVice ? 'jianpan' : 'yuyin2'"></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 class="zfb-tk-send-tool-icon wxfont" @click="changeShowVice"
|
||||
:class="showVice ? 'jianpan' : 'yuyin2'"></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 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>
|
||||
<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-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>
|
||||
</view>
|
||||
<scroll-view :scroll-y="true" v-if="showEmojitool" class="wxemojitool">
|
||||
<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>
|
||||
</scroll-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 -->
|
||||
<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 -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifdef APP-PLUS
|
||||
const TUICalling = uni.requireNativePlugin('TUICallingUniPlugin-TUICallingModule');
|
||||
// #endif
|
||||
let observer = null;
|
||||
import favorites from '../favorites/index.vue';
|
||||
import chatItem from './chat-item.vue';
|
||||
import sendCard from './sendCard.vue';
|
||||
// #ifdef APP-PLUS
|
||||
const TUICalling = uni.requireNativePlugin('TUICallingUniPlugin-TUICallingModule');
|
||||
// #endif
|
||||
let observer = null;
|
||||
import favorites from '../favorites/index.vue';
|
||||
import chatItem from './chat-item.vue';
|
||||
import sendCard from './sendCard.vue';
|
||||
|
||||
|
||||
export default {
|
||||
export default {
|
||||
components: {
|
||||
chatItem,
|
||||
sendCard,
|
||||
@@ -62,11 +83,14 @@ export default {
|
||||
isBottomHeight: '',
|
||||
clickToSubmitSure: null,
|
||||
autodown: true,
|
||||
emojilist: ['😁', '😂', '😃', '😄', '😅', '😆', '😉', '😊', '😋', '😌', '😍', '😏', '😒', '😓', '😔', '😖', '😘', '😚', '😜', '😝', '😞', '😠', '😡', '😢', '😣', '😤', '😥', '😨', '😩', '😪', '😫', '😭', '😰', '😱', '😲', '😳', '😵', '😷', '😸', '😹', '😺', '😻', '😼', '😽', '😾', '😿', '🙀', '🙅', '🙆', '🙇', '🙈', '🙉', '🙊', '🙋', '🙌', '🙍', '🙎', '🙏'],
|
||||
emojilist: ['😁', '😂', '😃', '😄', '😅', '😆', '😉', '😊', '😋', '😌', '😍', '😏', '😒', '😓', '😔', '😖',
|
||||
'😘', '😚', '😜', '😝', '😞', '😠', '😡', '😢', '😣', '😤', '😥', '😨', '😩', '😪', '😫', '😭',
|
||||
'😰', '😱', '😲', '😳', '😵', '😷', '😸', '😹', '😺', '😻', '😼', '😽', '😾', '😿', '🙀', '🙅',
|
||||
'🙆', '🙇', '🙈', '🙉', '🙊', '🙋', '🙌', '🙍', '🙎', '🙏'
|
||||
],
|
||||
showRecorder: false,
|
||||
showVice: false,
|
||||
toolist: [
|
||||
{
|
||||
toolist: [{
|
||||
title: '相册',
|
||||
icon: 'tupian'
|
||||
},
|
||||
@@ -102,7 +126,8 @@ export default {
|
||||
longTapItemKey: '',
|
||||
// chatWindowData:[],
|
||||
localData: {},
|
||||
showtitleNViewBtns: true
|
||||
showtitleNViewBtns: true,
|
||||
list:[]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -147,6 +172,10 @@ export default {
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
|
||||
// // 监听接收聊天信息
|
||||
uni.$on('onP2PMessage', this.onMessage)
|
||||
|
||||
this.talkTo = e;
|
||||
// 根据Id
|
||||
this.$store
|
||||
@@ -197,6 +226,10 @@ export default {
|
||||
100,
|
||||
false
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
onPageScroll() {
|
||||
this.clickToSubmitSure();
|
||||
@@ -222,10 +255,37 @@ export default {
|
||||
}
|
||||
if (this.chatListInfo) {
|
||||
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: {
|
||||
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) {
|
||||
this.msg += e;
|
||||
},
|
||||
@@ -245,7 +305,9 @@ export default {
|
||||
this.$refs['rec'].stopRecord();
|
||||
},
|
||||
recorderStop(e) {
|
||||
uni.showLoading({ title: '发送中' });
|
||||
uni.showLoading({
|
||||
title: '发送中'
|
||||
});
|
||||
this.$http.uploadFile({
|
||||
url: '/file/uploadAudio',
|
||||
filePath: e.recordFilePath,
|
||||
@@ -447,7 +509,8 @@ export default {
|
||||
uni.getSystemInfo({
|
||||
success: res => {
|
||||
// #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
|
||||
// #ifndef APP-PLUS
|
||||
this.windowHeight = res.windowHeight;
|
||||
@@ -476,6 +539,7 @@ export default {
|
||||
console.log(res.errMsg);
|
||||
}
|
||||
});
|
||||
|
||||
function getImage() {
|
||||
//拍照事件
|
||||
var cmr = plus.camera.getCamera();
|
||||
@@ -494,12 +558,12 @@ export default {
|
||||
},
|
||||
function(e) {
|
||||
console.log(e);
|
||||
},
|
||||
{
|
||||
}, {
|
||||
filename: 'file:///storage/emulated/0/Documents/weiliao/'
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function getVideo() {
|
||||
//拍摄视频
|
||||
var cmr = plus.camera.getCamera();
|
||||
@@ -518,17 +582,16 @@ export default {
|
||||
},
|
||||
function(e) {
|
||||
console.log(e);
|
||||
},
|
||||
{
|
||||
}, {
|
||||
filename: 'file:///storage/emulated/0/Documents/weiliao/'
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function compressImage(url, filename) {
|
||||
//压缩图片
|
||||
var name = 'file:///storage/emulated/0/Documents/weiliao/' + filename;
|
||||
plus.zip.compressImage(
|
||||
{
|
||||
plus.zip.compressImage({
|
||||
src: url, //src: (String 类型 )压缩转换原始图片的路径
|
||||
dst: name, //压缩转换目标图片的路径
|
||||
quality: 60, //quality: (Number 类型 )压缩图片的质量.取值范围为1-100
|
||||
@@ -537,7 +600,9 @@ export default {
|
||||
function(e) {
|
||||
//压缩后
|
||||
// openFile(e.target)
|
||||
uni.showLoading({ title: '发送中' });
|
||||
uni.showLoading({
|
||||
title: '发送中'
|
||||
});
|
||||
sendPhoto(e.target); //发送
|
||||
},
|
||||
function(error) {
|
||||
@@ -545,11 +610,11 @@ export default {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function compressVideo(url, filename) {
|
||||
//压缩视频
|
||||
// var name = 'file:///storage/emulated/0/Documents/weiliao/compress/' + filename;
|
||||
plus.zip.compressVideo(
|
||||
{
|
||||
plus.zip.compressVideo({
|
||||
src: url, //src: (String 类型 )压缩转换原始路径
|
||||
// filename: name, //压缩后的路径
|
||||
quality: 'medium' //压缩级别low medium high
|
||||
@@ -557,7 +622,9 @@ export default {
|
||||
function(e) {
|
||||
//压缩后
|
||||
// openFile(e.tempFilePath)
|
||||
uni.showLoading({ title: '发送中' });
|
||||
uni.showLoading({
|
||||
title: '发送中'
|
||||
});
|
||||
sendVideo(e.tempFilePath); //发送
|
||||
},
|
||||
function(error) {
|
||||
@@ -565,6 +632,7 @@ export default {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function openFile(filePath) {
|
||||
//打开文件
|
||||
let system = uni.getSystemInfoSync().platform;
|
||||
@@ -598,6 +666,7 @@ export default {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function sendVideo(filePath) {
|
||||
//发送视频
|
||||
_this.$http.uploadFile({
|
||||
@@ -629,7 +698,7 @@ export default {
|
||||
if (!e) {
|
||||
return;
|
||||
}
|
||||
/*
|
||||
|
||||
this.$fc.pushOutMsg({
|
||||
msgContent: e,
|
||||
msgType: msgType,
|
||||
@@ -637,7 +706,7 @@ export default {
|
||||
userId: this.talkTo.userId
|
||||
});
|
||||
this.msg = '';
|
||||
*/
|
||||
|
||||
// #ifdef H5
|
||||
this.msgFocus = false;
|
||||
this.$nextTick(() => {
|
||||
@@ -647,7 +716,7 @@ export default {
|
||||
console.log("==============sdk:")
|
||||
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
|
||||
},
|
||||
@@ -712,33 +781,35 @@ export default {
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.autodownView {
|
||||
.autodownView {
|
||||
height: 1px;
|
||||
width: 100%;
|
||||
opacity: 0;
|
||||
}
|
||||
.uni-list {
|
||||
background: none;
|
||||
}
|
||||
}
|
||||
|
||||
.zfb-tk-main {
|
||||
.uni-list {
|
||||
background: none;
|
||||
}
|
||||
|
||||
.zfb-tk-main {
|
||||
padding: 0 12px;
|
||||
padding-bottom: 112rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.zfb-tk-send-tool {
|
||||
.zfb-tk-send-tool {
|
||||
background: #f7f7f7;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
transition: all 0.1s;
|
||||
}
|
||||
.zfb-tk-send-tools {
|
||||
}
|
||||
|
||||
.zfb-tk-send-tools {
|
||||
height: 558rpx;
|
||||
width: 100%;
|
||||
background-color: #f7f7f7;
|
||||
@@ -746,14 +817,16 @@ export default {
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
}
|
||||
.zfb-tk-send-tools-item {
|
||||
}
|
||||
|
||||
.zfb-tk-send-tools-item {
|
||||
padding: 35rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.zfb-tk-send-tools-icon {
|
||||
}
|
||||
|
||||
.zfb-tk-send-tools-icon {
|
||||
background-color: #fff;
|
||||
width: 110rpx;
|
||||
height: 110rpx;
|
||||
@@ -762,17 +835,20 @@ export default {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
.zfb-tk-send-tools-icon .wxfont {
|
||||
}
|
||||
|
||||
.zfb-tk-send-tools-icon .wxfont {
|
||||
color: #181818;
|
||||
font-size: 64rpx;
|
||||
}
|
||||
.zfb-tk-send-tools-text {
|
||||
}
|
||||
|
||||
.zfb-tk-send-tools-text {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
.zfb-tk-send-tool-c {
|
||||
}
|
||||
|
||||
.zfb-tk-send-tool-c {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
padding: 16rpx 12rpx;
|
||||
@@ -784,12 +860,13 @@ export default {
|
||||
border: 1px #ddd solid;
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
}
|
||||
}
|
||||
|
||||
.zfb-tk-send-tool-c .zfb-tk-send-tool-btn {
|
||||
.zfb-tk-send-tool-c .zfb-tk-send-tool-btn {
|
||||
transition: color 0.5s;
|
||||
}
|
||||
.zfb-tk-send-tool-input-box {
|
||||
}
|
||||
|
||||
.zfb-tk-send-tool-input-box {
|
||||
overflow: auto;
|
||||
width: 100%;
|
||||
margin: 0 12rpx;
|
||||
@@ -799,14 +876,16 @@ export default {
|
||||
padding-top: 18rpx;
|
||||
max-height: 225rpx;
|
||||
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;
|
||||
box-sizing: border-box !important;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
}
|
||||
.zfb-tk-send-tool-vioce {
|
||||
}
|
||||
|
||||
.zfb-tk-send-tool-vioce {
|
||||
box-sizing: border-box;
|
||||
margin: 0 12rpx;
|
||||
width: 100%;
|
||||
@@ -816,33 +895,39 @@ export default {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
.zfb-tk-send-tool-vioce-item {
|
||||
}
|
||||
|
||||
.zfb-tk-send-tool-vioce-item {
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
line-height: 75rpx;
|
||||
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;
|
||||
}
|
||||
.zfb-tk-send-tool-text {
|
||||
}
|
||||
|
||||
.zfb-tk-send-tool-text {
|
||||
white-space: nowrap;
|
||||
padding: 10rpx 24rpx;
|
||||
border-radius: 12rpx;
|
||||
border: 1px #ddd solid;
|
||||
background: #f7f7f7;
|
||||
color: #ddd;
|
||||
}
|
||||
.zfb-tk-send-tool-more {
|
||||
}
|
||||
|
||||
.zfb-tk-send-tool-more {
|
||||
font-size: 64rpx;
|
||||
color: #333;
|
||||
}
|
||||
.zfb-tk-send-tool-icon {
|
||||
}
|
||||
|
||||
.zfb-tk-send-tool-icon {
|
||||
font-size: 64rpx;
|
||||
color: #333;
|
||||
}
|
||||
.zfb-tk-recorder {
|
||||
}
|
||||
|
||||
.zfb-tk-recorder {
|
||||
width: 250rpx;
|
||||
height: 250rpx;
|
||||
left: 50%;
|
||||
@@ -859,13 +944,15 @@ export default {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.popsendCard {
|
||||
}
|
||||
|
||||
.popsendCard {
|
||||
display: flex;
|
||||
background-color: #fff;
|
||||
overflow: auto;
|
||||
}
|
||||
.popsendCard-close {
|
||||
}
|
||||
|
||||
.popsendCard-close {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
height: 70rpx;
|
||||
@@ -876,16 +963,19 @@ export default {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 9999;
|
||||
}
|
||||
.wxemojitool {
|
||||
}
|
||||
|
||||
.wxemojitool {
|
||||
height: 558rpx;
|
||||
}
|
||||
.wxemojitool-content {
|
||||
}
|
||||
|
||||
.wxemojitool-content {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.wxemojitool-item {
|
||||
}
|
||||
|
||||
.wxemojitool-item {
|
||||
font-size: 44rpx;
|
||||
width: 93rpx;
|
||||
height: 93rpx;
|
||||
@@ -893,5 +983,5 @@ export default {
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -45,9 +45,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifdef APP-PLUS
|
||||
const TUICalling = uni.requireNativePlugin("TUICallingUniPlugin-TUICallingModule");
|
||||
// #endif
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -223,7 +221,9 @@
|
||||
uni.setStorageSync('appId', data.appId);
|
||||
uni.setStorageSync('userId', data.userId);
|
||||
uni.setStorageSync('imUserSign', data.imUserSign);
|
||||
uni.setStorageSync('userSign', data.userSign);
|
||||
uni.setStorageSync('userCSign', data.userSign);
|
||||
|
||||
this.$socketTask.connectSocket()
|
||||
|
||||
uni.reLaunch({
|
||||
url: '../tabbar1/index'
|
||||
|
||||
@@ -21,41 +21,9 @@
|
||||
</template>
|
||||
|
||||
<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 {
|
||||
data() {
|
||||
return {
|
||||
@@ -191,42 +159,9 @@
|
||||
},
|
||||
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({
|
||||
url: '../chatWindow/index?userId=' + e.item.data.userId + '&windowType=' + e.windowType
|
||||
url: '../chatWindow/index?userId=' + e.item.data.userId + '&windowType=' + "SINGLE"
|
||||
});
|
||||
},
|
||||
getflist(){
|
||||
|
||||
@@ -296,7 +296,6 @@ export class ImClient {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 2、心跳
|
||||
private heartbeatLoop(conn) {
|
||||
let start = Date.now()
|
||||
@@ -306,7 +305,7 @@ export class ImClient {
|
||||
return
|
||||
}
|
||||
if (Date.now() - start >= heartbeatInterval) {
|
||||
log.info(`>>> send ping ;`)
|
||||
// log.info(`>>> send ping ;`)
|
||||
start = Date.now()
|
||||
let pingPack = imClient.buildMessagePack(SystemCommand.PING, {});
|
||||
conn.send(pingPack.pack(false));
|
||||
|
||||
Reference in New Issue
Block a user