css bug fixes

master
cast1e 2024-01-05 21:01:52 +08:00
parent aa6c1bf9f9
commit 36891a901a
8 changed files with 337 additions and 160 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<router-view></router-view> <router-view style="margin-top: 10px;"></router-view>
</template> </template>
<script> <script>
@ -108,8 +108,8 @@ html.dark {
.container { .container {
height: calc(100%-20px); height: calc(100% - 20px);
width: calc(100%-20px); width: calc(100% - 20px);
padding: 20px; padding: 20px;
animation: enter ease-out .6s backwards; animation: enter ease-out .6s backwards;
} }

View File

@ -1,9 +1,4 @@
<template> <template>
<el-page-header style="margin:20px" @back="back_home">
<template #content>
<span class="text-large font-600 mr-3"> 编辑单词本 </span>
</template>
</el-page-header>
<div id="container"> <div id="container">
<router-view> <router-view>
@ -15,23 +10,13 @@
export default { export default {
name: "SetManage", name: "SetManage",
data() {
return {
}
},
methods: {
back_home() {
this.$router.push("/");
},
},
} }
</script> </script>
<style scoped> <style scoped>
#container{ #container{
height: calc(100% - 64px); height: 100%;
width: 100%; width: 100%;
} }
</style> </style>

View File

