index.vue 859 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <div class="boot">
  3. <el-button :loading="loading" v-if="loading">正在烧烤...</el-button>
  4. <el-button @click="initService" v-else>重新烧烤</el-button>
  5. </div>
  6. </template>
  7. <script lang="ts" setup>
  8. import { ref } from 'vue'
  9. import { ElMessage } from 'element-plus'
  10. import { useRoute, useRouter } from 'vue-router'
  11. import { initBaseData } from '@/business/common'
  12. const route = useRoute(),
  13. router = useRouter(),
  14. loading = ref(false);
  15. const initService = () => {
  16. loading.value = true;
  17. initBaseData(() => {
  18. const redirect = route.query.redirect;
  19. if (redirect) {
  20. router.replace(redirect.toString());
  21. } else {
  22. router.replace('/');
  23. }
  24. }).catch((err) => {
  25. ElMessage.error(err);
  26. loading.value = false;
  27. })
  28. }
  29. initService()
  30. </script>
  31. <style lang="less" scoped>
  32. @import './index.less';
  33. </style>