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
a6e6daf9
Commit
a6e6daf9
authored
Oct 20, 2020
by
shoei.kanno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品一覧画面機能、非同期通信途中
parent
d398f9d9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
44 deletions
+79
-44
style.css
src/main/resources/static/css/style.css
+24
-7
list.js
src/main/resources/static/js/list.js
+34
-29
list.html
src/main/resources/templates/list.html
+21
-8
No files found.
src/main/resources/static/css/style.css
View file @
a6e6daf9
...
@@ -1879,7 +1879,7 @@ th, td {
...
@@ -1879,7 +1879,7 @@ th, td {
/* list画面 */
/* list画面 */
#listBox
{
#listBox
{
/*background-color: #FDF5E6;*/
background-color
:
#FDF5E6
;
height
:
100%
;
height
:
100%
;
display
:
flex
;
display
:
flex
;
flex-direction
:
row
;
flex-direction
:
row
;
...
@@ -1887,18 +1887,19 @@ th, td {
...
@@ -1887,18 +1887,19 @@ th, td {
}
}
.productBox
{
.productBox
{
background-color
:
#FDF5E6
;
/*background-color: #FDF5E6;*/
height
:
400px
;
height
:
400px
;
width
:
3
0
%
;
width
:
3
3
%
;
/*border: 1px solid black;*/
/*border: 1px solid black;*/
margin
:
5px
;
box-sizing
:
border-box
;
padding
:
5px
;
}
}
/* listモーダル */
/* listモーダル */
#modal-content
{
#modal-content
{
width
:
5
0%
;
width
:
3
0%
;
margin
:
0
;
margin
:
0
;
padding
:
10px
20px
;
padding
:
10px
20px
;
border
:
2px
solid
#aaa
;
border
:
2px
solid
#aaa
;
...
@@ -1945,12 +1946,12 @@ th, td {
...
@@ -1945,12 +1946,12 @@ th, td {
color
:
#000
;
color
:
#000
;
}
}
.detailsBtn
,
.shoeImage
,
.shoeName
,
.shoePrice
,
.shoeImageDiv
{
.detailsBtn
,
.shoeImage
,
.shoeName
,
.shoePrice
,
.shoeImageDiv
,
.modalShow
{
text-align
:
center
;
text-align
:
center
;
}
}
.productBox
{
.productBox
{
margin
:
0
auto
;
/*margin: 0 auto;*/
}
}
.shoeImageDiv
{
.shoeImageDiv
{
...
@@ -1959,4 +1960,19 @@ th, td {
...
@@ -1959,4 +1960,19 @@ th, td {
.shoeName
{
.shoeName
{
margin-top
:
10px
;
margin-top
:
10px
;
}
.cart-close-btn
,
.cartBtn
{
width
:
150px
;
height
:
50px
;
font-weight
:
bold
;
font-size
:
small
;
background-color
:
#1abc9c
;
border-radius
:
3px
;
border
:
none
;
color
:
#000
;
}
#showQuantity
{
margin-bottom
:
10px
;
}
}
\ No newline at end of file
src/main/resources/static/js/list.js
View file @
a6e6daf9
...
@@ -27,15 +27,20 @@ $(function(){
...
@@ -27,15 +27,20 @@ $(function(){
let
priceField
=
document
.
createElement
(
"p"
);
let
priceField
=
document
.
createElement
(
"p"
);
let
idField
=
document
.
createElement
(
"input"
);
let
idField
=
document
.
createElement
(
"input"
);
idField
.
setAttribute
(
"type"
,
"hidden"
);
idField
.
setAttribute
(
"type"
,
"hidden"
);
let
name
=
$
(
event
.
target
.
parentNode
.
children
[
1
].
textContent
);
// let name = $(event.target.parentNode.children[1].textContent);
let
price
=
$
(
event
.
target
.
parentNode
.
children
[
2
].
textContent
);
// let price =$(event.target.parentNode.children[2].textContent);
let
id
=
$
(
event
.
target
.
parentNode
.
children
[
3
].
value
);
// let id =$(event.target.parentNode.children[3].value);
let
src
=
$
(
event
.
target
.
parentNode
.
previousElementSibling
.
previousElementSibling
.
previousElementSibling
.
previousElementSibling
).
children
(
'img'
).
attr
(
'src'
);
let
name
=
$
(
event
.
target
.
parentNode
.
previousElementSibling
.
previousElementSibling
.
previousElementSibling
.
textContent
);
let
price
=
$
(
event
.
target
.
parentNode
.
previousElementSibling
.
previousElementSibling
.
textContent
);
let
id
=
$
(
event
.
target
.
parentNode
.
previousElementSibling
.
value
);
nameField
.
textContent
=
name
.
selector
;
nameField
.
textContent
=
name
.
selector
;
$
(
'#showName'
).
append
(
nameField
);
$
(
'#showName'
).
append
(
nameField
);
priceField
.
textContent
=
price
.
selector
;
priceField
.
textContent
=
price
.
selector
;
$
(
'#showPrice'
).
append
(
priceField
);
$
(
'#showPrice'
).
append
(
priceField
);
idField
.
value
=
id
.
selector
;
idField
.
value
=
id
.
selector
;
$
(
'#showId'
).
append
(
idField
);
$
(
'#showId'
).
append
(
idField
);
$
(
'#showImage'
).
attr
(
'src'
,
src
);
//[#modal-overlay]、または[#modal-close]をクリックしたら…
//[#modal-overlay]、または[#modal-close]をクリックしたら…
$
(
"#modal-overlay,#modal-close"
).
unbind
().
click
(
function
(){
$
(
"#modal-overlay,#modal-close"
).
unbind
().
click
(
function
(){
...
@@ -49,6 +54,32 @@ $(function(){
...
@@ -49,6 +54,32 @@ $(function(){
}
)
;
}
)
;
}
)
;
}
)
;
//カートに追加
$
(
'.cartBtn'
).
on
(
'click'
,
function
(
event
){
let
data
=
{
shoesId
:
$
(
event
.
target
.
previousElementSibling
.
previousElementSibling
.
previousElementSibling
).
children
(
'input'
).
val
(),
quantity
:
$
(
event
.
target
.
previousElementSibling
.
previousElementSibling
).
children
(
'select'
).
val
()
};
console
.
log
(
data
);
$
.
ajax
({
type
:
"POST"
,
url
:
"/limited/inputCart"
,
contentType
:
'application/json'
,
dataType
:
"json"
,
data
:
JSON
.
stringify
(
data
)
}).
done
(
function
()
{
$
(
"#modal-content,#modal-overlay"
).
fadeOut
(
"slow"
,
function
(){
//[#modal-overlay]を削除する
$
(
'#modal-overlay'
).
remove
()
;
}
)
;
}).
fail
(
function
()
{
alert
(
"Failed."
);
});
});
}
)
;
}
)
;
});
});
...
@@ -77,29 +108,3 @@ $(function(){
...
@@ -77,29 +108,3 @@ $(function(){
}
)
;
}
)
;
//モーダル表示
//let details = document.getElementsByClassName("js-modal-open");
//$(".js-modal-open").each(function() {
// $(".js-modal-open").on("click", function(){
// $('.js-modal').fadeIn();
// return false;
// });
// $(".js-modal-close").on("click", function(){
// $('.js-modal').fadeIn();
// return false;
// });
//});
//モーダル内情報表示
//モーダルフォーム送信
//$('#ok-btn').on('click', function(){
//
//});
src/main/resources/templates/list.html
View file @
a6e6daf9
...
@@ -16,17 +16,31 @@
...
@@ -16,17 +16,31 @@
<![endif]-->
<![endif]-->
</head>
</head>
<body>
<body>
<!-- モーダル中身 -->
<!-- モーダル中身 -->
<div
id=
"modal-content"
>
<div
id=
"modal-content"
>
<div
id=
"modal-content-innar"
>
<div
id=
"modal-content-innar"
>
<!-- モーダルウィンドウのコンテンツ開始 -->
<!-- モーダルウィンドウのコンテンツ開始 -->
<img
class=
"shoeImage"
alt=
"productImage"
/>
<img
class=
"modalShow"
id=
"showImage"
alt=
"productImage"
width=
"300"
height=
"200"
/>
<div
id=
"showName"
></div>
<div
class=
"modalShow"
id=
"showName"
></div>
<div
id=
"showPrice"
></div>
<div
class=
"modalShow"
id=
"showPrice"
></div>
<div
id=
"showId"
></div>
<div
class=
"modalShow"
id=
"showId"
></div>
<p><a
id=
"modal-close"
class=
"button-link"
>
閉じる
</a></p>
<div
class=
"modalShow"
id=
"showQuantity"
>
<button
type=
"button"
class=
"cartBtn"
>
cartへ入れる
</button>
<span>
Quantity
</span>
<select
name=
"quantity"
>
<option
value=
"1"
>
1
</option>
<option
value=
"2"
>
2
</option>
<option
value=
"3"
>
3
</option>
<option
value=
"4"
>
4
</option>
<option
value=
"5"
>
5
</option>
<option
value=
"6"
>
6
</option>
<option
value=
"7"
>
7
</option>
<option
value=
"8"
>
8
</option>
<option
value=
"9"
>
9
</option>
<option
value=
"10"
>
10
</option>
</select>
</div>
<a
id=
"modal-close"
class=
"button-link"
><button
class=
"cart-close-btn"
>
Close
</button></a>
<button
type=
"button"
class=
"cartBtn"
>
Add Cart
</button>
</div>
</div>
</div>
</div>
<!-- モーダルウィンドウのコンテンツ終了 -->
<!-- モーダルウィンドウのコンテンツ終了 -->
...
@@ -120,7 +134,6 @@
...
@@ -120,7 +134,6 @@
</div>
</div>
</div>
</div>
</footer>
</footer>
<!-- JQUERY -->
<!-- JQUERY -->
<script
src=
"http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"
></script>
<script
src=
"http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"
></script>
<script
src=
"js/list.js"
th:src=
"@{/js/list.js}"
></script>
<script
src=
"js/list.js"
th:src=
"@{/js/list.js}"
></script>
...
...
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