Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
hcq11 committed Jan 11, 2021
0 parents commit 4deb2fa
Show file tree
Hide file tree
Showing 64 changed files with 5,189 additions and 0 deletions.
32 changes: 32 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "AtrisV",
"version": "4.2.0",
"private": true,
"scripts": {
"dev": "npm run serve",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"axios": "^0.18.0",
"babel-polyfill": "^6.26.0",
"element-ui": "^2.11.0",
"es6-promise": "^4.2.8",
"mavon-editor": "^2.9.0",
"nipplejs": "^0.8.5",
"vue": "^2.6.10",
"vue-cropperjs": "^3.0.0",
"vue-i18n": "^8.10.0",
"vue-quill-editor": "^3.0.6",
"vue-router": "^3.0.3",
"vue-schart": "^2.0.0",
"vue-socket.io": "^3.0.5",
"vuedraggable": "^2.23.2",
"vuex": "^3.4.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.9.0",
"@vue/cli-service": "^3.9.0",
"vue-template-compiler": "^2.6.10"
}
}
5 changes: 5 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
plugins: {
autoprefixer: {}
}
}
17 changes: 17 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
<link rel="stylesheet" href="//at.alicdn.com/t/font_830376_qzecyukz0s.css">
<title>vue-manage-system</title>
</head>
<body>
<noscript>
<strong>We're sorry but vms 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>
40 changes: 40 additions & 0 deletions public/table.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"list": [{
"id": 1,
"name": "测试部",
"money": "白名单",
"address": 2,
"state": "",
"date": "2020-01-10",
"thumb": "https://lin-xin.gitee.io/images/post/wms.png"
},
{
"id": 2,
"name": "研发部",
"money": "黑名单",
"address": 3,
"state": "",
"date": "2020-01-10",
"thumb": "https://lin-xin.gitee.io/images/post/node3.png"
},
{
"id": 3,
"name": "Atris产品组",
"money": "白名单",
"address": 5,
"state": "",
"date": "2020-01-11",
"thumb": "https://lin-xin.gitee.io/images/post/parcel.png"
},
{
"id": 4,
"name": "测试专用组",
"money": "白名单",
"address": 12,
"state": "测试专用,勿删",
"date": "2020-03-20",
"thumb": "https://lin-xin.gitee.io/images/post/notice.png"
}
],
"pageTotal": 4
}
10 changes: 10 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<template>
<div id="app">
<router-view></router-view>
</div>
</template>
<style>
@import "./assets/css/main.css";
@import "./assets/css/color-dark.css"; /*深色主题*/
/*@import "./assets/css/theme-green/color-green.css"; 浅绿色主题*/
</style>
32 changes: 32 additions & 0 deletions src/api/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// 该模块存放的是:token令牌的存储,获取一级删除

const userInfoKey = 'user-info'
// 登陆成功后存储token
export function saveUserInfo (userInfo) {
//console.log('save token:',userInfo.token)
window.localStorage.setItem(userInfoKey, JSON.stringify(userInfo))
}

// 退出登陆后 将token从本地存储中删除
export function removeUserInfo () {
window.localStorage.removeItem(userInfoKey)
}

// 从本地获取token
export function getToken () {
//console.log('get token:',getUserInfo())
return JSON.parse(getUserInfo()).token
}

export function getUsername() {
const userInfo = getUserInfo();
if(!userInfo){
return "";
}
return JSON.parse(getUserInfo()).username
}

// 从本地获取用户信息
export function getUserInfo () {
return window.localStorage.getItem(userInfoKey)
}
77 changes: 77 additions & 0 deletions src/api/http.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import Vue from 'vue';
import axios from 'axios'
import router from '../router';
import { getToken } from './auth.js'
import { base } from '../constant'


const http = axios.create({
baseURL: base
})

http.interceptors.request.use(function (config) {
if (config.url.indexOf('/token') !== 0) {
// console.log('get token:', getToken())
config.headers['Authorization'] = getToken()
}
return config
}, function (error) {
return Promise.reject(error)
})


http.interceptors.response.use(
res => {
return res;
},
error => {
if (error) {
if (error.response) {
console.log('data:', error.response.data);
console.log('status:', error.response.status);
console.log('headers:', error.response.headers);

const status = error.response.status;
const errortext = codeMessage[status] || error.response.statusText;
Vue.prototype.$message.error(status + ':' + errortext);
if (status === 401) {
router.push('/login')
}
} else if( error.request) {
console.log('request error:', error.request);
Vue.prototype.$message.error('连接服务器失败')
} else {
Vue.prototype.$message.error(error.message)
return console.log('Error', error.message);
}
console.log('err config:',err.config);
}
return Promise.reject(error);
}
);

