上传代码

master
吕天方 2 months ago
commit 1cc52967e0

@ -0,0 +1,11 @@
# 页面标题
VUE_APP_TITLE = 停车场查询
# 开发环境配置
ENV = 'development'
# 若依管理系统/开发环境
# /dev-api
# VUE_APP_BASE_API = 'http://39.101.188.84:9037'
VUE_APP_BASE_API = 'http://192.168.0.130:9004/api'
# VUE_APP_BASE_API = 'http://192.168.0.106:9037'

@ -0,0 +1,6 @@
# 页面标题
VUE_APP_TITLE = 停车场查询
# 生产环境配置
ENV = 'production'
VUE_APP_BASE_API = 'https://bjh.jndz.cn/bjh-admin-server'

23
.gitignore vendored

@ -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,19 @@
# jiangning-leflat
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### 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"
]
}
}

8046
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -0,0 +1,32 @@
{
"name": "eventMap",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"core-js": "^3.8.3",
"vue": "^2.6.14"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"sass": "^1.32.7",
"compression-webpack-plugin": "5.0.2",
"script-ext-html-webpack-plugin": "2.1.5",
"js-cookie": "3.0.1",
"file-saver": "2.0.5",
"sass-loader": "^12.0.0",
"element-ui": "2.15.13",
"axios": "0.24.0",
"vue-router": "3.4.9",
"vue-template-compiler": "^2.6.14"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="" style="font-size: 37.5px;">
<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>
</head>
<body style="font-size: 24px;">
<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,2 @@
User-agent: *
Disallow: /

@ -0,0 +1,23 @@
<template>
<div id="app">
<!-- <HelloWorld/> -->
<router-view />
</div>
</template>
<script>
export default {
name: 'App',
}
</script>
<style lang="scss">
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
padding: 0;
margin: 0;
}
</style>

@ -0,0 +1,43 @@
import request from '@/utils/request'
// 查询重点区域列表
export function listZdqy(query) {
return request({
url: '/jn/regionalsettings/list',
method: 'get',
params: query
})
}
// 查询区域网格列表
export function listQywg(query) {
return request({
url: '/jn/bgridsetting/list',
method: 'get',
params: query
})
}
//根据等级查询所有区域网格
export function levelQywg(query) {
return request({
url: '/jn/bgridsetting/getListBylevel',
method: 'get',
params:query
})
}
// 查询重点路段列表
export function listZdld(query) {
return request({
url: '/jn/roadsetting/list',
method: 'get',
params: query
})
}
// 获取围栏管理列表
export function getFenceList(params) {
return request({
url: "/jn/fence/list",
method:'get',
params
})
}

