🐛 移除resources,图标不存在时不会显示图片 (#1820)
Co-authored-by: Flern <cb56ec362bbbfb5272eb941281299d8d-qq_connect@git.osc>
|
Before Width: | Height: | Size: 604 KiB |
@ -1,321 +0,0 @@
|
|||||||
@font-face {
|
|
||||||
font-family: fzrzFont;
|
|
||||||
/* 导入的字体文件 */
|
|
||||||
src: url("../../font/fzrzExtraBold.ttf");
|
|
||||||
}
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: msyhFont;
|
|
||||||
/* 导入的字体文件 */
|
|
||||||
src: url("../../font/msyh.ttf");
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: hywhFont;
|
|
||||||
/* 导入的字体文件 */
|
|
||||||
src: url("../../font/HYWenHei-85W.ttf");
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: syhtFont;
|
|
||||||
/* 导入的字体文件 */
|
|
||||||
src: url("../../font/syht.otf");
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
position: absolute;
|
|
||||||
left: -8px;
|
|
||||||
top: -8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wrapper {
|
|
||||||
width: 850px;
|
|
||||||
font-family: "hywhFont";
|
|
||||||
padding: 10px 0;
|
|
||||||
background-color: #fbe4e4;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-title {
|
|
||||||
color: #e87692;
|
|
||||||
font-size: 85px;
|
|
||||||
text-align: center;
|
|
||||||
font-family: "fzrzFont";
|
|
||||||
margin-bottom: -30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.split {
|
|
||||||
background-image: url("./res/img/split.png");
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: center;
|
|
||||||
height: 15px;
|
|
||||||
margin-top: 70px;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-head {
|
|
||||||
background-image: url("./res/img/head.png");
|
|
||||||
background-size: contain;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: center;
|
|
||||||
height: 586px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-aaaa {
|
|
||||||
font-family: 'syhtFont';
|
|
||||||
font-size: 34px;
|
|
||||||
text-align: center;
|
|
||||||
color: #E87692;
|
|
||||||
height: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.shop-border {
|
|
||||||
margin-bottom: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.shop-item {
|
|
||||||
padding-top: 100px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.shop-item-border {
|
|
||||||
display: flex;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.shop-item-title {
|
|
||||||
background-image: url("./res/img/title-bk.png");
|
|
||||||
background-size: contain;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: center;
|
|
||||||
height: 100px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.shop-item-title-text {
|
|
||||||
color: white;
|
|
||||||
font-size: 30px;
|
|
||||||
margin-top: 13px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.shop-item-left {
|
|
||||||
min-height: 460px;
|
|
||||||
position: relative;
|
|
||||||
width: 158px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.shop-item-left-qq {
|
|
||||||
position: absolute;
|
|
||||||
height: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.left-img {
|
|
||||||
position: absolute;
|
|
||||||
left: 5px;
|
|
||||||
z-index: 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
.shop-item-right {
|
|
||||||
width: 210px;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.shop-item-right-zx {
|
|
||||||
height: 460px;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 3;
|
|
||||||
top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.right-img {
|
|
||||||
position: absolute;
|
|
||||||
right: -2px;
|
|
||||||
z-index: 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
.shop-item-mid {
|
|
||||||
width: 480px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
padding-top: 20px;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.shop-item-mid-bk-inner {
|
|
||||||
width: 520px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
padding-top: 30px;
|
|
||||||
background-color: #be5972;
|
|
||||||
border: 1px solid #b14b5f;
|
|
||||||
border-radius: 10px;
|
|
||||||
position: absolute;
|
|
||||||
right: -50px;
|
|
||||||
top: 10px;
|
|
||||||
z-index: 1;
|
|
||||||
height: calc(100% - 20px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.shop-item-mid-bk-out {
|
|
||||||
width: 520px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background-color: #f096a8;
|
|
||||||
border: 1px solid #812528;
|
|
||||||
border-radius: 10px;
|
|
||||||
height: 100%;
|
|
||||||
z-index: 2;
|
|
||||||
position: relative;
|
|
||||||
padding: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-item {
|
|
||||||
background-color: #f8cfd8;
|
|
||||||
width: 100%;
|
|
||||||
min-height: 130px;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 10px;
|
|
||||||
display: flex;
|
|
||||||
position: relative;
|
|
||||||
border: 1px solid #994446;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-id {
|
|
||||||
position: absolute;
|
|
||||||
color: white;
|
|
||||||
font-size: 15px;
|
|
||||||
border-top-left-radius: 10px;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
border-right: 60px solid transparent;
|
|
||||||
border-bottom: 60px solid transparent;
|
|
||||||
border-top: 60px solid #ea7492;
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-id-text {
|
|
||||||
position: absolute;
|
|
||||||
top: -54px;
|
|
||||||
left: 9px;
|
|
||||||
color: white;
|
|
||||||
font-size: 16px;
|
|
||||||
font-family: "fzrzFont";
|
|
||||||
transform: rotate(-45deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-item-left {
|
|
||||||
height: 100%;
|
|
||||||
min-height: 130px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding-top: 30px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-item-left-o {
|
|
||||||
height: 24px;
|
|
||||||
width: 20px;
|
|
||||||
background-color: #e99eab;
|
|
||||||
border-radius: 40%;
|
|
||||||
border: 1px solid #994446;
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-item-icon {
|
|
||||||
background-color: #fefefe;
|
|
||||||
border: 1px solid #994446;
|
|
||||||
margin-left: 20px;
|
|
||||||
width: 120px;
|
|
||||||
border-radius: 10px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-item-icon-img {
|
|
||||||
height: 104px;
|
|
||||||
width: 104px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-item-right-des {
|
|
||||||
width: 272px;
|
|
||||||
min-height: 80px;
|
|
||||||
background-color: #fefefe;
|
|
||||||
border: 1px solid #994446;
|
|
||||||
margin-left: 10px;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 5px;
|
|
||||||
font-family: "msyhFont";
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-item-right-price {
|
|
||||||
min-height: 30px;
|
|
||||||
background-color: #fefefe;
|
|
||||||
border-radius: 30px;
|
|
||||||
border: 1px solid #994446;
|
|
||||||
height: 20px;
|
|
||||||
margin-left: 10px;
|
|
||||||
margin-top: 5px;
|
|
||||||
font-size: 15px;
|
|
||||||
font-family: "msyhFont";
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding-left: 10px;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-item-right-btn {
|
|
||||||
min-height: 30px;
|
|
||||||
background-color: #bf9ac6;
|
|
||||||
color: white;
|
|
||||||
border-radius: 30px;
|
|
||||||
position: absolute;
|
|
||||||
right: 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 0 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-item-right-btn-line {
|
|
||||||
width: 1px;
|
|
||||||
height: 20px;
|
|
||||||
background-color: #994446;
|
|
||||||
margin: 0 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.shop-item-mid-bag1 {
|
|
||||||
position: absolute;
|
|
||||||
width: 70px;
|
|
||||||
height: 78px;
|
|
||||||
bottom: -35px;
|
|
||||||
left: -35px;
|
|
||||||
z-index: 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.shop-item-mid-bag2 {
|
|
||||||
position: absolute;
|
|
||||||
width: 121px;
|
|
||||||
height: 89px;
|
|
||||||
right: -35px;
|
|
||||||
bottom: -35px;
|
|
||||||
z-index: 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-item-name {
|
|
||||||
font-size: 18px;
|
|
||||||
font-family: "syhtFont";
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-item-name-line {
|
|
||||||
height: 2px;
|
|
||||||
width: 100%;
|
|
||||||
margin: 3px 0;
|
|
||||||
background-color: #731c1c;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.create-text {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1px;
|
|
||||||
right: 10px;
|
|
||||||
color: #97979c;
|
|
||||||
font-size: 15px;
|
|
||||||
}
|
|
||||||
@ -1,128 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="zh-cn">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>test</title>
|
|
||||||
<!-- <link rel="stylesheet" href="./res/font-awesome/css/font-awesome.min.css"> -->
|
|
||||||
<link rel="stylesheet" href="main.css">
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="top-title">
|
|
||||||
{{name}}的神秘商店
|
|
||||||
</div>
|
|
||||||
<div class="top-aaaa">“使用 '购买道具 [道具ID/道具名称]' 购买道具”</div>
|
|
||||||
<div class="split" style="margin-top: 30px;"></div>
|
|
||||||
<div class="top-head"></div>
|
|
||||||
<div class="shop-border">
|
|
||||||
{% for data in data_list %}
|
|
||||||
<div class="shop-item">
|
|
||||||
<div class="shop-item-title">
|
|
||||||
<span class="shop-item-title-text">{{data.partition}}</span>
|
|
||||||
</div>
|
|
||||||
<div class="shop-item-border">
|
|
||||||
<div class="shop-item-left">
|
|
||||||
</div>
|
|
||||||
<div class="shop-item-mid">
|
|
||||||
<div class="shop-item-mid-bk-inner"></div>
|
|
||||||
<div class="shop-item-mid-bk-out">
|
|
||||||
{% for goods in data['goods_list'] %}
|
|
||||||
<div class="goods-item">
|
|
||||||
<div class="goods-id">
|
|
||||||
<div class="goods-id-text">{{goods.id}}</div>
|
|
||||||
</div>
|
|
||||||
<div class="goods-item-left">
|
|
||||||
<div class="goods-item-left-o"></div>
|
|
||||||
<div class="goods-item-left-o"></div>
|
|
||||||
<div class="goods-item-left-o"></div>
|
|
||||||
</div>
|
|
||||||
<div class="goods-item-icon">
|
|
||||||
<img src="{{goods.icon}}" class="goods-item-icon-img" />
|
|
||||||
</div>
|
|
||||||
<div class="goods-item-right">
|
|
||||||
<div class="goods-item-right-des">
|
|
||||||
<div class="goods-item-name">
|
|
||||||
{{goods.name}}
|
|
||||||
</div>
|
|
||||||
<div class="goods-item-name-line"></div>
|
|
||||||
{{goods.description}}
|
|
||||||
</div>
|
|
||||||
<div class="goods-item-right-price">
|
|
||||||
<span>{{goods.price}}金币</span>
|
|
||||||
<span class="goods-item-right-btn">
|
|
||||||
<span class="goods-item-right-btn-buy">立即购买</span>
|
|
||||||
<span class="goods-item-right-btn-line"></span>
|
|
||||||
<span class="goods-item-right-btn-limit">限购: {{goods.daily_limit}}</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
<img src="./res/img/bag1.png" class="shop-item-mid-bag1" />
|
|
||||||
<img src="./res/img/bag2.png" class="shop-item-mid-bag2" />
|
|
||||||
</div>
|
|
||||||
<div class="shop-item-right">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <div class="shop-item-border">
|
|
||||||
<div class="shop-item-left">
|
|
||||||
<img src="./res/img/2.png" class="shop-item-right-zx" />
|
|
||||||
</div>
|
|
||||||
<div class="shop-item-mid">
|
|
||||||
<div class="shop-item-mid-bk-inner"></div>
|
|
||||||
<div class="shop-item-mid-bk-out">
|
|
||||||
<div class="goods-item">
|
|
||||||
<div class="goods-id">
|
|
||||||
<div class="goods-id-text">11</div>
|
|
||||||
</div>
|
|
||||||
<div class="goods-item-left">
|
|
||||||
<div class="goods-item-left-o"></div>
|
|
||||||
<div class="goods-item-left-o"></div>
|
|
||||||
<div class="goods-item-left-o"></div>
|
|
||||||
</div>
|
|
||||||
<div class="goods-item-icon">
|
|
||||||
<img src="./res/img/bag1.png" class="goods-item-icon-img" />
|
|
||||||
</div>
|
|
||||||
<div class="goods-item-right">
|
|
||||||
<div class="goods-item-right-des">
|
|
||||||
<div class="goods-item-name">
|
|
||||||
签到道具
|
|
||||||
</div>
|
|
||||||
<div class="goods-item-name-line"></div>
|
|
||||||
背包
|
|
||||||
</div>
|
|
||||||
<div class="goods-item-right-price">
|
|
||||||
<span>100金币</span>
|
|
||||||
<span class="goods-item-right-btn">
|
|
||||||
<span class="goods-item-right-btn-buy">立即购买</span>
|
|
||||||
<span class="goods-item-right-btn-line"></span>
|
|
||||||
<span class="goods-item-right-btn-limit">限购: 0</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<img src="./res/img/bag1.png" class="shop-item-mid-bag1" />
|
|
||||||
<img src="./res/img/bag2.png" class="shop-item-mid-bag2" />
|
|
||||||
</div>
|
|
||||||
<div class="shop-item-right">
|
|
||||||
<img src="./res/img/1.png" class="shop-item-right-zx" />
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
<div class="split"></div>
|
|
||||||
<div class="create-text">Create By ZhenXun</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
<script type="text/javascript" src="main.js">
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
@ -1,183 +0,0 @@
|
|||||||
const leftElements = document.getElementsByClassName("shop-item-left")
|
|
||||||
const rightElements = document.getElementsByClassName("shop-item-right")
|
|
||||||
|
|
||||||
const defaultList = [
|
|
||||||
"1.png",
|
|
||||||
"2.png",
|
|
||||||
"3.png",
|
|
||||||
"4.png",
|
|
||||||
"5.png",
|
|
||||||
"qq.png",
|
|
||||||
"xx1.png",
|
|
||||||
"xx2.png",
|
|
||||||
]
|
|
||||||
|
|
||||||
const leftRightImgList = ["1.png", "2.png", "3.png", "4.png", "5.png"]
|
|
||||||
|
|
||||||
const leftRightImgList2 = ["qq.png", "xx1.png", "xx2.png"]
|
|
||||||
|
|
||||||
var leftRightImg = null
|
|
||||||
var leftRightImg2 = null
|
|
||||||
|
|
||||||
function randomImg() {
|
|
||||||
const randomIndex = Math.floor(Math.random() * leftRightImgList.length)
|
|
||||||
const randImg = leftRightImgList[randomIndex]
|
|
||||||
if (leftRightImg == randImg) {
|
|
||||||
return randomImg()
|
|
||||||
}
|
|
||||||
leftRightImg = randImg
|
|
||||||
return randImg
|
|
||||||
}
|
|
||||||
|
|
||||||
function randomImg2() {
|
|
||||||
const randomIndex = Math.floor(Math.random() * leftRightImgList2.length)
|
|
||||||
const randImg = leftRightImgList2[randomIndex]
|
|
||||||
if (leftRightImg == randImg) {
|
|
||||||
return randomImg2()
|
|
||||||
}
|
|
||||||
leftRightImg2 = randImg
|
|
||||||
return randImg
|
|
||||||
}
|
|
||||||
|
|
||||||
function getRandomInt(min, max) {
|
|
||||||
const mathMin = Math.ceil(min)
|
|
||||||
const mathMax = Math.floor(max)
|
|
||||||
return Math.floor(Math.random() * (mathMax - mathMin + 1)) + mathMin
|
|
||||||
}
|
|
||||||
|
|
||||||
function createImgElement(is_qq, is_left, start_height, height) {
|
|
||||||
const imgElement = document.createElement("img")
|
|
||||||
const className = is_left ? "left-img" : "right-img"
|
|
||||||
if (is_qq) {
|
|
||||||
imgElement.className = "shop-item-left-qq " + className
|
|
||||||
imgElement.src = "./res/img/left_right/" + randomImg2()
|
|
||||||
imgElement.style.top = getRandomInt(start_height, height - 20) + "px"
|
|
||||||
if (is_left) {
|
|
||||||
imgElement.style.left = getRandomInt(10, 40) + "px"
|
|
||||||
} else {
|
|
||||||
imgElement.style.right = getRandomInt(10, 40) + "px"
|
|
||||||
}
|
|
||||||
imgElement.style.height = getRandomInt(80, 120) + "px"
|
|
||||||
imgElement.style.transform = "rotate(" + getRandomInt(0, 45) + "deg)"
|
|
||||||
} else {
|
|
||||||
imgElement.className = "shop-item-right-zx " + className
|
|
||||||
imgElement.src = "./res/img/left_right/" + randomImg()
|
|
||||||
imgElement.style.top = getRandomInt(start_height, height - 20) + "px"
|
|
||||||
}
|
|
||||||
|
|
||||||
return imgElement
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTop(dom) {
|
|
||||||
return parseInt(dom.style.top.slice(0, -2))
|
|
||||||
}
|
|
||||||
|
|
||||||
const randomIndex = Math.floor(Math.random() * defaultList.length)
|
|
||||||
const leftImg = defaultList[randomIndex]
|
|
||||||
|
|
||||||
var start = true
|
|
||||||
|
|
||||||
if (["qq.png", "xx1.png", "xx2.png"].includes(leftImg)) {
|
|
||||||
start = true
|
|
||||||
} else {
|
|
||||||
start = false
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < leftElements.length; i++) {
|
|
||||||
leftHeight = leftElements[i].offsetHeight
|
|
||||||
|
|
||||||
if (leftHeight <= 1000) {
|
|
||||||
// 长度不够,只增加一个
|
|
||||||
if (start) {
|
|
||||||
leftElements[i].appendChild(
|
|
||||||
createImgElement(true, true, 20, leftHeight - 50)
|
|
||||||
)
|
|
||||||
rightElements[i].appendChild(createImgElement(false, false, 10, 60))
|
|
||||||
} else {
|
|
||||||
leftElements[i].appendChild(createImgElement(false, true, 10, 60))
|
|
||||||
rightElements[i].appendChild(
|
|
||||||
createImgElement(true, false, 20, leftHeight - 50)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 先添加一个气球
|
|
||||||
const firstDom = createImgElement(true, true, 20, 200)
|
|
||||||
leftElements[i].appendChild(firstDom)
|
|
||||||
let startHeight = 100 + getTop(firstDom)
|
|
||||||
let endHeight = 300 + getTop(firstDom)
|
|
||||||
let firstIsQq = false
|
|
||||||
let inx = 0
|
|
||||||
while (leftHeight - endHeight >= 200) {
|
|
||||||
// 避免过多重复
|
|
||||||
rand = Math.random()
|
|
||||||
if (inx >= 2) {
|
|
||||||
rand = 0.4
|
|
||||||
inx = 0
|
|
||||||
}
|
|
||||||
if (inx <= -1) {
|
|
||||||
rand = 0.6
|
|
||||||
inx = 0
|
|
||||||
}
|
|
||||||
// 真寻和气球随机加
|
|
||||||
if (rand > 0.5) {
|
|
||||||
firstIsQq = true
|
|
||||||
inx += 1
|
|
||||||
const imgDom = createImgElement(true, true, startHeight, endHeight)
|
|
||||||
leftElements[i].appendChild(imgDom)
|
|
||||||
startHeight = getRandomInt(250, 350) + getTop(imgDom)
|
|
||||||
endHeight = getRandomInt(450, 500) + getTop(imgDom)
|
|
||||||
} else {
|
|
||||||
if (leftHeight - startHeight < 700) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
inx -= 1
|
|
||||||
const imgDom = createImgElement(false, true, startHeight, endHeight)
|
|
||||||
leftElements[i].appendChild(imgDom)
|
|
||||||
startHeight = getRandomInt(400, 700) + getTop(imgDom)
|
|
||||||
endHeight = getRandomInt(600, 900) + getTop(imgDom)
|
|
||||||
if (leftHeight - startHeight < 900) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
startHeight = 10
|
|
||||||
endHeight = 200
|
|
||||||
inx = 0
|
|
||||||
while (leftHeight - endHeight >= 200) {
|
|
||||||
// 真寻和气球随机加
|
|
||||||
rand = Math.random()
|
|
||||||
if (rand > 0.5 && firstIsQq) {
|
|
||||||
firstIsQq = false
|
|
||||||
rand = 0.4
|
|
||||||
}
|
|
||||||
// 避免过多重复
|
|
||||||
if (inx >= 2) {
|
|
||||||
rand = 0.4
|
|
||||||
inx = 0
|
|
||||||
}
|
|
||||||
if (inx <= -1) {
|
|
||||||
rand = 0.6
|
|
||||||
inx = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rand > 0.5) {
|
|
||||||
inx += 1
|
|
||||||
const imgDom = createImgElement(true, false, startHeight, endHeight)
|
|
||||||
rightElements[i].appendChild(imgDom)
|
|
||||||
startHeight = getRandomInt(250, 350) + getTop(imgDom)
|
|
||||||
endHeight = getRandomInt(450, 500) + getTop(imgDom)
|
|
||||||
} else {
|
|
||||||
if (leftHeight - startHeight < 700) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
inx -= 1
|
|
||||||
const imgDom = createImgElement(false, false, startHeight, endHeight)
|
|
||||||
rightElements[i].appendChild(imgDom)
|
|
||||||
startHeight = getRandomInt(400, 700) + getTop(imgDom)
|
|
||||||
endHeight = getRandomInt(600, 900) + getTop(imgDom)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
start = !start
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 125 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 122 KiB |
|
Before Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 257 KiB |
|
Before Width: | Height: | Size: 236 KiB |
|
Before Width: | Height: | Size: 278 KiB |
|
Before Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 8.6 KiB |
@ -33,10 +33,10 @@ async def html_image() -> bytes:
|
|||||||
partition_dict[goods[1].partition] = []
|
partition_dict[goods[1].partition] = []
|
||||||
icon = None
|
icon = None
|
||||||
if goods[1].icon:
|
if goods[1].icon:
|
||||||
icon = (
|
path = ICON_PATH / goods[1].icon
|
||||||
"data:image/png;base64,"
|
if path.exists():
|
||||||
+ BuildImage.open(ICON_PATH / goods[1].icon).pic2bs4()[9:]
|
icon = "data:image/png;base64,"
|
||||||
)
|
f"{BuildImage.open(ICON_PATH / goods[1].icon).pic2bs4()[9:]}"
|
||||||
partition_dict[goods[1].partition].append(
|
partition_dict[goods[1].partition].append(
|
||||||
{
|
{
|
||||||
"id": goods[0],
|
"id": goods[0],
|
||||||
@ -47,15 +47,10 @@ async def html_image() -> bytes:
|
|||||||
"description": goods[1].goods_description,
|
"description": goods[1].goods_description,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
data_list = []
|
data_list = [
|
||||||
for partition in partition_dict:
|
GoodsItem(goods_list=value, partition=partition)
|
||||||
data_list.append(
|
for partition, value in partition_dict.items()
|
||||||
GoodsItem(
|
]
|
||||||
goods_list=partition_dict[partition],
|
|
||||||
partition=partition,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
return await template_to_pic(
|
return await template_to_pic(
|
||||||
template_path=str((TEMPLATE_PATH / "shop").absolute()),
|
template_path=str((TEMPLATE_PATH / "shop").absolute()),
|
||||||
template_name="main.html",
|
template_name="main.html",
|
||||||
|
|||||||