diff --git a/app/static/js/word_operation.js b/app/static/js/word_operation.js index dcf38ff..fc01cb6 100644 --- a/app/static/js/word_operation.js +++ b/app/static/js/word_operation.js @@ -171,4 +171,25 @@ function compareWord(first, second) { return first.word < second.word ? -1 : 1; } return 0; +} + +/* 生词csv导出 */ +function exportToCSV() { + let csvContent = "data:text/csv;charset=utf-8,Word,Frequency\n"; + let rows = document.querySelectorAll(".new-word"); + + rows.forEach(row => { + let word = row.querySelector("a.btn-light").innerText; + let freq = row.querySelector("a[title]").innerText; + csvContent += word + "," + freq + "\n"; + }); + + let encodedUri = encodeURI(csvContent); + let link = document.createElement("a"); + link.setAttribute("href", encodedUri); + link.setAttribute("download", "word_list.csv"); + document.body.appendChild(link); + + link.click(); + document.body.removeChild(link); } \ No newline at end of file diff --git a/app/static/wordfreqapp.db b/app/static/wordfreqapp.db new file mode 100644 index 0000000..c551ea9 Binary files /dev/null and b/app/static/wordfreqapp.db differ diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index ae4aa7b..15be230 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -1,4 +1,4 @@ - +
@@ -152,6 +152,8 @@ 允许动态调整顺序 + +