Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
Ecsite
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shoei.kanno
Ecsite
Commits
b3f409e5
Commit
b3f409e5
authored
Oct 21, 2020
by
keita.onoguchi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'カート編集' into 'master'
カート編集機能追加 See merge request
!62
parents
18a0ff31
b699ae68
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
1 deletion
+39
-1
SecurityConfig.java
src/main/java/com/example/SecurityConfig.java
+1
-1
EcsiteRestController.java
src/main/java/com/example/api/EcsiteRestController.java
+11
-0
cart.js
src/main/resources/static/js/cart.js
+27
-0
No files found.
src/main/java/com/example/SecurityConfig.java
View file @
b3f409e5
...
@@ -14,7 +14,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter{
...
@@ -14,7 +14,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter{
@Override
@Override
public
void
configure
(
WebSecurity
web
)
throws
Exception
{
public
void
configure
(
WebSecurity
web
)
throws
Exception
{
web
.
debug
(
false
).
ignoring
().
antMatchers
(
"/images/**"
,
"/js/**"
,
"/css/**"
,
"/fonts/**"
,
"/limited/inputCart"
,
"/limited/buy"
);
web
.
debug
(
false
).
ignoring
().
antMatchers
(
"/images/**"
,
"/js/**"
,
"/css/**"
,
"/fonts/**"
,
"/limited/inputCart"
,
"/limited/buy"
,
"/limited/editCart"
);
}
}
@Override
@Override
...
...
src/main/java/com/example/api/EcsiteRestController.java
View file @
b3f409e5
...
@@ -115,6 +115,17 @@ public class EcsiteRestController {
...
@@ -115,6 +115,17 @@ public class EcsiteRestController {
}
}
}
}
@PostMapping
(
"editCart"
)
public
void
editCart
(
@RequestBody
ItemData
data
,
Shoes
shoes
)
{
System
.
out
.
println
(
data
.
getQuantity
());
LinkedHashMap
<
String
,
Items
>
cart
=
new
LinkedHashMap
<
String
,
Items
>();
String
id
=
data
.
getShoesId
().
toString
();
//生成したHashMapにセッションにもともとある情報を照会させる。
cart
=
(
LinkedHashMap
<
String
,
Items
>)
session
.
getAttribute
(
"cart"
);
cart
.
put
(
id
,
itemsService
.
findOne
(
data
.
getShoesId
(),
data
.
getQuantity
()));
session
.
setAttribute
(
"cart"
,
cart
);
}
@GetMapping
(
"buy"
)
@GetMapping
(
"buy"
)
public
void
buy
(
@AuthenticationPrincipal
LoginUser
userDetails
,
LinkedHashMap
<
String
,
Items
>
items
,
ArrayList
<
Items
>
cart
,
Wallets
wallet
){
public
void
buy
(
@AuthenticationPrincipal
LoginUser
userDetails
,
LinkedHashMap
<
String
,
Items
>
items
,
ArrayList
<
Items
>
cart
,
Wallets
wallet
){
items
=
(
LinkedHashMap
<
String
,
Items
>)
session
.
getAttribute
(
"cart"
);
items
=
(
LinkedHashMap
<
String
,
Items
>)
session
.
getAttribute
(
"cart"
);
...
...
src/main/resources/static/js/cart.js
View file @
b3f409e5
...
@@ -24,4 +24,30 @@ $('#ok-btn').on('click',function(){
...
@@ -24,4 +24,30 @@ $('#ok-btn').on('click',function(){
.
fail
(
function
(){
.
fail
(
function
(){
alert
(
"ウォレットの残高が足りません。チャージしてください"
);
alert
(
"ウォレットの残高が足りません。チャージしてください"
);
})
})
});
//商品個数追加
$
(
'.itemCountChange'
).
on
(
'click'
,
function
(
event
){
console
.
log
(
event
.
target
.
parentElement
.
parentElement
.
children
[
0
].
textContent
);
console
.
log
(
event
.
target
.
parentElement
.
parentElement
.
children
[
3
].
children
[
0
].
value
);
let
data
=
{
shoesId
:
parseInt
(
event
.
target
.
parentElement
.
parentElement
.
children
[
0
].
textContent
),
quantity
:
parseInt
(
event
.
target
.
parentElement
.
parentElement
.
children
[
3
].
children
[
0
].
value
)
};
$
.
ajax
({
type
:
"POST"
,
url
:
"/limited/editCart"
,
contentType
:
'application/json'
,
dataType
:
"json"
,
data
:
JSON
.
stringify
(
data
)
})
window
.
location
.
href
=
"/limited/cart"
;
//[#modal-content]と[#modal-overlay]をフェードアウトした後に…
$
(
"#modal-content,#modal-overlay"
).
fadeOut
(
"slow"
,
function
(){
//[#modal-overlay]を削除する
$
(
'#modal-overlay'
).
remove
()
;
})
;
});
});
\ 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