mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2025-09-15 16:46:25 +00:00
🔥 小型重构
This commit is contained in:
3
src/resources/liteyuki_crt/lang/en.lang
Normal file
3
src/resources/liteyuki_crt/lang/en.lang
Normal file
@ -0,0 +1,3 @@
|
||||
crt.station=Station(s)
|
||||
crt.hour=Hour(s)
|
||||
crt.minute=Min(s)
|
3
src/resources/liteyuki_crt/lang/zh-CN.lang
Normal file
3
src/resources/liteyuki_crt/lang/zh-CN.lang
Normal file
@ -0,0 +1,3 @@
|
||||
crt.station=站
|
||||
crt.hour=小时
|
||||
crt.minute=分钟
|
3
src/resources/liteyuki_crt/metadata.yml
Normal file
3
src/resources/liteyuki_crt/metadata.yml
Normal file
@ -0,0 +1,3 @@
|
||||
name: CRT相关资源包
|
||||
description: For Liteyuki CRT utils
|
||||
version: 2024.4.26
|
161
src/resources/liteyuki_crt/templates/crt_route.html
Normal file
161
src/resources/liteyuki_crt/templates/crt_route.html
Normal file
@ -0,0 +1,161 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>CRT 线路图</title>
|
||||
<link rel="stylesheet" href="./css/card.css">
|
||||
<link rel="stylesheet" href="./css/fonts.css">
|
||||
</head>
|
||||
<style>
|
||||
|
||||
:root {
|
||||
--color-primary: #f00;
|
||||
--color-secondary: #fff;
|
||||
--sub-text-color: #aaa;
|
||||
}
|
||||
|
||||
.segment {
|
||||
display: flex;
|
||||
background-color: #0d1117;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.line-icon {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.vertical-bar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 20px;
|
||||
height: 100%;
|
||||
border-radius: 50px;
|
||||
background-color: #f00;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.station-dot {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
aspect-ratio: 1/1;
|
||||
border-radius: 50%;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
/* 第一个点在bar顶端,第二个在底部*/
|
||||
.station-dot:first-child {
|
||||
margin-top: 2px;
|
||||
margin-bottom: auto;
|
||||
}
|
||||
|
||||
.station-dot:last-child {
|
||||
margin-top: auto;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.transfer-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.station-name {
|
||||
font-size: 16px;
|
||||
color: var(--color-secondary);
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.end-station {
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
.line-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.line-name {
|
||||
padding: 3px;
|
||||
border-radius: 50px;
|
||||
background-color: #f00;
|
||||
color: var(--color-secondary);
|
||||
font-size: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.line-direction {
|
||||
font-size: 12px;
|
||||
color: var(--sub-text-color);
|
||||
}
|
||||
|
||||
.station-info {
|
||||
align-items: center;
|
||||
font-size: 10px;
|
||||
color: var(--sub-text-color);
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.start-station {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.segment-index {
|
||||
font-size: 12px;
|
||||
color: var(--sub-text-color);
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div class="data-storage" id="data">{{ data | tojson }}</div>
|
||||
|
||||
<!---->
|
||||
|
||||
<template id="segment-template">
|
||||
<div class="segment">
|
||||
<div class="line-icon">
|
||||
<!-- 竖条-->
|
||||
<div class="vertical-bar">
|
||||
<div class="station-dot"></div>
|
||||
<div class="station-dot"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="transfer-info">
|
||||
<div class="start-station">
|
||||
<div class="station-name start-station-name">
|
||||
下北泽站
|
||||
</div>
|
||||
<div class="segment-index">
|
||||
第1段
|
||||
</div>
|
||||
</div>
|
||||
<div class="line-info">
|
||||
<div class="line-name">
|
||||
轨道交通环线外环
|
||||
</div>
|
||||
<div class="line-direction">
|
||||
沙坪坝方向
|
||||
</div>
|
||||
</div>
|
||||
<div class="station-info">
|
||||
5站(14分钟)
|
||||
</div>
|
||||
<div class="end-station">
|
||||
<div class="station-name end-station-name">
|
||||
新桥站
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template id="route-template">
|
||||
<div class="info-box route-info" id="route-info">
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script src="./js/card.js"></script>
|
||||
<script src="./js/crt_route.js"></script>
|
||||
</body>
|
||||
</html>
|
35
src/resources/liteyuki_crt/templates/js/crt_route.js
Normal file
35
src/resources/liteyuki_crt/templates/js/crt_route.js
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2024 SnowyKami Liteyuki Studio All Rights Reserved.
|
||||
|
||||
|
||||
/**
|
||||
* @type {{
|
||||
* results: Array<{
|
||||
* abstracts: string,
|
||||
* createdDt: string,
|
||||
* endStaName: string,
|
||||
* startStaName: string,
|
||||
* isValid: boolean,
|
||||
* needTimeScope: number,
|
||||
* needTransferTimes: number,
|
||||
* price: number,
|
||||
* skipGenerateSequence: boolean,
|
||||
* transferLines: string,
|
||||
* transferLinesColor: string,
|
||||
* transferStaDerict: string,
|
||||
* transferStaNames: string,
|
||||
* }>
|
||||
* }}
|
||||
*/
|
||||
|
||||
const data = JSON.parse(document.getElementById("data").innerText);
|
||||
const results = data["result"];
|
||||
const route_template = document.importNode(document.getElementById("route-template").content, true)
|
||||
|
||||
results.forEach(
|
||||
(item, index) => {
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user