file-parse

This commit is contained in:
N1KO 2024-12-19 17:11:14 +08:00
parent a77dfbe4c2
commit 6b39521805

View File

@ -5,6 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="icon" type="image/png" href="NIKO.png"/> <link rel="icon" type="image/png" href="NIKO.png"/>
<title>BAOGUTANG-FILE</title> <title>BAOGUTANG-FILE</title>
<link href="css/bootstrap.min.css" rel="stylesheet" th:href="@{css/bootstrap.min.css}">
<link href="css/font-awesome.min.css" rel="stylesheet" th:href="@{css/font-awesome.min.css}">
<link href="css/base.css" rel="stylesheet" th:href="@{css/base.css}">
<style> <style>
body { body {
font-family: "Microsoft YaHei", Arial, sans-serif; font-family: "Microsoft YaHei", Arial, sans-serif;
@ -12,6 +15,19 @@
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
/* 顶部标题条 */
.top-bar {
background-color: #50b3a2; /* 可根据需求调整颜色,参考截图中的色调 */
padding: 20px;
}
.top-bar h1 {
margin: 0;
font-size: 20px;
font-weight: bold;
color: #fff; /* 标题文字颜色为白色,突出标题 */
}
.container { .container {
max-width: 1200px; max-width: 1200px;
margin: 20px auto; margin: 20px auto;
@ -21,11 +37,6 @@
border-radius: 5px; border-radius: 5px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
} }
h1 {
text-align: center;
color: rgb(98, 210, 161);
margin-bottom: 20px;
}
h3 { h3 {
color: #444; color: #444;
margin-bottom: 10px; margin-bottom: 10px;
@ -90,6 +101,7 @@
display: flex; display: flex;
gap: 10px; gap: 10px;
margin-bottom: 10px; margin-bottom: 10px;
flex-wrap: wrap;
} }
.type-option { .type-option {
flex: 0 0 auto; flex: 0 0 auto;
@ -97,11 +109,12 @@
border: 1px solid #ddd; border: 1px solid #ddd;
border-radius: 3px; border-radius: 3px;
cursor: pointer; cursor: pointer;
background-color: #f7f7f7; background-color: #fff;
font-size: 14px; font-size: 14px;
color: #333; color: #333;
text-align: center; text-align: center;
user-select: none; user-select: none;
transition: background-color 0.2s;
} }
.type-option:hover { .type-option:hover {
background-color: #eee; background-color: #eee;
@ -112,15 +125,25 @@
border-color: rgb(98, 210, 161); border-color: rgb(98, 210, 161);
} }
</style> </style>
<script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
</head> </head>
<body> <body style="over-flow:hidden;">
<div class="container"> <header class="header">
<h1>BAOGUTANG-FILE</h1> <div class="row-fluid">
<div class="col-md-5" style="position:relative;">
<span class="logo">BAOGUTANG-FILE</span>
</div>
<nav class="col-md-7" style="padding:10px 0;" align="right">
</nav>
<br style="clear:both;"/>
</div>
</header>
<div class="container">
<!-- 文件转 Base64 --> <!-- 文件转 Base64 -->
<div class="section"> <div class="section">
<h3>文件转 Base64</h3> <h3>文件转 Base64</h3>
<label for="fileInput">选择文件</label>
<input type="file" id="fileInput" /> <input type="file" id="fileInput" />
<button onclick="convertToBase64()">转换为 Base64</button> <button onclick="convertToBase64()">转换为 Base64</button>
<label for="base64Output">Base64 输出</label> <label for="base64Output">Base64 输出</label>
@ -132,7 +155,6 @@
<!-- Base64 转文件 --> <!-- Base64 转文件 -->
<div class="section"> <div class="section">
<h3>Base64 转文件</h3> <h3>Base64 转文件</h3>
<label for="base64Input">粘贴 Base64 字符串</label>
<textarea id="base64Input" placeholder="粘贴 Base64 字符串"></textarea> <textarea id="base64Input" placeholder="粘贴 Base64 字符串"></textarea>
<div class="type-options" id="typeOptions"> <div class="type-options" id="typeOptions">
@ -271,6 +293,8 @@
reader.onload = function (e) { reader.onload = function (e) {
const textArea = document.createElement('textarea'); const textArea = document.createElement('textarea');
textArea.value = e.target.result; textArea.value = e.target.result;
textArea.style.width = '100%';
textArea.style.height = '200px';
previewArea.appendChild(textArea); previewArea.appendChild(textArea);
}; };
reader.readAsText(blob); reader.readAsText(blob);