index.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <view class="container">
  3. <uni-list>
  4. <uni-list-item showExtraIcon="true" :extraIcon="{ type: 'person-filled' }" title="昵称" :rightText="user.nickName" />
  5. <uni-list-item showExtraIcon="true" :extraIcon="{ type: 'phone-filled' }" title="手机号码" :rightText="user.phonenumber" />
  6. <uni-list-item showExtraIcon="true" :extraIcon="{ type: 'email-filled' }" title="邮箱" :rightText="user.email" />
  7. <uni-list-item showExtraIcon="true" :extraIcon="{ type: 'auth-filled' }" title="岗位" :rightText="postGroup" />
  8. <uni-list-item showExtraIcon="true" :extraIcon="{ type: 'staff-filled' }" title="角色" :rightText="roleGroup" />
  9. <uni-list-item showExtraIcon="true" :extraIcon="{ type: 'calendar-filled' }" title="创建日期" :rightText="user.createTime" />
  10. </uni-list>
  11. </view>
  12. </template>
  13. <script setup>
  14. import { getUserProfile } from "@/api/system/user";
  15. import { onLoad, onShow, onHide, onLaunch } from "@dcloudio/uni-app";
  16. import { ref, reactive, computed, getCurrentInstance, toRefs, inject } from "vue";
  17. import useStores from "@/store/modules/user.js";
  18. const useStore = useStores();
  19. const { proxy } = getCurrentInstance();
  20. const data = reactive({
  21. name: useStore.$state.name,
  22. version: getApp().globalData.config.appInfo.version,
  23. });
  24. const user = ref({});
  25. const roleGroup = ref("");
  26. const postGroup = ref("");
  27. function getUser() {
  28. getUserProfile().then((response) => {
  29. user.value = response.data;
  30. roleGroup.value = response.roleGroup;
  31. postGroup.value = response.postGroup;
  32. });
  33. }
  34. onLoad(() => {
  35. getUser();
  36. });
  37. </script>
  38. <style lang="scss">
  39. page {
  40. background-color: #ffffff;
  41. }
  42. </style>