Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
html
/
MeteorologicalBureau
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c3126569
authored
Mar 17, 2020
by
hank
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
控制端部分同步
parent
4746ced7
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
108 additions
and
17 deletions
+108
-17
ctr/.env.develop
+2
-2
dva/src/router.js
+3
-1
dva/src/routes/IntroductionWarning/Index.js
+2
-1
dva/src/routes/VisitingScene/Index.js
+3
-0
dva/src/routes/eventMonitor/Index.js
+3
-0
dva/src/routes/informationCenter/Index.js
+1
-0
dva/src/routes/ue4/Index.js
+1
-0
dva/src/routes/warmingCenter/Index.js
+1
-0
dva/src/services/ctr.js
+13
-0
dva/src/utils/index.js
+52
-0
dva/src/utils/request.js
+2
-1
test.txt
+25
-12
No files found.
ctr/.env.develop
View file @
c3126569
NODE_ENV='development'
VUE_APP_BASE_API='//123.57.209.57:8091'
\ No newline at end of file
VUE_APP_BASE_API='//172.16.4.63:8090'
\ No newline at end of file
dva/src/router.js
View file @
c3126569
import
React
from
'react'
;
import
{
Router
,
Route
,
Switch
}
from
'dva/router'
;
import
config
from
'./router/connfig'
import
{
checkState
}
from
'./utils/index'
function
generateRouter
(
maps
,
Routes
=
[])
{
// const Routes = []
(
maps
.
map
(
item
=>
{
...
...
@@ -24,8 +25,9 @@ function RouterConfig({ history }) {
location
.
query
=
JSON
.
parse
(
sessionStorage
.
getItem
(
'query'
))
}
}
checkState
(
history
)
})
//console.log(generateRouter(config), 'generateRouter(config)}') // 生成的路由表
return
(
<
Router
history
=
{
history
}
>
...
...
dva/src/routes/IntroductionWarning/Index.js
View file @
c3126569
...
...
@@ -2,9 +2,10 @@ import React from 'react';
import
{
connect
}
from
'dva'
;
import
'./index.less'
;
import
Layout
from
'@/components/Layout.js'
//
import { send } from '@/services/ctr'
import
{
send
}
from
'@/services/ctr'
function
IntroductionWarning
(
props
)
{
send
(
'/首页/预警介绍'
,
[])
return
(
<
Layout
>
<
div
className
=
"warmingCenter-content animated fadeIn"
>
...
...
dva/src/routes/VisitingScene/Index.js
View file @
c3126569
...
...
@@ -2,7 +2,10 @@ import React from 'react';
import
{
connect
}
from
'dva'
;
import
'./index.less'
;
import
Layout
from
'@/components/Layout.js'
import
{
send
}
from
'@/services/ctr'
function
IntroductionWarning
(
props
)
{
send
(
'/首页参观场景'
,
[])
return
(
<
Layout
>
<
div
className
=
"warmingCenter-content animated fadeIn"
>
...
...
dva/src/routes/eventMonitor/Index.js
View file @
c3126569
...
...
@@ -2,7 +2,10 @@ import React from 'react';
import
{
connect
}
from
'dva'
;
import
'./index.less'
;
import
Layout
from
'@/components/Layout.js'
import
{
send
}
from
'@/services/ctr'
function
IntroductionWarning
(
props
)
{
send
(
'/首页/事件监控'
,
[])
return
(
<
Layout
>
<
div
className
=
"warmingCenter-content animated fadeIn"
>
...
...
dva/src/routes/informationCenter/Index.js
View file @
c3126569
...
...
@@ -5,6 +5,7 @@ import Layout from '@/components/Layout.js'
import
{
send
}
from
'@/services/ctr'
function
WarmingCenter
(
props
)
{
send
(
'/首页/信息中心'
,
[])
return
(
<
Layout
>
<
div
className
=
"warmingCenter-content animated fadeIn"
>
...
...
dva/src/routes/ue4/Index.js
View file @
c3126569
...
...
@@ -5,6 +5,7 @@ import Layout from '@/components/Layout.js'
import
{
send
}
from
'@/services/ctr'
function
IntroductionWarning
(
props
)
{
send
(
'/首页/动画脚本'
)
return
(
<
Layout
>
<
div
className
=
"warmingCenter-content animated fadeIn"
>
...
...
dva/src/routes/warmingCenter/Index.js
View file @
c3126569
...
...
@@ -5,6 +5,7 @@ import Layout from '@/components/Layout.js'
import
{
send
}
from
'@/services/ctr'
// import Breadcrumb from '@/components/Breadcrumb.js'
function
WarmingCenter
(
props
)
{
send
(
'/首页/全国'
,
[])
return
(
<
Layout
>
<
div
className
=
"warmingCenter-content animated fadeIn"
>
...
...
dva/src/services/ctr.js
View file @
c3126569
import
request
from
'../utils/request'
;
export
function
send
(
path
,
agr
)
{
window
.
sessionStorage
.
setItem
(
'sendObj'
,
JSON
.
stringify
({
path
,
agr
}))
if
(
window
.
sessionStorage
.
getItem
(
'isUse'
))
{
console
.
log
(
'取消发送'
)
return
Promise
.
reject
(
'失败'
)
}
return
request
(
'/api/route'
,
{
body
:
JSON
.
stringify
({
path
,
...
...
@@ -13,3 +18,11 @@ export function send(path, agr) {
method
:
'post'
});
}
export
function
getState
()
{
return
request
(
'/api/getState'
,
{
headers
:
new
Headers
({
'Content-Type'
:
'application/json'
}),
method
:
'get'
});
}
dva/src/utils/index.js
0 → 100644
View file @
c3126569
import
{
getState
}
from
'../services/ctr'
import
routerConfig
from
'@/router/connfig'
// var filterRouter = {}
function
generateRouter
(
maps
,
Routes
=
[])
{
// const Routes = []
(
maps
.
map
(
item
=>
{
Routes
.
push
(
item
)
if
(
item
.
children
&&
item
.
children
.
length
)
{
// generateRouter(item.children, Routes)
}
return
item
.
children
&&
item
.
children
.
length
?
generateRouter
(
item
.
children
,
Routes
)
:
(
item
)
}))
return
Routes
}
function
filterRouter
(
path
)
{
var
routes
=
generateRouter
(
routerConfig
);
var
filterRouter
=
null
// eslint-disable-next-line array-callback-return
routes
.
map
((
item
)
=>
{
if
(
item
.
meta
.
vPath
===
path
)
{
filterRouter
=
item
}
return
item
})
console
.
log
(
filterRouter
,
'filterRouter'
)
return
filterRouter
}
export
function
checkState
(
history
)
{
// 检查路由状态 与大屏保持同步
window
.
_getState
&&
clearInterval
(
window
.
_getState
)
window
.
_getState
=
setInterval
(()
=>
{
getState
().
then
(
res
=>
{
let
data
=
JSON
.
parse
(
res
.
data
.
data
)
let
sendObj
=
window
.
sessionStorage
.
getItem
(
'sendObj'
);
sendObj
?
sendObj
=
JSON
.
parse
(
sendObj
)
:
(
sendObj
=
{})
console
.
log
(
data
,
sendObj
)
window
.
sessionStorage
.
setItem
(
'isUse'
,
'true'
)
if
(
data
.
route
===
sendObj
.
path
)
{
console
.
log
(
'路由重复'
)
window
.
sessionStorage
.
setItem
(
'isUse'
,
'true'
)
}
else
{
const
result
=
filterRouter
(
data
.
route
)
window
.
sessionStorage
.
removeItem
(
'isUse'
)
history
.
replace
(
result
.
path
)
}
})
},
1000
)
}
\ No newline at end of file
dva/src/utils/request.js
View file @
c3126569
...
...
@@ -11,6 +11,7 @@ function checkStatus(response) {
const
error
=
new
Error
(
response
.
statusText
);
error
.
response
=
response
;
// return Promise.reject(error)
throw
error
;
}
...
...
@@ -26,5 +27,5 @@ export default function request(url, options) {
.
then
(
checkStatus
)
.
then
(
parseJSON
)
.
then
(
data
=>
({
data
}))
.
catch
(
err
=>
({
err
}));
//
.catch(err => ({ err }));
}
test.txt
View file @
c3126569
{
"ip" : "192.168.1.110",
"route" : "/首页/全国",
"volume" : 50,
"brightness" : 50,
"enableTouch" : true,
"music" : {
"isPlay" : true,
"fileIndex" : 2,
"repeat" : -1,
"volume" : 20
}
{
"ip" : "192.168.1.110",
"route" : "/首页",
"volume" : 50,
"brightness" : 50,
"enableTouch" : true,
"music" : {
"isPlay" : true,
"fileIndex" : 2,
"repeat" : -1,
"volume" : 20
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment