commit
764970bc8f
24 changed files with 16781 additions and 0 deletions
@ -0,0 +1,7 @@ |
|||||||
|
[*.{js,jsx,ts,tsx,vue}] |
||||||
|
indent_style = space |
||||||
|
indent_size = 2 |
||||||
|
end_of_line = lf |
||||||
|
trim_trailing_whitespace = true |
||||||
|
insert_final_newline = true |
||||||
|
max_line_length = 100 |
||||||
@ -0,0 +1,23 @@ |
|||||||
|
.DS_Store |
||||||
|
node_modules |
||||||
|
/dist |
||||||
|
|
||||||
|
|
||||||
|
# local env files |
||||||
|
.env.local |
||||||
|
.env.*.local |
||||||
|
|
||||||
|
# Log files |
||||||
|
npm-debug.log* |
||||||
|
yarn-debug.log* |
||||||
|
yarn-error.log* |
||||||
|
pnpm-debug.log* |
||||||
|
|
||||||
|
# Editor directories and files |
||||||
|
.idea |
||||||
|
.vscode |
||||||
|
*.suo |
||||||
|
*.ntvs* |
||||||
|
*.njsproj |
||||||
|
*.sln |
||||||
|
*.sw? |
||||||
@ -0,0 +1,24 @@ |
|||||||
|
# admin |
||||||
|
|
||||||
|
## Project setup |
||||||
|
``` |
||||||
|
yarn install |
||||||
|
``` |
||||||
|
|
||||||
|
### Compiles and hot-reloads for development |
||||||
|
``` |
||||||
|
yarn serve |
||||||
|
``` |
||||||
|
|
||||||
|
### Compiles and minifies for production |
||||||
|
``` |
||||||
|
yarn build |
||||||
|
``` |
||||||
|
|
||||||
|
### Lints and fixes files |
||||||
|
``` |
||||||
|
yarn lint |
||||||
|
``` |
||||||
|
|
||||||
|
### Customize configuration |
||||||
|
See [Configuration Reference](https://cli.vuejs.org/config/). |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
module.exports = { |
||||||
|
presets: [ |
||||||
|
'@vue/cli-plugin-babel/preset', |
||||||
|
], |
||||||
|
}; |
||||||
@ -0,0 +1,19 @@ |
|||||||
|
{ |
||||||
|
"compilerOptions": { |
||||||
|
"target": "es5", |
||||||
|
"module": "esnext", |
||||||
|
"baseUrl": "./", |
||||||
|
"moduleResolution": "node", |
||||||
|
"paths": { |
||||||
|
"@/*": [ |
||||||
|
"src/*" |
||||||
|
] |
||||||
|
}, |
||||||
|
"lib": [ |
||||||
|
"esnext", |
||||||
|
"dom", |
||||||
|
"dom.iterable", |
||||||
|
"scripthost" |
||||||
|
] |
||||||
|
} |
||||||
|
} |
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,52 @@ |
|||||||
|
{ |
||||||
|
"name": "admin", |
||||||
|
"version": "0.1.0", |
||||||
|
"private": true, |
||||||
|
"scripts": { |
||||||
|
"serve": "vue-cli-service serve", |
||||||
|
"build": "vue-cli-service build", |
||||||
|
"lint": "vue-cli-service lint" |
||||||
|
}, |
||||||
|
"dependencies": { |
||||||
|
"core-js": "^3.8.3", |
||||||
|
"vue": "^2.6.14", |
||||||
|
"vue-router": "^3.5.1", |
||||||
|
"vuex": "^3.6.2" |
||||||
|
}, |
||||||
|
"devDependencies": { |
||||||
|
"@babel/core": "^7.12.16", |
||||||
|
"@babel/eslint-parser": "^7.12.16", |
||||||
|
"@vue/cli-plugin-babel": "~5.0.0", |
||||||
|
"@vue/cli-plugin-eslint": "~5.0.0", |
||||||
|
"@vue/cli-plugin-router": "~5.0.0", |
||||||
|
"@vue/cli-plugin-vuex": "~5.0.0", |
||||||
|
"@vue/cli-service": "~5.0.0", |
||||||
|
"@vue/eslint-config-airbnb": "^6.0.0", |
||||||
|
"eslint": "^7.32.0", |
||||||
|
"eslint-plugin-import": "^2.25.3", |
||||||
|
"eslint-plugin-vue": "^8.0.3", |
||||||
|
"eslint-plugin-vuejs-accessibility": "^1.1.0", |
||||||
|
"sass": "^1.32.7", |
||||||
|
"sass-loader": "^12.0.0", |
||||||
|
"vue-template-compiler": "^2.6.14" |
||||||
|
}, |
||||||
|
"eslintConfig": { |
||||||
|
"root": true, |
||||||
|
"env": { |
||||||
|
"node": true |
||||||
|
}, |
||||||
|
"extends": [ |
||||||
|
"plugin:vue/essential", |
||||||
|
"@vue/airbnb" |
||||||
|
], |
||||||
|
"parserOptions": { |
||||||
|
"parser": "@babel/eslint-parser" |
||||||
|
}, |
||||||
|
"rules": {} |
||||||
|
}, |
||||||
|
"browserslist": [ |
||||||
|
"> 1%", |
||||||
|
"last 2 versions", |
||||||
|
"not dead" |
||||||
|
] |
||||||
|
} |
||||||
|
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,18 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<html lang=""> |
||||||
|
<head> |
||||||
|
<meta charset="utf-8"> |
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1.0"> |
||||||
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> |
||||||
|
<!-- <title><%= htmlWebpackPlugin.options.title %></title> --> |
||||||
|
<title>包头市公共数据平台</title> |
||||||
|
</head> |
||||||
|
<body> |
||||||
|
<noscript> |
||||||
|
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> |
||||||
|
</noscript> |
||||||
|
<div id="app"></div> |
||||||
|
<!-- built files will be auto injected --> |
||||||
|
</body> |
||||||
|
</html> |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
<template> |
||||||
|
<div id="app"> |
||||||
|
<!-- <nav> |
||||||
|
<router-link to="/">Home</router-link> | |
||||||
|
<router-link to="/about">About</router-link> |
||||||
|
</nav> --> |
||||||
|
<router-view/> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<style lang="scss"> |
||||||
|
#app { |
||||||
|
font-family: Avenir, Helvetica, Arial, sans-serif; |
||||||
|
-webkit-font-smoothing: antialiased; |
||||||
|
-moz-osx-font-smoothing: grayscale; |
||||||
|
text-align: center; |
||||||
|
color: #2c3e50; |
||||||
|
margin: -8px; |
||||||
|
} |
||||||
|
|
||||||
|
nav { |
||||||
|
padding: 30px; |
||||||
|
|
||||||
|
a { |
||||||
|
font-weight: bold; |
||||||
|
color: #2c3e50; |
||||||
|
|
||||||
|
&.router-link-exact-active { |
||||||
|
color: #42b983; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
||||||
|
After Width: | Height: | Size: 6.7 KiB |
@ -0,0 +1,60 @@ |
|||||||
|
<template> |
||||||
|
<div class="hello"> |
||||||
|
<h1>{{ msg }}</h1> |
||||||
|
<p> |
||||||
|
For a guide and recipes on how to configure / customize this project,<br> |
||||||
|
check out the |
||||||
|
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>. |
||||||
|
</p> |
||||||
|
<h3>Installed CLI Plugins</h3> |
||||||
|
<ul> |
||||||
|
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li> |
||||||
|
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li> |
||||||
|
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex" target="_blank" rel="noopener">vuex</a></li> |
||||||
|
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li> |
||||||
|
</ul> |
||||||
|
<h3>Essential Links</h3> |
||||||
|
<ul> |
||||||
|
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li> |
||||||
|
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li> |
||||||
|
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li> |
||||||
|
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li> |
||||||
|
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li> |
||||||
|
</ul> |
||||||
|
<h3>Ecosystem</h3> |
||||||
|
<ul> |
||||||
|
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li> |
||||||
|
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li> |
||||||
|
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li> |
||||||
|
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li> |
||||||
|
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li> |
||||||
|
</ul> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
export default { |
||||||
|
name: 'HelloWorld', |
||||||
|
props: { |
||||||
|
msg: String, |
||||||
|
}, |
||||||
|
}; |
||||||
|
</script> |
||||||
|
|
||||||
|
<!-- Add "scoped" attribute to limit CSS to this component only --> |
||||||
|
<style scoped lang="scss"> |
||||||
|
h3 { |
||||||
|
margin: 40px 0 0; |
||||||
|
} |
||||||
|
ul { |
||||||
|
list-style-type: none; |
||||||
|
padding: 0; |
||||||
|
} |
||||||
|
li { |
||||||
|
display: inline-block; |
||||||
|
margin: 0 10px; |
||||||
|
} |
||||||
|
a { |
||||||
|
color: #42b983; |
||||||
|
} |
||||||
|
</style> |
||||||
@ -0,0 +1,45 @@ |
|||||||
|
<template> |
||||||
|
<div class="top_head"> |
||||||
|
<!-- <ul class="ul_box"> |
||||||
|
<li class="li_item" v-for="item in titleList" :key="item.title">{{item.title}}</li> |
||||||
|
</ul> --> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
export default { |
||||||
|
data() { |
||||||
|
return { |
||||||
|
// titleList:[ |
||||||
|
// {title:'门户首页',children:[],url:'/homePage'}, |
||||||
|
// {title:'公司概况',children:[],url:'/'}, |
||||||
|
// {title:'数据大厅',children:[],url:'dataHall'}, |
||||||
|
// {title:'门户首页',children:[],url:'/'}, |
||||||
|
// {title:'门户首页',children:[],url:'/'}, |
||||||
|
// ] |
||||||
|
} |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
|
||||||
|
}, |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="scss" scoped> |
||||||
|
.top_head{ |
||||||
|
width: 100%; |
||||||
|
height: 50px; |
||||||
|
line-height: 50px; |
||||||
|
background: red; |
||||||
|
|
||||||
|
.ul_box{ |
||||||
|
list-style: none; |
||||||
|
display: flex; |
||||||
|
|
||||||
|
.li_item{ |
||||||
|
padding: 0 20px; |
||||||
|
cursor: pointer; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
import Vue from 'vue'; |
||||||
|
import App from './App.vue'; |
||||||
|
import router from './router'; |
||||||
|
import store from './store'; |
||||||
|
|
||||||
|
Vue.config.productionTip = false; |
||||||
|
|
||||||
|
new Vue({ |
||||||
|
router, |
||||||
|
store, |
||||||
|
render: (h) => h(App), |
||||||
|
}).$mount('#app'); |
||||||
@ -0,0 +1,204 @@ |
|||||||
|
let RouterPlugin = function () { |
||||||
|
this.$router = null; |
||||||
|
this.$store = null; |
||||||
|
}; |
||||||
|
RouterPlugin.install = function (vue, option = {}) { |
||||||
|
this.$router = option.router; |
||||||
|
this.$store = option.store; |
||||||
|
this.$vue = new vue({ i18n: option.i18n }); |
||||||
|
|
||||||
|
// 这个的作用是 为了检查出网页链接,因为本项目用到了 iframe
|
||||||
|
function isURL(s) { |
||||||
|
if (s.includes("html")) return true; |
||||||
|
return /^http[s]?:\/\/.*/.test(s); |
||||||
|
} |
||||||
|
|
||||||
|
// 将参数处理为参数的形式拼接
|
||||||
|
function objToform(obj) { |
||||||
|
let result = []; |
||||||
|
Object.keys(obj).forEach((ele) => { |
||||||
|
result.push(`${ele}=${obj[ele]}`); |
||||||
|
}); |
||||||
|
return result.join("&"); |
||||||
|
} |
||||||
|
|
||||||
|
this.$router.$avueRouter = { |
||||||
|
//全局配置
|
||||||
|
$website: this.$store.getters.website, |
||||||
|
group: "", |
||||||
|
meta: {}, |
||||||
|
safe: this, |
||||||
|
// 设置标题
|
||||||
|
setTitle: (title) => { |
||||||
|
const defaultTitle = this.$vue.$t("title"); |
||||||
|
title = title ? `${title}-${defaultTitle}` : defaultTitle; |
||||||
|
document.title = title; |
||||||
|
}, |
||||||
|
closeTag: (value) => { |
||||||
|
let tag = value || this.$store.getters.tag; |
||||||
|
if (typeof value === "string") { |
||||||
|
tag = this.$store.getters.tagList.filter((ele) => ele.value === value)[0]; |
||||||
|
} |
||||||
|
this.$store.commit("DEL_TAG", tag); |
||||||
|
}, |
||||||
|
generateTitle: (title, key) => { |
||||||
|
if (!key) return title; |
||||||
|
const hasKey = this.$vue.$te("route." + key); |
||||||
|
if (hasKey) { |
||||||
|
// $t :this method from vue-i18n, inject in @/lang/index.js
|
||||||
|
const translatedTitle = this.$vue.$t("route." + key); |
||||||
|
|
||||||
|
return translatedTitle; |
||||||
|
} |
||||||
|
return title; |
||||||
|
}, |
||||||
|
//处理路由
|
||||||
|
getPath: function (params) { |
||||||
|
let { src } = params; |
||||||
|
let result = src || "/"; |
||||||
|
if (isURL(src)) { |
||||||
|
result = `/myiframe/urlPath?${objToform(params)}`; |
||||||
|
} |
||||||
|
return result; |
||||||
|
}, |
||||||
|
//正则处理路由
|
||||||
|
vaildPath: function (list, path) { |
||||||
|
let result = false; |
||||||
|
list.forEach((ele) => { |
||||||
|
if (new RegExp("^" + ele + ".*", "g").test(path)) { |
||||||
|
result = true; |
||||||
|
} |
||||||
|
}); |
||||||
|
return result; |
||||||
|
}, |
||||||
|
//设置路由值
|
||||||
|
getValue: function (route) { |
||||||
|
let value = ""; |
||||||
|
if (route.query.src) { |
||||||
|
value = route.query.src; |
||||||
|
} else { |
||||||
|
value = route.path; |
||||||
|
} |
||||||
|
return value; |
||||||
|
}, |
||||||
|
//动态路由
|
||||||
|
// 路由是专门的一个接口获取
|
||||||
|
/** |
||||||
|
* aMenu: 接受到的动态路由数据 menu的结构外层有父级path 里面有一个childen 记录页面的路由 |
||||||
|
* first: 为了区分外界 调用formatRoutes 和 当前文件调用 formatRoutes |
||||||
|
*/ |
||||||
|
formatRoutes: function (aMenu = [], first) { |
||||||
|
// window.console.log('aMenu')
|
||||||
|
// window.console.log(aMenu)
|
||||||
|
const aRouter = []; |
||||||
|
// 获取到全局配置中的 props
|
||||||
|
const propsConfig = this.$website.menu.props; |
||||||
|
// 设置 props默认值 作用就是将字段设置成配置的
|
||||||
|
const propsDefault = { |
||||||
|
label: propsConfig.label || "name", |
||||||
|
path: propsConfig.path || "path", |
||||||
|
icon: propsConfig.icon || "icon", |
||||||
|
children: propsConfig.children || "children", |
||||||
|
meta: propsConfig.meta || "meta", |
||||||
|
}; |
||||||
|
// 如果没有权限菜单就结束
|
||||||
|
if (aMenu.length === 0) return; |
||||||
|
// 开始处理menu
|
||||||
|
for (let i = 0; i < aMenu.length; i++) { |
||||||
|
// 取到当前要处理的一项
|
||||||
|
const oMenu = aMenu[i]; |
||||||
|
// 这一块的赋值 也就是取到返回的值
|
||||||
|
let path = (() => { |
||||||
|
if (first) { |
||||||
|
// 将 '/index' 替换为 ''
|
||||||
|
return oMenu[propsDefault.path].replace("/index", ""); |
||||||
|
} else { |
||||||
|
return oMenu[propsDefault.path]; |
||||||
|
} |
||||||
|
})(), |
||||||
|
//特殊处理组件 执行完这个 component 也就是精确到具体的文件了 views文件夹下面就是具体的页面代码
|
||||||
|
component = "views" + oMenu.path, |
||||||
|
name = oMenu[propsDefault.label], |
||||||
|
icon = oMenu[propsDefault.icon], |
||||||
|
children = oMenu[propsDefault.children], |
||||||
|
meta = oMenu[propsDefault.meta] || {}; |
||||||
|
// meta中 keepalive 的处理
|
||||||
|
meta = Object.assign( |
||||||
|
meta, |
||||||
|
(function () { |
||||||
|
if (option.keepAlive === true) { |
||||||
|
return { |
||||||
|
keepAlive: true, |
||||||
|
}; |
||||||
|
} |
||||||
|
})() |
||||||
|
); |
||||||
|
//是否有子路由
|
||||||
|
const isChild = children.length !== 0; |
||||||
|
const oRouter = { |
||||||
|
path: path, |
||||||
|
component(resolve) { |
||||||
|
// 判断是否为首路由
|
||||||
|
if (first) { |
||||||
|
// require(["../page/index"], resolve);
|
||||||
|
return; |
||||||
|
// 判断是否为多层路由
|
||||||
|
} else if (isChild && !first) { |
||||||
|
// require(["../page/index/layout"], resolve);
|
||||||
|
return; |
||||||
|
// 判断是否为最终的页面视图
|
||||||
|
} else { |
||||||
|
require([`../${component}.vue`], resolve); |
||||||
|
} |
||||||
|
}, |
||||||
|
name: name, |
||||||
|
icon: icon, |
||||||
|
meta: meta, |
||||||
|
redirect: (() => { |
||||||
|
// 第一次进来但是没有子路由的 需要添加redirect
|
||||||
|
if (!isChild && first && !isURL(path)) return `${path}/index`; |
||||||
|
else return ""; |
||||||
|
})(), |
||||||
|
// 整理子路由的route 配置
|
||||||
|
// 处理是否为一级路由
|
||||||
|
children: !isChild |
||||||
|
? (() => { |
||||||
|
if (first) { |
||||||
|
// 这里的isURL判断,因为这个网站有使用 iframe。所以需要判断是否为网页链接
|
||||||
|
if (!isURL(path)) oMenu[propsDefault.path] = `${path}/index`; |
||||||
|
return [ |
||||||
|
{ |
||||||
|
component(resolve) { |
||||||
|
require([`../${component}.vue`], resolve); |
||||||
|
}, |
||||||
|
icon: icon, |
||||||
|
name: name, |
||||||
|
meta: meta, |
||||||
|
path: "index", |
||||||
|
}, |
||||||
|
]; |
||||||
|
} |
||||||
|
return []; |
||||||
|
})() |
||||||
|
: (() => { |
||||||
|
/** |
||||||
|
* 这里是重点,当有子路由的时候 会再去执行 formatRoutes 方法,然后又会有一个新的 aMenu for循环。 |
||||||
|
* 最后返回的是一个数组 aRouter 这个数组就会作为 childen的值被 return |
||||||
|
*/ |
||||||
|
return this.formatRoutes(children, false); |
||||||
|
})(), |
||||||
|
}; |
||||||
|
aRouter.push(oRouter); |
||||||
|
} |
||||||
|
// for循环结束
|
||||||
|
// 这个first 卡的其实就是首路由
|
||||||
|
if (first) { |
||||||
|
this.safe.$router.addRoutes(aRouter); |
||||||
|
} else { |
||||||
|
// 这里返回的是子组件
|
||||||
|
return aRouter; |
||||||
|
} |
||||||
|
}, |
||||||
|
}; |
||||||
|
}; |
||||||
|
export default RouterPlugin; |
||||||
@ -0,0 +1,45 @@ |
|||||||
|
import Vue from "vue"; |
||||||
|
import VueRouter from "vue-router"; |
||||||
|
import AVueRouter from "./avue-router"; |
||||||
|
import HomeView from "../views/homePage/homePage.vue"; |
||||||
|
|
||||||
|
Vue.use(VueRouter); |
||||||
|
|
||||||
|
const routes = [ |
||||||
|
{ |
||||||
|
path: "/", |
||||||
|
name: "home", |
||||||
|
redirect: "/homePage", |
||||||
|
// component: HomeView,
|
||||||
|
}, |
||||||
|
{ |
||||||
|
path: "/homePage", |
||||||
|
name: "homePage", |
||||||
|
// redirect: "/homePage",
|
||||||
|
component: HomeView, |
||||||
|
}, |
||||||
|
{ |
||||||
|
path: "/about", |
||||||
|
name: "about", |
||||||
|
// route level code-splitting
|
||||||
|
// this generates a separate chunk (about.[hash].js) for this route
|
||||||
|
// which is lazy-loaded when the route is visited.
|
||||||
|
component: () => import(/* webpackChunkName: "about" */ "../views/AboutView.vue"), |
||||||
|
}, |
||||||
|
]; |
||||||
|
|
||||||
|
// // 初始化和注册 AvueRouter
|
||||||
|
// AvueRouter.install(Vue, {
|
||||||
|
// router: Router,
|
||||||
|
// store: Store,
|
||||||
|
// i18n: i18n,
|
||||||
|
// keepAlive: false,
|
||||||
|
// });
|
||||||
|
|
||||||
|
const router = new VueRouter({ |
||||||
|
mode: "history", |
||||||
|
base: process.env.BASE_URL, |
||||||
|
routes, |
||||||
|
}); |
||||||
|
|
||||||
|
export default router; |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
import Vue from 'vue'; |
||||||
|
import Vuex from 'vuex'; |
||||||
|
|
||||||
|
Vue.use(Vuex); |
||||||
|
|
||||||
|
export default new Vuex.Store({ |
||||||
|
state: { |
||||||
|
}, |
||||||
|
getters: { |
||||||
|
}, |
||||||
|
mutations: { |
||||||
|
}, |
||||||
|
actions: { |
||||||
|
}, |
||||||
|
modules: { |
||||||
|
}, |
||||||
|
}); |
||||||
@ -0,0 +1,46 @@ |
|||||||
|
import axios from "axios"; |
||||||
|
|
||||||
|
//跨域请求,允许保存cookie
|
||||||
|
axios.defaults.withCredentials = true; |
||||||
|
|
||||||
|
//返回其他状态码
|
||||||
|
axios.defaults.validateStatus = function (status) { |
||||||
|
return status >= 200 && status <= 500; |
||||||
|
}; |
||||||
|
//跨域请求,允许保存cookie
|
||||||
|
axios.defaults.withCredentials = true; |
||||||
|
|
||||||
|
//HTTP Request拦截
|
||||||
|
axios.interceptors.request.use( |
||||||
|
(config) => { |
||||||
|
// if (config.url !== "/api/blade-business/common-api/save-cup-img") {
|
||||||
|
// config.headers["Content-Type"] = "application/json";
|
||||||
|
// }
|
||||||
|
return config; |
||||||
|
}, |
||||||
|
(error) => { |
||||||
|
console.error("Request interceptors:", error); |
||||||
|
return Promise.reject(error); |
||||||
|
} |
||||||
|
); |
||||||
|
|
||||||
|
//HTTP Response拦截
|
||||||
|
axios.interceptors.response.use( |
||||||
|
(res) => { |
||||||
|
const ok = res.data.Success || false, |
||||||
|
status = res.status || 200, |
||||||
|
message = res.data.AllMessages || "Internal Server Error!"; |
||||||
|
|
||||||
|
if (!ok && !status) { |
||||||
|
return Promise.reject(new Error(message)); |
||||||
|
} |
||||||
|
|
||||||
|
return res.data; |
||||||
|
}, |
||||||
|
(error) => { |
||||||
|
console.error("Response interceptors:", error); |
||||||
|
return Promise.reject(error); |
||||||
|
} |
||||||
|
); |
||||||
|
|
||||||
|
export default axios; |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
<template> |
||||||
|
<div class="about"> |
||||||
|
<h1>This is an about page</h1> |
||||||
|
</div> |
||||||
|
</template> |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
<template> |
||||||
|
<div class="home"> |
||||||
|
<!-- <img alt="Vue logo" src="../assets/logo.png"> --> |
||||||
|
<!-- <HelloWorld msg="Welcome to Your Vue.js App"/> --> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
// @ is an alias to /src |
||||||
|
// import HelloWorld from '@/components/HelloWorld.vue'; |
||||||
|
|
||||||
|
export default { |
||||||
|
name: 'HomeView', |
||||||
|
components: { |
||||||
|
// HelloWorld, |
||||||
|
}, |
||||||
|
}; |
||||||
|
</script> |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
<template> |
||||||
|
<div>数据大厅</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
export default { |
||||||
|
|
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style> |
||||||
|
|
||||||
|
</style> |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
<template> |
||||||
|
<div class="home"> |
||||||
|
<page-head></page-head> |
||||||
|
首页 |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import pageHead from '@/components/pageHead.vue'; |
||||||
|
// @ is an alias to /src |
||||||
|
|
||||||
|
export default { |
||||||
|
// name: 'HomeView', |
||||||
|
components: { |
||||||
|
pageHead |
||||||
|
}, |
||||||
|
}; |
||||||
|
</script> |
||||||
@ -0,0 +1,6 @@ |
|||||||
|
const { defineConfig } = require("@vue/cli-service"); |
||||||
|
|
||||||
|
module.exports = defineConfig({ |
||||||
|
transpileDependencies: true, |
||||||
|
lintOnSave: true, |
||||||
|
}); |
||||||
Loading…
Reference in new issue