去除定时夜间模式;无法在线看时给出错误提示;(同步更新)去除面板中的预览图
This commit is contained in:
parent
f4b94a66b4
commit
fb925886c5
@ -22,15 +22,6 @@
|
||||
<el-switch @click="toggleStyle" v-model="isDark">夜间模式</el-switch>
|
||||
<br>
|
||||
<el-button v-if="isLion" @click="resetUndone">重置任务</el-button>
|
||||
<div v-show="thumbnailGallery.thumb_link !== undefined">
|
||||
<span>
|
||||
{{thumbnailGallery.shortName}}
|
||||
</span><br>
|
||||
<picture>
|
||||
<el-image :src="thumbnailGallery.thumb_link" :preview-src-list="[thumbnailGallery.thumb_link,]" class="preview"
|
||||
style="height: 30vh" fit="contain"/>
|
||||
</picture>
|
||||
</div>
|
||||
</el-drawer>
|
||||
|
||||
<el-dialog title="查询本子" v-model="chosenGallery" width="100%">
|
||||
@ -95,13 +86,7 @@
|
||||
<div>
|
||||
夜间模式<hr>
|
||||
<span style="display: inline-block">夜间模式跟随系统</span>
|
||||
<el-switch v-model="darkConfig.followSystem"></el-switch><br>
|
||||
<span style="display: inline-block">自定义起始时间(精确到分)</span>
|
||||
<el-switch v-model="darkConfig.customTime"></el-switch><br>
|
||||
<el-form :disabled="!darkConfig.customTime">
|
||||
<el-time-picker v-model="darkConfig.startTime" /> ~
|
||||
<el-time-picker v-model="darkConfig.endTime"/>
|
||||
</el-form>
|
||||
<el-switch v-model="darkConfig.followSystem"></el-switch>
|
||||
</div>
|
||||
<div>
|
||||
在线预览<hr>
|
||||
@ -306,64 +291,20 @@ function adjustForStyle(){
|
||||
let darkConfigStr = localStorage.getItem("darkConfig")
|
||||
if(darkConfigStr !== null) {
|
||||
darkConfig.value = JSON.parse(darkConfigStr)
|
||||
if (darkConfig.value.followSystem)
|
||||
if (isSystemDark()) {
|
||||
dark()
|
||||
isDark.value = true
|
||||
}
|
||||
else {
|
||||
light()
|
||||
isDark.value = false
|
||||
}
|
||||
|
||||
if (darkConfig.value.customTime)
|
||||
if (isDarkTime(darkConfig.value)) {
|
||||
dark()
|
||||
isDark.value = true
|
||||
}
|
||||
else {
|
||||
light()
|
||||
isDark.value = false
|
||||
}
|
||||
|
||||
if(isDark.value)
|
||||
if (darkConfig.value.followSystem && isSystemDark())
|
||||
dark()
|
||||
else
|
||||
light()
|
||||
}else {
|
||||
light()
|
||||
darkConfig.value = {'followSystem': false, 'customTime': false}
|
||||
darkConfig.value = {'followSystem': false}
|
||||
}
|
||||
}
|
||||
function isSystemDark(){
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
}
|
||||
function isDarkTime(darkConfig){
|
||||
let date = new Date()
|
||||
let startTime = darkConfig.startTime
|
||||
let endTime = darkConfig.endTime
|
||||
|
||||
if(startTime.hour > endTime.hour){ //隔夜 22:00 ~ 8:00
|
||||
if(date.getHours() > endTime.getHours() && date.getHours() < startTime.getHours()){ // 大于结束时间且小于起始时间 16:00
|
||||
return false
|
||||
}else if(date.getHours() === endTime.getHours()){ //22:00 ~ 8:30 8:26
|
||||
return date.getMinutes() <= endTime.getMinutes();
|
||||
}else if(date.getHours() === startTime.getHours()){ //22:30 ~ 8:00 22:46
|
||||
return date.getMinutes() > startTime.getMinutes();
|
||||
}else
|
||||
return true
|
||||
}else{ //不隔夜 00:00 ~ 6:00 22:00 ~ 23:00
|
||||
if(date.getHours() > endTime.getHours() || date.getHours() < startTime.getHours()){
|
||||
return false
|
||||
}else if(date.getHours() === startTime.getHours()){ // 01:30 ~ 06:00 01:32
|
||||
return date.getMinutes() >= startTime.getMinutes();
|
||||
}else if(date.getHours() === endTime.getHours()){ // 01:30 ~ 06:30 06:35
|
||||
return date.getMinutes() <= endTime.getMinutes();
|
||||
}else
|
||||
return true
|
||||
}
|
||||
}
|
||||
function dark(){
|
||||
isDark.value = true
|
||||
let html = document.querySelector("html")
|
||||
if(!html.classList.contains("dark"))
|
||||
html.classList.add('dark')
|
||||
@ -376,6 +317,7 @@ function dark(){
|
||||
|
||||
}
|
||||
function light(){
|
||||
isDark.value = false
|
||||
let html = document.querySelector("html")
|
||||
if(html.classList.contains("dark"))
|
||||
html.classList.remove('dark')
|
||||
@ -389,13 +331,6 @@ function light(){
|
||||
}
|
||||
}
|
||||
function saveConfig(){
|
||||
if(darkConfig.value.customTime) {
|
||||
if(darkConfig.value.startTime === undefined || darkConfig.value.endTime === undefined){
|
||||
ElMessage("请正确选择起始时间")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if(lengthPerPage.value < 0 || lengthPerPage.value > 30) {
|
||||
ElMessage("分页页数设置错误,范围1~30")
|
||||
lengthPerPage.value = 30
|
||||
|
||||
@ -117,8 +117,6 @@
|
||||
<script setup>
|
||||
import store from "../store";
|
||||
import {computed, ref} from "vue";
|
||||
import axios from "axios";
|
||||
import {ElMessage} from "element-plus";
|
||||
import OnlineReader from "./OnlineReader.vue";
|
||||
|
||||
//输入
|
||||
|
||||
@ -132,10 +132,13 @@ const actions = {
|
||||
context.commit("_setReadingGallery", gallery)
|
||||
else
|
||||
axios.post(GalleryManageUrl + "/cache?url=" + gallery.link).then((res) => {
|
||||
gallery.pages = res.data.data.pages
|
||||
setTimeout(() => {
|
||||
context.commit("_setReadingGallery", gallery)
|
||||
}, 100)
|
||||
if (res.data.result === 'success') {
|
||||
gallery.pages = res.data.data.pages
|
||||
setTimeout(() => {
|
||||
context.commit("_setReadingGallery", gallery)
|
||||
}, 100)
|
||||
} else
|
||||
ElMessage.error(res.data.data)
|
||||
})
|
||||
},
|
||||
alterAuthCode(context, AuthCode){
|
||||
@ -356,9 +359,6 @@ const mutations = {
|
||||
_closeReader(state){
|
||||
state.isReading = false;
|
||||
},
|
||||
_changeThumbnailGallery(state, gallery){
|
||||
state.thumbnailGallery = gallery
|
||||
},
|
||||
_openHistoryPanel(state){
|
||||
state.isShowHistory = true
|
||||
},
|
||||
@ -372,7 +372,6 @@ const state = {
|
||||
|
||||
totalGalleryTask: [], //存放本子数据的数组
|
||||
chosenGallery: false, //准备下载的本子
|
||||
thumbnailGallery: {}, //缩略图本子
|
||||
collectGallery: [], //收藏的本子
|
||||
downloadGallery: [], //下载的本子
|
||||
isSearch: false, //用于决定是否显示搜索结果
|
||||
|
||||
Loading…
Reference in New Issue
Block a user