Skip to content

Commit 552f41d

Browse files
author
developer
committed
更新
1 parent b0a49a2 commit 552f41d

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<div class="row justify-content-center">
1515
<!-- 表单容器 -->
1616
<div class="col-md-5 mb-3">
17-
<div class="card">
17+
<div class="card shadow-sm">
1818
<div class="card-header text-center">
1919
<h2>文本转语音</h2>
2020
</div>
@@ -64,7 +64,7 @@ <h2>文本转语音</h2>
6464

6565
<!-- 历史记录容器 -->
6666
<div class="col-md-5 mb-3">
67-
<div class="card">
67+
<div class="card shadow-sm">
6868
<div class="card-header text-center">
6969
<h2>历史记录</h2>
7070
</div>

script.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ const apiConfig = {
33
url: "https://api.pearktrue.cn/api/aivoicenet",
44
speakers: [
55
"宇祥", "宇蓝", "蕊柔", "宇智", "宇希", "希儿", "蕊诗", "蕊雪", "蕊姗", "珊儿",
6-
"婉儿", "智宸", "宇昊", "宇铭", "宇伟", "紫瑶", "紫阿", "紫雪", "紫娜", "紫芸",
6+
"婉儿", "智宸", "宇昊", "宇铭", "宇伟", "紫瑶", "紫阿", "紫雪", "紫娜", "紫芸",
77
"宇全", "玲儿", "艾婷", "宇诚", "宇盛", "宇栋", "宇光", "艾琳", "艾莉", "艾雯",
88
"艾诗", "宇驰", "艾薇", "艾洁", "艾蕊", "宇骏", "宇康", "艾悦", "艾冉", "艾楠",
99
"宇铭", "艾婧", "艾露", "艾思", "艾媛", "艾茜", "艾菲", "艾雅", "宇泽", "艾冉-情感女声",
10-
"晓萱-情感女声", "晓辰-知性女生", "晓晓-情感", "晓伊-儿童音", "云健-情感男声", "云夏-儿童音",
10+
"晓萱-情感女声", "晓辰-知性女生", "晓晓-情感", "晓伊-儿童音", "云健-情感男声", "云夏-儿童音",
1111
"云扬-青年男声", "云希-解说小帅", "晓贝-东北", "晓妮-陕西", "晓枫-情感女声", "晓新-情感女声",
12-
"云辰-台湾", "沁荷", "芸语", "语嫣", "蕊珠", "沁娜", "沁蕾", "宇璋", "馨月", "馨兰",
12+
"云辰-台湾", "沁荷", "芸语", "语嫣", "蕊珠", "沁娜", "沁蕾", "宇璋", "馨月", "馨兰",
1313
"宇尚", "宇同", "馨欣", "馨瑶", "宇韦", "宇晋", "蕊芬", "宇晋", "蕊莉", "沁雨",
1414
"沁香", "宇康", "馨逸", "沁莲", "宇栋", "馨荣", "芸渲", "芸露", "芸梅", "蕊若",
1515
"蕊晗", "沁美", "芸柔", "蕊韵", "宇彦", "芸茜", "蕊诗", "晓墨-青年女声", "云枫-磁性男声",
@@ -145,7 +145,9 @@ function generateVoice(isPreview) {
145145
$('#audio')[0].load(); // 确保加载音频文件
146146
if (!isPreview) {
147147
$('#download').attr('href', voiceUrl);
148-
addHistoryItem(text, voiceUrl);
148+
const timestamp = new Date().toLocaleTimeString(); // 获取当前时间
149+
const shortenedText = text.length > 10 ? text.substring(0, 10) + '...' : text;
150+
addHistoryItem(timestamp, shortenedText, voiceUrl);
149151
}
150152
$('#result').show();
151153
$('#loading').hide();
@@ -161,11 +163,11 @@ function generateVoice(isPreview) {
161163
});
162164
}
163165

164-
function addHistoryItem(text, audioURL) {
166+
function addHistoryItem(timestamp, text, audioURL) {
165167
const historyItems = $('#historyItems');
166168
const historyItem = $(`
167169
<div class="history-item">
168-
<span>${text}</span>
170+
<span>${timestamp} - ${text}</span>
169171
<div>
170172
<button class="btn btn-secondary" onclick="playAudio('${audioURL}')">播放</button>
171173
<button class="btn btn-info" onclick="downloadAudio('${audioURL}')">下载</button>
@@ -191,4 +193,5 @@ function downloadAudio(audioURL) {
191193

192194
function clearHistory() {
193195
$('#historyItems').empty();
196+
alert("历史记录已清除!");
194197
}

0 commit comments

Comments
 (0)