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 @@
<script>
import { send,getState } from "@/service/ctrapi";
import _ from "lodash";
export default {
data() {
return {
active: 0,
navList: [
{ name: "首页", path: "/home" ,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'},
// {name:'首页',path:'home'},
{ name: "首页", path: "/home" ,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:'/长江流域'},
]
};
},
mounted(){
// 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)
// }
// })
// 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);
getState().then((res)=>{
this.pagego(this.findIndexByRouteName(res.data))
})
setInterval(() => {
getState().then((res)=>{
this.pagego(this.findIndexByRouteName(res.data))
})
}, 1000);
},
methods: {
findIndexByRouteName(route){
return _.findIndex(this.navList,(item)=>{
return route.indexOf(item.send) == 0
})
},
pagego(index){
this.active = index;
this.$router.push(this.navList[this.active].path).catch(err => {err});
},
go(index) {
this.pagego(index)
// send(this.navList[index].send, []);
// getState()
// send("/首页", []);
// send("/首页/全国", []);
if(index<0)return false;
// this.pagego(index)
send(this.navList[index].send, []);
},
itempadding(index) {
return (
0.3 *
0.2 *
(this.navList.length / 2 -
Math.abs(index - (this.navList.length - 1) / 2)) +
"rem"
......@@ -116,14 +106,14 @@ export default {
list-style: none;
}
.layout-sidebar li {
height: 0.9rem;
height: 0.8rem;
line-height: 0.9rem;
border-radius: 0.4rem;
text-align: center;
white-space: nowrap;
cursor: pointer;
color: #ced0d2;
margin: 0.01rem 0 0.04rem;
/* margin: 0.01rem 0 0.04rem; */
}
.layout-sidebar li div.active {
background: url(../assets/img/select.png) no-repeat left top;
......@@ -204,4 +194,8 @@ export default {
background: url(../assets/img/icon/7.png) no-repeat center;
background-size: 90%;
}
.icon11 {
background: url(../assets/img/icon/7.png) no-repeat center;
background-size: 90%;
}
</style>
......@@ -38,7 +38,7 @@ def sendMessage(path, message):
parser = argparse.ArgumentParser()
parser.add_argument("--ip", default="127.0.0.1",
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")
args = parser.parse_args()
......@@ -102,21 +102,19 @@ def create_slider():
@app.route('/api/route', methods=['POST'])
def create_ctr():
app.logger.info(str(request))
# data = json.loads(request.json)
print(request.json['arguments'], len(request.json['arguments']))
# print(data)
result = request.json
# result = request.json
message = [getBigUnicode(request.json['path'])]
if(len(request.json['arguments'])):
for index in range(len(request.json['arguments'])):
message.append(getBigUnicode(request.json['arguments'][index]))
# print(message)
print(message)
# sendMessage('/route',[getBigUnicode(request.json['path']), 0 ,1])
sendMessage('/route',message)
sendMessage('/remote',message)
return jsonify(code=0, message='success', data = request.json)
@app.route('/api/getState', methods=['get'])
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()
f.close()
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