import modeMap from '~/configs/mode-map' import axios from 'axios' const whiteList = ['/auth'] export default function ({ route, error }) { if (whiteList.indexOf(route.path) > -1) return const authUserId = parseInt(route.params.template) const auth = modeMap.find((item) => item.authUserId === authUserId) let routePrefix = !auth ? `/${authUserId}/app` : `/${authUserId}/${auth.mode}` const baseURL = process.env.BASE_URL + '/wx/auth/shop/info' console.log(authUserId) return axios .get(baseURL, { params: { authUserId: authUserId }, }) .then(({ data }) => { if (data.code === -1 || route.path.indexOf(routePrefix) !== 0) { error({ statusCode: 404, message: '页面不存在', }) } }) .catch(() => { error({ statusCode: 404, message: '页面不存在', }) }) }