This commit is contained in:
sakuya 2021-05-06 22:39:16 +08:00
parent f510fb00e4
commit 2366eb4868
7 changed files with 33 additions and 16 deletions

View File

@ -34,6 +34,9 @@
"env": { "env": {
"node": true "node": true
}, },
"globals": {
"APP_CONFIG": true
},
"extends": [ "extends": [
"plugin:vue/vue3-essential", "plugin:vue/vue3-essential",
"eslint:recommended" "eslint:recommended"

8
public/config.js Normal file
View File

@ -0,0 +1,8 @@
const APP_CONFIG = {
//标题
APP_NAME: "SCUI",
//版本号
APP_VER: "1.0",
//接口地址
API_URL: ""
}

View File

@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>Welcome to SCUI Admin</title> <title>Welcome to SCUI Admin</title>
<script src="config.js"></script>
</head> </head>
<body> <body>
<noscript> <noscript>

View File

@ -12,7 +12,7 @@ import http from "@/utils/request";
const api = { const api = {
user: { user: {
info: { info: {
url: `${config.apiUrl}/json/user.json`, url: `${config.API_URL}/json/user.json`,
name: "登录获取用户菜单和权限", name: "登录获取用户菜单和权限",
get: async function(){ get: async function(){
return await http.get(this.url); return await http.get(this.url);
@ -21,7 +21,7 @@ const api = {
}, },
demo: { demo: {
select: { select: {
url: `${config.apiUrl}/json/select.json`, url: `${config.API_URL}/json/select.json`,
name: "下拉菜单数据", name: "下拉菜单数据",
get: async function(data){ get: async function(data){
return await http.get(this.url, data); return await http.get(this.url, data);
@ -29,7 +29,7 @@ const api = {
}, },
demolist: { demolist: {
list: { list: {
url: `${config.apiUrl}/json/list.json`, url: `${config.API_URL}/json/list.json`,
name: "列表数据", name: "列表数据",
get: async function(data){ get: async function(data){
return await http.get(this.url, data); return await http.get(this.url, data);

View File

@ -1,14 +1,16 @@
module.exports = {
const DEFAULT_CONFIG = {
//标题 //标题
title: "SCUI", APP_NAME: "SCUI",
//版本号 //版本号
version: "1.0", APP_VER: "0.0.0",
//接口地址 //接口地址
apiUrl: "", API_URL: ""
//是否开启多标签 }
tags: true,
//布局 //如果有外部APP_CONFIG就合并
layout: "default", if(APP_CONFIG){
//主题 Object.assign(DEFAULT_CONFIG, APP_CONFIG)
theme: "default", }
};
module.exports = DEFAULT_CONFIG

View File

@ -4,7 +4,7 @@
<div class="login_body"> <div class="login_body">
<div class="login-sidebox"> <div class="login-sidebox">
<div class="login-logo"> <div class="login-logo">
<i class="el-icon-platform-eleme"></i>SCUI <i class="el-icon-platform-eleme"></i>{{appName}}
</div> </div>
<div class="login-title"> <div class="login-title">
<h2>面面俱到的中后台前端框架</h2> <h2>面面俱到的中后台前端框架</h2>
@ -38,7 +38,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="login-footer">© SCUI</div> <div class="login-footer">© {{appName}} {{appVar}}</div>
</div> </div>
</template> </template>
@ -71,6 +71,8 @@
export default { export default {
data() { data() {
return { return {
appName: this.$CONFIG.APP_NAME,
appVar: this.$CONFIG.APP_VER,
ruleForm: { ruleForm: {
user: "admin", user: "admin",
password: "admin", password: "admin",

View File

@ -12,6 +12,7 @@ module.exports = {
chainWebpack: config => { chainWebpack: config => {
// 移除 prefetch 插件 // 移除 prefetch 插件
config.plugins.delete('preload');
config.plugins.delete('prefetch'); config.plugins.delete('prefetch');
}, },