index.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <div class="container">
  3. <Breadcrumb :items="['menu.profile', 'menu.profile.basic']" />
  4. <a-space direction="vertical" :size="16" fill>
  5. <a-card class="general-card" :title="$t('basicProfile.title.form')">
  6. <template #extra>
  7. <a-space>
  8. <a-button>{{ $t('basicProfile.cancel') }}</a-button>
  9. <a-button type="primary">
  10. {{ $t('basicProfile.goBack') }}
  11. </a-button>
  12. </a-space>
  13. </template>
  14. <a-steps v-model:current="step" line-less class="steps">
  15. <a-step>{{ $t('basicProfile.steps.commit') }}</a-step>
  16. <a-step>{{ $t('basicProfile.steps.approval') }}</a-step>
  17. <a-step>{{ $t('basicProfile.steps.finish') }}</a-step>
  18. </a-steps>
  19. </a-card>
  20. <a-card class="general-card">
  21. <ProfileItem :loading="loading" :render-data="currentData" />
  22. </a-card>
  23. <a-card class="general-card">
  24. <ProfileItem :loading="preLoading" type="pre" :render-data="preData" />
  25. </a-card>
  26. <OperationLog />
  27. </a-space>
  28. </div>
  29. </template>
  30. <script lang="ts" setup>
  31. import { ref } from 'vue';
  32. import useLoading from '@/hooks/loading';
  33. import { queryProfileBasic, ProfileBasicRes } from '@/api/profile';
  34. import ProfileItem from './components/profile-item.vue';
  35. import OperationLog from './components/operation-log.vue';
  36. const { loading, setLoading } = useLoading(true);
  37. const { loading: preLoading, setLoading: preSetLoading } = useLoading(true);
  38. const currentData = ref<ProfileBasicRes>({} as ProfileBasicRes);
  39. const preData = ref<ProfileBasicRes>({} as ProfileBasicRes);
  40. const step = ref(1);
  41. const fetchCurrentData = async () => {
  42. try {
  43. const { data } = await queryProfileBasic();
  44. currentData.value = data;
  45. step.value = 2;
  46. } catch (err) {
  47. // you can report use errorHandler or other
  48. } finally {
  49. setLoading(false);
  50. }
  51. };
  52. const fetchPreData = async () => {
  53. try {
  54. const { data } = await queryProfileBasic();
  55. preData.value = data;
  56. } catch (err) {
  57. // you can report use errorHandler or other
  58. } finally {
  59. preSetLoading(false);
  60. }
  61. };
  62. fetchCurrentData();
  63. fetchPreData();
  64. </script>
  65. <script lang="ts">
  66. export default {
  67. name: 'Basic',
  68. };
  69. </script>
  70. <style scoped lang="less">
  71. .container {
  72. padding: 0 10px 20px;
  73. }
  74. .steps {
  75. max-width: 548px;
  76. margin: 0 auto 10px;
  77. }
  78. </style>