@ -1,10 +1,11 @@
<template> <template>
<el-page-header style="margin:20px" @back="back_home"> <div v-if="mode === 0" class="wrapper">
<el-page-header style="margin-top:20px;margin-left:20px" @back="back_home">
<template #content> <template #content>
<span class="text-large font-600 mr-3"> 背诵 </span> <span class="text-large font-600 mr-3"> 选择范围 </span>
</template> </template>
</el-page-header> </el-page-header>
<div v-if="mode === 0" id="range" class="container colbox"> <div id="range" class="container colbox">
<div class="rowbox item"> <div class="rowbox item">
<div id="lastrecite" class="card"> <div id="lastrecite" class="card">
<el-button style="margin-bottom: 20px;" class="tbtn" type="primary" @click="init"></el-button><br /> <el-button style="margin-bottom: 20px;" class="tbtn" type="primary" @click="init"></el-button><br />
@ -17,8 +18,8 @@
<el-checkbox-group v-model="local.checkedSets" @change="(res) => { handleChange(local, res) }"> <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"> <div class="set_radios" v-for="(set_class, set_class_name) in wordsets" :key="set_class_name">
<p>{{ set_class_name }}</p> <p>{{ set_class_name }}</p>
<el-checkbox class="checkbox" v-for="set in set_class" :key="set.id" :label="set.id" size="large" <el-checkbox class="checkbox" v-for="set in set_class" :key="set.id" :label="set.id"
border> size="large" border>
<div style="font-size: 18px;font-weight: 500;"> <div style="font-size: 18px;font-weight: 500;">
{{ set.name }} {{ set.name }}
</div> </div>
@ -29,7 +30,7 @@
</div> </div>
<div class="rowbox item"> <div class="rowbox item">
<div id="rangeselect" class="card"> <div id="rangeselect" class="card">
<div class="title" style="font-size: 35px;">在线词库</div> <div class="title">在线词库</div>
<el-checkbox v-model="online.checkAll" :indeterminate="online.isIndeterminate" <el-checkbox v-model="online.checkAll" :indeterminate="online.isIndeterminate"
@change="(res) => { handleCheckAllChange(online, res) }" size="large">全选</el-checkbox> @change="(res) => { handleCheckAllChange(online, res) }" size="large">全选</el-checkbox>
<el-checkbox-group v-model="online.checkedSets" @change="(res) => { handleChange(online, res) }"> <el-checkbox-group v-model="online.checkedSets" @change="(res) => { handleChange(online, res) }">
@ -37,8 +38,8 @@
<div class="subtitle">{{ set_name }}</div> <div class="subtitle">{{ set_name }}</div>
<div v-for="(book, book_name) in set" :key="book_name"> <div v-for="(book, book_name) in set" :key="book_name">
<p>{{ book_name }}</p> <p>{{ book_name }}</p>
<el-checkbox class="checkbox" v-for="(config, id) in book" :key="id" :label="id" size="large" <el-checkbox class="checkbox" v-for="(config, id) in book" :key="id" :label="id"
border> size="large" border>
<div style="font-size: 18px;font-weight: 500;"> <div style="font-size: 18px;font-weight: 500;">
{{ config.name }} {{ config.name }}
</div> </div>
@ -49,7 +50,14 @@
</div> </div>
</div> </div>
</div> </div>
<div id="test" class="colbox" v-if="mode === 1"> </div>
<div v-if="mode === 1">
<el-page-header style="margin-top:20px;margin-left:20px" @back="mode = 0">
<template #content>
<span class="text-large font-600 mr-3"> 背诵 </span>
</template>
</el-page-header>
<div id="test" class="colbox">
<div style="flex-grow: 1;" class="card"> <div style="flex-grow: 1;" class="card">
<div id="status">背诵进度: {{ current + 1 }}/{{ total }}</div> <div id="status">背诵进度: {{ current + 1 }}/{{ total }}</div>
<div> <div>
@ -86,6 +94,7 @@
<el-button @click="add_to" type="primary">添加</el-button> <el-button @click="add_to" type="primary">添加</el-button>
</div> </div>
</div> </div>
</div>
</template> </template>
<script> <script>
@ -291,6 +300,8 @@ export default {
title: "Congratulations!", title: "Congratulations!",
type: "success" type: "success"
}) })
localStorage.removeItem("lastrecite");
localStorage.removeItem("lastcurrent");
return; return;
} }
nextTick(() => { nextTick(() => {
@ -298,8 +309,8 @@ export default {
}); });
} }
else ElMessage({ else ElMessage({
type:"error", type: "error",
message:"您还未答过该词,跳过请使用ctrl+M", message: "您还未答过该词,跳过请使用ctrl+M",
}) })
}, },
skip() { skip() {
@ -313,13 +324,13 @@ export default {
return; return;
}, },
prev() { prev() {
if(this.current>0){ if (this.current > 0) {
this.current--; this.current--;
this.show(); this.show();
} }
else ElMessage({ else ElMessage({
type:'error', type: 'error',
message:"已经是第一个单词" message: "已经是第一个单词"
}) })
}, },
showAnswer() { showAnswer() {
@ -331,7 +342,10 @@ export default {
let e = document.getElementById("input"); let e = document.getElementById("input");
e.value = "_".repeat(this.word.word.length); e.value = "_".repeat(this.word.word.length);
e.setSelectionRange(0, 0); e.setSelectionRange(0, 0);
e.style.height = "0";
setTimeout(() => {
e.style.height = `${e.scrollHeight}px`; e.style.height = `${e.scrollHeight}px`;
}, 200);
} }
}, },
change() { change() {
@ -353,18 +367,23 @@ export default {
title: "Error", title: "Error",
message: "错误", message: "错误",
type: "error" type: "error"
}), });
o = "_".repeat(this.word.word.length); o = "_".repeat(this.word.word.length);
n = 0; n = 0;
e.style.height = "0";
setTimeout(() => {
e.style.height = `${e.scrollHeight}px`;
}, 200);
} else } else
n == -1 ? o = "_".repeat(this.word.word.length) : (o = t.substring(0, n), n == -1 ? o = "_".repeat(this.word.word.length) : (o = t.substring(0, n),
o += "_".repeat(this.word.word.length - n)); o += "_".repeat(this.word.word.length - n));
e.value = o; e.value = o;
e.setSelectionRange(n, n); e.setSelectionRange(n, n);
e.style.height = 0;
setTimeout(() => { setTimeout(() => {
if (parseInt(e.style.height) < e.scrollHeight) {
e.style.height = `${e.scrollHeight}px`; e.style.height = `${e.scrollHeight}px`;
}, 0); }
},0);
e.focus(); e.focus();
}, },
audio_play() { audio_play() {
@ -450,7 +469,7 @@ export default {
<style scoped> <style scoped>
@media screen and (max-width: 500px) { @media screen and (max-width: 500px) {
#range { #range {
max-height: calc(100% - 104px); max-height: calc(100% - 40px);
flex-direction: column; flex-direction: column;
overflow-y: scroll; overflow-y: scroll;
} }
@ -460,7 +479,6 @@ export default {
} }
.item { .item {
margin-bottom: 20px;
/* background-color: var(--bg-color); */ /* background-color: var(--bg-color); */
width: 100%; width: 100%;
} }
@ -482,10 +500,6 @@ export default {
margin-top: 15px; margin-top: 15px;
} }
#add-to-box {
width: 100%;
}
#explain { #explain {
font-size: 18px; font-size: 18px;
margin-top: 15px; margin-top: 15px;
@ -521,7 +535,7 @@ export default {
@media screen and (min-width: 500px) { @media screen and (min-width: 500px) {
#range { #range {
max-height: calc(100% - 64px); height: 100%;
} }
#rangeselect { #rangeselect {
@ -540,18 +554,18 @@ export default {
} }
.title { .title {
font-size: 50px; font-size: 35px;
font-weight: 800; font-weight: 800;
color: var(--text-color); color: var(--text-color);
} }
#test { #test {
padding: 50px; padding: 30px;
animation: enter .5s ease-out; animation: enter .5s ease-out;
} }
#trans { #trans {
font-size: 50px; font-size: 43px;
transition: .5s; transition: .5s;
margin-top: 10px; margin-top: 10px;
} }
@ -579,6 +593,15 @@ export default {
} }
} }
.wrapper {
height: calc(100% - 10px);
}
.container {
padding: 10px;
height: calc(100% - 50px);
}
.subtitle { .subtitle {
font-size: 23px; font-size: 23px;
line-height: 35px; line-height: 35px;

View File

@ -0,0 +1,89 @@
<template>
<div class="container" style="overflow: auto;">
<el-page-header style="margin: 10px;" @back="this.$router.push('/manage');">
<template #content>
<span class="text-large font-600 mr-3"> {{ set }} : {{ book }} ({{ id }}) </span>
</template>
</el-page-header>
<div class="colbox" id="main">
<div style="flex-grow: 1;" class="card">
<el-table :data="table" style="height:calc(100% - 10px);overflow: auto;border-radius: 10px;">
<el-table-column type="index" />
<el-table-column prop="word" label="单词" />
<el-table-column prop="type" label="词性" />
<el-table-column prop="trans" label="翻译" />
</el-table>
</div>
</div>
</div>
</template>
<script>
import axios from 'axios';
export default {
name: "NoteEditor",
data() {
return {
table: [],
}
},
created() {
this.set = this.$route.query.set;
this.book = this.$route.query.book;
this.id = this.$route.query.id;
if (this.set && this.book && this.id) {
axios.get("./wordset/detail", {
params:{
set: this.set, book: this.book, id: this.id
}
}).then(
(res) => {
this.table = res.data;
}
);
}
},
}
</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;
}
}
.container {
padding: 10px;
padding-top: 0;
}
#main{
height: calc(100% - 50px);
}
.el-table {
--el-table-bg-color: #FFFFFF00;
--el-table-tr-bg-color: #FFFFFF00;
}
</style>

