person.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view>
  3. <!-- #ifdef MP-WEIXIN -->
  4. <u-navbar :is-back="false" title=" " :background="{ background: '#ffffff' }" :border-bottom="false"></u-navbar>
  5. <!-- #endif -->
  6. <!-- #ifndef MP-WEIXIN -->
  7. <view class="status_bar"></view>
  8. <!-- #endif -->
  9. <u-cell-group>
  10. <u-cell-item title="头像" :title-style="{ marginLeft: '10rpx' }">
  11. <u-upload :showUploadList="false" style="display: inline;" :custom-btn="true" @on-uploaded="onUploaded" :action="action">
  12. <view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
  13. <u-icon :name="`${$url}/${userData.user.avatar}`" size="60" :color="$u.color['lightColor']"></u-icon>
  14. </view>
  15. </u-upload>
  16. </u-cell-item>
  17. <u-cell-item title="名字" @tap="linkTo(userData.user.realname,0)" :value="userData.user.realname" :title-style="{ marginLeft: '10rpx' }">
  18. </u-cell-item>
  19. <u-cell-item title="用户名" :arrow="false" :value="userData.user.username" :title-style="{ marginLeft: '10rpx' }">
  20. </u-cell-item>
  21. <u-cell-item @tap="linkToQrcode" title="二维码" :title-style="{ marginLeft: '10rpx' }">
  22. <u-icon :name="src1" size="40" :color="$u.color['lightColor']"></u-icon>
  23. </u-cell-item>
  24. </u-cell-group>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. data() {
  30. return {
  31. src1:require('@/static/qrcode.png'),
  32. action:this.$uploadUrl,
  33. filesArr: [],
  34. groupList: [
  35. /*{ title: '新消息通知', color: '#409eff', icon: 'star' },*/
  36. /*{ title: '隐私', color: '#409eff', icon: 'photo' },*/
  37. /*{ title: '帮助与反馈', color: '#ff9900', icon: 'heart' }*/
  38. { title: '通用', color: '#409eff', icon: 'coupon' }
  39. ],
  40. $url:''
  41. }
  42. },
  43. methods: {
  44. onUploaded(lists) {
  45. this.filesArr = lists;
  46. let res = lists[0];
  47. if(res.response===undefined){
  48. uni.showToast({
  49. title:'文件错误',
  50. icon:'none'
  51. })
  52. }
  53. this.$socket.updateAvatar(this.userData.user.operId, res.response.data, res => {
  54. })
  55. },
  56. linkToQrcode(){
  57. this.$u.route({
  58. url: 'pages/qrcode/qrcode'
  59. });
  60. },
  61. linkTo( context, type){
  62. this.$u.route({
  63. url: 'pages/chat/updateGroupInfo',
  64. params: { context, type }
  65. });
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. .slot-btn {
  72. }
  73. .slot-btn__hover {
  74. background-color: rgb(235, 236, 238);
  75. }
  76. </style>