修改商店列表展示

master
laurieryayoi 8 years ago
parent aaea680e9f
commit d742ca3e5c

@ -81,7 +81,7 @@
.shop-table .card {
width: 100%;
margin: 10px 0 0 0;
padding: 1em 1em;
padding: 14px 1em;
border-radius: 10px 10px 0 0;
cursor: pointer;
grid-area: main;
@ -94,10 +94,10 @@
padding: 8px 2em;
grid-area: button;
}
.shop-drop {
grid-area: drop;
background: white;
padding: 1em 1.5em;
box-shadow: 0 0px 0 #e5e5e5, 0 2px 5px rgba(0,0,0,.12), 0 2px 4px rgba(0,0,0,.05);
}
@ -136,7 +136,7 @@
position: relative;
transition: .3s all;
grid-template-columns: 100%;
grid-template-rows: auto 0px auto;
grid-template-rows: auto auto auto;
grid-template-areas:
"main"
"drop"
@ -633,6 +633,10 @@ ul.dropdown-menu {
.btn:active,.fbtn:active {
transform: translate(3px,3px);
}
.shop-table .btn.shop-btn:active {
transform: scale3d(1.05,1.05,1.05);
}
.modal-inner p {
word-break: break-word;
@ -1076,19 +1080,19 @@ a.tag-magenta,.tag-magenta {
transition-delay: .3s
}
/* 下拉菜单插件 */
/* .dropdown-hide {
display: none;
} */
.dropdown-area {
height: 0;
opacity: 0;
transform: scale(1,0);
transition: .3s all;
transform: scale3d(1,0,1);
padding: 0 1.5em;
transition: .1s all;
transform-origin: top;
}
.dropdown-area.dropdown-active {
transform: scale(1,1);
transform: scale3d(1,1,1);
opacity: 1;
padding: 1.5em 1.5em;
}
@ -1148,15 +1152,13 @@ a.tag-magenta,.tag-magenta {
.shop-gridarea {
width: 100%;
grid-template-columns: 80% 20%;
grid-template-rows: auto 0px;
grid-template-rows: auto auto;
grid-template-areas:
"main button"
"drop block"
}
.shop-drop {
border-radius: 10px;
padding: 1em 1.5em;
margin: 5px 0 1em 0;
box-shadow: 0 0px 0 #e5e5e5, 0 0 15px rgba(0,0,0,.12), 0 2px 4px rgba(0,0,0,.05);
}
.shop-drop .card-tag {
@ -1167,6 +1169,12 @@ a.tag-magenta,.tag-magenta {
.node-tip.cust-modelin {
transform: translate3d(0,15rem,0);
}
.dropdown-area.dropdown-active {
margin: .5em 0 1.5em 0;
}
.dropdown-area {
transition: .3s all;
}
}
@media only screen and (min-width:768px) {

@ -112,7 +112,7 @@ $(function(){
requestAnimationFrame(()=>{
dropdownarea.classList.add('dropdown-active');
});
dropdownarea.style.height = dropdownarea.scrollHeight + parseInt(window.getComputedStyle(dropdownarea).paddingBottom) + 'px'; //我也不知道为什么少一个padding-bottom的长度
dropdownarea.style.height = dropdownarea.scrollHeight + 2*parseInt(window.getComputedStyle(dropdownarea).paddingLeft) + 'px'; //我也不知道为什么少一个padding-bottom的长度
} else {
requestAnimationFrame(()=>{
dropdownarea.classList.remove('dropdown-active');

@ -106,6 +106,8 @@
<div class="shop-name"> <span>{$shop->name}</span></div>
<div class="card-tag tag-gold">VIP {$shop->user_class()}</div>
<div class="card-tag tag-orange">¥ {$shop->price}</div>
<div class="card-tag tag-cyan">{$shop->bandwidth()} G</div>
<div class="card-tag tag-blue">{$shop->class_expire()} 天</div>
</div>
<div>
<i class="material-icons">expand_more</i>
@ -114,8 +116,6 @@
<a class="btn btn-brand-accent shop-btn" href="javascript:void(0);" onClick="buy('{$shop->id}',{$shop->auto_renew})">购买</a>
<div class="shop-drop dropdown-area">
<div class="card-tag tag-black">添加流量</div> <div class="card-tag tag-blue">{$shop->bandwidth()} G</div>
<div class="card-tag tag-black">等级有效期</div> <div class="card-tag tag-blue">{$shop->class_expire()} 天</div>
<div class="card-tag tag-black">账号有效期</div> <div class="card-tag tag-blue">{$shop->expire()} 天</div>
{if {$shop->reset()} == '0' }
<div class="card-tag tag-black">重置周期</div> <div class="card-tag tag-blue">N/A</div>
@ -288,37 +288,11 @@ function buy(id,auto) {
localStorage.setItem("tempUIshop",defaultUI);
});
//计算高度要用到的东西
let dropDownGridArea = document.querySelectorAll('.shop-gridarea');
let dropDownButton = document.querySelectorAll('.shop-table .card');
let dropDownArea = document.querySelectorAll('.dropdown-area');
let arrows = document.querySelectorAll('.shop-table .card i');
for (let i=0;i<dropDownButton.length;i++) {
dropDownButton[i].addEventListener('click',()=>{
//也不知道为什么取不到购买按钮的高度,只能用减法算出来
let buttonMarginTop = parseInt(window.getComputedStyle(dropDownButton[i]).marginTop);
let buttonHeight = dropDownButton[i].offsetHeight + buttonMarginTop;
let buyHeight = dropDownGridArea[i].offsetHeight - buttonHeight;
//grid layout后产生的问题,需要改第二行的高度
if (window.getComputedStyle(dropDownGridArea[i]).gridTemplateRows == buttonHeight + 'px 0px ' + buyHeight + 'px') {
dropDownGridArea[i].style.gridTemplateRows = 'auto auto auto';
} else if (window.getComputedStyle(dropDownGridArea[i]).gridTemplateRows == buttonHeight + 'px 0px') {
dropDownGridArea[i].style.gridTemplateRows = 'auto auto';
} else {
let loop = setInterval(()=>{
dropDownGridArea[i].style.gridTemplateRows = 'auto ' + (parseInt(window.getComputedStyle(dropDownGridArea[i]).gridTemplateRows.split(' ')[1]) - 13) + 'px';//没有办法只能这么算了
if (parseInt(window.getComputedStyle(dropDownGridArea[i]).gridTemplateRows.split(' ')[1]) < 15) {
clearInterval(loop);
dropDownGridArea[i].style.gridTemplateRows = 'auto 0px';
}
},10);
}
});
rotatrArrow(dropDownButton[i],arrows[i]);
custDropdown(dropDownButton[i], dropDownArea[i]);
}

Loading…
Cancel
Save