@ -0,0 +1,16 @@
import request from '@/utils/request'
export function GetAreaFreeSpaceNum() {
return request({
url:"/remoteCall/GetAreaFreeSpaceNum",
method:'get',
})
}
export function GetCarInfoByPlateNo(params) {
return request({
url:"/remoteCall/GetCarInfoByPlateNo",
method:'get',
params
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>icon_停车场</title>
<g id="停车场UI" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="停车查询" transform="translate(-68.000000, -412.000000)">
<g id="各个停车场" transform="translate(44.000000, 382.000000)">
<g id="Repeat-Cell" transform="translate(24.000000, 24.000000)">
<g id="icon_停车场" transform="translate(0.000000, 6.000000)">
<rect id="矩形" stroke="#6FBA2C" stroke-width="1.6" fill="#FFFFFF" x="0.8" y="0.8" width="22.4" height="22.4" rx="3.2"></rect>
<path d="M12.3990029,4 L8.03660126,4 C7.57455914,4 7.2,4.37455914 7.2,4.83660126 L7.2,19.5816993 C7.2,19.8127204 7.38727958,20 7.61830066,20 L9.17064052,20 C9.40165668,19.9999874 9.58893423,19.8127155 9.58895375,19.5816993 L9.58908043,15.3680019 L9.58908043,15.3680019 C9.58908043,15.1935962 9.69179157,15.0439569 9.83817261,14.9800376 L9.91472895,14.9555035 L9.99692356,14.9469492 L12.3990029,14.9469492 C15.2697929,14.9469492 17.6,12.4980527 17.6,9.47347462 C17.6,6.52644982 15.3877586,4.12596293 12.6187365,4.00479859 L12.3990029,4 Z M12.3990029,6.52694455 C13.9533477,6.52694455 15.210421,7.84804711 15.210421,9.47399859 C15.210421,11.0397296 14.0447398,12.322775 12.5704358,12.4156676 L12.3990029,12.4210526 L10.17719,12.4210526 C9.88437083,12.4210526 9.64144972,12.200494 9.59579369,11.9115166 L9.58808328,11.8128655 L9.58808328,7.13513168 C9.58808328,6.83282845 9.80172246,6.58203945 10.0816339,6.53490469 L10.17719,6.52694455 L12.3990029,6.52694455 Z" id="形状" fill="#6FBA2C" fill-rule="nonzero"></path>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

@ -0,0 +1,4 @@
@font-face {
font-family: "PingFangSC-Regular";
src: url("./fonts/PingFang Regular.ttf");
}

@ -0,0 +1,46 @@
// @import "./font.css";
body {
padding: 0;
margin: 0;
font-variant: tabular-nums;
line-height: 1.5;
background-color: #fff;
font-feature-settings: "tnum";
touch-action: manipulation;
}
html {
touch-action: manipulation;
}
ul {
margin: 0;
padding: 0;
}
p {
padding: 0;
margin: 0;
}
*, :after, :before {
box-sizing: border-box;
}
button, select {
text-transform: none;
}
button, input {
overflow: visible;
}
button, input, optgroup, select, textarea {
margin: 0;
color: inherit;
font-size: inherit;
font-family: inherit;
line-height: inherit;
}
[type=reset], [type=submit], button, html [type=button] {
-webkit-appearance: button;
}

@ -0,0 +1,267 @@
<template>
<div class="content" v-title data-title="" v-if="carInfo.freeSpaceNum">
<div class="car-number">
<div class="total-number">
<div class="text">当前总空余车位数</div>
<div class="number">{{ carInfo.freeSpaceNum }}</div>
</div>
<ul class="content-box">
<li class="content-box-li" v-for="(item,index) in carInfo.areaInfo" :key="index">
<div>
<div class="name-box">
<img src="@/assets/images/icon_p.svg" alt="" />
{{ item.areaName }}
</div>
<p class="text-box">
<span class="text-box-span">{{ item.freeSpaceNum }}</span>
<span class="text-box-xie">/</span>
{{ item.placeCount }}
</p>
</div>
</li>
<div class="line"></div>
<div class="line2"></div>
</ul>
</div>
<div class="footer-box">
<button class="bot-bg" @click="goQuery"></button>
<button class="bot-bg2" @click="InquiryPayment"></button>
</div>
</div>
</template>
<script>
import { GetAreaFreeSpaceNum } from "@/api/index"
export default {
data() {
return {
liItems:[
{
name:"镇东停车场",
number:288,
total: 347
},{
name:"镇北停车场",
number:146,
total: 361
},{
name:"镇南停车场",
number:95,
total: 98
},{
name:"地下停车场",
number:0,
total: 72
},
],
carInfo:{
freeSpaceNum:null,
areaInfo:[]
},
}
},
mounted(){
GetAreaFreeSpaceNum().then(res=>{
// let data = res.data ? JSON.parse(res.data) : '';
this.carInfo = res.data;
})
},
methods: {
InquiryPayment(){
window.open("https://cloud.keytop.cn/stcfront/Payment/GroupQuery?groupId=671540406378439398")
},
goQuery(){
this.$router.push('/parkinglot')
},
}
}
</script>
<style lang="scss" scoped>
.content {
padding: .53125rem .375rem;
}
.car-number {
padding: .5625rem .3125rem .25rem;
background-color: #fff;
display: flex;
flex-direction: column;
align-items: center;
box-shadow: 0 .0625rem .25rem 0 rgba(38, 80, 0, .06);
border-radius: .3125rem;
margin-bottom: 1.25rem;
.total-number {
font-family: PingFangSC-Regular;
font-size: .46875rem;
color: rgba(0, 0, 0, .85);
text-align: center;
font-weight: 400;
.number {
margin-top: .1875rem;
font-size: 1.125rem;
color: #59a812;
text-align: center;
margin-bottom: .46875rem;
}
}
.content-box {
list-style-type: none;
background: #f8faf8;
border-radius: .25rem;
width: 100%;
padding: .375rem;
position: relative;
display: flex;
flex-wrap: wrap;
li {
margin: 0 .15625rem;
}
.content-box-li {
width: 48%;
display: flex;
&:nth-child(1) {
margin: 0;
}
&:nth-child(2) {
width: 49%;
padding-left: .375rem;
margin-right: 0;
}
&:nth-child(3) {
margin: 0;
margin-top: .625rem;
}
&:nth-child(4) {
width: 49%;
padding-left: .375rem;
margin-right: 0;
margin-top: .625rem;
}
.name-box {
font-family: PingFangSC-Regular;
font-size: .40625rem;
color: rgba(0, 0, 0, .85);
line-height: .5625rem;
font-weight: 400;
margin-bottom: .25rem;
display: flex;
align-items: center;
img {
width: .390625rem;
height: .390625rem;
margin-right: .1875rem;
}
}
.text-box {
font-family: PingFangSC-Regular;
font-size: .5rem;
color: rgba(0, 0, 0, .85);
font-weight: 400;
.text-box-span {
font-size: .5625rem;
color: #6fba2c;
margin-left: .5625rem;
}
.text-box-xie {
font-size: .4375rem;
color: rgba(0, 0, 0, .65);
font-weight: 400;
display: inline-block;
margin-right: .0625rem;
margin-left: .125rem;
}
}
}
.line {
width: calc(100% - .75rem);
border-bottom: .03125rem dashed #d4d9d4;
position: absolute;
top: 50%;
left: .375rem;
}
.line2 {
height: calc(100% - .75rem);
position: absolute;
left: 50%;
top: .375rem;
border-right: .03125rem dashed #d4d9d4;
}
}
}
.footer-box {
width: 100%;
display: flex;
justify-content: space-between;
button {
// width: 200px;
// height: 90px;
// font-size: 18px;
// color: rgba(0, 0, 0, .85);
// text-align: left;
// padding-left: 20px;
// display: flex;
// align-items: center;
// border: none;
// border-radius: 10px;
// overflow: hidden;
// cursor: pointer;
width: 5.15625rem;
height: 2.5rem;
border: none;
font-size: .5rem;
color: rgba(0, 0, 0, .85);
text-align: left;
padding-left: .375rem;
}
.bot-bg {
background: url("@/assets/images/btnbg-1.png") no-repeat;
background-size: 100% 100%;
margin-right: .5rem;
}
.bot-bg2 {
background: url("@/assets/images/btnbg-2.png") no-repeat;
background-size: 100% 100%;
// width: 5.15625rem;
// height: 2.5rem;
// border: none;
// font-size: .5rem;
// color: rgba(0, 0, 0, .85);
// text-align: left;
// padding-left: .375rem;
}
}
// .code-number {
// width: 100%;
// height: 200px;
// display: flex;
// justify-content: center;
// /deep/ .message-input {
// width: 100%;
// }
// /deep/ .u-box[data-v-0e1e7f9a] {
// border: none;
// background-color: #F7F8FA;
// }
// /deep/.u-placeholder-line {
// background-color: #00B578;
// }
// /deep/.u-box.data-v-0e1e7f9a {
// border: none;
// background-color: #f7f8fa;
// }
// /deep/ .u-box-active.data-v-0e1e7f9a {
// border: none;
// }
// }
</style>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,24 @@
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import Element from 'element-ui'
import "@/assets/style/index.scss"
import 'element-ui/lib/theme-chalk/index.css';
import './permission'
Vue.config.productionTip = false
Vue.directive('title', {
inserted: function (el, binding) {
document.title = el.dataset.title
}
})
// router.beforeEach((to, from, next) => {
// window.document.title = to.meta.title == undefined ? '默认标题' : to.meta.title
// next();
// })
Vue.use(Element)
new Vue({
router,
render: h => h(App),
}).$mount('#app')

@ -0,0 +1,26 @@
import router from './router'
import { getRobot, setRobot } from '@/utils/auth'
router.beforeEach((to, from, next) => {
var tokenReg = new RegExp(/[?&]token=([^&#]+)/)
var t = window.location.href.match(tokenReg);
// console.log(t,"t");
if (window.location.href.includes("token=")) {
var tokenReg = new RegExp(/[?&]token=([^&#]+)/)
var t = window.location.href.match(tokenReg);
const token = t && t[1];
// localStorage.setItem('robotToken',token);
// robotLogin({username:"superAdmin",password:"sa@123456"}).then(res=>{
// setRobot(res.result.token)
// })
next();
} else {
next();
}
// else {
// if (localStorage.getItem('robotToken')) {
// next()
// } else {
// }
// }
})

@ -0,0 +1,60 @@
import store from '@/store'
function authPermission(permission) {
const all_permission = "*:*:*";
const permissions = store.getters && store.getters.permissions
if (permission && permission.length > 0) {
return permissions.some(v => {
return all_permission === v || v === permission
})
} else {
return false
}
}
function authRole(role) {
const super_admin = "admin";
const roles = store.getters && store.getters.roles
if (role && role.length > 0) {
return roles.some(v => {
return super_admin === v || v === role
})
} else {
return false
}
}
export default {
// 验证用户是否具备某权限
hasPermi(permission) {
return authPermission(permission);
},
// 验证用户是否含有指定权限,只需包含其中一个
hasPermiOr(permissions) {
return permissions.some(item => {
return authPermission(item)
})
},
// 验证用户是否含有指定权限,必须全部拥有
hasPermiAnd(permissions) {
return permissions.every(item => {
return authPermission(item)
})
},
// 验证用户是否具备某角色
hasRole(role) {
return authRole(role);
},
// 验证用户是否含有指定角色,只需包含其中一个
hasRoleOr(roles) {
return roles.some(item => {
return authRole(item)
})
},
// 验证用户是否含有指定角色,必须全部拥有
hasRoleAnd(roles) {
return roles.every(item => {
return authRole(item)
})
}
}

@ -0,0 +1,77 @@
const sessionCache = {
set (key, value) {
if (!sessionStorage) {
return
}
if (key != null && value != null) {
sessionStorage.setItem(key, value)
}
},
get (key) {
if (!sessionStorage) {
return null
}
if (key == null) {
return null
}
return sessionStorage.getItem(key)
},
setJSON (key, jsonValue) {
if (jsonValue != null) {
this.set(key, JSON.stringify(jsonValue))
}
},
getJSON (key) {
const value = this.get(key)
if (value != null) {
return JSON.parse(value)
}
},
remove (key) {
sessionStorage.removeItem(key);
}
}
const localCache = {
set (key, value) {
if (!localStorage) {
return
}
if (key != null && value != null) {
localStorage.setItem(key, value)
}
},
get (key) {
if (!localStorage) {
return null
}
if (key == null) {
return null
}
return localStorage.getItem(key)
},
setJSON (key, jsonValue) {
if (jsonValue != null) {
this.set(key, JSON.stringify(jsonValue))
}
},
getJSON (key) {
const value = this.get(key)
if (value != null) {
return JSON.parse(value)
}
},
remove (key) {
localStorage.removeItem(key);
}
}
export default {
/**
* 会话级缓存
*/
session: sessionCache,
/**
* 本地缓存
*/
local: localCache
}

@ -0,0 +1,72 @@
import axios from 'axios'
import { Message } from 'element-ui'
import { saveAs } from 'file-saver'
import { getToken } from '@/utils/auth'
import errorCode from '@/utils/errorCode'
import { blobValidate } from "@/utils/ruoyi";
const baseURL = process.env.VUE_APP_BASE_API
export default {
name(name, isDelete = true) {
var url = baseURL + "/common/download?fileName=" + encodeURIComponent(name) + "&delete=" + isDelete
axios({
method: 'get',
url: url,
responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() }
}).then((res) => {
const isBlob = blobValidate(res.data);
if (isBlob) {
const blob = new Blob([res.data])
this.saveAs(blob, decodeURIComponent(res.headers['download-filename']))
} else {
this.printErrMsg(res.data);
}
})
},
resource(resource) {
var url = baseURL + "/common/download/resource?resource=" + encodeURIComponent(resource);
axios({
method: 'get',
url: url,
responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() }
}).then((res) => {
const isBlob = blobValidate(res.data);
if (isBlob) {
const blob = new Blob([res.data])
this.saveAs(blob, decodeURIComponent(res.headers['download-filename']))
} else {
this.printErrMsg(res.data);
}
})
},
zip(url, name) {
var url = baseURL + url
axios({
method: 'get',
url: url,
responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() }
}).then((res) => {
const isBlob = blobValidate(res.data);
if (isBlob) {
const blob = new Blob([res.data], { type: 'application/zip' })
this.saveAs(blob, name)
} else {
this.printErrMsg(res.data);
}
})
},
saveAs(text, name, opts) {
saveAs(text, name, opts);
},
async printErrMsg(data) {
const resText = await data.text();
const rspObj = JSON.parse(resText);
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
Message.error(errMsg);
}
}

@ -0,0 +1,20 @@
import tab from './tab'
import auth from './auth'
import cache from './cache'
import modal from './modal'
import download from './download'
export default {
install(Vue) {
// 页签操作
Vue.prototype.$tab = tab
// 认证对象
Vue.prototype.$auth = auth
// 缓存对象
Vue.prototype.$cache = cache
// 模态框对象
Vue.prototype.$modal = modal
// 下载文件
Vue.prototype.$download = download
}
}

@ -0,0 +1,83 @@
import { Message, MessageBox, Notification, Loading } from 'element-ui'
let loadingInstance;
export default {
// 消息提示
msg(content) {
Message.info(content)
},
// 错误消息
msgError(content) {
Message.error(content)
},
// 成功消息
msgSuccess(content) {
Message.success(content)
},
// 警告消息
msgWarning(content) {
Message.warning(content)
},
// 弹出提示
alert(content) {
MessageBox.alert(content, "系统提示")
},
// 错误提示
alertError(content) {
MessageBox.alert(content, "系统提示", { type: 'error' })
},
// 成功提示
alertSuccess(content) {
MessageBox.alert(content, "系统提示", { type: 'success' })
},
// 警告提示
alertWarning(content) {
MessageBox.alert(content, "系统提示", { type: 'warning' })
},
// 通知提示
notify(content) {
Notification.info(content)
},
// 错误通知
notifyError(content) {
Notification.error(content);
},
// 成功通知
notifySuccess(content) {
Notification.success(content)
},
// 警告通知
notifyWarning(content) {
Notification.warning(content)
},
// 确认窗体
confirm(content) {
return MessageBox.confirm(content, "系统提示", {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: "warning",
})
},
// 提交内容
prompt(content) {
return MessageBox.prompt(content, "系统提示", {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: "warning",
})
},
// 打开遮罩层
loading(content) {
loadingInstance = Loading.service({
lock: true,
text: content,
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)",
})
},
// 关闭遮罩层
closeLoading() {
loadingInstance.close();
}
}

@ -0,0 +1,73 @@
import store from '@/store'
import router from '@/router';
export default {
// 刷新当前tab页签
refreshPage(obj) {
const { path, query, matched } = router.currentRoute;
if (obj === undefined) {
matched.forEach((m) => {
if (m.components && m.components.default && m.components.default.name) {
if (!['Layout', 'ParentView'].includes(m.components.default.name)) {
obj = { name: m.components.default.name, path: path, query: query };
}
}
});
}
return store.dispatch('tagsView/delCachedView', obj).then(() => {
const { path, query } = obj
router.replace({
path: '/redirect' + path,
query: query
})
})
},
// 关闭当前tab页签打开新页签
closeOpenPage(obj) {
store.dispatch("tagsView/delView", router.currentRoute);
if (obj !== undefined) {
// console.log(obj,"路由");
return router.push(obj);
}
},
// 关闭指定tab页签
closePage(obj) {
if (obj === undefined) {
return store.dispatch('tagsView/delView', router.currentRoute).then(({ visitedViews }) => {
const latestView = visitedViews.slice(-1)[0]
console.log(store.state.permission.topbarRouters,"router.currentRoute");
if (latestView) {
return router.push(latestView.fullPath)
}
return router.push('/');
});
}
return store.dispatch('tagsView/delView', obj);
},
// 关闭所有tab页签
closeAllPage() {
return store.dispatch('tagsView/delAllViews');
},
// 关闭左侧tab页签
closeLeftPage(obj) {
return store.dispatch('tagsView/delLeftTags', obj || router.currentRoute);
},
// 关闭右侧tab页签
closeRightPage(obj) {
return store.dispatch('tagsView/delRightTags', obj || router.currentRoute);
},
// 关闭其他tab页签
closeOtherPage(obj) {
return store.dispatch('tagsView/delOthersViews', obj || router.currentRoute);
},
// 添加tab页签
openPage(title, url, params) {
var obj = { path: url, meta: { title: title } }
store.dispatch('tagsView/addView', obj);
return router.push({ path: url, query: params });
},
// 修改tab页签
updatePage(obj) {
return store.dispatch('tagsView/updateVisitedView', obj);
}
}

@ -0,0 +1,31 @@
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
const constantRoutes = [
{
path: '/',
redirect: "home",
},
{
path: '/home',
meta: {
title:'首页'
},
component: () => import("@/components/map.vue"),
},
{
path: '/parkinglot',
meta: {
title:'停车查询'
},
component: () => import("@/components/queryCar.vue"),
}
]
export default new Router({
// mode: 'history', // 去掉url中的#
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
})

@ -0,0 +1,42 @@
import Cookies from 'js-cookie'
const TokenKey = 'Admin-Token' // 自己的token
const Access = 'X-Access-Token' // test环境的token
const RobotToken = 'X-Access-token' // 测试环境的token
export function getToken() {
return Cookies.get(TokenKey)
}
export function setToken(token) {
return Cookies.set(TokenKey, token, { expires: 7 })
}
export function removeToken() {
return Cookies.remove(TokenKey)
}
export function getAccess() {
return Cookies.get(Access)
}
export function setAccess(token) {
return Cookies.set(Access, token)
}
export function removeAccess() {
return Cookies.remove(Access)
}
export function getRobot() {
return Cookies.get(RobotToken)
}
export function setRobot(token) {
return Cookies.set(RobotToken, token)
}
export function removeRobot() {
return Cookies.remove(RobotToken)
}

@ -0,0 +1,6 @@
export default {
'401': '认证失败,无法访问系统资源',
'403': '当前操作没有权限',
'404': '访问资源不存在',
'default': '系统未知错误,请反馈给管理员'
}

@ -0,0 +1,156 @@
import axios from 'axios'
import { Notification, MessageBox, Message, Loading } from 'element-ui'
// import store from '@/store'
import { getToken,getAccess } from '@/utils/auth'
import errorCode from '@/utils/errorCode'
import { tansParams, blobValidate } from "@/utils/ruoyi";
import cache from '@/plugins/cache'
import { saveAs } from 'file-saver'
let downloadLoadingInstance;
// 是否显示重新登录
export let isRelogin = { show: false };
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
// 创建axios实例
const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
// baseURL: process.env.VUE_APP_BASE_API,
baseURL: location.origin + '/api',
// 超时
timeout: 20000
})
// request拦截器
service.interceptors.request.use(config => {
// 是否需要设置 token
const isToken = (config.headers || {}).isToken === false
// 是否需要防止数据重复提交
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
// if (getToken() && !isToken) {
// config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
// config.headers['X-Access-Token'] = getAccess() // 让每个请求携带自定义token 请根据实际情况自行修改
// }
// get请求映射params参数
if (config.method === 'get' && config.params) {
let url = config.url + '?' + tansParams(config.params);
url = url.slice(0, -1);
config.params = {};
config.url = url;
}
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
const requestObj = {
url: config.url,
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
time: new Date().getTime()
}
const requestSize = Object.keys(JSON.stringify(requestObj)).length; // 请求数据大小
const limitSize = 5 * 1024 * 1024; // 限制存放数据5M
if (requestSize >= limitSize) {
console.warn(`[${config.url}]: ` + '请求数据大小超出允许的5M限制无法进行防重复提交验证。')
return config;
}
const sessionObj = cache.session.getJSON('sessionObj')
if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
cache.session.setJSON('sessionObj', requestObj)
} else {
const s_url = sessionObj.url; // 请求地址
const s_data = sessionObj.data; // 请求数据
const s_time = sessionObj.time; // 请求时间
const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交
if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
const message = '数据正在处理,请勿重复提交';
console.warn(`[${s_url}]: ` + message)
return Promise.reject(new Error(message))
} else {
cache.session.setJSON('sessionObj', requestObj)
}
}
}
return config
}, error => {
console.log(error)
Promise.reject(error)
})
// 响应拦截器
service.interceptors.response.use(res => {
// 未设置状态码则默认成功状态
const code = res.data.code - 0 || 200;
// 获取错误信息
const msg = errorCode[code] || res.data.msg || errorCode['default']
// 二进制数据则直接返回
if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
return res.data
}
if (code === 401) {
if (!isRelogin.show) {
isRelogin.show = true;
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
isRelogin.show = false;
// store.dispatch('LogOut').then(() => {
// location.href = '/index';
// })
// TODO:自己token过期到登录页
location.href = process.env.VUE_APP_TEST_LOGIN;
}).catch(() => {
isRelogin.show = false;
});
}
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
} else if (code === 500) {
Message({ message: msg, type: 'error' })
return Promise.reject(new Error(msg))
} else if (code === 601) {
Message({ message: msg, type: 'warning' })
return Promise.reject('error')
} else if (code !== 200) {
Notification.error({ title: msg })
return Promise.reject('error')
} else {
return res.data
}
},
error => {
console.log('err' + error)
let { message } = error;
if (message == "Network Error") {
message = "后端接口连接异常";
} else if (message.includes("timeout")) {
message = "系统接口请求超时";
} else if (message.includes("Request failed with status code")) {
message = "系统接口" + message.substr(message.length - 3) + "异常";
}
Message({ message: message, type: 'error', duration: 5 * 1000 })
return Promise.reject(error)
}
)
// 通用下载方法
export function download(url, params, filename, config) {
downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
return service.post(url, params, {
transformRequest: [(params) => { return tansParams(params) }],
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
responseType: 'blob',
...config
}).then(async (data) => {
const isBlob = blobValidate(data);
if (isBlob) {
const blob = new Blob([data])
saveAs(blob, filename)
} else {
const resText = await data.text();
const rspObj = JSON.parse(resText);
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
Message.error(errMsg);
}
downloadLoadingInstance.close();
}).catch((r) => {
console.error(r)
Message.error('下载文件出现错误,请联系管理员!')
downloadLoadingInstance.close();
})
}
export default service

