Mobile device adaptation

master
cast1e 2023-12-03 14:50:52 +08:00
parent d86bbd5cdc
commit fbeb3820f8
8 changed files with 581 additions and 218 deletions

View File

@ -57,15 +57,27 @@ export default {
</script> </script>
<style> <style>
@media screen and (max-width: 500px) {
html { .pconly {
--bg-color: #ffffffae; display: none;
--text-color: #464646;
} }
html.dark { @keyframes enter {
--bg-color: #2a2a2aae; 0% {
--text-color: #c0c0c0; translate: 100px 0;
opacity: 0;
}
100% {
translate: 0 0;
opacity: 1;
}
}
}
@media screen and (min-width: 500px) {
.mbonly {
display: none;
} }
@keyframes enter { @keyframes enter {
@ -81,6 +93,19 @@ html.dark {
filter: blur(0px); filter: blur(0px);
} }
} }
}
html {
--bg-color: #ffffffae;
--text-color: #464646;
}
html.dark {
--bg-color: #2a2a2aae;
--text-color: #c0c0c0;
}
.container { .container {
height: calc(100%-20px); height: calc(100%-20px);
@ -112,18 +137,6 @@ html.bgimged .card{
backdrop-filter: blur(15px); 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 { .btn {
cursor: pointer; cursor: pointer;
} }

View File

@ -16,7 +16,7 @@
<div id="setting"> <div id="setting">
<box-icon class="btn" color="var(--text-color)" name='cog' @click="open_setting_dialog"></box-icon> <box-icon class="btn" color="var(--text-color)" name='cog' @click="open_setting_dialog"></box-icon>
</div> </div>
<el-dialog v-model="settingVisible" title="设置"> <el-dialog v-model="settingVisible" title="设置" width="75%">
<div class="title">更换自定义背景</div> <div class="title">更换自定义背景</div>
<div class="colbox" style="margin: 10px;"> <div class="colbox" style="margin: 10px;">
<el-input v-model="img_url"></el-input> <el-input v-model="img_url"></el-input>
@ -63,6 +63,50 @@ export default {
</script> </script>
<style scoped> <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 { .title {
font-weight: 800; font-weight: 800;
color: var(--text-color); color: var(--text-color);
@ -73,6 +117,22 @@ export default {
white-space: nowrap; white-space: nowrap;
} }
#main {
margin: 80px;
}
.button {
margin: 30px;
}
#ball{
width: 1350px;
height: 1350px;
top: -50%;
right: -10%;
}
}
#setting { #setting {
position: absolute; position: absolute;
right: 0; right: 0;
@ -80,12 +140,6 @@ export default {
margin: 20px; margin: 20px;
} }
#title {
font-size: 180px;
color: var(--text-color);
text-shadow: #00000057 5px 5px 20px ;
}
.button { .button {
width: 200px; width: 200px;
height: 100px; height: 100px;
@ -102,7 +156,6 @@ export default {
backdrop-filter: blur(20px); backdrop-filter: blur(20px);
cursor: pointer; cursor: pointer;
transition: .5s; transition: .5s;
margin: 30px;
color: var(--text-color); color: var(--text-color);
text-decoration: none; text-decoration: none;
} }
@ -119,12 +172,8 @@ html.dark .button {
#ball { #ball {
background-image: linear-gradient(120deg, #e0c3fcca 0%, #8ec5fcc4 100%); background-image: linear-gradient(120deg, #e0c3fcca 0%, #8ec5fcc4 100%);
width: 1350px;
height: 1350px;
border-radius: 100%; border-radius: 100%;
position: absolute; position: absolute;
top: -50%;
right: -10%;
animation: enter .8s ease-out; animation: enter .8s ease-out;
box-shadow: #e0c3fcca 0px 0px 50px 10px; box-shadow: #e0c3fcca 0px 0px 50px 10px;
z-index: -1; z-index: -1;
@ -132,9 +181,4 @@ html.dark .button {
html.bgimged #ball { html.bgimged #ball {
backdrop-filter: blur(20px); backdrop-filter: blur(20px);
} }</style>
#main {
margin: 80px;
}
</style>

View File

@ -4,9 +4,11 @@
<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 id="container">
<router-view> <router-view>
</router-view> </router-view>
</div>
</template> </template>
<script> <script>
@ -28,5 +30,8 @@ export default {
</script> </script>
<style scoped> <style scoped>
#container{
height: calc(100% - 64px);
width: 100%;
}
</style> </style>

View File

@ -5,7 +5,12 @@
</template> </template>
</el-page-header> </el-page-header>
<div v-if="mode === 0" id="range" class="container colbox"> <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> <div class="title">选择测验范围</div>
<el-checkbox v-model="local.checkAll" :indeterminate="local.isIndeterminate" <el-checkbox v-model="local.checkAll" :indeterminate="local.isIndeterminate"
@change="(res) => { handleCheckAllChange(local, res) }" size="large">全选</el-checkbox> @change="(res) => { handleCheckAllChange(local, res) }" size="large">全选</el-checkbox>
@ -21,12 +26,8 @@
</div> </div>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
<div class="rowbox item">
<div id="lastrecite" class="card">
<el-button style="margin-bottom: 20px;width: 50%;" type="primary" @click="init"></el-button><br />
<el-button style="margin:0;width: 50%;" type="success" @click="last_recite"></el-button>
</div> </div>
<div id="online-set-container" class="card"> <div id="rangeselect" class="card item">
<div class="title" style="font-size: 35px;">在线词库</div> <div class="title" style="font-size: 35px;">在线词库</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>
@ -46,7 +47,6 @@
</el-checkbox-group> </el-checkbox-group>
</div> </div>
</div> </div>
</div>
<div id="test" class="colbox" v-if="mode === 1"> <div id="test" class="colbox" v-if="mode === 1">
<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>
@ -56,7 +56,7 @@
</textarea> </textarea>
<div v-if="current < answered" class="answer">{{ word.word }}</div> <div v-if="current < answered" class="answer">{{ word.word }}</div>
</div> </div>
<p id="explain"> <div id="explain">
<el-button v-if="current > 0" @click="prev"></el-button> <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="next"></el-button>
<el-button v-if="current === answered" @click="showAnswer"></el-button> <el-button v-if="current === answered" @click="showAnswer"></el-button>
@ -64,11 +64,11 @@
<el-button @click="terminate" type="danger">停止背诵</el-button> <el-button @click="terminate" type="danger">停止背诵</el-button>
<box-icon color="var(--text-color)" class="btn" style="margin-left: 10px;translate: 0 4px;" <box-icon color="var(--text-color)" class="btn" style="margin-left: 10px;translate: 0 4px;"
@click="audio_play" name='volume-full'></box-icon> @click="audio_play" name='volume-full'></box-icon>
</p> </div>
<div id="trans">{{ word.type }} {{ word.trans }}</div> <div id="trans">{{ word.type }} {{ word.trans }}</div>
</div> </div>
<div id="add-to-box" class="card"> <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="colbox para">
<div class="mid-text">分组:</div> <div class="mid-text">分组:</div>
<el-select v-model="set_class" class="m-2" placeholder="Select"> <el-select v-model="set_class" class="m-2" placeholder="Select">
@ -409,9 +409,87 @@ export default {
</script> </script>
<style scoped> <style scoped>
@media screen and (max-width: 500px) {
#range {
max-height: calc(100% - 104px);
flex-direction: column;
overflow-y: scroll;
}
#rangeselect {
height: auto;
}
.item { .item {
margin-bottom: 20px; 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%; width: 50%;
} }
@ -421,6 +499,35 @@ export default {
color: var(--text-color); 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 { .subtitle {
font-size: 23px; font-size: 23px;
line-height: 35px; line-height: 35px;
@ -442,31 +549,12 @@ export default {
border-radius: 8px; border-radius: 8px;
background-color: var(--bg-color); 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-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; border: none;
outline-style: none; outline-style: none;
height: 100px;
padding: 0; padding: 0;
transition: .5s; transition: .5s;
resize: vertical; resize: vertical;
width: 100%; 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 { .set_radios {
@ -479,26 +567,11 @@ export default {
color: var(--text-color); color: var(--text-color);
} }
#add-to-box {
width: 30%;
min-width: 200px;
}
#lastrecite { #lastrecite {
max-height: 150px; max-height: 150px;
} }
#range {
max-height: 85%;
}
#rangeselect {
max-height: 100%;
overflow-x: auto;
}
#online-set-container { #online-set-container {
height: auto; height: auto;
overflow-y: auto; overflow-y: auto;
} }</style>
</style>

