去除定时夜间模式;无法在线看时给出错误提示;(同步更新)预览图链接为空时不切换到该预览图;
This commit is contained in:
parent
5cf7549b35
commit
df24dcb3e2
@ -98,13 +98,7 @@
|
|||||||
<div>
|
<div>
|
||||||
夜间模式<hr>
|
夜间模式<hr>
|
||||||
<span style="display: inline-block">夜间模式跟随系统</span>
|
<span style="display: inline-block">夜间模式跟随系统</span>
|
||||||
<el-switch v-model="darkConfig.followSystem"></el-switch><br>
|
<el-switch v-model="darkConfig.followSystem"></el-switch>
|
||||||
<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>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
在线预览<hr>
|
在线预览<hr>
|
||||||
@ -293,63 +287,20 @@ function adjustForStyle(){
|
|||||||
let darkConfigStr = localStorage.getItem("darkConfig")
|
let darkConfigStr = localStorage.getItem("darkConfig")
|
||||||
if(darkConfigStr !== null) {
|
if(darkConfigStr !== null) {
|
||||||
darkConfig.value = JSON.parse(darkConfigStr)
|
darkConfig.value = JSON.parse(darkConfigStr)
|
||||||
if (darkConfig.value.followSystem)
|
if (darkConfig.value.followSystem && isSystemDark())
|
||||||
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)
|
|
||||||
dark()
|
dark()
|
||||||
else
|
else
|
||||||
light()
|
light()
|
||||||
}else {
|
}else {
|
||||||
light()
|
light()
|
||||||
darkConfig.value = {'followSystem': false, 'customTime': false}
|
darkConfig.value = {'followSystem': false}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function isSystemDark(){
|
function isSystemDark(){
|
||||||
return window.matchMedia('(prefers-color-scheme: dark)').matches
|
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(){
|
function dark(){
|
||||||
|
isDark.value = true
|
||||||
let html = document.querySelector("html")
|
let html = document.querySelector("html")
|
||||||
if(!html.classList.contains("dark"))
|
if(!html.classList.contains("dark"))
|
||||||
html.classList.add('dark')
|
html.classList.add('dark')
|
||||||
@ -357,6 +308,7 @@ function dark(){
|
|||||||
document.querySelector(".app").style.setProperty("background-color", null)
|
document.querySelector(".app").style.setProperty("background-color", null)
|
||||||
}
|
}
|
||||||
function light(){
|
function light(){
|
||||||
|
isDark.value = false
|
||||||
let html = document.querySelector("html")
|
let html = document.querySelector("html")
|
||||||
if(html.classList.contains("dark"))
|
if(html.classList.contains("dark"))
|
||||||
html.classList.remove('dark')
|
html.classList.remove('dark')
|
||||||
@ -365,13 +317,6 @@ function light(){
|
|||||||
document.querySelector(".app").style.setProperty("background-color", "#c6e2ff")
|
document.querySelector(".app").style.setProperty("background-color", "#c6e2ff")
|
||||||
}
|
}
|
||||||
function saveConfig(){
|
function saveConfig(){
|
||||||
if(darkConfig.value.customTime) {
|
|
||||||
if(darkConfig.value.startTime === undefined || darkConfig.value.endTime === undefined){
|
|
||||||
ElMessage("请正确选择起始时间")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(lengthPerPage.value < 0 || lengthPerPage.value > 30) {
|
if(lengthPerPage.value < 0 || lengthPerPage.value > 30) {
|
||||||
ElMessage("分页页数设置错误,范围1~30")
|
ElMessage("分页页数设置错误,范围1~30")
|
||||||
lengthPerPage.value = 30
|
lengthPerPage.value = 30
|
||||||
|
|||||||
@ -98,8 +98,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import store from "../store";
|
import store from "../store";
|
||||||
import {computed, ref} from "vue";
|
import {computed, ref} from "vue";
|
||||||
import axios from "axios";
|
|
||||||
import {ElMessage} from "element-plus";
|
|
||||||
import OnlineReader from "./OnlineReader.vue";
|
import OnlineReader from "./OnlineReader.vue";
|
||||||
|
|
||||||
//输入
|
//输入
|
||||||
@ -209,7 +207,7 @@ function readOnlineGallery(gallery){
|
|||||||
|
|
||||||
//显示缩略图
|
//显示缩略图
|
||||||
function showThumbnail(gallery){
|
function showThumbnail(gallery){
|
||||||
if(gallery.status === "下载完成") {
|
if(gallery.status === "下载完成" && 'thumb_link' in gallery) {
|
||||||
clearTimeout(debounceTimer)
|
clearTimeout(debounceTimer)
|
||||||
debounceTimer = setTimeout(() => {
|
debounceTimer = setTimeout(() => {
|
||||||
store.commit("_changeThumbnailGallery", gallery)
|
store.commit("_changeThumbnailGallery", gallery)
|
||||||
|
|||||||
@ -131,10 +131,13 @@ const actions = {
|
|||||||
context.commit("_setReadingGallery", gallery)
|
context.commit("_setReadingGallery", gallery)
|
||||||
else
|
else
|
||||||
axios.post(GalleryManageUrl + "/cache?url=" + gallery.link).then((res) => {
|
axios.post(GalleryManageUrl + "/cache?url=" + gallery.link).then((res) => {
|
||||||
gallery.pages = res.data.data.pages
|
if (res.data.result === 'success') {
|
||||||
setTimeout(() => {
|
gallery.pages = res.data.data.pages
|
||||||
context.commit("_setReadingGallery", gallery)
|
setTimeout(() => {
|
||||||
}, 100)
|
context.commit("_setReadingGallery", gallery)
|
||||||
|
}, 100)
|
||||||
|
} else
|
||||||
|
ElMessage.error(res.data.data)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
alterAuthCode(context, AuthCode){
|
alterAuthCode(context, AuthCode){
|
||||||
@ -185,7 +188,10 @@ const mutations = {
|
|||||||
tasks.forEach((task) => {
|
tasks.forEach((task) => {
|
||||||
//处理名字
|
//处理名字
|
||||||
task.shortName = getShortname(task.name)
|
task.shortName = getShortname(task.name)
|
||||||
task.thumb_link = GalleryManageUrl + "/ehThumbnail?path=" + task.thumb_link
|
if(task.thumb_link.trim() !== '')
|
||||||
|
task.thumb_link = GalleryManageUrl + "/ehThumbnail?path=" + task.thumb_link
|
||||||
|
else
|
||||||
|
delete task.thumb_link
|
||||||
|
|
||||||
//处理进度相关
|
//处理进度相关
|
||||||
switch (task.status) {
|
switch (task.status) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user