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"/>
<link rel="icon" type="image/png" href="NIKO.png"/>
<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>
body {
font-family: "Microsoft YaHei", Arial, sans-serif;
@ -12,6 +15,19 @@
margin: 0;
padding: 0;
}
/* 顶部标题条 */
.top-bar {
background-color: #50b3a2; /* 可根据需求调整颜色,参考截图中的色调 */
padding: 20px;
}
.top-bar h1 {
margin: 0;
font-size: 20px;
font-weight: bold;
color: #fff; /* 标题文字颜色为白色,突出标题 */
}
.container {
max-width: 1200px;
margin: 20px auto;
@ -21,11 +37,6 @@
border-radius: 5px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
color: rgb(98, 210, 161);
margin-bottom: 20px;
}
h3 {
color: #444;
margin-bottom: 10px;
@ -68,7 +79,7 @@
border-radius: 3px;
}
iframe {
height: 80vh; /* PDF 预览高度设置为屏幕高度的 80% */
height: 80vh; /* PDF预览高度设置为屏幕高度的80% */
}
.download-link {
display: block;
@ -90,6 +101,7 @@
display: flex;
gap: 10px;
margin-bottom: 10px;
flex-wrap: wrap;
}
.type-option {
flex: 0 0 auto;
@ -97,11 +109,12 @@
border: 1px solid #ddd;
border-radius: 3px;
cursor: pointer;
background-color: #f7f7f7;
background-color: #fff;
font-size: 14px;
color: #333;
text-align: center;
user-select: none;
transition: background-color 0.2s;
}
.type-option:hover {
background-color: #eee;
@ -112,15 +125,25 @@
border-color: rgb(98, 210, 161);
}
</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>
<body>
<div class="container">
<h1>BAOGUTANG-FILE</h1>
<body style="over-flow:hidden;">
<header class="header">
<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 -->
<div class="section">
<h3>文件转 Base64</h3>
<label for="fileInput">选择文件</label>
<input type="file" id="fileInput" />
<button onclick="convertToBase64()">转换为 Base64</button>
<label for="base64Output">Base64 输出</label>
@ -132,7 +155,6 @@
<!-- Base64 转文件 -->
<div class="section">
<h3>Base64 转文件</h3>
<label for="base64Input">粘贴 Base64 字符串</label>
<textarea id="base64Input" placeholder="粘贴 Base64 字符串"></textarea>
<div class="type-options" id="typeOptions">
@ -271,6 +293,8 @@
reader.onload = function (e) {
const textArea = document.createElement('textarea');
textArea.value = e.target.result;
textArea.style.width = '100%';
textArea.style.height = '200px';
previewArea.appendChild(textArea);
};
reader.readAsText(blob);