info.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view class="user-info">
  3. <nav-bar title="个人信息" @init="onInitNavbar"></nav-bar>
  4. <u-scroll-view>
  5. <van-cell-group>
  6. <van-cell title="头像" class="van-cell--clickable" @click="navigateTo('/pages/user/info-edit')">
  7. <view class="right-icon" slot="right-icon">
  8. <view class="user-avator">
  9. <image v-if="user.avatar" :src="user.avatar" mode="aspectFill" />
  10. <image v-else src="https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132" mode="aspectFill" />
  11. </view>
  12. <van-icon
  13. name="arrow"
  14. class="van-cell__right-icon-wrap right-icon-class"
  15. custom-class="van-cell__right-icon"
  16. />
  17. </view>
  18. </van-cell>
  19. <van-cell title="呢称" is-link :value="user.nick_name || '微信呢称'" @click="navigateTo('/pages/user/info-edit')">
  20. </van-cell>
  21. <van-cell title="公司" is-link :value="user.company_name || '点击设置'" @click="navigateTo('/pages/user/info-edit')">
  22. </van-cell>
  23. <van-cell title="职业" is-link :value="user.title || '点击设置'" @click="navigateTo('/pages/user/info-edit')">
  24. </van-cell>
  25. </van-cell-group>
  26. </u-scroll-view>
  27. </view>
  28. </template>
  29. <script>
  30. import NavBar from '@/components/layout/nav-bar'
  31. import UScrollView from '@/components/common/u-scroll-view'
  32. import VanCellGroup from '@/wxcomponents/vant/cell-group/index'
  33. import VanCell from '@/wxcomponents/vant/cell/index'
  34. import VanActionSheet from '@/wxcomponents/vant/action-sheet/index'
  35. import { updateInfo } from '../../api/user'
  36. export default {
  37. options: {
  38. styleIsolation: 'shared'
  39. },
  40. components: {
  41. NavBar,
  42. UScrollView,
  43. VanCell,
  44. VanCellGroup,
  45. VanActionSheet
  46. },
  47. computed: {
  48. user() {
  49. return this.$store.getters.user || {}
  50. }
  51. },
  52. data() {
  53. return {}
  54. },
  55. created() {
  56. this.checkAuth('/pages/user/info')
  57. },
  58. onShow() {
  59. },
  60. methods: {
  61. onChooseAvatar(e) {
  62. this.navigateTo('/pages/user/info-edit?avatar=' + e.detail.avatarUrl)
  63. },
  64. onCellClick() {
  65. this.navigateTo('/pages/user/setting-edit')
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss">
  71. .user-info{
  72. .user-avator{
  73. @include display-flex-center;
  74. width: 111rpx;
  75. height: 111rpx;
  76. border-radius: 50%;
  77. overflow: hidden;
  78. margin-right: 13rpx;
  79. .icon{
  80. color: #ffffff;
  81. opacity: 0.67;
  82. font-size: 70rpx;
  83. }
  84. }
  85. }
  86. </style>