index.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <div class="user-main">
  3. <div class="info">
  4. <div class="tx-info">
  5. <div class="tx"><el-image style="width: 50px; height: 50px;border-radius: 5px;"
  6. src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" fit="cover" />
  7. </div>
  8. <div>
  9. <div>{{ user.nickName }}</div>
  10. <div>余额:¥{{ form.money }}</div>
  11. </div>
  12. </div>
  13. </div>
  14. </div>
  15. </template>
  16. <script setup>
  17. import { getUserProfile } from '@/api/system/user.js'
  18. import { getInfo } from '@/api/svc/user'
  19. import { onMounted } from 'vue';
  20. const user = ref({})
  21. const form = ref({})
  22. async function init() {
  23. await getUserProfile().then(res => {
  24. console.log(res);
  25. user.value = res.data
  26. })
  27. await getInfo(user.value.userId).then(res => {
  28. console.log(res);
  29. form.value = res.data
  30. })
  31. }
  32. onMounted(() => {
  33. init()
  34. })
  35. </script>
  36. <style scoped>
  37. .user-main {
  38. width: 100%;
  39. display: flex;
  40. justify-content: center;
  41. }
  42. .info {
  43. width: 90%;
  44. padding-top: 10px;
  45. }
  46. .tx-info {
  47. border-radius: 5px;
  48. background-color: #FFF;
  49. width: 100%;
  50. display: flex;
  51. padding: 5px;
  52. align-items: center;
  53. }
  54. .tx {
  55. margin-right: 50px;
  56. display: flex;
  57. justify-content: center;
  58. align-items: center;
  59. }
  60. </style>