userDetail.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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="url" 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: require('@/static/image/huge.jpg'),
  42. $url:''
  43. }
  44. },
  45. methods: {
  46. showSearch() {
  47. this.$u.route({
  48. url:"pages/search/search",
  49. params: {searchType: 3, chatId:this.chatId}
  50. })
  51. },
  52. getUserInfo(){
  53. this.$socket.getUserById(this.chatObj.chatId, res=> {
  54. this.userInfo = res.user
  55. this.url = this.$url + res.user.avatar
  56. })
  57. },
  58. showAddGroupUser(){
  59. this.$u.route({
  60. url: 'pages/chat/addGroupUser',
  61. params: { chatId: this.chatId, chatName: this.chatName, type: 1 }
  62. });
  63. },
  64. chooseImg() {
  65. this.$u.route({
  66. url: 'components/u-avatar-cropper/u-avatar-cropper',
  67. params: {
  68. destWidth: uni.upx2px(750),
  69. rectWidth: uni.upx2px(500),
  70. fileType: 'jpg'
  71. }
  72. });
  73. },
  74. deleteFriendMsg(){
  75. this.$socket.deleteFriendMsg(this.userData.user.operId, this.chatId, res=> {
  76. if (res.success) {
  77. uni.showModal({
  78. title: '成功',
  79. showCancel: false
  80. });
  81. } else {
  82. uni.showModal({
  83. title: '失败',
  84. showCancel: false
  85. });
  86. }
  87. })
  88. },
  89. },
  90. onLoad(option) {
  91. },
  92. onShow() {
  93. },
  94. onReady() {
  95. this.getUserInfo()
  96. }
  97. }
  98. </script>
  99. <style lang="scss" scoped>
  100. .header{
  101. display: flex;
  102. justify-content: space-between;
  103. align-items: center;
  104. padding: 60rpx 38rpx;
  105. background-color: #ffffff;
  106. &_left{
  107. display: flex;
  108. align-items: center;
  109. &_content{
  110. padding-left: 20rpx;
  111. &_name{
  112. font-weight: bold;
  113. }
  114. &_number{
  115. color:#969799 ;
  116. font-size: 26rpx;
  117. }
  118. }
  119. }
  120. &_right{
  121. font-size: 28rpx;
  122. color: #969799;
  123. }
  124. image {
  125. width: 100rpx;
  126. height: 100rpx;
  127. border-radius: 6rpx;
  128. }
  129. }
  130. .status_bar {
  131. height: var(--status-bar-height);
  132. width: 100%;
  133. }
  134. </style>