Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-090 frontend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-090
2021-090 frontend
Commits
3465b8bb
Commit
3465b8bb
authored
Nov 09, 2021
by
IT18111170-Silva S.H.I
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated: discount model
parent
072bc4f4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
19 deletions
+49
-19
Navigations/BottomTab.js
Navigations/BottomTab.js
+7
-1
screen/Leaderboard.js
screen/Leaderboard.js
+2
-2
screen/PriceScreen.js
screen/PriceScreen.js
+40
-16
No files found.
Navigations/BottomTab.js
View file @
3465b8bb
...
@@ -17,7 +17,7 @@ import {
...
@@ -17,7 +17,7 @@ import {
import
{
MaterialIcons
}
from
'
@expo/vector-icons
'
;
import
{
MaterialIcons
}
from
'
@expo/vector-icons
'
;
import
{
gamification
}
from
"
../screen/gamification
"
;
import
{
gamification
}
from
"
../screen/gamification
"
;
import
{
useNavigation
}
from
'
@react-navigation/native
'
;
import
{
useNavigation
}
from
'
@react-navigation/native
'
;
export
function
BottomTab
()
{
export
function
BottomTab
()
{
const
navigation
=
useNavigation
();
const
navigation
=
useNavigation
();
return
(
return
(
...
@@ -60,6 +60,12 @@ export function BottomTab() {
...
@@ -60,6 +60,12 @@ export function BottomTab() {
<
Ionicons
name
=
"
home
"
size
=
{
24
}
color
=
"
black
"
/>
<
Ionicons
name
=
"
home
"
size
=
{
24
}
color
=
"
black
"
/>
<
Text
>
Home
<
/Text
>
<
Text
>
Home
<
/Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
barButtonView
}
onPress
=
{()
=>
navigation
.
navigate
(
"
PriceScreen
"
)}
>
<
Entypo
name
=
"
user
"
size
=
{
24
}
color
=
"
black
"
/>
<
Text
>
Profile
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
);
);
}
}
...
...
screen/Leaderboard.js
View file @
3465b8bb
...
@@ -68,7 +68,7 @@ const fetchData = async () => {
...
@@ -68,7 +68,7 @@ const fetchData = async () => {
{
data
.
map
((
data
)
=>
(
{
data
.
map
((
data
)
=>
(
<
TouchableOpacity
style
=
{
styles
.
touchable
}
onPress
=
{()
=>
navigation
.
navigate
(
'
PriceScreen
'
,
{
picture
:
data
.
userID
.
prof_img_name
})}
>
//
<TouchableOpacity style={styles.touchable} onPress={() => navigation.navigate('PriceScreen', {picture: data.userID.prof_img_name})}>
<
View
style
=
{
styles
.
card
}
>
<
View
style
=
{
styles
.
card
}
>
{
/* <View style={styles.left}>
{
/* <View style={styles.left}>
...
@@ -89,7 +89,7 @@ const fetchData = async () => {
...
@@ -89,7 +89,7 @@ const fetchData = async () => {
<
Text
>
Points
:
{
data
.
points
}
<
/Text
>
<
Text
>
Points
:
{
data
.
points
}
<
/Text
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
/TouchableOpacity
>
// {/* </TouchableOpacity> */}
))}
))}
{
/* ) )} */
}
{
/* ) )} */
}
...
...
screen/PriceScreen.js
View file @
3465b8bb
...
@@ -20,29 +20,53 @@ import { SignIn } from "./SignIn";
...
@@ -20,29 +20,53 @@ import { SignIn } from "./SignIn";
import
axios
from
"
axios
"
;
import
axios
from
"
axios
"
;
import
{
BottomTab
}
from
"
../Navigations/BottomTab
"
;
import
{
BottomTab
}
from
"
../Navigations/BottomTab
"
;
export
function
PriceScreen
({
navigation
,
data
,
route
})
{
export
function
PriceScreen
({
navigation
})
{
const
{
picture
}
=
route
.
params
const
[
discount
,
setDiscount
]
=
useState
(
""
);
useEffect
(()
=>
{
getImage
(
picture
);
// data, route
},
[]);
// const {picture} = route.params
// useEffect(() => {
// getImage(picture);
// }, []);
const
fetchData
=
async
()
=>
{
// const resp = await fetch("http://192.168.8.126:5000/getDetails", {method:"POST"});
axios
({
method
:
"
GET
"
,
url
:
"
http://192.168.8.126:5000/discount/<id>
"
,
})
.
then
(
function
(
response
)
{
console
.
log
(
response
.
data
.
message
);
// data = response.data
setDiscount
(
response
.
data
.
message
);
})
.
catch
(
function
(
error
)
{
console
.
log
(
"
axios error
"
+
error
);
});
};
useEffect
(()
=>
{
fetchData
();
},[]);
function
name
()
{
function
name
()
{
axios
axios
}
}
const
[
image
,
setImage
]
=
useState
(
''
);
//
const [image, setImage] = useState('');
//get the token and id from headers
//get the token and id from headers
//from the id get the
//from the id get the
const
getImage
=
async
(
name
)
=>
{
//
const getImage = async (name) => {
console
.
log
(
name
)
//
console.log(name)
const
q
=
name
.
split
(
'
'
).
join
(
'
+
'
)
//
const q = name.split(' ').join('+')
const
img
=
await
fetch
(
`http://192.168.8.126:5000/getimage/
${
name
}
`
)
//
const img = await fetch(`http://192.168.8.126:5000/getimage/${name}`)
const
image
=
await
img
.
json
();
//
const image = await img.json();
console
.
log
(
image
)
//
console.log(image)
setImage
(
image
.
previewURL
)
//
setImage(image.previewURL)
}
//
}
const
[
details
,
setDetails
]
=
useState
({
const
[
details
,
setDetails
]
=
useState
({
name
:
""
,
name
:
""
,
...
@@ -156,7 +180,7 @@ const getImage = async (name) => {
...
@@ -156,7 +180,7 @@ const getImage = async (name) => {
<
View
style
=
{
styles
.
con
}
>
<
View
style
=
{
styles
.
con
}
>
<
Text
>
<
Text
>
{
{
<
Image
source
=
{{
uri
:
`http://192.168.8.126:5000/getimage/
${
picture
}
`
}}
style
=
{{
width
:
200
,
height
:
200
}}
/
>
<
Image
source
=
{{}}
style
=
{{
width
:
200
,
height
:
200
}}
/
>
}
}
<
/Text
>
<
/Text
>
...
@@ -254,7 +278,7 @@ const getImage = async (name) => {
...
@@ -254,7 +278,7 @@ const getImage = async (name) => {
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
View
>
<
View
>
<
Text
style
=
{
styles
.
text1
}
>
You
have
earned
5
%
Discount
<
/Text
>
<
Text
style
=
{
styles
.
text1
}
>
You
have
earned
{
discount
}
%
Discount
<
/Text
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
...
...
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