49397ded by 任超

style:布局样式得确定

1 parent e24674b5
{
"TITLE": "汉中市数据上报系统",
"THEME": "sb"
"THEME": "jg"
}
......
import Vue from 'vue'
import request from '@/utils/request'
console.log(Vue.prototype, Vue.prototype.BASE_API);
import SERVER from './config'
// 获取用户信息
export function getUserInfo () {
......
......@@ -2,7 +2,7 @@
* @Author: yangwei
* @Date: 2023-01-16 09:10:12
* @LastEditors: Please set LastEditors
* @LastEditTime: 2023-03-21 14:15:40
* @LastEditTime: 2023-03-21 15:00:04
* @FilePath: \bdcjg-web\src\main.js
* @Description:
*
......@@ -51,7 +51,7 @@ Vue.directive('fo', {
import './image/icons' // icon
import store from './store'
import router from './router'
import _, { set } from 'lodash'
import _ from 'lodash'
Vue.use(Element, { size: 'small', zIndex: 1000 })
Vue.use(Base)
Vue.component('icon', Icon);
......@@ -60,16 +60,12 @@ Vue.use(dataV)
axios.get("./config.json")
.then((res) => {
Vue.prototype.BASE_API = res.data
localStorage.setItem('ApiUrl', JSON.stringify(res.data));
require('./permission')
setTimeout(() => {
new Vue({
el: '#app',
router,
store,
render: h => h(App)
})
}, 20)
})
\ No newline at end of file
......
......@@ -2,13 +2,13 @@
* @Author: xiaomiao 1158771342@qq.com
* @Date: 2023-03-09 15:24:53
* @LastEditors: Please set LastEditors
* @LastEditTime: 2023-03-21 14:05:43
* @LastEditTime: 2023-03-21 16:05:39
* @FilePath: \上报\bdcjg-web\src\store\modules\permission.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import Vue from 'vue'
import { constantRoutes } from '@/router'
import asyncRouter from '@/utils/asyncRouter.js'
// import asyncRouter from '@/utils/asyncRouter.js'
const state = {
routes: [],
addRoutes: false,
......@@ -26,6 +26,38 @@ const mutations = {
const actions = {
// 添加全部菜单
generateRoutes ({ commit }, getMenuInfo) {
let Layout;
if (Vue.prototype.BASE_API.THEME == 'sb') {
Layout = r => require.ensure([], () => r(require(`@/layout1`)))
} else {
Layout = r => require.ensure([], () => r(require(`@/layout`)))
}
function asyncRouter (routers) {
routers.forEach(item => {
if (!item.children) {
delete item.children
} else {
item.children = asyncRouter(item.children)
}
item.path = JSON.parse(item.metadata)?.path || '/'
if (!item.parentId) {
item.component = Layout
console.log(item.component);
} else {
item.component = loadView(item.uri)
}
item.meta = {
title: item.name,
icon: item.icon
}
})
return routers
}
function loadView (view) {
return r => require.ensure([], () => r(require(`@/views${view}.vue`)))
}
return new Promise(resolve => {
// 将权限菜单数组转成路由树数据结构
let permission_tree = asyncRouter(getMenuInfo)
......
/*
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-21 14:27:07
* @LastEditTime: 2023-03-21 15:41:21
*/
import Vue from 'vue'
import Layout from '@/layout1'
const config = require('/public/config.json')
console.log(config, 'Vue.2222222222222.BASE_API');
var Layout;
// import Layout1 from '@/layout1'
let ApiUrl = localStorage.getItem('ApiUrl')
if (ApiUrl.THEME == 'sb') {
Layout = r => require.ensure([], () => r(require(`@/layout1`)))
} else {
Layout = r => require.ensure([], () => r(require(`@/layout`)))
}
export default function filterAsyncRouter (routers) {
routers.forEach(item => {
if (!item.children) {
......@@ -19,6 +23,7 @@ export default function filterAsyncRouter (routers) {
item.component = Layout
} else {
item.component = loadView(item.uri)
console.log(item.component, 'item.componentitem.component');
}
item.meta = {
title: item.name,
......
/*
* @Description:
* @Description: 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器
* @Autor: renchao
* @LastEditTime: 2023-03-21 13:46:56
*/
/**
* 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器
* @LastEditTime: 2023-03-21 15:03:37
*/
import axios from "axios";
import { Message } from "element-ui";
......@@ -17,6 +14,7 @@ const service = axios.create({
headers: {
"Content-Type": "application/json; charset=utf-8",
},
timeout: 15000,
});
......