Compare commits
2 Commits
a88b8bcb5f
...
fbeb3820f8
| Author | SHA1 | Date |
|---|---|---|
|
|
fbeb3820f8 | |
|
|
d86bbd5cdc |
51
src/App.vue
51
src/App.vue
|
|
@ -57,15 +57,27 @@ export default {
|
|||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
html {
|
||||
--bg-color: #ffffffae;
|
||||
--text-color: #464646;
|
||||
@media screen and (max-width: 500px) {
|
||||
.pconly {
|
||||
display: none;
|
||||
}
|
||||
|
||||
html.dark {
|
||||
--bg-color: #2a2a2aae;
|
||||
--text-color: #c0c0c0;
|
||||
@keyframes enter {
|
||||
0% {
|
||||
translate: 100px 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
100% {
|
||||
translate: 0 0;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 500px) {
|
||||
.mbonly {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@keyframes enter {
|
||||
|
|
@ -81,6 +93,19 @@ html.dark {
|
|||
filter: blur(0px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
html {
|
||||
--bg-color: #ffffffae;
|
||||
--text-color: #464646;
|
||||
}
|
||||
|
||||
html.dark {
|
||||
--bg-color: #2a2a2aae;
|
||||
--text-color: #c0c0c0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.container {
|
||||
height: calc(100%-20px);
|
||||
|
|
@ -112,18 +137,6 @@ html.bgimged .card{
|
|||
backdrop-filter: blur(15px);
|
||||
}
|
||||
|
||||
|
||||
.wordset {
|
||||
border-radius: 13px;
|
||||
padding: 20px;
|
||||
height: 220px;
|
||||
width: 170px;
|
||||
box-shadow: var(--el-box-shadow);
|
||||
margin: 20px;
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.btn {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<div id="setting">
|
||||
<box-icon class="btn" color="var(--text-color)" name='cog' @click="open_setting_dialog"></box-icon>
|
||||
</div>
|
||||
<el-dialog v-model="settingVisible" title="设置">
|
||||
<el-dialog v-model="settingVisible" title="设置" width="75%">
|
||||
<div class="title">更换自定义背景</div>
|
||||
<div class="colbox" style="margin: 10px;">
|
||||
<el-input v-model="img_url"></el-input>
|
||||
|
|
@ -63,6 +63,50 @@ export default {
|
|||
</script>
|
||||
|
||||
<style scoped>
|
||||
@media screen and (max-width: 500px) {
|
||||
#title {
|
||||
font-size: 80px;
|
||||
color: var(--text-color);
|
||||
text-shadow: #00000057 5px 5px 20px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-weight: 800;
|
||||
color: var(--text-color);
|
||||
font-size: 15px;
|
||||
flex-grow: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#main {
|
||||
margin: 10px;
|
||||
margin-top: 80px;
|
||||
}
|
||||
|
||||
.colbox {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.button {
|
||||
margin-top: 30px;
|
||||
}
|
||||
#ball{
|
||||
width: 750px;
|
||||
height: 750px;
|
||||
top: -20%;
|
||||
right: -90%;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 500px) {
|
||||
#title {
|
||||
font-size: 180px;
|
||||
color: var(--text-color);
|
||||
text-shadow: #00000057 5px 5px 20px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-weight: 800;
|
||||
color: var(--text-color);
|
||||
|
|
@ -73,6 +117,22 @@ export default {
|
|||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#main {
|
||||
margin: 80px;
|
||||
}
|
||||
|
||||
.button {
|
||||
margin: 30px;
|
||||
}
|
||||
#ball{
|
||||
width: 1350px;
|
||||
height: 1350px;
|
||||
top: -50%;
|
||||
right: -10%;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#setting {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
|
|
@ -80,12 +140,6 @@ export default {
|
|||
margin: 20px;
|
||||
}
|
||||
|
||||
#title {
|
||||
font-size: 180px;
|
||||
color: var(--text-color);
|
||||
text-shadow: #00000057 5px 5px 20px ;
|
||||
}
|
||||
|
||||
.button {
|
||||
width: 200px;
|
||||
height: 100px;
|
||||
|
|
@ -102,7 +156,6 @@ export default {
|
|||
backdrop-filter: blur(20px);
|
||||
cursor: pointer;
|
||||
transition: .5s;
|
||||
margin: 30px;
|
||||
color: var(--text-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
|
@ -119,12 +172,8 @@ html.dark .button {
|
|||
|
||||
#ball {
|
||||
background-image: linear-gradient(120deg, #e0c3fcca 0%, #8ec5fcc4 100%);
|
||||
width: 1350px;
|
||||
height: 1350px;
|
||||
border-radius: 100%;
|
||||
position: absolute;
|
||||
top: -50%;
|
||||
right: -10%;
|
||||
animation: enter .8s ease-out;
|
||||
box-shadow: #e0c3fcca 0px 0px 50px 10px;
|
||||
z-index: -1;
|
||||
|
|
@ -132,9 +181,4 @@ html.dark .button {
|
|||
|
||||
html.bgimged #ball {
|
||||
backdrop-filter: blur(20px);
|
||||
}
|
||||
|
||||
#main {
|
||||
margin: 80px;
|
||||
}
|
||||
</style>
|
||||
}</style>
|
||||
|
|
@ -4,9 +4,11 @@
|
|||
<span class="text-large font-600 mr-3"> 编辑单词本 </span>
|
||||
</template>
|
||||
</el-page-header>
|
||||
<div id="container">
|
||||
<router-view>
|
||||
|
||||
</router-view>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
@ -28,5 +30,8 @@ export default {
|
|||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
#container{
|
||||
height: calc(100% - 64px);
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -5,11 +5,16 @@
|
|||
</template>
|
||||
</el-page-header>
|
||||
<div v-if="mode === 0" id="range" class="container colbox">
|
||||
<div id="rangeselect" class="card item">
|
||||
<div class="rowbox item">
|
||||
<div id="lastrecite" class="card">
|
||||
<el-button style="margin-bottom: 20px;" class="tbtn" type="primary" @click="init">开始背诵</el-button><br />
|
||||
<el-button style="margin:0;" class="tbtn" type="success" @click="last_recite">继续上一次的背诵</el-button>
|
||||
</div>
|
||||
<div id="online-set-container" class="card">
|
||||
<div class="title">选择测验范围:</div>
|
||||
<el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange"
|
||||
size="large">全选</el-checkbox>
|
||||
<el-checkbox-group v-model="checkedSets" @change="handleChange">
|
||||
<el-checkbox v-model="local.checkAll" :indeterminate="local.isIndeterminate"
|
||||
@change="(res) => { handleCheckAllChange(local, res) }" size="large">全选</el-checkbox>
|
||||
<el-checkbox-group v-model="local.checkedSets" @change="(res) => { handleChange(local, res) }">
|
||||
<div class="set_radios" v-for="(set_class, set_class_name) in wordsets" :key="set_class_name">
|
||||
<p>{{ set_class_name }}</p>
|
||||
<el-checkbox class="checkbox" v-for="set in set_class" :key="set.id" :label="set.id" size="large"
|
||||
|
|
@ -20,11 +25,26 @@
|
|||
</el-checkbox>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
<el-button style="margin: 20px;width: 50%;" type="primary" @click="init">开始背诵</el-button>
|
||||
</div>
|
||||
<div id="lastrecite" class="card item">
|
||||
<div class="title" style="font-size: 35px;">继续上一次的背诵</div>
|
||||
<el-button style="margin: 20px;width: 50%;" type="primary" @click="last_recite">开始背诵</el-button>
|
||||
</div>
|
||||
<div id="rangeselect" class="card item">
|
||||
<div class="title" style="font-size: 35px;">在线词库</div>
|
||||
<el-checkbox v-model="online.checkAll" :indeterminate="online.isIndeterminate"
|
||||
@change="(res) => { handleCheckAllChange(online, res) }" size="large">全选</el-checkbox>
|
||||
<el-checkbox-group v-model="online.checkedSets" @change="(res) => { handleChange(online, res) }">
|
||||
<div class="set_radios" v-for="(set, set_name) in online_sets" :key="set_name">
|
||||
<div class="subtitle">{{ set_name }}</div>
|
||||
<div v-for="(book, book_name) in set" :key="book_name">
|
||||
<p>{{ book_name }}</p>
|
||||
<el-checkbox class="checkbox" v-for="(config, id) in book" :key="id" :label="id" size="large"
|
||||
border>
|
||||
<div style="font-size: 18px;font-weight: 500;">
|
||||
{{ config.name }}
|
||||
</div>
|
||||
</el-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
</div>
|
||||
<div id="test" class="colbox" v-if="mode === 1">
|
||||
|
|
@ -36,7 +56,7 @@
|
|||
</textarea>
|
||||
<div v-if="current < answered" class="answer">{{ word.word }}</div>
|
||||
</div>
|
||||
<p id="explain">
|
||||
<div id="explain">
|
||||
<el-button v-if="current > 0" @click="prev">上一个</el-button>
|
||||
<el-button v-if="current < answered" @click="next">下一个</el-button>
|
||||
<el-button v-if="current === answered" @click="showAnswer">显示答案</el-button>
|
||||
|
|
@ -44,11 +64,11 @@
|
|||
<el-button @click="terminate" type="danger">停止背诵</el-button>
|
||||
<box-icon color="var(--text-color)" class="btn" style="margin-left: 10px;translate: 0 4px;"
|
||||
@click="audio_play" name='volume-full'></box-icon>
|
||||
</p>
|
||||
</div>
|
||||
<div id="trans">{{ word.type }} {{ word.trans }}</div>
|
||||
</div>
|
||||
<div id="add-to-box" class="card">
|
||||
<el-text class="mx-1" style="font-size: 35px;font-weight: 800;">加入至</el-text>
|
||||
<el-text class="mx-1 title">加入至</el-text>
|
||||
<div class="colbox para">
|
||||
<div class="mid-text">分组:</div>
|
||||
<el-select v-model="set_class" class="m-2" placeholder="Select">
|
||||
|
|
@ -67,6 +87,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios';
|
||||
import { ElMessage, ElNotification, ElMessageBox } from 'element-plus';
|
||||
import { nextTick } from 'vue';
|
||||
|
||||
|
|
@ -75,11 +96,19 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
mode: 0,
|
||||
allsets: [],
|
||||
wordsets: window.wordsets,
|
||||
local: {
|
||||
allsets: [],
|
||||
checkedSets: [],
|
||||
isIndeterminate: false,
|
||||
checkAll: false,
|
||||
},
|
||||
online: {
|
||||
allsets: [],
|
||||
checkedSets: [],
|
||||
isIndeterminate: false,
|
||||
checkAll: false,
|
||||
},
|
||||
testWords: [],
|
||||
seq: [],
|
||||
total: 0,
|
||||
|
|
@ -88,20 +117,31 @@ export default {
|
|||
word: {},
|
||||
set_class: "",
|
||||
set_id: "",
|
||||
online_sets: {},
|
||||
online_ids: {}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
handleCheckAllChange(val) {
|
||||
this.checkedSets = val ? this.allsets : [];
|
||||
this.isIndeterminate = false;
|
||||
key_listener(e) {
|
||||
if (this.mode === 1) {
|
||||
let ctrlKey = e.ctrlKey || e.metaKey;
|
||||
if (ctrlKey && e.key === 'b') {
|
||||
this.showAnswer();
|
||||
}
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
},
|
||||
handleChange(value) {
|
||||
console.log(this.checkedSets);
|
||||
this.checkAll = value.length === this.allsets.length;
|
||||
this.isIndeterminate = value.length > 0 && value.length < this.allsets.length;
|
||||
handleCheckAllChange(range, val) {
|
||||
range.checkedSets = val ? range.allsets : [];
|
||||
range.isIndeterminate = false;
|
||||
},
|
||||
init() {
|
||||
if (this.checkedSets.length <= 0) {
|
||||
handleChange(range, value) {
|
||||
range.checkAll = value.length === range.allsets.length;
|
||||
range.isIndeterminate = value.length > 0 && value.length < range.allsets.length;
|
||||
},
|
||||
async init() {
|
||||
if (this.local.checkedSets.length + this.online.checkedSets.length <= 0) {
|
||||
ElMessage({
|
||||
message: "请至少选择一个单词本",
|
||||
type: "error"
|
||||
|
|
@ -110,14 +150,34 @@ export default {
|
|||
}
|
||||
let seed = (new Date()).getTime();
|
||||
this.testWords = [];
|
||||
for (let i of this.checkedSets) {
|
||||
for (let i of this.local.checkedSets) {
|
||||
let words = JSON.parse(localStorage.getItem(i));
|
||||
this.testWords = this.testWords.concat(...words);
|
||||
}
|
||||
for (let i of this.online.checkedSets) {
|
||||
let config = this.online_ids[i];
|
||||
let res = await axios.get("/wordset/detail", {
|
||||
params: {
|
||||
set: config.set,
|
||||
book: config.book,
|
||||
id: i
|
||||
}
|
||||
})
|
||||
if (res.status != 200) {
|
||||
ElMessage({
|
||||
message: "获取单词本时出现错误",
|
||||
type: "error"
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.testWords = this.testWords.concat(...res.data);
|
||||
}
|
||||
localStorage.setItem("lastrecite", JSON.stringify({
|
||||
checkedSets: this.checkedSets,
|
||||
checkedSets: this.local.checkedSets,
|
||||
onlineSets: this.online.checkedSets,
|
||||
seed: seed
|
||||
}))
|
||||
console.log(this.testWords);
|
||||
this.total = this.testWords.length;
|
||||
if (this.total === 0) {
|
||||
ElMessage({
|
||||
|
|
@ -138,7 +198,7 @@ export default {
|
|||
this.show();
|
||||
});
|
||||
},
|
||||
last_recite() {
|
||||
async last_recite() {
|
||||
let lr = JSON.parse(localStorage.getItem("lastrecite"));
|
||||
if (!lr) {
|
||||
ElMessage({
|
||||
|
|
@ -158,6 +218,35 @@ export default {
|
|||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (let i of lr.onlineSets) {
|
||||
let config = this.online_ids[i];
|
||||
if (config) {
|
||||
let res = await axios.get("/wordset/detail", {
|
||||
params: {
|
||||
set: config.set,
|
||||
book: config.book,
|
||||
id: i
|
||||
}
|
||||
})
|
||||
if (res.status != 200) {
|
||||
ElMessage({
|
||||
message: "获取单词本时出现错误",
|
||||
type: "error"
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.testWords = this.testWords.concat(...res.data);
|
||||
}
|
||||
else {
|
||||
ElMessage({
|
||||
message: "在线单词本不存在",
|
||||
type: "error"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
this.total = this.testWords.length;
|
||||
let arr = Array.from(new Array(this.total).keys());
|
||||
|
|
@ -207,7 +296,6 @@ export default {
|
|||
},
|
||||
show() {
|
||||
this.word = this.testWords[this.seq[this.current]];
|
||||
console.log(this.word);
|
||||
if (this.current === this.answered) {
|
||||
let e = document.getElementById("input");
|
||||
e.value = "_".repeat(this.word.word.length);
|
||||
|
|
@ -265,29 +353,143 @@ export default {
|
|||
},
|
||||
add_to() {
|
||||
let data = JSON.parse(localStorage.getItem(this.set_id));
|
||||
for (let i of data) {
|
||||
if (i.word === this.word.word) {
|
||||
ElMessage({
|
||||
message: '已经添加过该词',
|
||||
type: 'error',
|
||||
})
|
||||
return;
|
||||
}
|
||||
}
|
||||
data.push(this.word);
|
||||
localStorage.setItem(this.set_id, JSON.stringify(data));
|
||||
return ElMessage({
|
||||
ElMessage({
|
||||
message: `已添加 ${this.word.word} (${this.word.type})`,
|
||||
type: 'success',
|
||||
});
|
||||
}
|
||||
return;
|
||||
},
|
||||
},
|
||||
created() {
|
||||
for (let i of Object.values(window.wordsets)) {
|
||||
for (let j of i) {
|
||||
this.allsets.push(j.id);
|
||||
this.local.allsets.push(j.id);
|
||||
}
|
||||
}
|
||||
console.log(this.allsets);
|
||||
document.addEventListener('keyup', this.key_listener);
|
||||
axios.get("/wordset/list").then((res, err) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
ElMessage({
|
||||
message: "在线词库加载失败",
|
||||
type: "error"
|
||||
})
|
||||
return;
|
||||
}
|
||||
this.online_sets = res.data;
|
||||
console.log(this.online_sets);
|
||||
for (let i in this.online_sets) {
|
||||
for (let j in this.online_sets[i]) {
|
||||
for (let k in this.online_sets[i][j]) {
|
||||
this.online.allsets.push(k);
|
||||
this.online_ids[k] = {
|
||||
set: i,
|
||||
book: j
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
beforeUnmount() {
|
||||
document.removeEventListener("keyup", this.key_listener);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@media screen and (max-width: 500px) {
|
||||
#range {
|
||||
max-height: calc(100% - 104px);
|
||||
flex-direction: column;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
#rangeselect {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.item {
|
||||
margin-bottom: 20px;
|
||||
background-color: var(--bg-color);
|
||||
/* background-color: var(--bg-color); */
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 30px;
|
||||
font-weight: 800;
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
#test {
|
||||
flex-direction: column;
|
||||
animation: enter .5s ease-out;
|
||||
}
|
||||
|
||||
#trans {
|
||||
font-size: 25px;
|
||||
transition: .5s;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
#add-to-box {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#explain {
|
||||
font-size: 18px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.el-button {
|
||||
width: 55px;
|
||||
height: 28px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tbtn {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.answer {
|
||||
font-size: 55px;
|
||||
letter-spacing: 15px;
|
||||
min-height: 50px;
|
||||
height: 55px;
|
||||
}
|
||||
.card{
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 500px) {
|
||||
#range {
|
||||
max-height: calc(100% - 64px);
|
||||
}
|
||||
|
||||
#rangeselect {
|
||||
max-height: 100%;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.item {
|
||||
margin-bottom: 20px;
|
||||
/* background-color: var(--bg-color); */
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.tbtn {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
|
|
@ -297,8 +499,45 @@ export default {
|
|||
color: var(--text-color);
|
||||
}
|
||||
|
||||
#test {
|
||||
padding: 50px;
|
||||
animation: enter .5s ease-out;
|
||||
}
|
||||
|
||||
#trans {
|
||||
font-size: 50px;
|
||||
transition: .5s;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#add-to-box {
|
||||
width: 30%;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
#explain {
|
||||
font-size: 25px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.answer {
|
||||
font-size: 70px;
|
||||
letter-spacing: 30px;
|
||||
min-height: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 23px;
|
||||
line-height: 35px;
|
||||
margin-bottom: 15px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
font-size: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#status {
|
||||
|
|
@ -310,31 +549,12 @@ export default {
|
|||
border-radius: 8px;
|
||||
background-color: var(--bg-color);
|
||||
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
||||
font-size: 70px;
|
||||
letter-spacing: 30px;
|
||||
border: none;
|
||||
outline-style: none;
|
||||
height: 100px;
|
||||
padding: 0;
|
||||
transition: .5s;
|
||||
resize: vertical;
|
||||
width: 100%;
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
#test {
|
||||
padding: 50px;
|
||||
animation: enter .5s ease-out;
|
||||
}
|
||||
|
||||
#explain {
|
||||
font-size: 25px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#trans {
|
||||
font-size: 50px;
|
||||
transition: .5s;
|
||||
}
|
||||
|
||||
.set_radios {
|
||||
|
|
@ -342,26 +562,16 @@ export default {
|
|||
}
|
||||
|
||||
.set_radios p {
|
||||
font-size: 25px;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
#add-to-box {
|
||||
width: 30%;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
#lastrecite {
|
||||
max-height: 150px;
|
||||
}
|
||||
|
||||
#range {
|
||||
max-height: 85%;
|
||||
}
|
||||
|
||||
#rangeselect {
|
||||
max-height: 100%;
|
||||
overflow-x: auto;
|
||||
}
|
||||
</style>
|
||||
#online-set-container {
|
||||
height: auto;
|
||||
overflow-y: auto;
|
||||
}</style>
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
<template>
|
||||
<div class="container" style="overflow: auto;">
|
||||
<el-page-header @back="$router.push('/manage')">
|
||||
<el-page-header @back="$router.push('/manage')" class="pconly">
|
||||
<template #content>
|
||||
<span class="text-large font-600 mr-3"> {{ editing.name }} ({{ editing.id }}) </span>
|
||||
</template>
|
||||
</el-page-header>
|
||||
<div class="colbox" style="margin-top: 20px;">
|
||||
<div class="colbox" id="main">
|
||||
<div class="rowbox">
|
||||
<div class="card" style="margin-bottom: 20px;">
|
||||
<div class="card">
|
||||
<div class="title">添加单词</div>
|
||||
<el-input ref="input1" autofocus @change="focusnext($refs.input2)" v-model="new_word.word"></el-input>
|
||||
<div class="colbox">
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
<el-button @click="change_name()" type="primary">更改名称</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 100%;" class="card">
|
||||
<div style="flex-grow: 1;" class="card">
|
||||
<el-table :data="table" style="max-height: 550px;overflow: auto;border-radius: 10px;">
|
||||
<el-table-column type="index" />
|
||||
<el-table-column prop="word" label="单词" />
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog v-model="word_editing">
|
||||
<el-dialog v-model="word_editing" width="80%">
|
||||
<div class="title">修改单词</div>
|
||||
<el-input v-model="editing_word.word"></el-input>
|
||||
<div class="colbox">
|
||||
|
|
@ -179,6 +179,30 @@ export default {
|
|||
</script>
|
||||
|
||||
<style scoped>
|
||||
@media screen and (max-width: 500px) {
|
||||
#main{
|
||||
flex-direction: column;
|
||||
overflow: scroll;
|
||||
}
|
||||
.container{
|
||||
padding: 10px;
|
||||
height: calc(100% - 20px);
|
||||
}
|
||||
.title{
|
||||
font-size: 25px;
|
||||
min-height: 50px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 500px) {
|
||||
.title{
|
||||
font-size: 35px;
|
||||
min-height: 60px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#main-container {
|
||||
height: 87%;
|
||||
}
|
||||
|
|
@ -186,12 +210,10 @@ export default {
|
|||
.title {
|
||||
font-weight: 800;
|
||||
color: var(--text-color);
|
||||
font-size: 35px;
|
||||
flex-grow: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
min-height: 60px;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -209,10 +231,8 @@ export default {
|
|||
border-radius: 8px;
|
||||
}
|
||||
|
||||
|
||||
.el-collapse {
|
||||
--el-collapse-header-bg-color: #FFFFFF00;
|
||||
--el-collapse-content-bg-color: #FFFFFF00;
|
||||
--el-collapse-header-font-size: 18px;
|
||||
.el-table {
|
||||
--el-table-bg-color: #FFFFFF00;
|
||||
--el-table-tr-bg-color: #FFFFFF00;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
<el-option v-for="item in Object.keys(wordsets)" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
</div>
|
||||
<el-button style="width: 50%;" type="primary" @click="new_wordset()">创建</el-button>
|
||||
<el-button style="width: 50%;margin-top: 20px;" type="primary" @click="new_wordset()">创建</el-button>
|
||||
</div>
|
||||
</el-container>
|
||||
</template>
|
||||
|
|
@ -52,7 +52,7 @@ export default {
|
|||
});
|
||||
localStorage.setItem("wordsets", JSON.stringify(this.wordsets));
|
||||
localStorage.setItem(id, JSON.stringify([]));
|
||||
this.mode = 0;
|
||||
this.$router.push('/manage');
|
||||
return;
|
||||
},
|
||||
}
|
||||
|
|
@ -60,7 +60,23 @@ export default {
|
|||
</script>
|
||||
|
||||
<style scoped>
|
||||
@media screen and (max-width: 500px) {
|
||||
.colbox {
|
||||
flex-direction: column;
|
||||
}
|
||||
.colbox * {
|
||||
margin-top: 15px;
|
||||
}
|
||||
.card{
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
#main-container {
|
||||
height: 87%;
|
||||
}
|
||||
|
||||
.colbox {
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,29 +1,41 @@
|
|||
<template>
|
||||
<el-container id="main-container" class="container card">
|
||||
<el-header id="header" class="colbox">
|
||||
<div class="no">共有{{ Object.keys(wordsets).length }}个单词集合</div>
|
||||
<el-container id="main-container">
|
||||
<el-header id="header" style="text-align: right;">
|
||||
<div>
|
||||
<el-button @click="export_set" type="success"><box-icon color="white" name='export'
|
||||
size="15px"></box-icon>导出</el-button>
|
||||
<el-button @click="import_set" type="warning"><box-icon color="white" name='import'
|
||||
size="15px"></box-icon>导入</el-button>
|
||||
<el-button @click="$router.push('/manage/new')" type="primary"><box-icon color="white" name='plus'></box-icon>新建单词本</el-button>
|
||||
<el-button @click="manage_online_wordsets" type="primary"><box-icon color="white" name='world'
|
||||
size="20px"></box-icon>管理在线单词本</el-button>
|
||||
<el-button @click="export_set" type="success" class="pconly"><box-icon color="white" name='export'
|
||||
size="18px"></box-icon>导出</el-button>
|
||||
<el-button @click="import_set" type="warning" class="pconly"><box-icon color="white" name='import'
|
||||
size="18px"></box-icon>导入</el-button>
|
||||
<el-button @click="$router.push('/manage/new')" type="primary"><box-icon color="white"
|
||||
name='plus'></box-icon>新建单词本</el-button>
|
||||
</div>
|
||||
</el-header>
|
||||
<el-container style="height:calc(100% - 40px);">
|
||||
<el-aside id="sidebar">
|
||||
<div class="sidebar-title">
|
||||
|本地
|
||||
</div>
|
||||
<div v-for="(set_class, class_name) in wordsets" :title="class_name" :key="class_name"
|
||||
@click="view(class_name)" class="sidebar-item">
|
||||
{{ class_name }}
|
||||
</div>
|
||||
<div class="sidebar-title">
|
||||
|在线
|
||||
</div>
|
||||
</el-aside>
|
||||
<el-main id="wordsets-container">
|
||||
<div class="colbox" if="sets-container">
|
||||
<el-collapse accordion v-model="active_set_class" style="width: 100%;border: none;">
|
||||
<el-collapse-item v-for="(set_class, class_name) in wordsets" :title="class_name" :key="class_name"
|
||||
:name="class_name">
|
||||
<div id="sets-container">
|
||||
<div class="colbox wordclass">
|
||||
<div v-for="(wordset, index) in set_class" :key="index" class="wordset rowbox">
|
||||
<div v-for="(wordset, index) in wordsets[view_class]" :key="index" class="wordset rowbox">
|
||||
<div class="no">
|
||||
{{ index + 1 }}
|
||||
</div>
|
||||
<div class="title">
|
||||
{{ wordset.name }}
|
||||
</div>
|
||||
<div style="font-size: 17px;font-weight: 200;">
|
||||
<div class="created-date">
|
||||
创建日期:{{ (new Date(wordset.created)).toLocaleString() }}
|
||||
</div>
|
||||
<div class="option">
|
||||
|
|
@ -34,11 +46,13 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</div>
|
||||
<div class="mbonly" id="show-sidebar" @click="taggle_sidebar">
|
||||
<box-icon name='list-ul' color="var(--text-color)"></box-icon>
|
||||
</div>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
@ -49,10 +63,21 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
wordsets: window.wordsets,
|
||||
active_set_class: "",
|
||||
view_class: "",
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
view(classname) {
|
||||
this.view_class = classname;
|
||||
let node = document.getElementById("wordsets-container").style;
|
||||
node.animation = "";
|
||||
setTimeout(() => {
|
||||
node.animation = "enter ease-out .6s backwards";
|
||||
}, 0);
|
||||
},
|
||||
manage_online_wordsets() {
|
||||
window.location.href = '/dashboard';
|
||||
},
|
||||
del(set_class_name, id, index) {
|
||||
ElMessageBox.confirm("确定要删除吗?")
|
||||
.then(() => {
|
||||
|
|
@ -126,15 +151,142 @@ export default {
|
|||
title: "添加成功",
|
||||
message: `已添加 ${cnt} 本单词本`
|
||||
});
|
||||
},
|
||||
taggle_sidebar(){
|
||||
let node = document.getElementById("sidebar");
|
||||
if(node.style.width === "180px") node.style.width = "0";
|
||||
else node.style.width = "180px";
|
||||
return;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.active_set_class = Object.keys(this.wordsets)[0];
|
||||
let first_set = Object.keys(this.wordsets)[0];
|
||||
if (first_set) {
|
||||
setTimeout(() => {
|
||||
this.view(first_set);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@media screen and (max-width: 500px) {
|
||||
@keyframes sidebar-enter {
|
||||
0% {
|
||||
translate: -100px 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
100% {
|
||||
translate: 0 0;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
width: 0;
|
||||
transition: .5s;
|
||||
}
|
||||
|
||||
.wordset {
|
||||
border-radius: 13px;
|
||||
padding: 10px;
|
||||
height: 180px;
|
||||
width: 40%;
|
||||
box-shadow: var(--el-box-shadow);
|
||||
margin: 5px;
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.no {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-weight: 800;
|
||||
color: var(--text-color);
|
||||
font-size: 30px;
|
||||
flex-grow: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
min-height: 60px;
|
||||
}
|
||||
|
||||
.created-date {
|
||||
font-size: 12px;
|
||||
font-weight: 200;
|
||||
height: 45px;
|
||||
}
|
||||
|
||||
.wordset .option {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#show-sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 100%;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
left: 20px;
|
||||
color: var(--text-color);
|
||||
box-shadow: var(--el-box-shadow);
|
||||
background-color: var(--bg-color);
|
||||
cursor: pointer;
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
#wordsets-container{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
}
|
||||
#sets-container{
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 500px) {
|
||||
@keyframes sidebar-enter {
|
||||
0% {
|
||||
translate: -100px 0;
|
||||
opacity: 0;
|
||||
filter: blur(20px);
|
||||
}
|
||||
|
||||
100% {
|
||||
translate: 0 0;
|
||||
opacity: 1;
|
||||
filter: blur(0px);
|
||||
}
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.wordset {
|
||||
border-radius: 13px;
|
||||
padding: 20px;
|
||||
height: 220px;
|
||||
width: 170px;
|
||||
box-shadow: var(--el-box-shadow);
|
||||
margin: 20px;
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.no {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-weight: 800;
|
||||
color: var(--text-color);
|
||||
|
|
@ -145,6 +297,58 @@ export default {
|
|||
white-space: nowrap;
|
||||
min-height: 60px;
|
||||
}
|
||||
|
||||
.created-date {
|
||||
font-size: 17px;
|
||||
font-weight: 200;
|
||||
}
|
||||
|
||||
.wordset:hover .option {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#sidebar {
|
||||
background-color: var(--bg-color);
|
||||
border-radius: 0 5px 5px 0;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
animation: sidebar-enter ease-out .6s backwards;
|
||||
}
|
||||
|
||||
.sidebar-title {
|
||||
width: 100%;
|
||||
font-size: 25px;
|
||||
line-height: 60px;
|
||||
padding-left: 5px;
|
||||
font-weight: 800;
|
||||
letter-spacing: 3px;
|
||||
}
|
||||
|
||||
html.bgimged #sidebar {
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
html.bgimged .wordset {
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.sidebar-item {
|
||||
margin-left: 10px;
|
||||
width: 100%;
|
||||
font-size: 20px;
|
||||
line-height: 50px;
|
||||
padding-left: 5px;
|
||||
cursor: pointer;
|
||||
transition: .5s;
|
||||
}
|
||||
|
||||
.sidebar-item:hover {
|
||||
background-color: #00000033;
|
||||
}
|
||||
|
||||
.option {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
|
|
@ -152,28 +356,21 @@ export default {
|
|||
transition: .5s;
|
||||
}
|
||||
|
||||
.wordset:hover .option{
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#header {
|
||||
/* border-bottom: solid 1px #bcbcbc; */
|
||||
justify-content: space-between;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.no {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
#wordsets-container {
|
||||
overflow-x: auto;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#main-container {
|
||||
height: 87%;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wordclass {
|
||||
|
|
@ -183,4 +380,10 @@ export default {
|
|||
.card div {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.el-collapse {
|
||||
--el-collapse-header-bg-color: #FFFFFF00;
|
||||
--el-collapse-content-bg-color: #FFFFFF00;
|
||||
--el-collapse-header-font-size: 18px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -3,6 +3,6 @@ module.exports = defineConfig({
|
|||
transpileDependencies: true,
|
||||
publicPath:"./",
|
||||
devServer: {
|
||||
proxy: 'http://localhost:3000'
|
||||
proxy: 'https://localhost:443'
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue