businessCard.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <view>
  3. <view class="userinfo">
  4. <u-avatar :src="userInfo.avatar" mode="square" size="110" @tap="previewImg(url)"></u-avatar>
  5. <view class="userinfo-desc">
  6. <view>
  7. <view class="userinfo-desc-name">{{userInfo.nickName||userInfo.realname }}</view>
  8. <u-tag v-if="userInfo.traderFlag == 1" style="margin-right: 10px;" text="粮商" size ="mini"type="info" mode="plain"/>
  9. <u-tag v-if="userInfo.farmerFlag == 1" style="margin-right: 10px;" text="粮农" size ="mini"type="info" mode="plain"/>
  10. <u-tag v-if="userInfo.driverFlag == 1" style="margin-right: 10px;" text="物流" size ="mini"type="info" mode="plain"/>
  11. </view>
  12. <!-- <view class="userinfo-desc-gray">积分:{{userInfo.money}}</view> -->
  13. </view>
  14. </view>
  15. <view class="perch"></view>
  16. <u-cell-group v-if="1 == source">
  17. <!-- <u-cell-item title="粮友圈" label="暂不支持查看粮友圈" hover-class="none" :title-style="{ marginLeft: '10rpx' }"></u-cell-item> -->
  18. <!-- <u-cell-item title="更多信息" :title-style="{ marginLeft: '10rpx' }" @click="linkToMoreInfoMation"></u-cell-item> -->
  19. </u-cell-group>
  20. <view class="" v-if="!isItMe">
  21. <view class="perch"></view>
  22. <u-cell-group v-if="0 == source || 2 == source">
  23. <!-- <u-cell-item title=" " @click="toAddUser" :arrow="false" :center="true" :title-style="{ marginLeft: '10rpx' }">
  24. <view style="text-align: center;">添加到通讯录</view>
  25. </u-cell-item> -->
  26. </u-cell-group>
  27. <u-cell-group v-else-if="1 == source">
  28. <u-cell-item title="发消息" :arrow="false" :center="true" :title-style="{ marginLeft: '10rpx' }" @click="linkToChat">
  29. <u-icon slot="icon" name="chat" color="#36648B" size="34"></u-icon>
  30. </u-cell-item>
  31. </u-cell-group>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. userInfo:{
  40. },
  41. isItMe:false,
  42. source:'',
  43. $url:''
  44. }
  45. },
  46. methods: {
  47. linkToChat(){
  48. let chat = {
  49. chatId: this.userInfo.id,
  50. chatType:0,
  51. chatName:this.userInfo.nickName
  52. }
  53. this.$u.vuex('chatObj',chat);
  54. this.$u.route({
  55. url:"pageC/chat/chat"
  56. });
  57. },
  58. previewImg(urls){
  59. uni.previewImage({urls:[urls]})
  60. },
  61. linkToMoreInfoMation(){
  62. this.$u.route({
  63. url:"pageD/moreInforMation/moreInforMation",
  64. params:{ signature:this.userInfo.signature }
  65. })
  66. },
  67. toAddUser(){
  68. this.$socket.insertFriend(this.userData.user.operId, this.userInfo.id, res => {
  69. if (res.success) {
  70. uni.showModal({
  71. title: '请求已发送',
  72. showCancel: false
  73. });
  74. }
  75. });
  76. },
  77. },
  78. onLoad({ id, nickName, source }) {
  79. this.source = source
  80. if(0 == source){
  81. let _this = this
  82. this.$socket.findFriendRequestList(nickName, res => {
  83. if (res.success) {
  84. res.userList.forEach(function(element) {
  85. if(element.id == id){
  86. _this.userInfo = element
  87. }
  88. });
  89. }
  90. });
  91. }else if(2 == source){
  92. this.$socket.getUserById(id, res=>{
  93. this.userInfo = res.user
  94. })
  95. } else {
  96. if(id == this.userData.user.operId){
  97. this.userInfo = this.userData.user;
  98. this.isItMe = true;
  99. return;
  100. }
  101. for(let i in this.firendItem){
  102. let members = this.firendItem[i].members
  103. for(let j in members){
  104. if (members[j].id==id){
  105. this.userInfo = members[j]
  106. }
  107. }
  108. }
  109. }
  110. }
  111. }
  112. </script>
  113. <style scoped lang="scss">
  114. .perch{
  115. height: 10rpx;
  116. }
  117. .userinfo{
  118. display: flex;
  119. justify-content: flex-start;
  120. align-items: flex-start;
  121. padding: 20rpx 30rpx 40rpx 40rpx;
  122. background-color: #FFFFFF;
  123. .img{
  124. display: block;
  125. width: 110rpx;
  126. height: 110rpx;
  127. border-radius: 10rpx;
  128. }
  129. &-desc{
  130. padding-left: 30rpx;
  131. &-name{
  132. font-weight: bold;
  133. font-size: 36rpx;
  134. transform: translateY(-10rpx);
  135. }
  136. &-gray{
  137. color: $u-tips-color;
  138. font-size: 29rpx;
  139. }
  140. }
  141. }
  142. </style>