const codeMessage = {
200: '服务器成功返回请求的数据。',
201: '新建或修改数据成功。',
202: '一个请求已经进入后台排队(异步任务)。',
204: '删除数据成功。',
400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
401: '用户没有权限(令牌、用户名、密码错误)。',
403: '用户得到授权,但是访问是被禁止的。',
404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
406: '请求的格式不可得。',
410: '请求的资源被永久删除,且不会再得到的。',
422: '当创建一个对象时,发生一个验证错误。',
500: '服务器发生错误,请检查服务器。',
502: '网关错误。',
503: '服务不可用,服务器暂时过载或维护。',
504: '网关超时。',
};

const httpPlugin = {}

httpPlugin.install = function (Vue, options) {
Vue.prototype.$http = http
}

export default httpPlugin
12 changes: 12 additions & 0 deletions src/api/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import request from '../utils/request';
import * as api from './robotapi';

export const fetchData = query => {
return request({
url: './table.json',
method: 'get',
params: query
});
};

export default api;
76 changes: 76 additions & 0 deletions src/api/robotapi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import Vue from 'vue'
import { base } from '../constant'

const http = Vue.prototype.$http;

//Account
export const requestLogin = params => {
return http.get(`/token?id=` + params.username + `&secret=` + params.password).then(res => res);
};
export const requestLogout = params => {
return http.delete(`/token?id=` + params.username + `&secret=` + params.password).then(res => res);
};

//Robot
export const switchFlashLight = params => {
return http.put(`/robot/` + params.id + `/ctrl/flashlight?status=` + params.status).then(res => res);
};
export const switchHeadLight = params => {
return http.put(`/robot/` + params.id + `/ctrl/headlight?status=` + params.status).then(res => res);
};
export const getWebSockTicket = params => {
return http.get(`/robot/` + params.id + `ticket`).then(res => res);
};
export const move = params => {
return http.put(`/robot/` + params.id + `/ctrl/move?linea =` + params.linear + `angular=` + params.angular).then(res => res);
};

//face AI
export const addPerson = params => {
return http.put(`/robot/` + params.id + `/ai/face/person`, params).then(res => res);
};
export const getFaceReporterChannel = params => {
return http.get(`/robot/` + params.id + `/ai/face/ticket`, params).then(res => res);
};

//PZT angle -180~180 ,angle(zoom) -128~128
export const ptzMove = params => {
return http.put(`/robot/` + params.id + `/ctrl/ptz/rotation?status=` + params.status + `&direction=` + params.direction + `&step=` + params.step).then(res => res);
};
export const autoRotation = params => {
return http.put(`/robot/` + params.id + `/ctrl/ptz/autoRotation?status=` + params.status).then(res => res);
};
export const ptzHMove = params => {
return http.put(`/robot/` + params.id + `/ctrl/ptz/horizontal?angle=` + params.angle).then(res => res);
};
export const ptzVMove = params => {
return http.put(`/robot/` + params.id + `/ctrl/ptz/vertical?angle=` + params.angle).then(res => res);
};
export const ptzResetPosition = params => {
return http.put(`/robot/` + params.id + `/ctrl/ptz/reset`).then(res => res);
};
export const ptzZoom = params => {
return http.put(`/robot/` + params.id + `/ctrl/ptz/zoom?angle=` + params.angle).then(res => res);
};

//audio
export const getAudioList = params => {
return http.get(`${base}/musics`, { params: params });
};
export const uploadAudios = params => {
return http.get(`${base}/user/remove`, { params: params });
};
export const deleteAudios = params => {
return http.get(`${base}/user/batchremove`, { params: params });
};
export const playAudio = params => {
return http.get(`${base}/user/edit`, { params: params });
};
export const stopAudio = params => {
return http.get(`${base}/user/add`, { params: params });
};

//map
export const deleteMaps = params => {
return http.delete(`/robot/` + params.id + `/map`, { params: params }).then(res => res);
};
28 changes: 28 additions & 0 deletions src/assets/css/color-dark.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.header{
background-color: #242f42;
}
.login-wrap{
background: #324157;
}
.plugins-tips{
background: #eef1f6;
}
.plugins-tips a{
color: #20a0ff;
}
.el-upload--text em {
color: #20a0ff;
}
.pure-button{
background: #20a0ff;
}
.tags-li.active {
border: 1px solid #409EFF;
background-color: #409EFF;
}
.message-title{
color: #20a0ff;
}
.collapse-btn:hover{
background: rgb(40,52,70);
}
4 changes: 4 additions & 0 deletions src/assets/css/icon.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

[class*=" el-icon-lx"], [class^=el-icon-lx] {
font-family: lx-iconfont!important;
}
Loading

0 comments on commit 4deb2fa

Please sign in to comment.