Files
qctool/index.html

109 lines
4.3 KiB
HTML

<!doctype html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="./statics/github.css" />
<link rel="stylesheet" href="./statics/theme.css" />
<script src="./statics/modules/jquery.min.js"></script>
<script type="module">
import { IO } from './statics/modules/tools.js'
let page = 10
let url = `https://git.solidaim.cn/api/v1/repos/hbk01/qctool/commits?page=1&limit=${page}`
let functions = [
{
name: '干燥失重',
location: './views/lod.html',
},
{
name: '炽灼残渣',
location: './views/roi.html',
},
{
name: '进样时间',
location: './views/injection-sequence.html',
},
{
name: '日期计算',
location: './views/calc-date.html',
},
{
name: '操作规程',
location: './views/sop.html',
},
]
$(() => {
// 加载功能列表
functions.forEach((value) => {
let onclick = `window.location.href='${value.location}'`
let div = `<div class="item" onclick="${onclick}">${value.name}</div>`
$('.list').append(div)
})
// 加载最近的 commit 记录
$.getJSON(url, (data) => {
let color1 = '#f9f9f9'
let color2 = '#f3f3f3'
let changeColor = false
data.forEach((element) => {
// 处理换行和+号
let message = element.commit.message.replaceAll('\n', '<br>')
if (message.startsWith('+')) {
message = message.replace('+', '<br>&nbsp;&nbsp;<strong>&bull;</strong>')
}
message = message.replaceAll('+', '&nbsp;&nbsp;<strong>&bull;</strong>')
// 处理提交的日期
let date = new Date(element.commit.committer.date) // "2022-10-08T10:54:36Z"
date = new Date(+new Date(date) + 28800000).toISOString()
date = date.replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
// 组装标题信息
let verifiedString = "<span style='color: green;'><strong>Verified</strong></span>"
let hash = `<a href='${element.html_url}'>${element.sha.slice(0, 7)}</a>`
let verified = `${element.commit.verification.verified ? verifiedString : ''}`
let header = `${hash} ${date} ${verified}`
changeColor = !changeColor
let color = `${changeColor ? color1 : color2}`
let msg = `
<div style="background-color: ${color}; padding: 5px 0px 5px 10px">
${header}
${message}
</div>`
$('.changelog').append(msg)
})
})
})
</script>
<title>QC TOOL</title>
</head>
<body>
<h4>功能列表</h4>
<div class="list"></div>
<h4>关于</h4>
<div class="about">
<p>建议使用系统自带浏览器,以完善使用体验!</p>
<p>
本项目已开源,点击<a href="https://git.solidaim.cn/hbk01/qctool" target="_blank"> 此处 </a>查看源代码。
</p>
</div>
<h4 id="changelog_title">变更日志</h4>
<div class="changelog" style="width: 100%"></div>
</body>
<footer>
<p>
<a href="https://beian.miit.gov.cn" target="_blank">赣ICP备2025067425号</a>
<br />
<a href="https://www.beian.gov.cn/portal/registerSystemInfo?recordcode=36012402000282"
>赣公网安备36012402000282号</a
>
</p>
</footer>
</html>