Commit ccfaedca by fengfan

ctr osc test

parent 6f59b09c
{ {
"python.pythonPath": "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/bin/python3" "python.pythonPath": "C:\\Users\\daping\\AppData\\Local\\Programs\\Python\\Python37\\python.exe"
} }
\ No newline at end of file
...@@ -17,65 +17,55 @@ ...@@ -17,65 +17,55 @@
<script> <script>
import { send,getState } from "@/service/ctrapi"; import { send,getState } from "@/service/ctrapi";
import _ from "lodash";
export default { export default {
data() { data() {
return { return {
active: 0, active: 0,
navList: [ navList: [
{ name: "首页", path: "/home" ,send:'/首页'}, { name: "首页", path: "/home" ,send:'/预警监控'},
{ name: "设备/联络人", path: "/equipment" ,send:'/大数据'}, { name: "设备/联络人", path: "/equipment" ,send:'/系统监控'},
{ name: "中心建设", path: "home" ,send:'/首页'}, { name: "中心建设", path: "home" ,send:'/中心建设'},
{ name: "预警系统", path: "home" ,send:'/首页'}, { name: "预警系统", path: "home" ,send:'/预警系统'},
{ name: "部委信息", path: "home" ,send:'/首页'}, { name: "部委信息", path: "home" ,send:'/行业聚焦'},
{ name: "服务效益", path: "home" ,send:'/首页'}, { name: "服务效益", path: "home" ,send:'/服务效益'},
{ name: "参观场景", path: "home" ,send:'/首页'}, { name: "参观场景", path: "home" ,send:'/参观场景'},
{ name: "自然灾害", path: "home" ,send:'/首页'}, { name: "自然灾害", path: "home" ,send:'/自然灾害'},
{ name: "事件监控", path: "home" ,send:'/首页'}, { name: "事件监控", path: "home" ,send:'/事件监控'},
{ name: "预警大数据", path: "home" ,send:'/首页'}, { name: "预警大数据", path: "home" ,send:'/大数据'},
// {name:'首页',path:'home'}, {name:'一带一路',path:'home',send:'/一带一路'},
// {name:'首页',path:'home'}, {name:'长江流域',path:'home',send:'/长江流域'},
] ]
}; };
}, },
mounted(){ mounted(){
// getState().then((res)=>{ getState().then((res)=>{
// console.log(JSON.parse(res.data)); this.pagego(this.findIndexByRouteName(res.data))
// var router = JSON.parse(res.data).route })
// if(router=='/首页/全国/预警信息综合监控平台'){ setInterval(() => {
// this.pagego(1) getState().then((res)=>{
// } this.pagego(this.findIndexByRouteName(res.data))
// if(router=='/首页'){ })
// this.pagego(0) }, 1000);
// }
// })
// setInterval(() => {
// getState().then((res)=>{
// console.log(JSON.parse(res.data));
// var router = JSON.parse(res.data).route
// if(router=='/首页/全国/预警信息综合监控平台'){
// this.pagego(1)
// }
// if(router=='/首页'){
// this.pagego(0)
// }
// })
// }, 2000);
}, },
methods: { methods: {
findIndexByRouteName(route){
return _.findIndex(this.navList,(item)=>{
return route.indexOf(item.send) == 0
})
},
pagego(index){ pagego(index){
this.active = index; this.active = index;
this.$router.push(this.navList[this.active].path).catch(err => {err}); this.$router.push(this.navList[this.active].path).catch(err => {err});
}, },
go(index) { go(index) {
this.pagego(index) if(index<0)return false;
// send(this.navList[index].send, []); // this.pagego(index)
// getState() send(this.navList[index].send, []);
// send("/首页", []);
// send("/首页/全国", []);
}, },
itempadding(index) { itempadding(index) {
return ( return (
0.3 * 0.2 *
(this.navList.length / 2 - (this.navList.length / 2 -
Math.abs(index - (this.navList.length - 1) / 2)) + Math.abs(index - (this.navList.length - 1) / 2)) +
"rem" "rem"
...@@ -116,14 +106,14 @@ export default { ...@@ -116,14 +106,14 @@ export default {
list-style: none; list-style: none;
} }
.layout-sidebar li { .layout-sidebar li {
height: 0.9rem; height: 0.8rem;
line-height: 0.9rem; line-height: 0.9rem;
border-radius: 0.4rem; border-radius: 0.4rem;
text-align: center; text-align: center;
white-space: nowrap; white-space: nowrap;
cursor: pointer; cursor: pointer;
color: #ced0d2; color: #ced0d2;
margin: 0.01rem 0 0.04rem; /* margin: 0.01rem 0 0.04rem; */
} }
.layout-sidebar li div.active { .layout-sidebar li div.active {
background: url(../assets/img/select.png) no-repeat left top; background: url(../assets/img/select.png) no-repeat left top;
...@@ -204,4 +194,8 @@ export default { ...@@ -204,4 +194,8 @@ export default {
background: url(../assets/img/icon/7.png) no-repeat center; background: url(../assets/img/icon/7.png) no-repeat center;
background-size: 90%; background-size: 90%;
} }
.icon11 {
background: url(../assets/img/icon/7.png) no-repeat center;
background-size: 90%;
}
</style> </style>
...@@ -38,7 +38,7 @@ def sendMessage(path, message): ...@@ -38,7 +38,7 @@ def sendMessage(path, message):
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--ip", default="127.0.0.1", parser.add_argument("--ip", default="127.0.0.1",
help="The ip of the OSC server") help="The ip of the OSC server")
parser.add_argument("--port", type=int, default=7000, parser.add_argument("--port", type=int, default=7001,
help="The port the OSC server is listening on") help="The port the OSC server is listening on")
args = parser.parse_args() args = parser.parse_args()
...@@ -102,21 +102,19 @@ def create_slider(): ...@@ -102,21 +102,19 @@ def create_slider():
@app.route('/api/route', methods=['POST']) @app.route('/api/route', methods=['POST'])
def create_ctr(): def create_ctr():
app.logger.info(str(request)) app.logger.info(str(request))
# data = json.loads(request.json)
print(request.json['arguments'], len(request.json['arguments'])) print(request.json['arguments'], len(request.json['arguments']))
# print(data) # result = request.json
result = request.json
message = [getBigUnicode(request.json['path'])] message = [getBigUnicode(request.json['path'])]
if(len(request.json['arguments'])): if(len(request.json['arguments'])):
for index in range(len(request.json['arguments'])): for index in range(len(request.json['arguments'])):
message.append(getBigUnicode(request.json['arguments'][index])) message.append(getBigUnicode(request.json['arguments'][index]))
# print(message) print(message)
# sendMessage('/route',[getBigUnicode(request.json['path']), 0 ,1]) # sendMessage('/route',[getBigUnicode(request.json['path']), 0 ,1])
sendMessage('/route',message) sendMessage('/remote',message)
return jsonify(code=0, message='success', data = request.json) return jsonify(code=0, message='success', data = request.json)
@app.route('/api/getState', methods=['get']) @app.route('/api/getState', methods=['get'])
def handle_route(): def handle_route():
with open('test.txt',mode = 'r' , encoding = "UTF-8" ) as f: with open('D:/Warning/2020/Data/currentRoute.txt',mode = 'r' , encoding = "UTF-8" ) as f:
str = f.read() str = f.read()
f.close() f.close()
return jsonify(code=0, message='success', data = str) return jsonify(code=0, message='success', data = str)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment