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