index.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <view class="container">
  3. <uni-row>
  4. <uni-col :span="8" :offset="8">
  5. <view>
  6. <image :src="avatar" class="round" mode="aspectFill" style="width: 100px; height: 100px;"></image>
  7. </view>
  8. </uni-col>
  9. </uni-row>
  10. <uni-list>
  11. <uni-list-item showExtraIcon="true" :extraIcon="{type: 'person-filled'}" title="昵称"
  12. :rightText="user.nickName" />
  13. <uni-list-item showExtraIcon="true" :extraIcon="{type: 'staff-filled'}" title="性别"
  14. :rightText="user.sex == null ? '未知' : (user.sex == 0 ? '女' : '男')" />
  15. <uni-list-item showExtraIcon="true" :extraIcon="{type: 'calendar-filled'}" title="创建日期"
  16. :rightText="user.createTime" />
  17. </uni-list>
  18. </view>
  19. </template>
  20. <script>
  21. import {
  22. getMiniAppUserInfo
  23. } from "@/api/basics/miniAppUser.js"
  24. export default {
  25. data() {
  26. return {
  27. user: {},
  28. avatar: this.$store.state.user.avatar
  29. }
  30. },
  31. onShow() {
  32. wx.showShareMenu({
  33. withShareTicket: true,
  34. menus: ['shareAppMessage', 'shareTimeline']
  35. });
  36. },
  37. onLoad() {
  38. this.getUser()
  39. },
  40. methods: {
  41. getUser() {
  42. getMiniAppUserInfo().then(response => {
  43. this.user = response.data
  44. })
  45. }
  46. }
  47. }
  48. </script>
  49. <style lang="scss">
  50. page {
  51. background-color: #ffffff;
  52. }
  53. .cu-avatar {
  54. border: 2px solid #eaeaea;
  55. .icon {
  56. font-size: 40px;
  57. }
  58. }
  59. </style>