View File

@ -1,9 +1,10 @@
<template> <template>
<div class="container" style="overflow: auto;"> <div class="container" style="overflow: auto;">
<div class="colbox" style="justify-content: space-between;margin: 0 20px 0 20px;"> <el-page-header style="margin: 10px;" @back="this.$router.push('/manage');">
<div>{{ editing.name }} ({{ editing.id }}) </div> <template #content>
<box-icon name="x" color="var(--text-color)" style="cursor: pointer;" @click="$router.push('/manage')"></box-icon> <span class="text-large font-600 mr-3"> {{ name }} ({{ id }}) </span>
</div> </template>
</el-page-header>
<div class="colbox" id="main"> <div class="colbox" id="main">
<div class="rowbox"> <div class="rowbox">
<div class="card"> <div class="card">
@ -170,10 +171,10 @@ export default {
}, },
created() { created() {
this.editing = this.$store.state.editing.set; this.name = this.$route.query.name;
this.editingClass = this.$store.state.editing.set_class_name; this.id = this.$route.query.id;
if(this.editing && this.editingClass){ if(this.name && this.id){
this.table = JSON.parse(localStorage.getItem(this.editing.id)); this.table = JSON.parse(localStorage.getItem(this.id));
} }
}, },
} }
@ -185,10 +186,7 @@ export default {
flex-direction: column; flex-direction: column;
overflow: scroll; overflow: scroll;
} }
.container{
padding: 10px;
height: calc(100% - 20px);
}
.title{ .title{
font-size: 25px; font-size: 25px;
min-height: 50px; min-height: 50px;
@ -200,9 +198,16 @@ export default {
font-size: 35px; font-size: 35px;
min-height: 60px; min-height: 60px;
} }
.container{
padding: 10px;
height: 100%;
}
} }
#main{
height: calc(100% - 50px);
}
#main-container { #main-container {
height: 87%; height: 87%;

View File