@ -0,0 +1,248 @@
/**
* 通用js方法封装处理
* Copyright (c) 2019 ruoyi
*/
// 日期格式化
export function parseTime(time, pattern) {
if (arguments.length === 0 || !time) {
return null
}
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'object') {
date = time
} else {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
time = parseInt(time)
} else if (typeof time === 'string') {
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm), '');
}
if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000
}
date = new Date(time)
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
}
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
return time_str
}
// 表单重置
export function resetForm(refName) {
if (this.$refs[refName]) {
this.$refs[refName].resetFields();
}
}
// 添加日期范围
export function addDateRange(params, dateRange, propName) {
let search = params;
search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {};
dateRange = Array.isArray(dateRange) ? dateRange : [];
if (typeof (propName) === 'undefined') {
search.params['beginTime'] = dateRange[0];
search.params['endTime'] = dateRange[1];
} else {
search.params['begin' + propName] = dateRange[0];
search.params['end' + propName] = dateRange[1];
}
return search;
}
// 添加日期范围Tow
export function addDateRangeTow(params, dateRange, propName) {
let search = params;
search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {};
dateRange = Array.isArray(dateRange) ? dateRange : [];
if (typeof (propName) === 'undefined') {
search.beginTime = dateRange[0];
search.endTime = dateRange[1];
} else {
search.beginTime = dateRange[0];
search.endTime = dateRange[1];
}
return search;
}
// 回显数据字典
export function selectDictLabel(datas, value) {
if (value === undefined) {
return "";
}
var actions = [];
Object.keys(datas).some((key) => {
if (datas[key].value == ('' + value)) {
actions.push(datas[key].label);
return true;
}
})
if (actions.length === 0) {
actions.push(value);
}
return actions.join('');
}
// 回显数据字典(字符串、数组)
export function selectDictLabels(datas, value, separator) {
if (value === undefined || value.length ===0) {
return "";
}
if (Array.isArray(value)) {
value = value.join(",");
}
var actions = [];
var currentSeparator = undefined === separator ? "," : separator;
var temp = value.split(currentSeparator);
Object.keys(value.split(currentSeparator)).some((val) => {
var match = false;
Object.keys(datas).some((key) => {
if (datas[key].value == ('' + temp[val])) {
actions.push(datas[key].label + currentSeparator);
match = true;
}
})
if (!match) {
actions.push(temp[val] + currentSeparator);
}
})
return actions.join('').substring(0, actions.join('').length - 1);
}
// 字符串格式化(%s )
export function sprintf(str) {
var args = arguments, flag = true, i = 1;
str = str.replace(/%s/g, function () {
var arg = args[i++];
if (typeof arg === 'undefined') {
flag = false;
return '';
}
return arg;
});
return flag ? str : '';
}
// 转换字符串undefined,null等转化为""
export function parseStrEmpty(str) {
if (!str || str == "undefined" || str == "null") {
return "";
}
return str;
}
// 数据合并
export function mergeRecursive(source, target) {
for (var p in target) {
try {
if (target[p].constructor == Object) {
source[p] = mergeRecursive(source[p], target[p]);
} else {
source[p] = target[p];
}
} catch (e) {
source[p] = target[p];
}
}
return source;
};
/**
* 构造树型结构数据
* @param {*} data 数据源
* @param {*} id id字段 默认 'id'
* @param {*} parentId 父节点字段 默认 'parentId'
* @param {*} children 孩子节点字段 默认 'children'
*/
export function handleTree(data, id, parentId, children) {
let config = {
id: id || 'id',
parentId: parentId || 'parentId',
childrenList: children || 'children'
};
var childrenListMap = {};
var nodeIds = {};
var tree = [];
for (let d of data) {
let parentId = d[config.parentId];
if (childrenListMap[parentId] == null) {
childrenListMap[parentId] = [];
}
nodeIds[d[config.id]] = d;
childrenListMap[parentId].push(d);
}
for (let d of data) {
let parentId = d[config.parentId];
if (nodeIds[parentId] == null) {
tree.push(d);
}
}
for (let t of tree) {
adaptToChildrenList(t);
}
function adaptToChildrenList(o) {
if (childrenListMap[o[config.id]] !== null) {
o[config.childrenList] = childrenListMap[o[config.id]];
}
if (o[config.childrenList]) {
for (let c of o[config.childrenList]) {
adaptToChildrenList(c);
}
}
}
return tree;
}
/**
* 参数处理
* @param {*} params 参数
*/
export function tansParams(params) {
let result = ''
for (const propName of Object.keys(params)) {
const value = params[propName];
var part = encodeURIComponent(propName) + "=";
if (value !== null && value !== "" && typeof (value) !== "undefined") {
if (typeof value === 'object') {
for (const key of Object.keys(value)) {
if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') {
let params = propName + '[' + key + ']';
var subPart = encodeURIComponent(params) + "=";
result += subPart + encodeURIComponent(value[key]) + "&";
}
}
} else {
result += part + encodeURIComponent(value) + "&";
}
}
}
return result
}
// 验证是否为blob格式
export function blobValidate(data) {
return data.type !== 'application/json'
}

