Toggle navigation
Toggle navigation
This project
Loading...
Sign in
유희정
/
fwiot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
유희정
2019-12-14 09:34:29 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d771cce129e391db79f1ba796484e8718c5148ad
d771cce1
1 parent
ec3b7624
referesh
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
6 deletions
package-lock.json
package.json
source/AppTabNavigator/HomeTab.js
source/AppTabNavigator/SettingTab.js
package-lock.json
View file @
d771cce
This diff is collapsed. Click to expand it.
package.json
View file @
d771cce
...
...
@@ -10,6 +10,7 @@
"lint"
:
"eslint ."
},
"dependencies"
:
{
"aws-sdk"
:
"^2.589.0"
,
"d3"
:
"^5.14.2"
,
"express"
:
"^4.17.1"
,
"react"
:
"16.9.0"
,
...
...
source/AppTabNavigator/HomeTab.js
View file @
d771cce
...
...
@@ -5,13 +5,17 @@ import Circle from '../component/circle_component'
import
{
Table
,
TableWrapper
,
Row
,
Rows
}
from
'react-native-table-component'
var
date
=
new
Date
();
date
.
setHours
(
date
.
getHours
()
+
9
);
var
month
=
date
.
getMonth
()
+
1
;
if
(
month
==
11
){
month
=
12
}
export
default
class
HomeTab
extends
Component
{
constructor
(
props
){
super
(
props
);
this
.
state
=
{
today
:
date
.
getFullYear
()
+
"."
+
date
.
getMonth
()
+
"."
+
date
.
getDate
(),
ID
:
this
.
props
.
navigation
.
getParam
(
'id'
,
'pi1'
),
today
:
date
.
getFullYear
()
+
"."
+
month
+
"."
+
date
.
getDate
(),
current_weight
:
0
,
table_contents
:
[[
'오후'
,
'6:12:15'
,
'+0.25kg'
,
'Total : 1.5 kg'
],[
'오후'
,
'4:27:52'
,
'+0.12kg'
,
'Total : 1.38kg'
],
[
'오후'
,
'6:12:15'
,
'+0.25kg'
,
'Total : 1.5 kg'
],[
'오후'
,
'6:12:15'
,
'+0.25kg'
,
'Total : 1.5 kg'
],
...
...
@@ -21,11 +25,34 @@ export default class HomeTab extends Component {
]
}
}
get_diff_data
(){
return
fetch
(
'http://10.0.2.2:3000/app/get_diff_data/'
,{
method
:
'POST'
,
headers
:
{
'Accept'
:
'application/json'
,
'Content-Type'
:
'application/json'
,
},
body
:
JSON
.
stringify
({
ras_id
:
this
.
state
.
ID
,
date
:
this
.
state
.
today
,
}),
})
.
then
((
response
)
=>
console
.
log
(
response
.
json
()))
.
then
((
responseJson
)
=>
{
console
.
log
(
responseJson
)
},
function
(){
})
.
catch
((
error
)
=>
{
console
.
error
(
error
);
})
}
render
()
{
return
(
<
View
style
=
{
style
.
container
}
>
<
View
style
=
{
style
.
header
}
>
<
Text
style
=
{
style
.
tabName
}
>
Home
<
/Text
>
<
Text
style
=
{
style
.
tabName
}
>
Home
{
this
.
state
.
ID
}
<
/Text
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
,
flex
:
0.8
,
backgroundColor
:
"rgba(230,230,230,0.5)"
}}
>
<
View
style
=
{{
flex
:
1
,
justifyContent
:
'center'
}}
>
...
...
@@ -38,7 +65,8 @@ export default class HomeTab extends Component {
<
/View
>
<
View
style
=
{
style
.
current_state
}
>
<
Circle
title
=
{
"3.6"
}
>
title
=
{
"3.6"
}
onPress
=
{()
=>
{
this
.
get_diff_data
()}}
>
<
/Circle
>
<
/View
>
<
View
style
=
{
style
.
waste_detail
}
>
...
...
source/AppTabNavigator/SettingTab.js
View file @
d771cce
...
...
@@ -4,16 +4,40 @@ import AddButton from '../component/AddButton'
var
date
=
new
Date
();
date
.
setHours
(
date
.
getHours
()
+
9
);
date
.
setMonth
(
date
.
getMonth
()
+
1
);
export
default
class
SettingTab
extends
Component
{
constructor
(
props
){
super
(
props
);
this
.
state
=
{
ID
:
'abcdefg1234'
ID
:
'pi1'
,
user
:
'user1'
}
}
save_app_data
(){
return
fetch
(
'http://10.0.2.2:3000/app/save_data/'
,{
method
:
'POST'
,
headers
:
{
'Accept'
:
'application/json'
,
'Content-Type'
:
'application/json'
,
},
body
:
JSON
.
stringify
({
ras_id
:
this
.
state
.
ID
,
user_id
:
this
.
state
.
user
,
}),
})
.
then
((
response
)
=>
console
.
log
(
response
.
json
()))
.
then
((
responseJson
)
=>
{
console
.
log
(
responseJson
)
},
function
(){
})
.
catch
((
error
)
=>
{
console
.
error
(
error
);
})
}
delete_id
(){
this
.
setState
({
ID
:
''
})
//기기연결 해제, 디비비우기
...
...
@@ -54,8 +78,9 @@ export default class SettingTab extends Component {
placeholder
=
"New Rasberry ID"
value
=
{
this
.
state
.
text
}
onChangeText
=
{(
text
)
=>
this
.
setState
({
ID
:
text
})}
/
>
<
AddButton
><
/AddButton
>
<
/View
>
<
AddButton
onPress
=
{()
=>
{
this
.
save_app_data
()}}
/
>
<
/View
>
<
/View
>
<
/View
>
...
...
Please
register
or
login
to post a comment