View File

@ -1,13 +1,13 @@
<template> <template>
<div class="container" style="overflow: auto;"> <div class="container" style="overflow: auto;">
<el-page-header @back="$router.push('/manage')"> <el-page-header @back="$router.push('/manage')" class="pconly">
<template #content> <template #content>
<span class="text-large font-600 mr-3"> {{ editing.name }} ({{ editing.id }}) </span> <span class="text-large font-600 mr-3"> {{ editing.name }} ({{ editing.id }}) </span>
</template> </template>
</el-page-header> </el-page-header>
<div class="colbox" style="margin-top: 20px;"> <div class="colbox" id="main">
<div class="rowbox"> <div class="rowbox">
<div class="card" style="margin-bottom: 20px;"> <div class="card">
<div class="title">添加单词</div> <div class="title">添加单词</div>
<el-input ref="input1" autofocus @change="focusnext($refs.input2)" v-model="new_word.word"></el-input> <el-input ref="input1" autofocus @change="focusnext($refs.input2)" v-model="new_word.word"></el-input>
<div class="colbox"> <div class="colbox">
@ -31,7 +31,7 @@
<el-button @click="change_name()" type="primary">更改名称</el-button> <el-button @click="change_name()" type="primary">更改名称</el-button>
</div> </div>
</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 :data="table" style="max-height: 550px;overflow: auto;border-radius: 10px;">
<el-table-column type="index" /> <el-table-column type="index" />
<el-table-column prop="word" label="单词" /> <el-table-column prop="word" label="单词" />
@ -51,7 +51,7 @@
</div> </div>
</div> </div>
</div> </div>
<el-dialog v-model="word_editing"> <el-dialog v-model="word_editing" width="80%">
<div class="title">修改单词</div> <div class="title">修改单词</div>
<el-input v-model="editing_word.word"></el-input> <el-input v-model="editing_word.word"></el-input>
<div class="colbox"> <div class="colbox">
@ -179,6 +179,30 @@ export default {
</script> </script>
<style scoped> <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 { #main-container {
height: 87%; height: 87%;
} }
@ -186,12 +210,10 @@ export default {
.title { .title {
font-weight: 800; font-weight: 800;
color: var(--text-color); color: var(--text-color);
font-size: 35px;
flex-grow: 1; flex-grow: 1;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
min-height: 60px;
} }

View File

@ -60,9 +60,22 @@ export default {
</script> </script>
<style scoped> <style scoped>
@media screen and (max-width: 500px) {
.colbox {
flex-direction: column;
}
.colbox * {
margin-top: 15px;
}
.card{
box-shadow: none;
}
}
#main-container { #main-container {
height: 87%; height: 87%;
} }
.colbox { .colbox {
margin-top: 20px; margin-top: 20px;
} }