@ -0,0 +1,136 @@
'use strict'
const path = require('path')
function resolve(dir) {
return path.join(__dirname, dir)
}
const CompressionPlugin = require('compression-webpack-plugin')
const name = process.env.VUE_APP_TITLE || '停车场查询' // 网页标题
console.log(name,"name");
const port = process.env.port || process.env.npm_config_port || 80 // 端口
module.exports = {
transpileDependencies: true,
publicPath: process.env.NODE_ENV === "production" ? "/parking" : "/parking",
// publicPath: process.env.NODE_ENV === "production" ? "/demo/JiangNingUmaleWeb" : "/",
// 在npm run build 或 yarn build 时 生成文件的目录名称要和baseUrl的生产环境路径一致默认dist
outputDir: 'dist',
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
assetsDir: 'static',
// 是否开启eslint保存检测有效值ture | false | 'error'
lintOnSave: process.env.NODE_ENV === 'development',
// 如果你不需要生产环境的 source map可以将其设置为 false 以加速生产环境构建。
productionSourceMap: false,
// webpack-dev-server 相关配置
devServer: {
host: '0.0.0.0',
port: port,
open: true,
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
target: `http://localhost:8080`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
}
},
},
// disableHostCheck: true
historyApiFallback: true,
allowedHosts: 'all',
},
css: {
loaderOptions: {
sass: {
sassOptions: { outputStyle: "expanded" }
}
}
},
configureWebpack: {
name: name,
resolve: {
alias: {
'@': resolve('src')
}
},
plugins: [
// http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件
new CompressionPlugin({
cache: false, // 不启用文件缓存
test: /\.(js|css|html)?$/i, // 压缩文件格式
filename: '[path].gz[query]', // 压缩后的文件名
algorithm: 'gzip', // 使用gzip压缩
minRatio: 0.8 // 压缩率小于1才会压缩
})
],
},
chainWebpack(config) {
// const VersionPlugin = require('./src/versionPlugin')
// config.plugin('version').use(VersionPlugin).tap(args => {
// return args
// })
config.plugins.delete('preload') // TODO: need test
config.plugins.delete('prefetch') // TODO: need test
// set svg-sprite-loader
config.module
.rule('svg')
.exclude.add(resolve('src/assets/icons'))
.end()
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(resolve('src/assets/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
.end()
config.when(process.env.NODE_ENV !== 'development', config => {
config
.plugin('ScriptExtHtmlWebpackPlugin')
.after('html')
.use('script-ext-html-webpack-plugin', [{
// `runtime` must same as runtimeChunk name. default is `runtime`
inline: /runtime\..*\.js$/
}])
.end()
config.optimization.splitChunks({
chunks: 'all',
cacheGroups: {
libs: {
name: 'chunk-libs',
test: /[\\/]node_modules[\\/]/,
priority: 10,
chunks: 'initial' // only package third parties that are initially dependent
},
elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package
test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm
priority: 20 // the weight needs to be larger than libs and app or it will be packaged into libs or app
},
commons: {
name: 'chunk-commons',
test: resolve('src/components'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true
}
}
})
config.optimization.runtimeChunk('single'),
{
from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
to: './' //到根目录下
}
})
}
}
Loading…
Cancel
Save