userDetail.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view class="content">
  3. <u-navbar :is-back="true" title="好友聊天详情" :background="{ background: '#F6F7F8' }" title-color="#404133" :border-bottom="false" z-index="1001">
  4. </u-navbar>
  5. <view style="background-color: #FFFFFF;padding-left: 30rpx;">
  6. <u-grid :col="6" :border="false">
  7. <u-grid-item>
  8. <u-avatar :src="userInfo.avatar" mode="square"></u-avatar>
  9. <view class="grid-text">{{userInfo.nickName}}</view>
  10. </u-grid-item>
  11. <u-grid-item @click="showAddGroupUser">
  12. <u-icon name="plus" size="40"></u-icon>
  13. </u-grid-item>
  14. </u-grid>
  15. </view>
  16. <view style="height: 10rpx;"></view>
  17. <u-cell-group>
  18. <u-cell-item title="查看聊天内容" @click="showSearch" :title-style="{ marginLeft: '10rpx' }">
  19. </u-cell-item>
  20. </u-cell-group>
  21. <view style="height: 10rpx;"></view>
  22. <u-cell-group>
  23. <u-cell-item title="设置聊天背景" :title-style="{ marginLeft: '10rpx' }" @click="chooseImg">
  24. </u-cell-item>
  25. </u-cell-group>
  26. <view style="height: 10rpx;"></view>
  27. <u-cell-group>
  28. <u-cell-item :title-style="{ marginLeft: '10rpx' }" @click="deleteFriendMsg" :arrow="false">
  29. <view style="text-align: center; color: red;">清空聊天记录</view>
  30. </u-cell-item>
  31. </u-cell-group>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. chatId:'',
  39. chatName:'',
  40. userInfo:{},
  41. $url:''
  42. }
  43. },
  44. methods: {
  45. showSearch() {
  46. this.$u.route({
  47. url:"pageD/search/search",
  48. params: {searchType: 3, chatId:this.chatId}
  49. })
  50. },
  51. getUserInfo(){
  52. this.$socket.getUserById(this.chatObj.chatId, res=> {
  53. this.userInfo = res.user
  54. this.url = res.user.avatar
  55. })
  56. },
  57. showAddGroupUser(){
  58. this.$u.route({
  59. url: 'pageC/chat/addGroupUser',
  60. params: { chatId: this.chatId, chatName: this.chatName, type: 1 }
  61. });
  62. },
  63. chooseImg() {
  64. this.$u.route({
  65. url: 'components/u-avatar-cropper/u-avatar-cropper',
  66. params: {
  67. destWidth: uni.upx2px(750),
  68. rectWidth: uni.upx2px(500),
  69. fileType: 'jpg'
  70. }
  71. });
  72. },
  73. deleteFriendMsg(){
  74. this.$socket.deleteFriendMsg(this.userData.user.operId, this.chatId, res=> {
  75. if (res.success) {
  76. uni.showModal({
  77. title: '成功',
  78. showCancel: false
  79. });
  80. } else {
  81. uni.showModal({
  82. title: '失败',
  83. showCancel: false
  84. });
  85. }
  86. })
  87. },
  88. },
  89. onLoad(option) {
  90. },
  91. onShow() {
  92. },
  93. onReady() {
  94. this.getUserInfo()
  95. }
  96. }
  97. </script>
  98. <style lang="scss" scoped>
  99. .header{
  100. display: flex;
  101. justify-content: space-between;
  102. align-items: center;
  103. padding: 60rpx 38rpx;
  104. background-color: #ffffff;
  105. &_left{
  106. display: flex;
  107. align-items: center;
  108. &_content{
  109. padding-left: 20rpx;
  110. &_name{
  111. font-weight: bold;
  112. }
  113. &_number{
  114. color:#969799 ;
  115. font-size: 26rpx;
  116. }
  117. }
  118. }
  119. &_right{
  120. font-size: 28rpx;
  121. color: #969799;
  122. }
  123. image {
  124. width: 100rpx;
  125. height: 100rpx;
  126. border-radius: 6rpx;
  127. }
  128. }
  129. .status_bar {
  130. height: var(--status-bar-height);
  131. width: 100%;
  132. }
  133. </style>