@ -1,11 +1,11 @@
<template> <template>
<el-container id="main-container" class="container card"> <el-page-header style="margin: 20px;" @back="$router.push('/manage')">
<div style="overflow: auto;">
<el-page-header @back="$router.push('/manage')">
<template #content> <template #content>
<span class="text-large font-600 mr-3"> 新建单词本 </span> <span class="text-large font-600 mr-3"> 新建单词本 </span>
</template> </template>
</el-page-header> </el-page-header>
<el-container id="main-container" class="container card">
<div style="overflow: auto;">
<div class="colbox"> <div class="colbox">
<div class="mid-text">名称:</div> <div class="mid-text">名称:</div>
<el-input v-model="set_name"></el-input> <el-input v-model="set_name"></el-input>
@ -64,16 +64,19 @@ export default {
.colbox { .colbox {
flex-direction: column; flex-direction: column;
} }
.colbox * { .colbox * {
margin-top: 15px; margin-top: 15px;
} }
.card{
.card {
box-shadow: none; box-shadow: none;
} }
} }
#main-container { #main-container {
height: 87%; height: calc(100% - 80px);
width: calc(100% - 20px);
} }
.colbox { .colbox {

View File

@ -1,18 +1,30 @@
<template> <template>
<el-container id="main-container"> <el-container id="main-container">
<el-header id="header" style="text-align: right;"> <el-header id="header" style="">
<div> <el-page-header style="margin: 10px;" @back="this.$router.push('/');">
<template #content>
<span class="text-large font-600 mr-3"> 编辑单词本 </span>
</template>
<template #extra>
<div class="pconly">
<el-button @click="manage_online_wordsets" type="primary"><box-icon color="white" name='world' <el-button @click="manage_online_wordsets" type="primary"><box-icon color="white" name='world'
size="20px"></box-icon>线</el-button> size="20px"></box-icon>线</el-button>
<el-button @click="export_set" type="success" class="pconly"><box-icon color="white" name='export' <el-button @click="export_set" type="success"><box-icon color="white" name='export'
size="18px"></box-icon></el-button> size="18px"></box-icon></el-button>
<el-button @click="import_set" type="warning" class="pconly"><box-icon color="white" name='import' <el-button @click="import_set" type="warning"><box-icon color="white" name='import'
size="18px"></box-icon></el-button> size="18px"></box-icon></el-button>
<el-button @click="$router.push('/manage/new')" type="primary"><box-icon color="white" <el-button @click="$router.push('/manage/new')" type="primary"><box-icon color="white"
name='plus'></box-icon></el-button> name='plus'></box-icon></el-button>
</div> </div>
</template>
</el-page-header>
<div class="mbonly">
<el-button @click="$router.push('/manage/new')" type="primary"><box-icon color="white"
name='plus'></box-icon></el-button>
</div>
</el-header> </el-header>
<el-container style="height:calc(100% - 40px);"> <el-container style="height:calc(100% - 40px);">
<el-aside id="sidebar"> <el-aside id="sidebar">
<div class="sidebar-title"> <div class="sidebar-title">
|本地 |本地
@ -24,11 +36,17 @@
<div class="sidebar-title"> <div class="sidebar-title">
|在线 |在线
</div> </div>
<div v-for="set in Object.keys(online_wordsets)" :key="set">
<div v-for="(set_class, class_name) in online_wordsets[set]" :title="class_name" :key="class_name"
@click="view_online(set, class_name)" class="sidebar-item">
{{ class_name }}
</div>
</div>
</el-aside> </el-aside>
<el-main id="wordsets-container"> <el-main id="wordsets-container">
<div id="sets-container"> <div id="sets-container">
<div class="colbox wordclass"> <div v-if="mode === 0" class="colbox wordclass">
<div v-for="(wordset, index) in wordsets[view_class]" :key="index" class="wordset rowbox"> <div v-for="(wordset, index) in view_wordsets" :key="index" class="wordset rowbox">
<div class="no"> <div class="no">
{{ index + 1 }} {{ index + 1 }}
</div> </div>
@ -40,12 +58,26 @@
</div> </div>
<div class="option"> <div class="option">
<box-icon class="btn" name='edit' color="var(--text-color)" <box-icon class="btn" name='edit' color="var(--text-color)"
@click="edit(wordset, view_class)"></box-icon> @click="edit(wordset.id, wordset.name)"></box-icon>
<box-icon class="btn" name='trash' color="var(--text-color)" <box-icon class="btn" name='trash' color="var(--text-color)"
@click="del(view_class, wordset.id, index)"></box-icon> @click="del(view_class, wordset.id, index)"></box-icon>
</div> </div>
</div> </div>
</div> </div>
<div v-if="mode === 1" class="colbox wordclass">
<div v-for="(wordset, index) in online_wordsets[viewing.set][viewing.book]" :key="index"
class="wordset rowbox">
<div class="title">
{{ wordset.name }}
</div>
<div class="created-date">
创建日期{{ (new Date(wordset.created)).toLocaleString() }}
</div>
<div class="option">
<box-icon class="btn" name='show' color="var(--text-color)" @click="show(index)"></box-icon>
</div>
</div>
</div>
</div> </div>
<div class="mbonly" id="show-sidebar" @click="taggle_sidebar"> <div class="mbonly" id="show-sidebar" @click="taggle_sidebar">
<box-icon name='list-ul' color="var(--text-color)"></box-icon> <box-icon name='list-ul' color="var(--text-color)"></box-icon>
@ -57,18 +89,35 @@
<script> <script>
import { ElNotification, ElMessage, ElMessageBox } from 'element-plus'; import { ElNotification, ElMessage, ElMessageBox } from 'element-plus';
import axios from 'axios';
export default { export default {
name: "SetList", name: "SetList",
data() { data() {
return { return {
wordsets: window.wordsets, wordsets: window.wordsets,
view_class: "", view_wordsets: [],
viewing: {
set: "",
book: "",
},
online_wordsets: [],
mode: 0,
} }
}, },
methods: { methods: {
view(classname) { view(classname) {
this.view_class = classname; this.mode = 0;
this.view_wordsets = this.wordsets[classname];
let node = document.getElementById("wordsets-container").style;
node.animation = "";
setTimeout(() => {
node.animation = "enter ease-out .6s backwards";
}, 0);
},
view_online(set_name, class_name) {
this.mode = 1;
this.viewing = { set: set_name, book: class_name };
let node = document.getElementById("wordsets-container").style; let node = document.getElementById("wordsets-container").style;
node.animation = ""; node.animation = "";
setTimeout(() => { setTimeout(() => {
@ -90,10 +139,16 @@ export default {
ElMessage(`已经删除 ${set_class_name} `); ElMessage(`已经删除 ${set_class_name} `);
}); });
}, },
edit(set, set_class_name) { edit(id, name) {
this.$store.state.editing = {set, set_class_name};
this.$router.push({ this.$router.push({
path: "/manage/edit", path: "./manage/edit",
query: { id, name }
})
},
show(id) {
this.$router.push({
path: "./manage/show",
query: { set: this.viewing.set, book: this.viewing.book, id }
}) })
}, },
async export_set() { async export_set() {
@ -152,9 +207,9 @@ export default {
message: `已添加 ${cnt} 本单词本` message: `已添加 ${cnt} 本单词本`
}); });
}, },
taggle_sidebar(){ taggle_sidebar() {
let node = document.getElementById("sidebar"); let node = document.getElementById("sidebar");
if(node.style.width === "180px") node.style.width = "0"; if (node.style.width === "180px") node.style.width = "0";
else node.style.width = "180px"; else node.style.width = "180px";
return; return;
} }
@ -166,6 +221,11 @@ export default {
this.view(first_set); this.view(first_set);
}, 0); }, 0);
} }
axios.get("/wordset/list").then(
(res) => {
this.online_wordsets = res.data;
}
);
} }
} }
</script> </script>
@ -184,6 +244,10 @@ export default {
} }
} }
#header{
height: 70px;
}
#sidebar { #sidebar {
width: 0; width: 0;
transition: .5s; transition: .5s;
@ -243,11 +307,13 @@ export default {
cursor: pointer; cursor: pointer;
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
} }
#wordsets-container{
#wordsets-container {
width: 100%; width: 100%;
display: flex; display: flex;
} }
#sets-container{
#sets-container {
width: 100%; width: 100%;
} }
} }
@ -267,6 +333,10 @@ export default {
} }
} }
#header{
height: 60px;
}
#sidebar { #sidebar {
width: 180px; width: 180px;
} }
@ -359,7 +429,7 @@ html.bgimged .wordset {
#header { #header {
/* border-bottom: solid 1px #bcbcbc; */ /* border-bottom: solid 1px #bcbcbc; */
justify-content: space-between; justify-content: space-between;
height: 40px; animation: enter ease-out .6s backwards;
} }
#wordsets-container { #wordsets-container {

View File

@ -5,6 +5,7 @@ const home = ()=>import("./components/Home.vue");
const recite = ()=>import('./components/Recite.vue'); const recite = ()=>import('./components/Recite.vue');
const setlist = ()=>import('./components/manage/SetList.vue'); const setlist = ()=>import('./components/manage/SetList.vue');
const newset = ()=>import('./components/manage/NewSet.vue'); const newset = ()=>import('./components/manage/NewSet.vue');
const display = ()=>import('./components/manage/Display.vue');
const routes = [ const routes = [
{ path: '/', component: home }, { path: '/', component: home },
@ -13,7 +14,8 @@ const routes = [
children:[ children:[
{path: '',component:setlist}, {path: '',component:setlist},
{path: 'new',component:newset}, {path: 'new',component:newset},
{path: 'edit',component:editor} {path: 'edit',component:editor},
{path: 'show',component:display}
]}, ]},
] ]