123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <template>
- <div></div>
- </template>
- <script>
- import oldRoutes from '@/utils/old-routes'
- import { getQueryObject } from '@/utils/index'
- export default {
- data() {
- return {
- appId: '',
- redirectInfo: null,
- }
- },
- mounted() {
- this.initData()
- },
- methods: {
- initData() {
- // 获取页面hash值 因为老页面基于vue-router hash模式进行路由跳转
- let hash = this.$route.hash
- const query = getQueryObject(hash)
- this.appId = query.appId
- const index = hash.indexOf('?')
- hash = hash.slice(1, index)
- this.redirectInfo = oldRoutes.find((route) => hash === route.path)
- if (this.redirectInfo) {
- this.fetchSupplierInfo()
- }
- },
- // 获取供应商信息
- async fetchSupplierInfo() {
- try {
- const { data } = await this.$http.api.fetchSupplierInfo({
- appId: this.appId,
- })
- const path = `/${data.authUserId}` + this.redirectInfo.redirect
- this.$router.push(path)
- } catch (error) {
- console.log(error)
- }
- },
- },
- }
- </script>
- <style scoped></style>
|