好友资料页面

This commit is contained in:
2022-01-26 11:01:42 +08:00
parent 33ee2ebd55
commit 5b3f036ed0
3 changed files with 306 additions and 225 deletions

View File

@@ -1,6 +1,5 @@
{
"pages": [
{
"pages": [{
"path": "pages/index/index",
"name": "Index",
"style": {
@@ -158,15 +157,13 @@
"app-plus": {
"titleNView": {
"backgroundColor": "#FFFFFF",
"buttons": [
{
"buttons": [{
"float": "right",
"text": "\ue603",
"fontSrc": "/static/iconfont.ttf",
"color": "#000",
"fontSize": "20px"
}
]
}]
}
}
}
@@ -386,14 +383,12 @@
"app-plus": {
"titleNView": {
"type": "default",
"buttons": [
{
"buttons": [{
"float": "right",
"fontSrc": "/static/iconfont.ttf",
"text": "\ue607",
"fontSize": "20px"
}
]
}]
}
}
}
@@ -413,14 +408,12 @@
"app-plus": {
"titleNView": {
"type": "default",
"buttons": [
{
"buttons": [{
"float": "right",
"fontSrc": "/static/iconfont.ttf",
"text": "\ue603",
"fontSize": "20px"
}
]
}]
}
}
}
@@ -446,7 +439,7 @@
"name": "imFriendsInfo",
"style": {
"navigationBarTitleText": "好友资料",
"navigationBarBackgroundColor":"#F3F6FB"
"navigationBarBackgroundColor": "#FFFFFF"
}
},
{
@@ -509,16 +502,14 @@
"titleNView": {
"backgroundImage": "linear-gradient(to right, #34ce98, #22aa98)",
"type": "transparent",
"buttons": [
{
"buttons": [{
"float": "right",
"text": "\ue607",
"fontSrc": "/static/iconfont.ttf",
"color": "#FFF",
"fontSize": "20px",
"background": "rgba(0,0,0,0)"
}
],
}],
"backButton": {
"background": "rgba(0,0,0,0)"
}
@@ -580,8 +571,7 @@
"tabBar": {
"borderStyle": "white",
"selectedColor": "#34CE98",
"list": [
{
"list": [{
"iconPath": "static/tabBar/tabBar_00.png",
"selectedIconPath": "static/tabBar/tabBar_show_00.png",
"pagePath": "pages/index/index",

View File

@@ -4,48 +4,129 @@
<view class="user-info">
<u-avatar :src="userInfo.portraitUrl" size="100" />
<view class="nickname">{{ userInfo.name }}</view>
<!-- <view class="sex">
<u-tag text="" color="#fff" borderColor="#5db6ee" size="mini" icon="man" bgColor="#5db6ee"></u-tag>
<u-tag text="女" color="#fff" borderColor="#e4867a" size="mini" icon="woman" bgColor="#e4867a"></u-tag>
</view> -->
<view class="nickname">{{ userInfo.username }}</view>
<view class="gender">
<u-tag text="保密" v-if="userInfo.gender === 0" color="#fff" borderColor="#999" size="mini"
bgColor="#999"></u-tag>
<u-tag text="男" v-if="userInfo.gender === 1" color="#fff" borderColor="#5db6ee" size="mini" icon="man"
bgColor="#5db6ee"></u-tag>
<u-tag text="女" v-if="userInfo.gender === 2" color="#fff" borderColor="#e4867a" size="mini" icon="woman"
bgColor="#e4867a"></u-tag>
</view>
<view class="address">{{ userInfo.address }}</view>
<!-- 通过/拒绝/已通过/已拒绝 -->
</view>
<!-- <view class="user-lists">
<view class="user-lists-item">
<label>地区</label>
<text>黑龙江 哈尔滨</text>
<view class="actions">
<u-cell-group>
<u-cell isLink title="设置备注" @click="setRemark"></u-cell>
<u-cell isLink title="设置标签" @click="setRemark"></u-cell>
<u-cell title="聊天免打扰">
<u-switch slot="value" size="18" v-model="status" activeColor="#34CE98" @change="setStatus">
</u-switch>
</u-cell>
<u-cell title="聊天置顶">
<u-switch slot="value" size="18" v-model="isTop" activeColor="#34CE98" @change="setTop">
</u-switch>
</u-cell>
<!-- <u-cell title="加入黑名单">
<u-switch slot="value" size="18" v-model="block" activeColor="#34CE98" @change="setBlock"></u-switch>
</u-cell> -->
<u-cell isLink titleStyle="color: red" title="删除好友" @click="deleteFriend"></u-cell>
</u-cell-group>
</view>
<view class="footer">
<u-button @click="toPrivate()">
<u-icon name="chat" size="20" /> 发送消息
</u-button>
<u-button @click="toPrivate()">
<u-icon name="mic" size="20" /> 音视频通话
</u-button>
</view>
</view> -->
<!-- 发送消息 -->
<view class="info-footer"><button class="open-btn" @click="toPrivate">发送消息</button></view>
</view>
</template>
<script>
import { getUserInfo } from '@/apis/interfaces/im.js';
import {
getUserInfo
} from '@/apis/interfaces/im.js'
import * as RongIMLib from '@rongcloud/imlib-uni'
export default {
data() {
return {
targetId: '',
userInfo: {}
userInfo: {},
status: false, // 0 是免打扰1是正常通知
isTop: false,
block: false,
conversationType: 1
};
},
mounted() {
getUserInfo(this.$Route.query.id).then(res => {
this.userInfo = res;
onLoad(e) {
this.targetId = e.targetId
getUserInfo(e.targetId).then(res => {
console.log(res);
this.userInfo = res
uni.setNavigationBarTitle({
title: res.name
});
});
})
})
RongIMLib.getConversationNotificationStatus(this.conversationType, this.targetId, ({
status
}) => {
this.status = !Boolean(status)
})
RongIMLib.getConversation(this.conversationType, this.targetId, ({
conversation
}) => {
this.isTop = conversation.isTop
})
},
methods: {
toPrivate() {
uni.redirectTo({
url: '/pages/im/private/index?conversationType=1&targetId=' + this.targetId
});
})
},
setRemark() {
uni.showToast({
icon: 'none',
title: '开发中'
})
},
deleteFriend() {
uni.showModal({
title: '删除确认',
content: '确认删除后不可恢复',
success: (e) => {
if (e.confirm) {
uni.showToast({
icon: 'none',
title: '开发中'
})
}
}
})
},
setStatus() {
RongIMLib.setConversationNotificationStatus(this.conversationType, this.targetId, this.status, ({
status
}) => {
this.status = !Boolean(status)
})
},
setTop() {
RongIMLib.setConversationToTop(this.conversationType, this.targetId, this.isTop, (res) => {
RongIMLib.getConversation(this.conversationType, this.targetId, ({
conversation
}) => {
this.isTop = conversation.isTop
})
})
},
setBlock() {
}
}
};
@@ -57,9 +138,14 @@ export default {
background: $window-color;
}
.actions {
background: white;
margin-top: $padding / 2;
}
// 用户信息
.user-info {
padding: $padding * 3 $padding;
padding: $padding 0;
display: flex;
flex-direction: column;
justify-content: center;
@@ -77,7 +163,7 @@ export default {
color: $text-gray;
}
.sex {
.gender {
padding-top: $padding/2;
text {
@@ -113,26 +199,11 @@ export default {
}
}
// 发送消息
.info-footer {
padding: $padding;
width: 100%;
box-sizing: border-box;
.footer {
padding: $padding / 2;
.open-btn {
width: 100%;
height: 90rpx;
line-height: 90rpx;
background: $main-color;
border-radius: $radius-lg;
padding: 0;
margin: 0;
color: white;
font-size: $title-size;
&::after {
display: none;
}
.u-button {
margin-top: $padding / 2;
}
}
</style>

View File

@@ -10,53 +10,71 @@
<view class="pending">
<u-sticky>
<view class="header-search" @click="$Router.push({ name: 'SearchFriend' })">
<u-search placeholder="输入手机号码搜索" height="74" searchIcon="search" inputAlign="center" bgColor="white" :disabled="true" :show-action="false" />
<u-search placeholder="输入手机号码搜索" height="74" searchIcon="search" inputAlign="center" bgColor="white"
:disabled="true" :show-action="false" />
</view>
</u-sticky>
<block v-if="pedings.length > 0"><applyFriend :lists="pedings" :isAgree="true" :isReject="false" @action="action" /></block>
<block v-if="pedings.length > 0">
<applyFriend :lists="pedings" :isAgree="true" :isReject="false" @action="action" />
</block>
<view class="no-lists" v-else>
<u-image class="cover" radius="4" width="400rpx" height="400rpx" :src="require('@/static/imgs/no-friend.png')" :lazy-load="true" />
<u-image class="cover" radius="4" width="400rpx" height="400rpx"
:src="require('@/static/imgs/no-friend.png')" :lazy-load="true" />
<span>暂无申请记录~</span>
</view>
</view>
</template>
<script>
import { getPedings, resolveFriend, rejectFriend } from '@/apis/interfaces/im.js';
import applyFriend from '@/components/friend-apply-reject-agree';
import {
getPedings,
resolveFriend,
rejectFriend
} from '@/apis/interfaces/im.js';
import * as RongIMLib from '@rongcloud/imlib-uni'
import applyFriend from '@/components/friend-apply-reject-agree'
export default {
components: {
applyFriend
},
data() {
return {
// pedings: [{userId:10990,name:'张三'}]
pedings: []
};
}
},
onLoad() {
this.getPeddingList();
this.getPeddingList()
},
methods: {
// 操作同意或拒绝
action(e) {
let url = e.type === 'agree' ? resolveFriend : rejectFriend;
let url = e.type === 'agree' ? resolveFriend : rejectFriend
uni.showModal({
title: e.type === 'agree' ? '通过' : '拒绝',
content: e.type === 'agree' ? '通过后即可与该用户畅所欲言' : '拒绝后将不会收到该用户发来信息',
success: res => {
if (res.confirm) {
url(e.item.userId).then(res => {
this.getPeddingList();
});
this.getPeddingList()
})
}
}
});
})
},
getPeddingList() {
// 获取系统中的好友关系会话列表
// RongIMLib.getConversationList([RongIMLib.ConversationType.SYSTEM], 50, 0, (res) => {
// if (res.code === 0) {
// this.pedings = res.conversations.filter((item) => {
// return item.objectName == RongIMLib.ObjectName.ContactNotification
// })
// }
// })
getPedings().then(res => {
this.pedings = res;
});
console.log(res)
this.pedings = res
})
}
}
};
@@ -67,6 +85,7 @@ export default {
padding: $padding/2 $padding;
background: $window-color;
}
.no-lists {
padding-top: $padding * 3;
display: flex;
@@ -76,6 +95,7 @@ export default {
box-sizing: border-box;
font-size: $title-size-m;
color: $text-gray-m;
span {
padding-top: $padding;
}