还有搜索好友申请模块处理
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="apply--cell u-border-bottom">
|
<view class="apply--cell u-border-bottom">
|
||||||
<view class="avatar">
|
<view class="avatar">
|
||||||
<u-avatar :src="user.portraitUrl" shape="square" size="46" />
|
<u-avatar :src="user.portraitUrl || require('@/static/user/cover.png')" shape="square" size="46" />
|
||||||
</view>
|
</view>
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<view class="name">
|
<view class="name">
|
||||||
|
|||||||
138
pages/im/components/friendSearchList.vue
Normal file
138
pages/im/components/friendSearchList.vue
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
<template>
|
||||||
|
<view class="friend-apply">
|
||||||
|
<block v-for="(item, index) in lists" v-if="lists.length > 0" :key="index">
|
||||||
|
<view class="lists">
|
||||||
|
<view class="" style="width: 100rpx;height: 100rpx;">
|
||||||
|
<u-avatar :src="item.portraitUrl || require('@/static/user/cover.png')" shape="square" size="44" />
|
||||||
|
</view>
|
||||||
|
<view class="right">
|
||||||
|
<view class="title">
|
||||||
|
<view class="name">{{ item.name }}</view>
|
||||||
|
<view class="des">{{ item.address }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="agress-btn">
|
||||||
|
<span v-if="isApply && item.friendship !=='accepted'" @click="action('apply', item)">查看</span>
|
||||||
|
<span class="isFri" v-if="isApply && item.friendship ==='accepted'" @click="action('isFriend', item)">已是好友</span>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'friend-apply-reject-agree',
|
||||||
|
props: {
|
||||||
|
lists: {
|
||||||
|
type: Array,
|
||||||
|
default: []
|
||||||
|
},
|
||||||
|
isAgree: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
isReject: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
isApply: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
console.log(this.lists);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
action(type, item) {
|
||||||
|
if (type === 'isFriend') {
|
||||||
|
// ,后期可以跳转到信息介绍页面,先留在这里
|
||||||
|
return uni.showToast({
|
||||||
|
title: '已是好友,无需重复添加',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.$emit('action', {
|
||||||
|
type,
|
||||||
|
item
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.lists {
|
||||||
|
padding: 0 $padding;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: $title-size;
|
||||||
|
color: $text-gray;
|
||||||
|
|
||||||
|
.cover {
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
width: 570rpx;
|
||||||
|
margin-left: $margin - 10;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: $padding 0;
|
||||||
|
border-bottom: solid 1rpx #f9f9f9;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
width: 370rpx;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
width: 100%;
|
||||||
|
color: $text-color;
|
||||||
|
font-size: $title-size + 2;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.des {
|
||||||
|
width: 100%;
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
font-size: $title-size-m;
|
||||||
|
margin-top: $margin - 10;
|
||||||
|
color: $text-gray-m;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.agress-btn {
|
||||||
|
display: flex;
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
|
span {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 6rpx 14rpx;
|
||||||
|
background-color: $text-price;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
span:nth-child(1) {
|
||||||
|
background-color: $main-color;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.isFri {
|
||||||
|
background-color: #f9f9f9 !important;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -6,12 +6,10 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="name">{{ contact(item.targetId).name }} <text v-if="item.conversationType === 3"
|
<view class="name">{{ contact(item.targetId).name }} <text v-if="item.conversationType === 3" class='qun'>[群]</text></view>
|
||||||
class='qun'>[群]</text></view>
|
|
||||||
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
||||||
</view>
|
</view>
|
||||||
<message-preview class="preview" :msg="item.latestMessage" :conversationType="item.conversationType"
|
<message-preview class="preview" :msg="item.latestMessage" :conversationType="item.conversationType" :user="item.latestMessage.userInfo" />
|
||||||
:user="item.latestMessage.userInfo" />
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -19,6 +17,10 @@
|
|||||||
<script>
|
<script>
|
||||||
import messagePreview from './messagePreview'
|
import messagePreview from './messagePreview'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
item: {
|
item: {
|
||||||
|
|||||||
@@ -12,15 +12,14 @@
|
|||||||
</view>
|
</view>
|
||||||
<block v-if="friends.length > 0">
|
<block v-if="friends.length > 0">
|
||||||
<u-index-item v-for="(item, fkey) in friends" :key="fkey">
|
<u-index-item v-for="(item, fkey) in friends" :key="fkey">
|
||||||
<u-index-anchor :text="indexs[fkey]" bgColor="#F3F6FB" height="20" size="12" color="#666">
|
<u-index-anchor :text="indexs[fkey]" bgColor="#F9F9F9" height="20" size="12" color="#666" />
|
||||||
</u-index-anchor>
|
|
||||||
|
|
||||||
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex u-border-bottom"
|
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex u-border-bottom"
|
||||||
@click="toFriend(friendItem.targetId)">
|
@click="toFriend(friendItem.targetId)">
|
||||||
<u-avatar size="40" shape="square" :src="contact(friendItem.targetId).portraitUrl" />
|
<u-avatar class="avatar-img" size="40" shape="square" :src="contact(friendItem.targetId).portraitUrl" />
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<view class="name">{{ contact(friendItem.targetId).name }}</view>
|
<view class="name">{{ contact(friendItem.targetId).name }}</view>
|
||||||
<view class="address">{{ friendItem.address }}</view>
|
<view class="address">hash:{{ friendItem.address }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-index-item>
|
</u-index-item>
|
||||||
@@ -119,10 +118,13 @@
|
|||||||
// 好友列表
|
// 好友列表
|
||||||
.friend-flex {
|
.friend-flex {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 20rpx $padding;
|
padding: 24rpx $padding;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
.avatar-img{
|
||||||
|
box-shadow: 0 0 20rpx rgba($color: $main-color, $alpha: 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
.info {
|
.info {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@@ -137,7 +139,8 @@
|
|||||||
|
|
||||||
.address {
|
.address {
|
||||||
color: $text-gray-m;
|
color: $text-gray-m;
|
||||||
font-size: $title-size-m - 5;
|
font-size: $title-size-m - 3;
|
||||||
|
padding-top: 10rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
bg-color="#fff"></u-avatar>
|
bg-color="#fff"></u-avatar>
|
||||||
<view class="info-text">
|
<view class="info-text">
|
||||||
<view class="nickname">{{ userInfo.name }}</view>
|
<view class="nickname">{{ userInfo.name }}</view>
|
||||||
<view class="address" @longpress="copyAddress">地址:{{ userInfo.address }}</view>
|
<view class="address" @longpress="copyAddress">Hash:{{ userInfo.address }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 用户资料 -->
|
<!-- 用户资料 -->
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<block v-if="userInfo.is_friend">
|
<block v-if="userInfo.friendship ==='accepted'">
|
||||||
<view class="info-btns">
|
<view class="info-btns">
|
||||||
<view class="item u-border-bottom" @click="setRemark">
|
<view class="item u-border-bottom" @click="setRemark">
|
||||||
<label>设置备注</label>
|
<label>设置备注</label>
|
||||||
@@ -83,7 +83,11 @@
|
|||||||
} from '@/apis/interfaces/im.js'
|
} from '@/apis/interfaces/im.js'
|
||||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||||
import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index'
|
import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index'
|
||||||
|
// friendship: '' 没有好友关系
|
||||||
|
// accepted 好友
|
||||||
|
// pending 申请中
|
||||||
|
// denied 拒绝
|
||||||
|
// blocked 黑名单
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -108,6 +112,7 @@
|
|||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
this.targetId = e.targetId
|
this.targetId = e.targetId
|
||||||
getFriendInfo(e.targetId).then(res => {
|
getFriendInfo(e.targetId).then(res => {
|
||||||
|
console.log(res, "获取朋友的信息")
|
||||||
this.userInfo = res
|
this.userInfo = res
|
||||||
// 获取到用户信息之后,去检查一下要不要更新
|
// 获取到用户信息之后,去检查一下要不要更新
|
||||||
this.$store.dispatch('updateContact', res)
|
this.$store.dispatch('updateContact', res)
|
||||||
@@ -198,17 +203,23 @@
|
|||||||
toBeFriend() {
|
toBeFriend() {
|
||||||
pedingFriend(this.targetId).then(res => {
|
pedingFriend(this.targetId).then(res => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '申请成功',
|
title: ` 申请成功,等待审核 `,
|
||||||
icon: 'none'
|
icon: 'none',
|
||||||
|
duration: 3000,
|
||||||
|
mask: true
|
||||||
});
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
// if(err.status_code === 6001){
|
||||||
|
// this.userInfo.friendship = 'accepted'
|
||||||
|
// }else{
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'error',
|
icon: 'error',
|
||||||
title: err.message,
|
title: err.message,
|
||||||
duration: 2000
|
duration: 2000,
|
||||||
|
mask: true
|
||||||
})
|
})
|
||||||
|
// }
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
singleCall(e) {
|
singleCall(e) {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
searchFriend,
|
searchFriend,
|
||||||
pedingFriend
|
pedingFriend
|
||||||
} from '@/apis/interfaces/im.js';
|
} from '@/apis/interfaces/im.js';
|
||||||
import applyFriend from '../components/friendApplyList.vue';
|
import applyFriend from '../components/friendSearchList.vue';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
applyFriend
|
applyFriend
|
||||||
@@ -45,9 +45,15 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
search() {
|
search() {
|
||||||
|
// friendship: '' 没有好友关系
|
||||||
|
// accepted 好友
|
||||||
|
// pending 申请中
|
||||||
|
// denied 拒绝
|
||||||
|
// blocked 黑名单
|
||||||
searchFriend(this.searchValue)
|
searchFriend(this.searchValue)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.searchResult = res;
|
this.searchResult = res;
|
||||||
|
console.log(res)
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -57,8 +63,9 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
action(e) {
|
action(e) {
|
||||||
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/im/friends/info?targetId=' + e.item.userId
|
url: '/pages/im/friends/info?targetId=' + e.item.targetId
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user