2019-05-21 19:15:12 +08:00
|
|
|
import Vue from 'vue'
|
|
|
|
import VueRouter from 'vue-router'
|
2019-06-12 13:55:49 +08:00
|
|
|
import axios from 'axios'
|
2019-05-21 19:15:12 +08:00
|
|
|
|
2022-02-26 14:53:22 +08:00
|
|
|
import * as i18n from './i18n'
|
2022-02-25 22:42:50 +08:00
|
|
|
import App from './App'
|
|
|
|
import NotFound from './views/NotFound'
|
2019-07-08 11:42:35 +08:00
|
|
|
|
2021-03-28 18:30:31 +08:00
|
|
|
axios.defaults.timeout = 10 * 1000
|
2019-06-12 13:55:49 +08:00
|
|
|
|
2019-06-09 12:37:59 +08:00
|
|
|
Vue.config.ignoredElements = [
|
|
|
|
/^yt-/
|
|
|
|
]
|
|
|
|
|
2019-05-21 19:15:12 +08:00
|
|
|
const router = new VueRouter({
|
|
|
|
mode: 'history',
|
|
|
|
routes: [
|
2019-06-11 12:51:25 +08:00
|
|
|
{
|
|
|
|
path: '/',
|
2023-10-08 22:55:12 +08:00
|
|
|
component: () => import('./layout'),
|
2019-06-11 12:51:25 +08:00
|
|
|
children: [
|
2023-10-08 22:55:12 +08:00
|
|
|
{ path: '', name: 'home', component: () => import('./views/Home') },
|
|
|
|
{ path: 'stylegen', name: 'stylegen', component: () => import('./views/StyleGenerator') },
|
2024-03-07 21:25:02 +08:00
|
|
|
{ path: 'help', name: 'help', component: () => import('./views/Help') },
|
|
|
|
{ path: 'plugins', name: 'plugins', component: () => import('./views/Plugins') },
|
2019-06-11 12:51:25 +08:00
|
|
|
]
|
|
|
|
},
|
2022-02-26 14:53:22 +08:00
|
|
|
{
|
|
|
|
path: '/room/test',
|
|
|
|
name: 'test_room',
|
2023-10-08 22:55:12 +08:00
|
|
|
component: () => import('./views/Room'),
|
2022-02-26 14:53:22 +08:00
|
|
|
props: route => ({ strConfig: route.query })
|
|
|
|
},
|
2021-04-05 18:48:49 +08:00
|
|
|
{
|
2023-09-09 17:13:53 +08:00
|
|
|
path: '/room/:roomKeyValue',
|
2021-04-05 18:48:49 +08:00
|
|
|
name: 'room',
|
2023-10-08 22:55:12 +08:00
|
|
|
component: () => import('./views/Room'),
|
2021-04-05 18:48:49 +08:00
|
|
|
props(route) {
|
2023-09-09 17:13:53 +08:00
|
|
|
let roomKeyType = parseInt(route.query.roomKeyType) || 1
|
|
|
|
if (roomKeyType < 1 || roomKeyType > 2) {
|
|
|
|
roomKeyType = 1
|
2021-04-05 18:48:49 +08:00
|
|
|
}
|
2023-09-09 17:13:53 +08:00
|
|
|
|
|
|
|
let roomKeyValue = route.params.roomKeyValue
|
|
|
|
if (roomKeyType === 1) {
|
|
|
|
roomKeyValue = parseInt(roomKeyValue) || null
|
|
|
|
} else {
|
|
|
|
roomKeyValue = roomKeyValue || null
|
|
|
|
}
|
|
|
|
return { roomKeyType, roomKeyValue, strConfig: route.query }
|
2021-04-05 18:48:49 +08:00
|
|
|
}
|
|
|
|
},
|
2022-01-04 21:41:12 +08:00
|
|
|
{ path: '*', component: NotFound }
|
2019-05-21 19:15:12 +08:00
|
|
|
]
|
|
|
|
})
|
|
|
|
|
|
|
|
new Vue({
|
|
|
|
render: h => h(App),
|
2019-07-08 11:42:35 +08:00
|
|
|
router,
|
2022-02-26 14:53:22 +08:00
|
|
|
i18n: i18n.i18n
|
2019-05-21 19:15:12 +08:00
|
|
|
}).$mount('#app')
|