客户端消息发送
This commit is contained in:
@@ -49,6 +49,8 @@ let observer = null;
|
||||
import favorites from '../favorites/index.vue';
|
||||
import chatItem from './chat-item.vue';
|
||||
import sendCard from './sendCard.vue';
|
||||
|
||||
|
||||
export default {
|
||||
components: {
|
||||
chatItem,
|
||||
@@ -627,18 +629,26 @@ export default {
|
||||
if (!e) {
|
||||
return;
|
||||
}
|
||||
this.$fc.pushOutMsg({
|
||||
/*
|
||||
this.$fc.pushOutMsg({
|
||||
msgContent: e,
|
||||
msgType: msgType,
|
||||
windowType: this.talkTo.windowType,
|
||||
userId: this.talkTo.userId
|
||||
});
|
||||
this.msg = '';
|
||||
this.msg = '';
|
||||
*/
|
||||
// #ifdef H5
|
||||
this.msgFocus = false;
|
||||
this.$nextTick(() => {
|
||||
this.msgFocus = true;
|
||||
});
|
||||
|
||||
console.log("==============sdk:")
|
||||
console.log(this.talkTo.userId)
|
||||
|
||||
this.imsdk.lim.im.sendP2PMessage(this.imsdk.lim.im.createP2PTextMessage(this.talkTo.userId, e))
|
||||
|
||||
// #endif
|
||||
},
|
||||
startRecognize() {
|
||||
|
||||
@@ -229,14 +229,7 @@
|
||||
url: '../tabbar1/index'
|
||||
})
|
||||
|
||||
return;
|
||||
|
||||
// #ifdef H5
|
||||
this.$socketTask.connectSocket()
|
||||
// #endif
|
||||
this.$store.dispatch('get_UserInfo').then(res => {
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import config from "@/common/config.js"
|
||||
|
||||
|
||||
|
||||
const ListenerMap = {
|
||||
onSocketConnectEvent: (option, status, data) => {
|
||||
console.log("已建立连接:" + JSON.stringify(status));
|
||||
@@ -189,19 +193,33 @@
|
||||
|
||||
console.log(this.imsdk)
|
||||
|
||||
//app服务登录成功,去登录im
|
||||
const lim = this.imsdk
|
||||
const sdk = lim.im;
|
||||
|
||||
var listeners = {};
|
||||
for (const v in ListenerMap) {
|
||||
listeners[v] = ListenerMap[v];
|
||||
}
|
||||
|
||||
sdk.init("http://127.0.0.1:28000/v1","10000", "18200702230", "asdasdsd", listeners, function(
|
||||
|
||||
|
||||
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"
|
||||
})
|
||||
@@ -210,6 +228,7 @@
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
longpressItem(e, i, v) {
|
||||
|
||||
@@ -20,11 +20,43 @@
|
||||
},
|
||||
methods: {
|
||||
bindClick(e){
|
||||
//注释之前的旧代码,直接跳转到里聊天页
|
||||
/*
|
||||
uni.navigateTo({
|
||||
url:'../personInfo/detail?param='+e.item.data.userId
|
||||
})
|
||||
})
|
||||
*/
|
||||
uni.navigateTo({
|
||||
url: '../chatWindow/index?userId=' + e.item.data.userId + '&windowType=' + e.windowType
|
||||
});
|
||||
},
|
||||
getflist(){
|
||||
//TODO 从接口获取
|
||||
var list=[
|
||||
{
|
||||
name:"测试18200702230",
|
||||
avatar:"item.portrait",
|
||||
userId:"18200702230",
|
||||
userType:"item.userType",
|
||||
chatNo:"item.chatNo"
|
||||
},
|
||||
{
|
||||
name:"测试18200000000",
|
||||
avatar:"item.portrait",
|
||||
userId:"18200000000",
|
||||
userType:"item.userType",
|
||||
chatNo:"item.chatNo"
|
||||
},{
|
||||
name:"测试18200000001",
|
||||
avatar:"item.portrait",
|
||||
userId:"18200000001",
|
||||
userType:"item.userType",
|
||||
chatNo:"item.chatNo"
|
||||
}
|
||||
]
|
||||
|
||||
this.list=this.$fc.sortList({list:list,key:'name'})
|
||||
|
||||
this.$http.request({
|
||||
url: '/friend/friendList',
|
||||
method: 'POST',
|
||||
|
||||
Reference in New Issue
Block a user