info.vue 7.0 KB

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