好友资料页面

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

View File

@@ -4,48 +4,129 @@
<view class="user-info"> <view class="user-info">
<u-avatar :src="userInfo.portraitUrl" size="100" /> <u-avatar :src="userInfo.portraitUrl" size="100" />
<view class="nickname">{{ userInfo.name }}</view> <view class="nickname">{{ userInfo.username }}</view>
<!-- <view class="sex"> <view class="gender">
<u-tag text="" color="#fff" borderColor="#5db6ee" size="mini" icon="man" bgColor="#5db6ee"></u-tag> <u-tag text="保密" v-if="userInfo.gender === 0" color="#fff" borderColor="#999" size="mini"
<u-tag text="女" color="#fff" borderColor="#e4867a" size="mini" icon="woman" bgColor="#e4867a"></u-tag> bgColor="#999"></u-tag>
</view> --> <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 class="address">{{ userInfo.address }}</view>
<!-- 通过/拒绝/已通过/已拒绝 -->
</view> </view>
<!-- <view class="user-lists">
<view class="user-lists-item"> <view class="actions">
<label>地区</label> <u-cell-group>
<text>黑龙江 哈尔滨</text> <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> -->
<!-- 发送消息 -->
<view class="info-footer"><button class="open-btn" @click="toPrivate">发送消息</button></view>
</view> </view>
</template> </template>
<script> <script>
import { getUserInfo } from '@/apis/interfaces/im.js'; import {
getUserInfo
} from '@/apis/interfaces/im.js'
import * as RongIMLib from '@rongcloud/imlib-uni'
export default { export default {
data() { data() {
return { return {
targetId: '', targetId: '',
userInfo: {} userInfo: {},
status: false, // 0 是免打扰1是正常通知
isTop: false,
block: false,
conversationType: 1
}; };
}, },
mounted() { onLoad(e) {
getUserInfo(this.$Route.query.id).then(res => { this.targetId = e.targetId
this.userInfo = res; getUserInfo(e.targetId).then(res => {
console.log(res);
this.userInfo = res
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: res.name 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: { methods: {
toPrivate() { toPrivate() {
uni.redirectTo({ uni.redirectTo({
url: '/pages/im/private/index?conversationType=1&targetId=' + this.targetId 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; background: $window-color;
} }
.actions {
background: white;
margin-top: $padding / 2;
}
// 用户信息 // 用户信息
.user-info { .user-info {
padding: $padding * 3 $padding; padding: $padding 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
@@ -77,7 +163,7 @@ export default {
color: $text-gray; color: $text-gray;
} }
.sex { .gender {
padding-top: $padding/2; padding-top: $padding/2;
text { text {
@@ -113,26 +199,11 @@ export default {
} }
} }
// 发送消息 .footer {
.info-footer { padding: $padding / 2;
padding: $padding;
width: 100%;
box-sizing: border-box;
.open-btn { .u-button {
width: 100%; margin-top: $padding / 2;
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;
}
} }
} }
</style> </style>

View File

@@ -10,53 +10,71 @@
<view class="pending"> <view class="pending">
<u-sticky> <u-sticky>
<view class="header-search" @click="$Router.push({ name: 'SearchFriend' })"> <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> </view>
</u-sticky> </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> <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> <span>暂无申请记录~</span>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { getPedings, resolveFriend, rejectFriend } from '@/apis/interfaces/im.js'; import {
import applyFriend from '@/components/friend-apply-reject-agree'; 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 { export default {
components: { components: {
applyFriend applyFriend
}, },
data() { data() {
return { return {
// pedings: [{userId:10990,name:'张三'}]
pedings: [] pedings: []
}; }
}, },
onLoad() { onLoad() {
this.getPeddingList(); this.getPeddingList()
}, },
methods: { methods: {
// 操作同意或拒绝 // 操作同意或拒绝
action(e) { action(e) {
let url = e.type === 'agree' ? resolveFriend : rejectFriend; let url = e.type === 'agree' ? resolveFriend : rejectFriend
uni.showModal({ uni.showModal({
title: e.type === 'agree' ? '通过' : '拒绝', title: e.type === 'agree' ? '通过' : '拒绝',
content: e.type === 'agree' ? '通过后即可与该用户畅所欲言' : '拒绝后将不会收到该用户发来信息', content: e.type === 'agree' ? '通过后即可与该用户畅所欲言' : '拒绝后将不会收到该用户发来信息',
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
url(e.item.userId).then(res => { url(e.item.userId).then(res => {
this.getPeddingList(); this.getPeddingList()
}); })
} }
} }
}); })
}, },
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 => { getPedings().then(res => {
this.pedings = res; console.log(res)
}); this.pedings = res
})
} }
} }
}; };
@@ -67,6 +85,7 @@ export default {
padding: $padding/2 $padding; padding: $padding/2 $padding;
background: $window-color; background: $window-color;
} }
.no-lists { .no-lists {
padding-top: $padding * 3; padding-top: $padding * 3;
display: flex; display: flex;
@@ -76,6 +95,7 @@ export default {
box-sizing: border-box; box-sizing: border-box;
font-size: $title-size-m; font-size: $title-size-m;
color: $text-gray-m; color: $text-gray-m;
span { span {
padding-top: $padding; padding-top: $padding;
} }