sync
This commit is contained in:
180
src/routes.js
Normal file
180
src/routes.js
Normal file
@@ -0,0 +1,180 @@
|
||||
import Vue from "vue";
|
||||
import VueRouter from "vue-router";
|
||||
import axios from "axios";
|
||||
import store from "./store";
|
||||
|
||||
Vue.use(VueRouter);
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: "/",
|
||||
name: "index",
|
||||
component: () =>
|
||||
import(/* webpackChunkName: "index" */ "./components/index.vue"),
|
||||
// beforeEnter(to, from, next) {
|
||||
// axios.interceptors.request.use(
|
||||
// (config) => {
|
||||
// config.headers.post["project"] = "";
|
||||
// console.log(config)
|
||||
// return config;
|
||||
// },
|
||||
// (error) => {
|
||||
// return Promise.reject(error);
|
||||
// }
|
||||
// );
|
||||
// next();
|
||||
// },
|
||||
},
|
||||
{
|
||||
path: "/prohodnaya",
|
||||
name: "prohodnaya",
|
||||
component: () => import("./components/prohodnaya.vue"),
|
||||
},
|
||||
{
|
||||
path: "/weatherAvg",
|
||||
name: "weatherAvg",
|
||||
component: () => import("./components/weatherAvg.vue"),
|
||||
},
|
||||
{
|
||||
path: "/tundishSample",
|
||||
name: "tundishSample",
|
||||
component: () => import("./components/tundishSample.vue"),
|
||||
},
|
||||
{
|
||||
path: "/BOFReport/BOFReportSample_A1",
|
||||
name: "BOFReportSample_A1",
|
||||
component: () => import("./components/BOFReport/BOFReportSample_A1.vue"),
|
||||
beforeEnter(to, from, next) {
|
||||
axios.defaults.headers.post["project"] = "BOFReport";
|
||||
next();
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/BOFReport/BOFReportSample_A2",
|
||||
name: "BOFReportSample_A2",
|
||||
component: () => import("./components/BOFReport/BOFReportSample_A2.vue"),
|
||||
beforeEnter(to, from, next) {
|
||||
axios.defaults.headers.post["project"] = "BOFReport";
|
||||
next();
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/BOFReport/BOFReportSample_B1",
|
||||
name: "BOFReportSample_B1",
|
||||
component: () => import("./components/BOFReport/BOFReportSample_B1.vue"),
|
||||
beforeEnter(to, from, next) {
|
||||
axios.defaults.headers.post["project"] = "BOFReport";
|
||||
next();
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/BOFReport/BOFReportSample_C1",
|
||||
name: "BOFReportSample_C1",
|
||||
component: () => import("./components/BOFReport/BOFReportSample_C1.vue"),
|
||||
beforeEnter(to, from, next) {
|
||||
axios.defaults.headers.post["project"] = "BOFReport";
|
||||
next();
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/BOFReport/BOFReportSample_D1",
|
||||
name: "BOFReportSample_D1",
|
||||
component: () => import("./components/BOFReport/BOFReportSample_D1.vue"),
|
||||
beforeEnter(to, from, next) {
|
||||
axios.defaults.headers.post["project"] = "BOFReport";
|
||||
next();
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/BOFReport/BOFMainUseConfig",
|
||||
name: "BOFMainUseConfig",
|
||||
component: () => import("./components/BOFReport/BOFMainUseConfig.vue"),
|
||||
beforeEnter(to, from, next) {
|
||||
axios.defaults.headers.post["project"] = "BOFReport";
|
||||
next();
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/BOFReport/BOFReportAvgData_Marka",
|
||||
name: "BOFReportAvgData_Marka",
|
||||
component: () => import("./components/BOFReport/BOFReportAvgData_Marka.vue"),
|
||||
beforeEnter(to, from, next) {
|
||||
axios.defaults.headers.post["project"] = "BOFReport";
|
||||
next();
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/Pasport_KRO",
|
||||
name: "Pasport_KRO",
|
||||
component: () => import("./components/Pasport_KRO.vue"),
|
||||
},
|
||||
{
|
||||
path: "/LadleUse",
|
||||
name: "LadleUse",
|
||||
component: () => import("./components/LadleUse.vue"),
|
||||
},
|
||||
{
|
||||
path: "/HMCarReport",
|
||||
name: "HMCarReport",
|
||||
component: () => import("./components/HMCarReport.vue"),
|
||||
},
|
||||
{
|
||||
path: "/HM_DC",
|
||||
name: "HM_DC",
|
||||
component: () => import("./components/HM_DC.vue"),
|
||||
},
|
||||
{
|
||||
path: "/crewAggregateWeight",
|
||||
name: "crewAggregateWeight",
|
||||
component: () => import("./components/crewAggregateWeight.vue"),
|
||||
},
|
||||
{
|
||||
path: "/BOFHeatPhase",
|
||||
name: "BOFHeatPhase",
|
||||
component: () => import("./components/BOFHeatPhase.vue"),
|
||||
},
|
||||
// {
|
||||
// path: "/BOFHeatPhaseAllStatus",
|
||||
// name: "BOFHeatPhaseAllStatus",
|
||||
// component: () => import("./components/BOFHeatPhaseAllStatus.vue"),
|
||||
// },
|
||||
|
||||
{
|
||||
path: "/PRB_FileControl",
|
||||
name: "PRB_FileControl",
|
||||
component: () => import("./components/PRB_FileControl.vue"),
|
||||
},
|
||||
|
||||
{
|
||||
path: "/stat",
|
||||
name: "Stat",
|
||||
component: () => import("./components/stat.vue"),
|
||||
},
|
||||
// {
|
||||
// path: "/about",
|
||||
// name: "About",
|
||||
// component: () =>
|
||||
// import(/* webpackChunkName: "about" */ "../views/About.vue"),
|
||||
// },
|
||||
];
|
||||
|
||||
const router = new VueRouter({
|
||||
routes,
|
||||
mode: "hash",
|
||||
});
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (to.name === 'index') {
|
||||
axios.defaults.headers.post["project"] = "stat";
|
||||
}
|
||||
else {
|
||||
axios.defaults.headers.post["project"] = "stat";
|
||||
if (process.env.NODE_ENV !== 'development') {
|
||||
store.dispatch("stat/addData", to.name);
|
||||
}
|
||||
axios.defaults.headers.post["project"] = to.name;
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user