Commit abe991d4 by 潘建波

Merge branch 'fanxing' of http://192.168.9.26/platform/fanxing_new into fanxing

# Conflicts:
#	package.json
#	public/index.html
#	src/App.vue
#	src/api/apiList.js
#	src/api/axios.js
#	src/api/index.js
#	src/api/install.js
#	src/api/login/index.js
#	src/api/login/urls.js
#	src/api/taskManage/urls.js
#	src/assets/resetElementCss/index.css
#	src/assets/scss/common.scss
#	src/main.js
#	src/router/index.js
#	src/store/actions.js
#	src/store/index.js
#	src/views/Home.vue
#	src/views/Login.vue
#	src/views/sceneManage/index.vue
#	vue.config.js
2 parents 23f6cdf0 4c917f85
import axios from "axios";
import store from "../store/index.js";
import axios from 'axios'
import store from '../store/index.js'
// 创建 axios 实例
let service = axios.create({
// headers: {'Content-Type': 'application/json'},
timeout: 60000
});
})
// 设置 post、put 默认 Content-Type
service.defaults.headers.post["Content-Type"] = "application/json";
service.defaults.headers.put["Content-Type"] = "application/json";
service.defaults.headers.post['Content-Type'] = 'application/json'
service.defaults.headers.put['Content-Type'] = 'application/json'
// 添加请求拦截器
service.interceptors.request.use(
config => {
if (store.state.users.atoken) {
// 判断是否存在token,如果存在的话,则每个http header都加上token
config.headers.authorization = store.state.users.atoken;
}
if (config.method == "post") {
config.data = {
...config.data,
_t: Date.parse(new Date()) / 1000
};
} else if (config.method == "get") {
config.params = {
_t: Date.parse(new Date()) / 1000,
...config.params
};
}
return config;
(config) => {
if (store.state.users.atoken) { // 判断是否存在token,如果存在的话,则每个http header都加上token
config.headers.authorization = store.state.users.atoken;
}
if (config.method == 'post') {
config.data = {
...config.data,
_t: Date.parse(new Date()) / 1000
}
} else if (config.method == 'get') {
config.params = {
_t: Date.parse(new Date()) / 1000,
...config.params
}
}
return config
},
error => {
(error) => {
// 请求错误处理
return Promise.reject(error);
return Promise.reject(error)
}
);
)
// 添加响应拦截器
service.interceptors.response.use(
response => {
let { data } = response;
return data;
(response) => {
let { data } = response
return data
},
error => {
console.log(error);
let info = {};
(error) => {
console.log(error)
let info = {}
if (!error.response) {
info = {
code: 5000,
msg: "Network Error"
};
msg: 'Network Error'
}
} else {
let { status, statusText, data } = error.response;
let { status, statusText, data } = error.response
// 此处整理错误信息格式
info = {
code: status,
data: data,
msg: statusText
};
}
}
return Promise.reject(error);
return Promise.reject(error)
}
);
)
/**
* 创建统一封装过的 axios 实例
* @return {AxiosInstance}
*/
export default function() {
return service;
return service
}
import axios from "./axios";
import axios from './axios'
let instance = axios();
let instance = axios()
export default {
get(url, params, headers) {
let options = {};
let options = {}
if (params) {
options.params = params;
options.params = params
}
if (headers) {
options.headers = headers;
options.headers = headers
}
return instance.get(url, options);
return instance.get(url, options)
},
post(url, data, headers, params) {
let options = {};
post(url,data,headers,params) {
let options = {}
if (params) {
options.params = params;
options.params = params
}
if (headers) {
options.headers = headers;
options.headers = headers
}
return instance.post(url, data, options);
return instance.post(url, data, options)
},
put(url, params, headers) {
let options = {};
let options = {}
if (headers) {
options.headers = headers;
options.headers = headers
}
return instance.put(url, params, options);
return instance.put(url, params, options)
},
delete(url, params, headers) {
let options = {};
let options = {}
if (params) {
options.params = params;
options.params = params
}
if (headers) {
options.headers = headers;
options.headers = headers
}
return instance.delete(url, options);
return instance.delete(url, options)
}
};
}
import apiList from "./apiList";
import apiList from './apiList'
const install = function(Vue) {
if (install.installed) {
return;
return
}
install.installed = true;
install.installed = true
Object.defineProperties(Vue.prototype, {
$api: {
get() {
return apiList;
return apiList
}
}
});
};
})
}
export default {
install
};
}
import api from "../index";
import urls from "./urls";
import api from '../index'
import urls from './urls'
export default {
//登陆
login(params, id) {
return api.post(urls.login, params)
//登陆
login(params,id) {
return api.post(urls.login,params)
},
algocombs(params, id) {
return api.get(urls.algocombs, params);
algocombs(params,id){
return api.get(urls.algocombs,params)
},
storeconfs(params, id) {
return api.get(urls.storeconfs, params);
storeconfs(params,id){
return api.get(urls.storeconfs,params)
},
cates(params,id){
return api.get(urls.cates,params)
},
codes(params,id){
return api.get(urls.codes+id+'/codes',params)
}
};
}
......@@ -2,5 +2,7 @@ import baseUrl from '../baseUrl'
export default {
login: baseUrl + '/api/v1/devconf_fx/users/login',
algocombs:baseUrl+'/api/v1/devconf_fx/algo_combs',
storeconfs:baseUrl+'/api/v1/devconf_fx/store_confs'
storeconfs:baseUrl+'/api/v1/devconf_fx/store_confs',
cates:baseUrl+'/api/v1/codes/traffic/cates',
codes:baseUrl+'/api/v1/codes/traffic/cates/',
}
\ No newline at end of file
import api from '../index'
import urls from './urls'
export default {
vehicleList(params) {
return api.get(urls.vehicleList, params)
},
detailImg(params,id) {
return api.get(urls.detailImg+id, params)
},
delVehicle(params,id) {
// return出去了一个promise
return api.delete(urls.delVehicle+id,params)
},
}
\ No newline at end of file
import baseUrl from '../baseUrl'
export default {
vehicleList: baseUrl + '/api/v1/traffic/events',
detailImg: baseUrl + '/api/v1/web/pics/',
delVehicle: baseUrl + '/api/v1/traffic/events/',
}
\ No newline at end of file
import baseUrl from "../baseUrl";
import baseUrl from '../baseUrl'
export default {
tasks: baseUrl + "/api/v1/devconf_fx/tasks",
subtasks: baseUrl + "/api/v1/devconf_fx/tasks/"
};
tasks: baseUrl + '/api/v1/devconf_fx/tasks',
subtasks:baseUrl+'/api/v1/devconf_fx/tasks/',
}
......@@ -24,6 +24,7 @@
}
.el-popper[x-placement^=bottom]{
margin-top: 0;
left:0!important;
}
.el-select-dropdown__list{
padding: 4px 0;
......@@ -181,4 +182,7 @@
.el-switch.is-checked .el-switch__core::after {
left: 100%;
margin-left: -10px;
}
.el-form-item--mini.el-form-item, .el-form-item--small.el-form-item {
margin-bottom: 4px;
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ $bodyback-color:#f5f7f9;
$border-color:#e5e5e5;
$title-color:#f4f4f4;
$title-backgroud:#f3f3f3;
$dialog-title:#3BB7FF;
body{
margin: 0;
color: $font-color;
......@@ -33,7 +34,10 @@ a:active{
}
.inputBox{
display: inline-block;
width: 200px;
width: 150px;
}
.innnerBox{
padding: 10px;background: #FFFFFF;margin: 10px;
}
.selectBox{
width:150px;
......@@ -84,4 +88,22 @@ a:active{
padding: 12px;
}
}
.detaiCon span{
display: inline-block;
width: 120px;
}
.arrow{
position: absolute;
font-size: 38px;
top: 43%;
cursor: pointer;
color:$dialog-title;
}
.leftArrow{
@extend .arrow;
left: -27px;
}
.rightArrow{
@extend .arrow;
right: -27px;
}
......@@ -9,11 +9,12 @@ import api from "./api/install";
import "./assets/css/public.css";
import echarts from "echarts";
import "./assets/icon/iconfont.css";
import buildCode from "../src/assets/js/buildcodes";
import moment from "moment";
Vue.prototype.$echarts = echarts;
Vue.prototype.$moment = moment;
Vue.prototype.oParse = new XML.ObjTree()
Vue.prototype.$buildCode = buildCode;
Vue.prototype.oParse = new XML.ObjTree();
Vue.use(api);
Vue.use(ElementUI, { size: "small", zIndex: 3000 });
Vue.use(resetCss);
......
......@@ -7,26 +7,29 @@ const routes = [
{
path: "/",
name: "home",
component: resolve => require(["../views/Home.vue"], resolve),
children: [
{
path: "/map",
name: "mapShow",
component: resolve => require(["../views/mapShow/index.vue"], resolve)
},
{
path: "/task/sceneSet",
name: "sceneSet",
component: resolve =>
require(["../views/sceneManage/index.vue"], resolve)
},
{
path: "/task/taskSet",
name: "taskSet",
component: resolve =>
require(["../views/taskManage/index.vue"], resolve)
}
]
component: resolve => require(['../views/Home.vue'], resolve),
children:[
{
path: "/map",
name: "mapShow",
component: resolve => require(['../views/mapShow/index.vue'], resolve),
},
{
path: "/task/sceneSet",
name: "sceneSet",
component: resolve => require(['../views/sceneManage/index.vue'], resolve),
},
{
path: "/task/taskSet",
name: "taskSet",
component: resolve => require(['../views/taskManage/index.vue'], resolve),
},
{
path: "/search/vehicleSearch",
name: "taskSet",
component: resolve => require(['../views/search/vehicleSearch.vue'], resolve),
}
]
},
{
path: "/login",
......@@ -34,7 +37,7 @@ const routes = [
// 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: resolve => require(["../views/Login.vue"], resolve)
component: resolve => require(['../views/Login.vue'], resolve)
}
];
......
// 异步操作中需要用到 increment 方法,所以需要导入 types.js 文件
import types from "./types";
import types from './types'
const actions = {
incrementAsync({ commit, state }) {
// 异步操作
var p = new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, 3000);
});
p.then(() => {
commit(types.INCREMENT);
}).catch(() => {
console.log("异步操作");
});
}
};
const actions= {
incrementAsync({ commit, state }) {
// 异步操作
var p = new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, 3000);
});
p.then(() => {
commit(types.INCREMENT);
}).catch(() => {
console.log('异步操作');
})
}
}
// 最后导出
export default actions;
......@@ -32,6 +32,7 @@
<i class="el-icon-document"></i>
<span slot="title">智能检索</span>
</template>
<el-menu-item index="/search/vehicleSearch"> <i class="el-icon-location"></i>过车记录检索</el-menu-item>
</el-submenu>
<el-submenu index="4">
<template slot="title">
......@@ -81,4 +82,4 @@ export default {
</script>
<style lang="stylus" scoped>
</style>
\ No newline at end of file
</style>
......@@ -63,6 +63,8 @@ import types from '../store/types.js'
this.algoList();
//存储配置列表
this.storeConfList();
//code列表
this.getCodeList();
this.$router.push('/map')
}
......@@ -90,6 +92,23 @@ import types from '../store/types.js'
}
}).catch((err) => {
})
},
getCodeList(){
this.$api.login.cates().then(res => {
res.list_data.forEach(item=>{
this.$api.login.codes({
},item.cate_unid).then(res => {
// 存储code列表
window.localStorage.setItem(item.name,JSON.stringify(res.list_data))
// 存储单独code
res.list_data.forEach(chilItem=>{
window.localStorage.setItem(item.name+'-'+chilItem.code,chilItem.name)
})
}).catch((err) => {
})
})
}).catch((err) => {
})
}
},
watch: {},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!