View File

@ -1,30 +1,41 @@
<template> <template>
<el-container id="main-container" class="container card"> <el-container id="main-container">
<el-header id="header" class="colbox"> <el-header id="header" style="text-align: right;">
<div class="no">共有{{ Object.keys(wordsets).length }}个单词集合</div>
<div> <div>
<el-button @click="manage_online_wordsets" type="primary"><box-icon color="white" name='world' size="20px"></box-icon>线</el-button> <el-button @click="manage_online_wordsets" type="primary"><box-icon color="white" name='world'
<el-button @click="export_set" type="success"><box-icon color="white" name='export' 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> size="18px"></box-icon></el-button>
<el-button @click="import_set" type="warning"><box-icon color="white" name='import' <el-button @click="import_set" type="warning" class="pconly"><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" name='plus'></box-icon></el-button> <el-button @click="$router.push('/manage/new')" type="primary"><box-icon color="white"
name='plus'></box-icon></el-button>
</div> </div>
</el-header> </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"> <el-main id="wordsets-container">
<div class="colbox" if="sets-container"> <div id="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 class="colbox wordclass"> <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"> <div class="no">
{{ index + 1 }} {{ index + 1 }}
</div> </div>
<div class="title"> <div class="title">
{{ wordset.name }} {{ wordset.name }}
</div> </div>
<div style="font-size: 17px;font-weight: 200;"> <div class="created-date">
创建日期{{ (new Date(wordset.created)).toLocaleString() }} 创建日期{{ (new Date(wordset.created)).toLocaleString() }}
</div> </div>
<div class="option"> <div class="option">
@ -35,11 +46,13 @@
</div> </div>
</div> </div>
</div> </div>
</el-collapse-item> </div>
</el-collapse> <div class="mbonly" id="show-sidebar" @click="taggle_sidebar">
<box-icon name='list-ul' color="var(--text-color)"></box-icon>
</div> </div>
</el-main> </el-main>
</el-container> </el-container>
</el-container>
</template> </template>
<script> <script>
@ -50,10 +63,18 @@ export default {
data() { data() {
return { return {
wordsets: window.wordsets, wordsets: window.wordsets,
active_set_class: "", view_class: "",
} }
}, },
methods: { 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() { manage_online_wordsets() {
window.location.href = '/dashboard'; window.location.href = '/dashboard';
}, },
@ -130,15 +151,142 @@ export default {
title: "添加成功", title: "添加成功",
message: `已添加 ${cnt} 本单词本` 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() { 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> </script>
<style scoped> <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 { .title {
font-weight: 800; font-weight: 800;
color: var(--text-color); color: var(--text-color);
@ -149,6 +297,58 @@ export default {
white-space: nowrap; white-space: nowrap;
min-height: 60px; 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 { .option {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
@ -156,28 +356,21 @@ export default {
transition: .5s; transition: .5s;
} }
.wordset:hover .option{
opacity: 1;
}
#header { #header {
/* border-bottom: solid 1px #bcbcbc; */ /* border-bottom: solid 1px #bcbcbc; */
justify-content: space-between; justify-content: space-between;
height: 40px; height: 40px;
} }
.no {
font-size: 20px;
font-weight: 700;
}
#wordsets-container { #wordsets-container {
overflow-x: auto; overflow-x: auto;
height: 100%; height: 100%;
position: relative;
} }
#main-container { #main-container {
height: 87%; height: 100%;
width: 100%;
} }
.wordclass { .wordclass {

View File

@ -3,6 +3,6 @@ module.exports = defineConfig({
transpileDependencies: true, transpileDependencies: true,
publicPath:"./", publicPath:"./",
devServer: { devServer: {
proxy: 'http://localhost:3000' proxy: 'https://localhost:443'
} }
}) })