[同步数据]

This commit is contained in:
2022-01-27 17:40:41 +08:00
parent 4d5d595329
commit e147e1c09c

View File

@@ -2,12 +2,7 @@
<view class="content">
<!-- 用户信息 -->
<view class="info-flex">
<u-avatar
:src="userInfo.portraitUrl"
shape="square"
size="50"
bg-color="#fff"
></u-avatar>
<u-avatar :src="userInfo.portraitUrl" shape="square" size="50" bg-color="#fff" />
<view class="info-text">
<view class="nickname">{{ userInfo.name }}</view>
<view class="address" @longpress="copyAddress">地址{{ userInfo.address }}</view>
@@ -27,11 +22,11 @@
<view class="info-btns">
<view class="item" @click="setRemark">
<label>设置备注</label>
<u-icon name="arrow-right" color="#999" size="16"></u-icon>
<u-icon name="arrow-right" color="#999" size="16" />
</view>
<view class="item" @click="setRemark">
<label>设置标签</label>
<u-icon name="arrow-right" color="#999" size="16"></u-icon>
<u-icon name="arrow-right" color="#999" size="16" />
</view>
<view class="item">
<label>聊天免打扰</label>
@@ -44,21 +39,15 @@
</view>
<view class="footer">
<view class="footer-item" @click="deleteFriend">
<view class="icon">
<u-icon class="icon-u" name="close-circle-fill" color="#fff" size="26"></u-icon>
</view>
<view class="icon"><u-icon class="icon-u" name="close-circle-fill" color="#fff" size="26" /></view>
<view class="text">删除好友</view>
</view>
<view class="footer-item" @click="toPrivate">
<view class="icon">
<u-icon class="icon-u" name="chat-fill" color="#fff" size="26"></u-icon>
</view>
<view class="icon"><u-icon class="icon-u" name="chat-fill" color="#fff" size="26" /></view>
<view class="text">发送消息</view>
</view>
<view class="footer-item" @click="toPrivate">
<view class="icon">
<u-icon class="icon-u" name="camera-fill" color="#fff" size="26"></u-icon>
</view>
<view class="icon"><u-icon class="icon-u" name="camera-fill" color="#fff" size="26" /></view>
<view class="text">视频通话</view>
</view>
</view>
@@ -66,9 +55,7 @@
<block v-else>
<view class="footer">
<view class="footer-item" @click="toBeFriend">
<view class="icon">
<u-icon class="icon-u" name="plus-people-fill" color="#fff" size="26"></u-icon>
</view>
<view class="icon"><u-icon class="icon-u" name="plus-people-fill" color="#fff" size="26" /></view>
<view class="text">申请好友</view>
</view>
</view>
@@ -77,12 +64,8 @@
</template>
<script>
import {
getFriendInfo,
pedingFriend,
deleteFriend
} from '@/apis/interfaces/im.js'
import * as RongIMLib from "@/uni_modules/RongCloud-IMWrapper/js_sdk/index"
import { getFriendInfo, pedingFriend, deleteFriend } from '@/apis/interfaces/im.js';
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index';
export default {
data() {
@@ -93,29 +76,24 @@
isTop: false,
block: false,
conversationType: 1
}
};
},
onLoad(e) {
this.targetId = e.targetId
this.targetId = e.targetId;
getFriendInfo(e.targetId).then(res => {
this.userInfo = 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, ({
code,
conversation
}) => {
});
});
RongIMLib.getConversationNotificationStatus(this.conversationType, this.targetId, ({ status }) => {
this.status = !Boolean(status);
});
RongIMLib.getConversation(this.conversationType, this.targetId, ({ code, conversation }) => {
if (code == 0) {
this.isTop = conversation.isTop
this.isTop = conversation.isTop;
}
})
});
},
methods: {
copyAddress() {
@@ -125,78 +103,74 @@
uni.showToast({
icon: 'none',
title: '复制区块链成功'
})
});
}
})
});
},
toPrivate() {
uni.redirectTo({
url: '/pages/im/private/index?conversationType=1&targetId=' + this.targetId
})
});
},
setRemark() {
uni.showToast({
title: '开发中',
icon: 'none'
})
});
},
deleteFriend() {
uni.showModal({
title: '删除确认',
content: '确认删除后不可恢复',
success: (e) => {
success: e => {
if (e.confirm) {
deleteFriend(this.targetId).then(res => {
// 删除聊天记录
RongIMLib.deleteMessages(1, this.targetId)
RongIMLib.removeConversation(1, this.targetId)
RongIMLib.deleteMessages(1, this.targetId);
RongIMLib.removeConversation(1, this.targetId);
uni.showToast({
icon: 'none',
title: '好友删除成功',
success() {
uni.switchTab({
url: '/pages/im/index'
})
});
}
})
})
});
});
}
}
})
});
},
setStatus() {
RongIMLib.setConversationNotificationStatus(this.conversationType, this.targetId, this.status, ({
status
}) => {
this.status = !Boolean(status)
})
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() {
RongIMLib.setConversationToTop(this.conversationType, this.targetId, this.isTop, res => {
RongIMLib.getConversation(this.conversationType, this.targetId, ({ conversation }) => {
this.isTop = conversation.isTop;
});
});
},
setBlock() {},
// 申请好友
toBeFriend() {
pedingFriend(this.targetId).then(res => {
pedingFriend(this.targetId)
.then(res => {
uni.showToast({
title: '申请成功',
icon: "none"
icon: 'none'
});
})
}).catch(err => {
.catch(err => {
uni.showToast({
icon: 'error',
title: err.message,
duration: 2000
})
})
});
});
}
}
};
@@ -298,5 +272,4 @@
}
}
}
</style>