|
@@ -50,7 +50,7 @@ export const constantRoutes = [{
|
|
|
let config = getConfig();
|
|
|
if (config) {
|
|
|
let configObj = JSON.parse(config);
|
|
|
- let path = handleSysType(configObj.sys_type);
|
|
|
+ let path = handleSysType(configObj.sys_type, 'home');
|
|
|
if (path) {
|
|
|
loadingInstance.close();
|
|
|
if (configObj.sys_type == 'GCLS') {
|
|
@@ -127,6 +127,35 @@ export const constantRoutes = [{
|
|
|
},
|
|
|
{
|
|
|
path: '/GoodsDetail',
|
|
|
+ beforeEnter: (to, from, next) => {
|
|
|
+ let loadingInstance = Loading.service({
|
|
|
+ text: '跳转中...'
|
|
|
+ });
|
|
|
+ let config = getConfig();
|
|
|
+ if (config) {
|
|
|
+ let configObj = JSON.parse(config);
|
|
|
+ let path = handleSysType(configObj.sys_type, 'goods');
|
|
|
+ if (path) {
|
|
|
+ loadingInstance.close();
|
|
|
+ if (configObj.sys_type == 'GCLS') {
|
|
|
+ next(path);
|
|
|
+ } else {
|
|
|
+ window.location.href = path
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ loadingInstance.close();
|
|
|
+ Message({
|
|
|
+ message: '此路径不存在',
|
|
|
+ type: 'error',
|
|
|
+ showClose: true,
|
|
|
+ duration: 0
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+},
|
|
|
+{
|
|
|
+ path: '/curGoodsDetail',
|
|
|
component: () =>
|
|
|
import('@/views/TextbookDetail')
|
|
|
},
|
|
@@ -163,16 +192,24 @@ export function resetRouter() {
|
|
|
const newRouter = createRouter()
|
|
|
router.matcher = newRouter.matcher // reset router
|
|
|
}
|
|
|
-export function handleSysType(sys_type) {
|
|
|
- let path = ''
|
|
|
+export function handleSysType(sys_type, path_type) {
|
|
|
+ let path = '';
|
|
|
switch (sys_type) {
|
|
|
case 'GCLS':
|
|
|
console.log('全球汉语教学平台')
|
|
|
- path = '/';
|
|
|
+ if (path_type == 'home') {
|
|
|
+ path = '/';
|
|
|
+ } else if (path_type == 'goods') {
|
|
|
+ path = '/curGoodsDetail'
|
|
|
+ }
|
|
|
break;
|
|
|
case 'AILP':
|
|
|
console.log('课后三点半')
|
|
|
- path = "/GCLS-Book-AILP/#/EnterSys";
|
|
|
+ if (path_type == 'home') {
|
|
|
+ path = '/GCLS-Book-AILP/#/EnterSys';
|
|
|
+ } else if (path_type == 'goods') {
|
|
|
+ path = '/GCLS-Book-AILP/#/curGoodsDetail';
|
|
|
+ }
|
|
|
break;
|
|
|
default:
|
|
|
path = '';
|