Merge pull request 'xbx' (#143) from xbx into master
Reviewed-on: http://git.luyuan.tk/luyuan/deming/pulls/143
This commit is contained in:
commit
610d012e67
@ -181,7 +181,6 @@
|
||||
me.loginIn(res.data.token); //存储一个字符传值
|
||||
// 缓存用户的信息
|
||||
uni.setStorageSync('user_info',res.data);
|
||||
|
||||
if (res.data.member.has_labels) {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
|
@ -256,32 +256,41 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
customers(){
|
||||
function Friend(uuid, name, avatar,time = "", text = "",date = "") {
|
||||
this.uuid = uuid;
|
||||
this.name = name;
|
||||
this.avatar = avatar;
|
||||
this.online = false;
|
||||
this.unReadMessage = 0;
|
||||
this.text = text;
|
||||
this.time = time;
|
||||
this.date = date
|
||||
}
|
||||
console.log(123)
|
||||
this.$u.api.getAtwillUserInfo({
|
||||
id:this.storeid
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
let user = new Friend(res.data.member_id,res.data.member_nickname,res.data.member_avatar)
|
||||
this.$u.route({
|
||||
url:"/pageD/privateChat/privateChat",
|
||||
params:{
|
||||
id:JSON.stringify(user)
|
||||
}
|
||||
|
||||
console.log(this.$store.state.hasLogin)
|
||||
if(!this.$store.state.hasLogin){
|
||||
this.$refs.uToast.show({
|
||||
title: "请先登录",
|
||||
type: 'warning'
|
||||
})
|
||||
}).catch((err)=>{
|
||||
console.log(err)
|
||||
})
|
||||
}else{
|
||||
function Friend(uuid, name, avatar,time = "", text = "",date = "") {
|
||||
this.uuid = uuid;
|
||||
this.name = name;
|
||||
this.avatar = avatar;
|
||||
this.online = false;
|
||||
this.unReadMessage = 0;
|
||||
this.text = text;
|
||||
this.time = time;
|
||||
this.date = date
|
||||
}
|
||||
console.log(123)
|
||||
this.$u.api.getAtwillUserInfo({
|
||||
id:this.storeid
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
let user = new Friend(res.data.member_id,res.data.member_nickname,res.data.member_avatar)
|
||||
this.$u.route({
|
||||
url:"/pageD/privateChat/privateChat",
|
||||
params:{
|
||||
id:JSON.stringify(user)
|
||||
}
|
||||
|
||||
})
|
||||
}).catch((err)=>{
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
setSwiperList(list) {
|
||||
let img = [];
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="attention">
|
||||
<view class="attention_box" v-for="(item,index) in attention" :key="index">
|
||||
<view class="attention_box" v-for="(item,index) in attention" :key="index" @click="navto(item.friend_tomid)">
|
||||
<view>
|
||||
<image :src="item.friend_tomavatar" mode="aspectFill"></image>
|
||||
</view>
|
||||
@ -40,6 +40,15 @@
|
||||
this.$u.api.snsfriendList({}).then((res)=>{
|
||||
this.attention = res.data;
|
||||
})
|
||||
},
|
||||
navto(id){
|
||||
// /pageB/details/index
|
||||
this.$u.route({
|
||||
url:"/pageB/details/index",
|
||||
params:{
|
||||
id
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
@ -21,10 +21,10 @@
|
||||
<image class="cart" src="../../static/cart.png" @click="show = true">
|
||||
|
||||
</image>
|
||||
<view class="danmufasongbox" @click="danmu = true">
|
||||
<view class="danmufasongbox" @click="danmu = $store.state.hasLogin">
|
||||
<view class="danmufasongboxback"></view>
|
||||
<image src="../../static/danmu.png" class="danmubianji"></image>
|
||||
<text style="font-size:26rpx;color:#fff;margin-left:20rpx">想说点什么</text>
|
||||
<text style="font-size:26rpx;color:#fff;margin-left:20rpx">{{$store.state.hasLogin ? '想说点什么' : '请先登录'}}</text>
|
||||
</view>
|
||||
<image class="liketap" src="../../static/like.png" @click="">
|
||||
|
||||
|
@ -458,6 +458,8 @@ IMService.prototype.sendPrivateTextMessage = function (friendId, text) {
|
||||
text: text
|
||||
});
|
||||
this.sendPrivateMessage(friendId, textMessage);
|
||||
this.sendMessagesSetStorage(friendId, text)
|
||||
|
||||
};
|
||||
|
||||
//私聊图片消息
|
||||
@ -469,6 +471,7 @@ IMService.prototype.sendPrivateImageMessage = function (friendId, imageFile) {
|
||||
}
|
||||
});
|
||||
this.sendPrivateMessage(friendId, imageMessage);
|
||||
this.sendMessagesSetStorage(friendId, '其他消息')
|
||||
};
|
||||
|
||||
//私聊视频消息
|
||||
@ -480,6 +483,8 @@ IMService.prototype.sendPrivateVideoMessage = function (friendId, videoFile) {
|
||||
}
|
||||
});
|
||||
this.sendPrivateMessage(friendId, videoMessage);
|
||||
this.sendMessagesSetStorage(friendId, '其他消息')
|
||||
|
||||
};
|
||||
|
||||
IMService.prototype.sendPrivateAudioMessage = function (friendId, audiofile) {
|
||||
@ -491,8 +496,88 @@ IMService.prototype.sendPrivateAudioMessage = function (friendId, audiofile) {
|
||||
});
|
||||
|
||||
this.sendPrivateMessage(friendId, audioMessage);
|
||||
};
|
||||
this.sendMessagesSetStorage(friendId, '其他消息')
|
||||
|
||||
};
|
||||
IMService.prototype.sendMessagesSetStorage = function (friendId,message){
|
||||
let friend = this.friends[friendId];
|
||||
console.log(friend)
|
||||
// return ;
|
||||
let sorts = function (friends){
|
||||
let paixu = function (a,b){
|
||||
if(a.date > b.date){
|
||||
return 0;
|
||||
}else{
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
friends.sort(paixu)
|
||||
|
||||
}
|
||||
|
||||
let that = this
|
||||
if(!friend && friend == undefined){
|
||||
const token = uni.getStorageSync('token');
|
||||
console.log(token)
|
||||
uni.request({
|
||||
url:"https://dmmall.sdbairui.com/api/Specialci/getAtwillUserInfo",
|
||||
data:{
|
||||
userId:friendId
|
||||
},
|
||||
method:"POST",
|
||||
header:{
|
||||
"Authorization" : 'Bearer' + " " + token
|
||||
},
|
||||
success(res){
|
||||
console.log(res)
|
||||
that.friends[friendId] = new Friend(res.data.data.member_id, res.data.data.member_nickname, res.data.data.member_avatar);
|
||||
friend = that.friends[friendId];
|
||||
console.log(friend)
|
||||
friend.text = message
|
||||
let time = new Date()
|
||||
friend.date = time.getTime()
|
||||
friend.time = time.getHours() + ":" + time.getMinutes() + ":" + time.getSeconds()
|
||||
console.log(that.friends)
|
||||
that.friendsarr = []
|
||||
for(let i in that.friends){
|
||||
console.log(i)
|
||||
that.friendsarr.push(that.friends[i])
|
||||
}
|
||||
sorts(that.friendsarr)
|
||||
let arr = []
|
||||
for(let i in that.friends){
|
||||
arr.push([that.friends[i].uuid,that.friends[i].time,that.friends[i].text,that.friends[i].date,0])
|
||||
}
|
||||
console.log(arr)
|
||||
uni.setStorageSync('imlist',JSON.stringify(arr))
|
||||
|
||||
that.onFriendListChange(that.friends);
|
||||
|
||||
}
|
||||
})
|
||||
}else{
|
||||
console.log(friend)
|
||||
friend.text = message
|
||||
let time = new Date()
|
||||
friend.date = time.getTime()
|
||||
friend.time = time.getHours() + ":" + time.getMinutes() + ":" + time.getSeconds()
|
||||
console.log(this.friends)
|
||||
that.friendsarr = []
|
||||
for(let i in this.friends){
|
||||
that.friendsarr.push(this.friends[i])
|
||||
}
|
||||
sorts(that.friendsarr)
|
||||
let arr = []
|
||||
for(let i in that.friends){
|
||||
arr.push([that.friends[i].uuid,that.friends[i].time,that.friends[i].text,that.friends[i].date,0])
|
||||
}
|
||||
console.log(arr)
|
||||
uni.setStorageSync('imlist',JSON.stringify(arr))
|
||||
this.onFriendListChange(this.friends);
|
||||
|
||||
}
|
||||
}
|
||||
//发送私聊消息
|
||||
IMService.prototype.sendPrivateMessage = function (friendId, message) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user