userShow.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <view>
  3. <uni-nav-bar statusBar backgroundColor="#fff" fixed title="查看好友" left-icon="left" @clickLeft="utils.navigateBack()">
  4. </uni-nav-bar>
  5. <view class="info fx-r fd-bc" v-if="data != null">
  6. <view class="avatar">
  7. <image :src="data.avatar == '' ? '/static/img/logo.png' : data.avatar" mode="aspectFill"></image>
  8. </view>
  9. <view class="user-info">
  10. <view class="nickname fx-r fx-bc">
  11. <image src="../../../static/img/sex.png" mode="widthFix"></image>
  12. {{data.friend != null ? (data.friend.remark || data.nickname) : data.nickname}}
  13. </view>
  14. <view class="tag-nickname" v-if="data.friend != null && data.friend.remark != ''" >昵称:{{data.nickname}}</view>
  15. <view class="info-name">编码:{{data.number_code}}</view>
  16. <view class="info-name">地区:{{data.region}}</view>
  17. </view>
  18. </view>
  19. <view class="info-qm">
  20. <view class="label">个性签名</view>
  21. <view class="mono">{{data.signature}}</view>
  22. </view>
  23. <view class="list-item" v-if="data.friend != null">
  24. <view class="item fx-r fx-bc fx-ac" @tap="tapOpen" :data-url="'noteinfo?usercode=' + usercode">
  25. <view class="label">备注信息</view>
  26. <view class="fx-g1"></view>
  27. <view class="tag-label">{{data.friend.remark}}</view>
  28. <image class="pve" src="/static/img/next.png" mode="widthFix"></image>
  29. </view>
  30. <view class="item fx-r fx-bc fx-ac" @tap="tapPhone">
  31. <view class="label">电话号码</view>
  32. <view class="fx-g1"></view>
  33. <view class="tag-label" v-for="item in isPhone(data.friend.phone)">
  34. {{item}}
  35. </view>
  36. <image class="pve" src="/static/img/next.png" mode="widthFix"></image>
  37. </view>
  38. </view>
  39. <view class="list-item"v-if="data.friend != null" @tap="tapOpen" :data-url="'more?usercode=' + usercode + '&is_black=' + data.friend.is_black">
  40. <view class="item fx-r fx-bc fx-ac">
  41. <view class="label">更多信息</view>
  42. <view class="fx-g1"></view>
  43. <view></view>
  44. <image class="pve" src="/static/img/next.png" mode="widthFix"></image>
  45. </view>
  46. </view>
  47. <view class="list-item" v-if="data.friend != null">
  48. <view class="item fx-r fx-bc fx-ac" @tap="tapSend">
  49. <view class="label">发送消息</view>
  50. </view>
  51. </view>
  52. <view class="black-item" v-if="data.friend != null && data.friend.is_black == 1">已添加至黑名单,你将不在收到对方的消息</view>
  53. <view class="call-pop" v-if="isPop">
  54. <view class="bg"></view>
  55. <view class="sheel-foot">
  56. <view class="items">
  57. <view class="item" @tap="tapOpenPhone(item)" v-for="item in isPhone(data.friend.phone)">{{item}}</view>
  58. </view>
  59. <view class="not-item" @tap="isPop = false">取消</view>
  60. </view>
  61. </view>
  62. </view>
  63. </template>
  64. <style lang="scss">
  65. .info{background: #fff;padding: 10px;}
  66. .info .avatar image{width: 60px;height: 60px;}
  67. .user-info{margin-left: 10px;width: calc(100% - 70px);}
  68. .user-info .nickname{font-size: 16px;}
  69. .user-info .nickname image{width: 15px;}
  70. .info-name{color: $ic-default-text;font-size: 12px;margin-top: 6px;}
  71. .info-qm{padding: 10px;background: #fff;}
  72. .info-qm .label{color:$ic-default-text;font-size: 14px;}
  73. .info-qm .mono{color:$ic-default-text;font-size: 14px;padding: 20px;}
  74. .list-item{background: #fff;padding: 0px 20px;margin-top: 10px;}
  75. .list-item .item{padding: 20px 0;border-bottom: 1px solid #f1f1f1;}
  76. .list-item .item:last-child{border-bottom: 0;}
  77. .list-item .item .label{font-size: 16px;color:$ic-default-text;}
  78. .list-item .item .pve{width: 20px;}
  79. .tag-nickname{font-size: 14px;color: $ic-default-text;margin-top: 4px;}
  80. .tag-label{color:$ic-default-text ;}
  81. .call-pop{position:fixed;width: 100%;height: 100%;left: 0;top: 0;}
  82. .call-pop .bg{position: absolute;top: 0;left: 0;width: 100%;height: 100%;background: rgba(0, 0, 0, 0.5);}
  83. .call-pop .sheel-foot{position: absolute;bottom: 0;width: 100%;}
  84. .call-pop .sheel-foot .items{border-radius: 10px;background: #fff;margin: 10px;}
  85. .call-pop .sheel-foot .items .item{padding: 10px 0;text-align: center;border-bottom: 1px solid #f1f1f1;color: $ic-appcolor;font-size: 16px;}
  86. .call-pop .sheel-foot .items .item:last-child{border-bottom: 0;}
  87. .call-pop .sheel-foot .not-item{border-radius: 10px;background: #fff;margin: 10px;padding: 10px;text-align: center;color: red;}
  88. .black-item{font-size: 14px;color:$ic-default-text;padding: 10px;text-align: center;}
  89. </style>
  90. <script>
  91. import {mapState,mapMutations } from 'vuex';
  92. export default {
  93. data() {
  94. return {
  95. data : {},
  96. usercode : "",
  97. isPop:false
  98. }
  99. },
  100. onLoad(option){
  101. this.usercode = option.usercode || "";
  102. },
  103. onShow() {
  104. this.getData();
  105. },
  106. methods: {
  107. /**
  108. * 获取get数据
  109. */
  110. getData:function(){
  111. uni.showLoading({ title: '获取数据中..'});
  112. this
  113. .request
  114. .post("chatFriendFind",{usercode:this.usercode})
  115. .then(res => {
  116. uni.hideLoading();
  117. if(res.code == 200) {
  118. this.data = res.data;
  119. } else {
  120. uni.showModal({title: '系统提示',content: res.msg,showCancel: false});
  121. }
  122. })
  123. .catch(res=>{
  124. console.log(res);
  125. uni.hideLoading();
  126. uni.showModal({title: '系统提示',content: '加载失败,重新点击尝试!',showCancel: false});
  127. });
  128. },
  129. isPhone:function(str){
  130. if(str == '') return [];
  131. return str.split(',');
  132. },
  133. /**
  134. * open
  135. * @param {Object} ev
  136. */
  137. tapOpen:function(ev){
  138. let url = ev.currentTarget.dataset.url;
  139. this.utils.navigateTo(url);
  140. },
  141. tapSend:function(){
  142. this.utils.navigateTo("/pages/chat/chat?groupId=" + this.data.friend.group_id + "&usercode=" + this.data.uid);
  143. },
  144. /**
  145. *
  146. */
  147. tapPhone:function(){
  148. if(this.data.friend.phone == '') {
  149. return;
  150. }
  151. this.isPop = true;
  152. },
  153. /**
  154. * 打开手机号码
  155. * @param {Object} item
  156. */
  157. tapOpenPhone:function(item){
  158. uni.makePhoneCall({ phoneNumber:item});
  159. },
  160. /**
  161. * 添加好友
  162. */
  163. tapAddBtn:function(){
  164. uni.showLoading({ title: '获取数据中..'});
  165. this
  166. .request
  167. .post("chatFriendAdd",{usercode:this.usercode})
  168. .then(res => {
  169. uni.hideLoading();
  170. if(res.code == 200) {
  171. if(res.data.stats == 1) {
  172. this.utils.Tip("加入成功");
  173. this.getData();
  174. } else {
  175. uni.navigateTo({
  176. url:"checkAdd?userCode=" + this.usercode
  177. })
  178. }
  179. } else {
  180. uni.showModal({title: '系统提示',content: res.msg,showCancel: false});
  181. }
  182. })
  183. .catch(res=>{
  184. console.log(res);
  185. uni.hideLoading();
  186. uni.showModal({title: '系统提示',content: '加载失败,重新点击尝试!',showCancel: false});
  187. });
  188. }
  189. }
  190. }
  191. </script>
  192. <style>
  193. </style>