This commit is contained in:
张成
2025-10-10 00:08:35 +08:00
parent 88cd8d6e72
commit f86ee00e3b
15 changed files with 72 additions and 403 deletions

View File

@@ -24,6 +24,9 @@ const config = {
uploadUrl: 'http://localhost:9098/admin_api/upload' // 修改为你的上传地址 uploadUrl: 'http://localhost:9098/admin_api/upload' // 修改为你的上传地址
} }
// 提前暴露框架实例(确保工具类可以访问)
window.framework = AdminFramework
// 初始化框架 // 初始化框架
AdminFramework.install(Vue, { AdminFramework.install(Vue, {
config: config, config: config,
@@ -82,7 +85,6 @@ app.$mount('#app')
// 全局暴露(方便调试) // 全局暴露(方便调试)
window.app = app window.app = app
window.rootVue = app window.rootVue = app
window.framework = AdminFramework

View File

@@ -51,7 +51,7 @@ export default {
}, },
data() { data() {
return { return {
actionUrl: window.rootVue.$config.apiUrl + 'sys_file/upload_oos_img', actionUrl: this.config.apiUrl + 'sys_file/upload_oos_img',
cropper: null, cropper: null,
insideSrc: '', insideSrc: '',
file: null, file: null,
@@ -81,7 +81,7 @@ export default {
reader.onload = async (event) => { reader.onload = async (event) => {
this.getSize(event.srcElement.result).then(({ width, height }) => { this.getSize(event.srcElement.result).then(({ width, height }) => {
if (width < 500 || height < 500) { if (width < 500 || height < 500) {
rootVue.$Message.error('图片尺寸小于 500*500 ,请更换图片') this.$Message.error('图片尺寸小于 500*500 ,请更换图片')
return false return false
} }
this.insideSrc = event.srcElement.result this.insideSrc = event.srcElement.result

View File

@@ -25,7 +25,7 @@ export default {
this.editor = new WangEditor(domId) this.editor = new WangEditor(domId)
this.editor.config.uploadImgShowBase64 = true this.editor.config.uploadImgShowBase64 = true
this.editor.config.uploadImgServer = window.rootVue.$config.apiUrl + 'sys_file/upload_oos_img' this.editor.config.uploadImgServer =this.config.apiUrl + 'sys_file/upload_oos_img'
this.editor.config.uploadImgHooks = { this.editor.config.uploadImgHooks = {
customInsert: (insertImg, result, editor) => { customInsert: (insertImg, result, editor) => {
var url = result.data.path var url = result.data.path

View File

@@ -37,7 +37,7 @@ export default {
return { return {
headers, headers,
uploadList: [], uploadList: [],
actionUrl: window.rootVue.$config.apiUrl + 'sys_file/upload_oos_img', actionUrl:this.config.apiUrl + 'sys_file/upload_oos_img',
imgSrc: '', imgSrc: '',
visible: false, visible: false,
} }

View File

@@ -34,7 +34,7 @@ export default {
data() { data() {
return { return {
headers, headers,
actionUrl: window.rootVue.$config.apiUrl + 'sys_file/upload_oos_img', actionUrl: this.config.apiUrl + 'sys_file/upload_oos_img',
imgUrl: '', imgUrl: '',
visible: false, visible: false,
} }

View File

@@ -29,7 +29,7 @@ const funTool = {
import storeModules, { userModule, appModule } from './store' import storeModules, { userModule, appModule } from './store'
import routerConfig, { createBaseRoutes, setupRouterGuards } from './router' import { createBaseRoutes, setupRouterGuards } from './router'
import HomePage from './views/home/index.vue' import HomePage from './views/home/index.vue'
@@ -75,6 +75,7 @@ class AdminFramework {
this.config = {} this.config = {}
this.store = null this.store = null
this.router = null this.router = null
this.ViewUI = null
this.tools = tools this.tools = tools
this.uiTool = uiTool this.uiTool = uiTool
@@ -119,6 +120,7 @@ class AdminFramework {
const { config = {}, ViewUI, VueRouter, Vuex, createPersistedState, componentMap } = options const { config = {}, ViewUI, VueRouter, Vuex, createPersistedState, componentMap } = options
this.config = config this.config = config
this.ViewUI = ViewUI
if (ViewUI) { if (ViewUI) {
Vue.use(ViewUI) Vue.use(ViewUI)

View File

@@ -104,9 +104,8 @@ export default {
commit('setMenuList', mainMenu.children) commit('setMenuList', mainMenu.children)
// 动态添加路由(重要!解决登录后点击菜单空白的问题) // 动态添加路由(重要!解决登录后点击菜单空白的问题)
if (window.rootVue && window.rootVue.$router) { if (this.router) {
const router = window.rootVue.$router const routes =this.router.options.routes
const routes = router.options.routes
// 查找并移除旧的主路由 // 查找并移除旧的主路由
const mainRouteIndex = routes.findIndex(r => r.path === '/') const mainRouteIndex = routes.findIndex(r => r.path === '/')

View File

@@ -1,6 +1,7 @@
import axios from 'axios' import axios from 'axios'
import { formatDate } from './tools' import { formatDate } from './tools'
class Http { class Http {
constructor() { constructor() {
this.config = { this.config = {
@@ -71,8 +72,15 @@ class Http {
if (this.store) { if (this.store) {
this.store.commit('user/setToken', '') this.store.commit('user/setToken', '')
} }
if (window.rootVue && window.rootVue.$router) { // 使用框架的 router 实例跳转到登录页
window.rootVue.$router.push({ path: '/login' }) // 使用 path 而不是 name try {
if (window.framework && window.framework.router) {
window.framework.router.push({ path: '/login' })
} else if (window.location) {
window.location.href = '#/login'
}
} catch (err) {
console.error('跳转登录页失败:', err)
} }
return Promise.reject(error) return Promise.reject(error)
} }
@@ -106,8 +114,17 @@ class Http {
} }
showError(msg) { showError(msg) {
if (window.rootVue && window.rootVue.$Message) { // 优先使用框架的 ViewUI 实例,如果不存在则使用全局的 $Message
window.rootVue.$Message.error({ content: msg, duration: 3 }) try {
if (window.framework && window.framework.ViewUI && window.framework.ViewUI.Message) {
window.framework.ViewUI.Message.error({ content: msg, duration: 3 })
} else if (window.$Message) {
window.$Message.error({ content: msg, duration: 3 })
} else {
console.error('[HTTP Error]', msg)
}
} catch (error) {
console.error('[HTTP Error]', msg, error)
} }
} }

View File

@@ -110,20 +110,31 @@ export default class uiTool {
} }
static delConfirm(callback) { static delConfirm(callback) {
if (window.rootVue && window.rootVue.$Modal) { try {
window.rootVue.$Modal.confirm({ const Modal = (window.framework && window.framework.ViewUI && window.framework.ViewUI.Modal) || window.$Modal
if (Modal) {
Modal.confirm({
title: '温馨提示', title: '温馨提示',
content: '<p>你确定删除吗?</p>', content: '<p>你确定删除吗?</p>',
onOk: () => { onOk: () => {
callback && callback() callback && callback()
} }
}) })
} else {
// 如果 Modal 不存在,使用原生确认框
if (confirm('你确定删除吗?')) {
callback && callback()
}
}
} catch (error) {
console.error('delConfirm error:', error)
} }
} }
static showConfirm({ title = '温馨提示', content = '内容' }, callback) { static showConfirm({ title = '温馨提示', content = '内容' }, callback) {
if (window.rootVue && window.rootVue.$Modal) { const Modal = (window.framework && window.framework.ViewUI && window.framework.ViewUI.Modal) || window.$Modal
window.rootVue.$Modal.confirm({ if (Modal) {
Modal.confirm({
title, title,
content, content,
onOk: () => { onOk: () => {

View File

@@ -75,7 +75,7 @@ export default {
this.$refs.editModal.addShow({}, async (row) => { this.$refs.editModal.addShow({}, async (row) => {
await paramSetupServer.add(row) await paramSetupServer.add(row)
rootVue.$Message.success('新增成功!') this.$Message.success('新增成功!')
this.init() this.init()
}) })
}, },
@@ -88,7 +88,7 @@ export default {
this.gridOption.editRow = row this.gridOption.editRow = row
this.$refs.editModal.editShow(row, async (newRow) => { this.$refs.editModal.editShow(row, async (newRow) => {
await paramSetupServer.edit(newRow) await paramSetupServer.edit(newRow)
rootVue.$Message.success('修改成功!') this.$Message.success('修改成功!')
this.init() this.init()
}) })
@@ -96,7 +96,7 @@ export default {
async delConfirm(row) { async delConfirm(row) {
uiTool.delConfirm(async () => { uiTool.delConfirm(async () => {
await paramSetupServer.del(row) await paramSetupServer.del(row)
rootVue.$Message.success('删除成功!') this.$Message.success('删除成功!')
this.init() this.init()
}) })
}, },

View File

@@ -82,21 +82,21 @@ export default {
this.$refs.editModal.addShow({}, async (row) => { this.$refs.editModal.addShow({}, async (row) => {
await roleServer.add(row) await roleServer.add(row)
this.init() this.init()
await rootVue.$Message.success('新增成功!') await this.$Message.success('新增成功!')
}) })
}, },
showEditWarp(row) { showEditWarp(row) {
this.$refs.editModal.editShow(row, async (newRow) => { this.$refs.editModal.editShow(row, async (newRow) => {
await roleServer.edit(newRow) await roleServer.edit(newRow)
await this.init() await this.init()
rootVue.$Message.success('修改成功!') this.$Message.success('修改成功!')
}) })
}, },
async delConfirm(row) { async delConfirm(row) {
uiTool.delConfirm(async () => { uiTool.delConfirm(async () => {
await roleServer.del(row) await roleServer.del(row)
await this.init() await this.init()
rootVue.$Message.success('删除成功!') this.$Message.success('删除成功!')
}) })
}, },
async submitPermission() { async submitPermission() {
@@ -110,7 +110,7 @@ export default {
await roleServer.edit(param) await roleServer.edit(param)
await this.init() await this.init()
rootVue.$Message.success('权限修改成功!') this.$Message.success('权限修改成功!')
this.isShowPermission = false this.isShowPermission = false
}, },

View File

@@ -112,21 +112,21 @@ export default {
showAddWarp() { showAddWarp() {
this.$refs.editModal.addShow({}, async (newRow) => { this.$refs.editModal.addShow({}, async (newRow) => {
await userServer.add(newRow) await userServer.add(newRow)
rootVue.$Message.success('新增成功!') this.$Message.success('新增成功!')
this.init() this.init()
}) })
}, },
showEditWarp(row) { showEditWarp(row) {
this.$refs.editModal.editShow(row, async (newRow) => { this.$refs.editModal.editShow(row, async (newRow) => {
await userServer.edit(newRow) await userServer.edit(newRow)
rootVue.$Message.success('修改成功!') this.$Message.success('修改成功!')
this.init() this.init()
}) })
}, },
async delConfirm(row) { async delConfirm(row) {
uiTool.delConfirm(async () => { uiTool.delConfirm(async () => {
await userServer.del(row) await userServer.del(row)
rootVue.$Message.success('删除成功!') this.$Message.success('删除成功!')
this.init() this.init()
}) })
}, },

View File

@@ -119,7 +119,7 @@ export default {
async showAddWarp() { async showAddWarp() {
this.$refs.editModal.addShow({}, async (newRow) => { this.$refs.editModal.addShow({}, async (newRow) => {
let res = await sysControlTypeServer.add(newRow) let res = await sysControlTypeServer.add(newRow)
rootVue.$Message.success('新增成功!') this.$Message.success('新增成功!')
this.init() this.init()
}) })
}, },
@@ -128,7 +128,7 @@ export default {
let valid = await this.$refs['editModal'].$refs['From'].validate() let valid = await this.$refs['editModal'].$refs['From'].validate()
if (valid) { if (valid) {
let res = await sysControlTypeServer.edit(newRow) let res = await sysControlTypeServer.edit(newRow)
rootVue.$Message.success('修改成功!') this.$Message.success('修改成功!')
this.init() this.init()
} }
}) })
@@ -137,7 +137,7 @@ export default {
async delConfirm(row) { async delConfirm(row) {
uiTool.delConfirm(async () => { uiTool.delConfirm(async () => {
await sysControlTypeServer.del(row) await sysControlTypeServer.del(row)
rootVue.$Message.success('删除成功!') this.$Message.success('删除成功!')
this.init() this.init()
}) })
}, },

View File

@@ -317,7 +317,7 @@ export default {
this.$refs.editModal.editShow(this.editRow, async (newRow) => { this.$refs.editModal.editShow(this.editRow, async (newRow) => {
let param = Object.assign({}, this.editRow, newRow) let param = Object.assign({}, this.editRow, newRow)
await menuServer.edit(param) await menuServer.edit(param)
rootVue.$Message.success('修改成功!') this.$Message.success('修改成功!')
this.init() this.init()
}) })
}, },
@@ -335,7 +335,7 @@ export default {
this.$refs.editModal.addShow(this.editRow, async (newRow) => { this.$refs.editModal.addShow(this.editRow, async (newRow) => {
let param = Object.assign({}, newRow) let param = Object.assign({}, newRow)
await menuServer.add(param) await menuServer.add(param)
rootVue.$Message.success('新增成功!') this.$Message.success('新增成功!')
this.init() this.init()
}) })
}, },
@@ -354,14 +354,14 @@ export default {
this.$refs.editModal.addShow(this.editRow, async (newRow) => { this.$refs.editModal.addShow(this.editRow, async (newRow) => {
let param = Object.assign({}, newRow) let param = Object.assign({}, newRow)
await menuServer.add(param) await menuServer.add(param)
rootVue.$Message.success('新增成功!') this.$Message.success('新增成功!')
this.init() this.init()
}) })
}, },
async delConfirm(row) { async delConfirm(row) {
uiTool.delConfirm(async () => { uiTool.delConfirm(async () => {
await menuServer.del(row) await menuServer.del(row)
rootVue.$Message.success('删除成功!') this.$Message.success('删除成功!')
this.init() this.init()
}) })
}, },
@@ -372,7 +372,7 @@ export default {
}, },
async () => { async () => {
let res = await menuServer.generate(row) let res = await menuServer.generate(row)
rootVue.$Message.success('生成成功!') this.$Message.success('生成成功!')
this.init() this.init()
} }
) )
@@ -384,7 +384,7 @@ export default {
}, },
async () => { async () => {
let res = await menuServer.generateModel(row) let res = await menuServer.generateModel(row)
rootVue.$Message.success('生成成功!') this.$Message.success('生成成功!')
this.init() this.init()
} }
) )

View File

@@ -1,362 +0,0 @@
/**
* Admin Framework - 閫氱敤鍚庡彴绠$悊绯荤粺妗嗘灦
* 鐗堟湰: 1.0.0
*
* 鍔熻兘鍖呭惈:
* - 绯荤粺绠$悊鍔熻兘 (sys_*)
* - 鐢ㄦ埛鐧诲綍鍜屾潈闄愮鐞? * - 鍔ㄦ€佽矾鐢辩鐞? * - 涓诲竷灞€鍜岄〉闈㈠竷灞€
* - 鍏ㄥ眬缁勪欢
* - 宸ュ叿搴? * - Vuex 鐘舵€佺鐞? */
// ==================== 鏍峰紡鏂囦欢 ====================
import './assets/css/animate.css'
import './assets/css/base.less'
import './assets/css/ivewExpand.less'
import './assets/icons/iconfont.css'
// ==================== 宸ュ叿搴?====================
import uiTool from './utils/uiTool'
import http from './utils/http'
import * as tools from './utils/tools'
// ==================== Store 妯″潡 ====================
import storeModules, { userModule, appModule } from './store'
// ==================== 璺敱閰嶇疆 ====================
import routerConfig, { createBaseRoutes, setupRouterGuards } from './router'
// ==================== 绯荤粺椤甸潰 ====================
// 涓婚〉
import HomePage from './views/home/index.vue'
// system 椤甸潰
import SysLog from './views/system/sys_log.vue'
import SysParamSetup from './views/system/sys_param_setup.vue'
import SysRole from './views/system/sys_role.vue'
import SysUser from './views/system/sys_user.vue'
// system_high 椤甸潰
import SysControl from './views/system_high/sys_control.vue'
import SysMenu from './views/system_high/sys_menu.vue'
import SysTitle from './views/system_high/sys_title.vue'
// 鐧诲綍鍜岄敊璇〉闈?import LoginPage from './views/login/login.vue'
import Page401 from './views/error-page/401.vue'
import Page404 from './views/error-page/404.vue'
import Page500 from './views/error-page/500.vue'
// 甯冨眬缁勪欢
import Main from './components/main'
import ParentView from './components/parent-view'
// ==================== 绯荤粺 API ====================
// system API
import * as systemApi from './api/system'
// system_high API
import * as systemHighApi from './api/system_high'
// ==================== 妗嗘灦绫?====================
class AdminFramework {
constructor() {
this.version = '1.0.0'
this.installed = false
this.config = {}
this.store = null
this.router = null
// 瀵煎嚭宸ュ叿
this.tools = tools
this.uiTool = uiTool
this.http = http
// 瀵煎嚭 Store 妯″潡
this.storeModules = storeModules
this.userModule = userModule
this.appModule = appModule
// 瀵煎嚭璺敱閰嶇疆
this.createBaseRoutes = createBaseRoutes
this.setupRouterGuards = setupRouterGuards
// 瀵煎嚭缁勪欢
this.Main = Main
this.ParentView = ParentView
this.LoginPage = LoginPage
this.Page401 = Page401
this.Page404 = Page404
this.Page500 = Page500
// 瀵煎嚭绯荤粺椤甸潰
this.HomePage = HomePage
this.SysLog = SysLog
this.SysParamSetup = SysParamSetup
this.SysRole = SysRole
this.SysUser = SysUser
this.SysControl = SysControl
this.SysMenu = SysMenu
this.SysTitle = SysTitle
// 瀵煎嚭 API
this.systemApi = systemApi
this.systemHighApi = systemHighApi
}
/**
* Vue 鎻掍欢瀹夎鏂规硶 - 鑷姩瀹屾垚鎵€鏈夊垵濮嬪寲
* @param {Object} Vue - Vue 瀹炰緥
* @param {Object} options - 閰嶇疆閫夐」
* @param {Object} options.config - 搴旂敤閰嶇疆
* @param {Object} options.ViewUI - ViewUI 瀹炰緥锛堝彲閫夛紝妗嗘灦浼氳嚜鍔ㄥ鐞嗭級
* @param {Object} options.VueRouter - VueRouter 瀹炰緥锛堝彲閫夛級
* @param {Object} options.Vuex - Vuex 瀹炰緥锛堝彲閫夛級
* @param {Function} options.createPersistedState - vuex-persistedstate锛堝彲閫夛級
* @param {Object} options.componentMap - 鑷畾涔夌粍浠舵槧灏勮〃锛堝彲閫夛級
*/
install(Vue, options = {}) {
if (this.installed) return
this.installed = true
const { config = {}, ViewUI, VueRouter, Vuex, createPersistedState, componentMap } = options
this.config = config
// 鑷姩娉ㄥ唽 ViewUI
if (ViewUI) {
Vue.use(ViewUI)
}
// 鑷姩娉ㄥ唽 VueRouter
if (VueRouter) {
Vue.use(VueRouter)
}
// 鑷姩娉ㄥ唽 Vuex
if (Vuex) {
Vue.use(Vuex)
}
// 鎸傝浇鍏ㄥ眬閰嶇疆鍜屽伐鍏? Vue.prototype.$config = config
Vue.prototype.$http = http
Vue.prototype.$tools = tools
Vue.prototype.$uiTool = uiTool
// 鑷姩娉ㄥ唽鍏ㄥ眬缁勪欢
this.registerGlobalComponents(Vue)
// 鑷姩璁剧疆缁勪欢鏄犲皠琛紙鍖呭惈澶栭儴浼犲叆鐨勬槧灏勶級
this.setupComponentMap(componentMap)
// 濡傛灉鎻愪緵浜?Vuex锛岃嚜鍔ㄥ垱寤?Store
if (Vuex && !this.store) {
this.store = this.createStore(Vuex, {}, createPersistedState)
// 鑷姩鍒濆鍖?HTTP
http.init(config, this.store)
}
// 濡傛灉鎻愪緵浜?VueRouter锛岃嚜鍔ㄥ垱寤?Router
if (VueRouter && !this.router) {
// 鑾峰彇涓昏矾鐢遍厤缃紙浠庡悗绔潈闄愯彍鍗曠敓鎴愶級
const mainRoute = this.getRoutes({ Main, ParentView, Page404 })
this.router = this.createRouter(VueRouter, {
Main,
ParentView,
LoginPage,
Page401,
Page404,
Page500
}, mainRoute ? [mainRoute] : [], ViewUI)
}
}
/**
* 鑷姩娉ㄥ唽鍏ㄥ眬缁勪欢
*/
registerGlobalComponents(Vue) {
// 娉ㄥ唽甯冨眬缁勪欢
Vue.component('Main', Main)
Vue.component('ParentView', ParentView)
// 娉ㄥ唽閿欒椤甸潰
Vue.component('Page401', Page401)
Vue.component('Page404', Page404)
Vue.component('Page500', Page500)
// 娉ㄥ唽鐧诲綍椤甸潰
Vue.component('LoginPage', LoginPage)
}
/**
* 璁剧疆缁勪欢鏄犲皠琛紙灏嗗悗绔繑鍥炵殑璺緞鏄犲皠鍒板疄闄呯粍浠讹級
* @param {Object} customMap - 澶栭儴浼犲叆鐨勮嚜瀹氫箟缁勪欢鏄犲皠
*/
setupComponentMap(customMap = {}) {
// 妗嗘灦鍐呯疆缁勪欢鍒楄〃锛氳矾寰?=> 缁勪欢
const components = {
'home/index': HomePage,
'system/sys_log': SysLog,
'system/sys_param_setup': SysParamSetup,
'system/sys_role': SysRole,
'system/sys_user': SysUser,
'system_high/sys_control': SysControl,
'system_high/sys_menu': SysMenu,
'system_high/sys_title': SysTitle,
// 鍚堝苟澶栭儴浼犲叆鐨勭粍浠舵槧灏? ...customMap
}
// 鑷姩鐢熸垚甯?.vue 鍜屼笉甯?.vue 鐨勬槧灏? const map = {}
Object.keys(components).forEach(path => {
const cleanPath = path.replace(/\.vue$/, '')
map[cleanPath] = components[path]
map[cleanPath + '.vue'] = components[path]
})
uiTool.setComponentMap(map)
}
/**
* 娣诲姞鑷畾涔夌粍浠舵槧灏? * @param {Object} customMap - 鑷畾涔夌粍浠舵槧灏勫璞? * @example
* AdminFramework.addComponentMap({
* 'ball/games.vue': GamesComponent,
* 'order/pay_orders.vue': PayOrdersComponent
* })
*/
addComponentMap(customMap) {
uiTool.setComponentMap(customMap)
}
/**
* 鍒濆鍖?HTTP 閰嶇疆
* @param {Object} config - HTTP 閰嶇疆
* @param {Object} store - Vuex Store 瀹炰緥
*/
initHttp(config, store) {
http.init(config, store)
this.store = store
}
/**
* 鍒涘缓璺敱瀹炰緥
* @param {Object} Router - VueRouter 绫? * @param {Object} components - 缁勪欢瀵硅薄
* @param {Array} customRoutes - 鑷畾涔夎矾鐢? * @param {Object} ViewUI - ViewUI 瀹炰緥
* @param {String} homeName - 棣栭〉鍚嶇О
* @returns {Object} router 瀹炰緥
*/
createRouter(Router, components = {}, customRoutes = [], ViewUI, homeName = 'home') {
const { LoginPage, Page401, Page404, Page500 } = components
if (!LoginPage || !Page401 || !Page404 || !Page500) {
console.error('Missing required page components')
return null
}
const baseRoutes = createBaseRoutes(LoginPage, Page401, Page404, Page500)
const router = new Router({
routes: [...baseRoutes, ...customRoutes],
mode: 'hash'
})
if (ViewUI) {
setupRouterGuards(router, ViewUI, homeName)
}
return router
}
/**
* 鍒涘缓 Store 瀹炰緥
* @param {Object} Vuex - Vuex 绫? * @param {Object} customModules - 鑷畾涔夋ā鍧? * @param {Object} createPersistedState - vuex-persistedstate 鎻掍欢
* @returns {Object} store 瀹炰緥
*/
createStore(Vuex, customModules = {}, createPersistedState) {
const store = new Vuex.Store({
modules: {
user: userModule,
app: appModule,
...customModules
},
plugins: createPersistedState ? [
createPersistedState({
storage: window.localStorage
})
] : []
})
this.store = store
return store
}
/**
* 鑾峰彇鍔ㄦ€佽矾鐢? * @param {Object} components - 缁勪欢瀵硅薄
* @returns {Object} 涓昏矾鐢遍厤缃? */
getRoutes(components = {}) {
const { Main, ParentView, Page404 } = components
if (!Main || !ParentView || !Page404) {
console.error('Missing required layout components')
return null
}
return uiTool.getRoutes(Main, ParentView, Page404)
}
/**
* 娉ㄥ唽鍏ㄥ眬缁勪欢
* @param {Object} Vue - Vue 瀹炰緥
* @param {Object} components - 缁勪欢瀵硅薄
*/
registerComponents(Vue, components = {}) {
Object.keys(components).forEach(name => {
Vue.component(name, components[name])
})
}
}
// ==================== 鍒涘缓瀹炰緥骞跺鍑?====================
const framework = new AdminFramework()
// 榛樿瀵煎嚭妗嗘灦瀹炰緥
export default framework
// 鎸夐渶瀵煎嚭
export {
// 宸ュ叿搴? tools,
uiTool,
http,
// Store 妯″潡
storeModules,
userModule,
appModule,
// 璺敱閰嶇疆
createBaseRoutes,
setupRouterGuards,
// 绯荤粺椤甸潰
HomePage,
SysLog,
SysParamSetup,
SysRole,
SysUser,
SysControl,
SysMenu,
SysTitle,
// 鐧诲綍鍜岄敊璇〉闈? LoginPage,
Page401,
Page404,
Page500,
// 甯冨眬缁勪欢
Main,
ParentView,
// 绯荤粺 API
systemApi,
systemHighApi,
// 妗嗘灦绫? AdminFramework
}