From 07eb3567b413d0b770a7767b89992f6fe9272840 Mon Sep 17 00:00:00 2001 From: chuzhongzai Date: Thu, 29 Jun 2023 14:18:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=A2=84=E8=A7=88=E5=88=86?= =?UTF-8?q?=E9=A1=B5=EF=BC=8C=E5=8F=AF=E4=BB=A5=E8=AE=BE=E7=BD=AE=E6=AF=8F?= =?UTF-8?q?=E9=A1=B5=E6=9C=89=E5=A4=9A=E5=B0=91=E5=BC=A0=E5=9B=BE=E7=89=87?= =?UTF-8?q?=EF=BC=9B=E5=B0=86=E9=A2=84=E8=A7=88=E6=8A=BD=E5=8F=96=E4=B8=BA?= =?UTF-8?q?=E5=8D=95=E7=8B=AC=E4=B8=80=E4=B8=AA=E7=BB=84=E4=BB=B6=EF=BC=9B?= =?UTF-8?q?=EF=BC=88=E5=90=8C=E6=AD=A5=E6=9B=B4=E6=96=B0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DashBoard.vue | 50 +++++++++++++-------- src/components/OnlineReader.vue | 78 +++++++++++++++++++++++++++++++++ src/components/Side.vue | 12 +---- src/store/index.js | 26 ++++++----- 4 files changed, 126 insertions(+), 40 deletions(-) create mode 100644 src/components/OnlineReader.vue diff --git a/src/components/DashBoard.vue b/src/components/DashBoard.vue index 2abb995..b1140ef 100644 --- a/src/components/DashBoard.vue +++ b/src/components/DashBoard.vue @@ -32,7 +32,7 @@
修改授权码 删除本地授权码 - 夜间模式配置 + 配置 夜间模式 夜间模式
@@ -133,17 +133,25 @@ - - 夜间模式跟随系统 -
- 自定义起始时间(精确到分) -
- - ~ - - + +
+ 夜间模式
+ 夜间模式跟随系统 +
+ 自定义起始时间(精确到分) +
+ + ~ + + +
+
+ 在线预览
+ 在线预览分页页数: + +
@@ -197,12 +205,13 @@ let tempAuthCode = ref("") let isQuerying = ref(false) let isViewingTag = ref(false) -let isConfigDarkMode = ref(false) +let isConfig = ref(false) let isDark = ref(false) let keyword = ref("") let galleries = ref([]) let queryPage = ref({}) let darkConfig = ref({}) +let lengthPerPage = ref(0) //查询相关 let type = ref("link") @@ -401,12 +410,12 @@ function resetLocalQuery(){ store.commit("_searchLocalByKeyword", "") param.value = "" } -function queryGalleries(link){ +function queryGalleries(link) { let tempParam - if(link !== null) { + if (link !== null) { let url = new URL(link) tempParam = url.search.replace("?f_search=", "") - }else{ + } else { tempParam = keyword.value } tempParam = tempParam.replace(" ", "+") @@ -426,7 +435,7 @@ function queryGalleries(link){ tempGalleries.forEach((gallery) => { galleries.value.push(gallery) }) - }else { + } else { ElMessage({message: res.data.data, type: "error"}) } }) @@ -484,6 +493,9 @@ function toggleStyle(){ onMounted(() => { const auth = localStorage.getItem("auth") adjustForStyle() + store.state.lengthPerPage = localStorage.getItem("lengthPerPage") + store.state.lengthPerPage = store.state.lengthPerPage === null ? 30: Number(store.state.lengthPerPage) + lengthPerPage.value = store.state.lengthPerPage if(auth !== null){ store.dispatch("validate", auth) @@ -566,7 +578,7 @@ function light(){ document.querySelector(".DashBoard").style.setProperty("background-color", "ghostwhite") document.querySelector(".app").style.setProperty("background-color", "#c6e2ff") } -function saveDarkConfig(){ +function saveConfig(){ if(darkConfig.value.customTime) { if(darkConfig.value.startTime === undefined || darkConfig.value.endTime === undefined){ ElMessage("请正确选择起始时间") @@ -574,8 +586,10 @@ function saveDarkConfig(){ } } + store.state.lengthPerPage = Number(lengthPerPage.value) + localStorage.setItem("lengthPerPage", lengthPerPage.value) localStorage.setItem("darkConfig", JSON.stringify(darkConfig.value)) - isConfigDarkMode.value = false + isConfig.value = false adjustForStyle() } diff --git a/src/components/OnlineReader.vue b/src/components/OnlineReader.vue new file mode 100644 index 0000000..fb72540 --- /dev/null +++ b/src/components/OnlineReader.vue @@ -0,0 +1,78 @@ + + + + + \ No newline at end of file diff --git a/src/components/Side.vue b/src/components/Side.vue index 1a56907..bc67ebc 100644 --- a/src/components/Side.vue +++ b/src/components/Side.vue @@ -111,12 +111,7 @@
- - - - - + 请输入授权码后再查看 @@ -127,6 +122,7 @@ import store from "../store"; import {computed, ref} from "vue"; import axios from "axios"; import {ElMessage} from "element-plus"; +import OnlineReader from "./OnlineReader.vue"; //输入 let inputNode = ref(null) @@ -316,10 +312,6 @@ function deleteGallery(gid){ function onlineGalleryReader(gid){ store.dispatch("queryOnlineLinks", gid) } -function closeOnlineReading(){ - store.state.isOnlineReading = false - onlineReadingScrollbar.value.setScrollTop(0) -} function shareGallery(data){ const {gid, shortName} = data let link diff --git a/src/store/index.js b/src/store/index.js index e9010a8..3e640d7 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -118,18 +118,19 @@ const actions = { context.dispatch("updateGalleryTasks", "all").then(() => confirmCurrentTask(context.state)) //获取图片合适长度 - let screenWidth = window.screen.width * 0.9 - 40 - let width - let i - for(i=3; i>0; i--) - if(screenWidth / i <= 350 || screenWidth / i >= 100){ - width = screenWidth / i - break - } - - width = width - (width % 10) - state.imageWidth = width + 'px' - state.imagePadding = ((screenWidth - i * width) / i) + 'px' + // let screenWidth = window.screen.width * 0.9 - 40 + // let width + // let i + // for(i=3; i>0; i--) + // if(screenWidth / i <= 350 || screenWidth / i >= 100){ + // width = screenWidth / i + // break + // } + // + // width = width - (width % 10) + //写死图片合适宽度 + state.imageWidth = 550 + 'px' + state.imagePadding = 10 + 'px' } else context.commit("_unAuthed") @@ -615,6 +616,7 @@ const state = { currentLinks: [], //当前本子链接 imageWidth: "", //图片宽度 imagePadding: "", //图片padding + lengthPerPage: 0, //在线预览每页图片数量 page: 1, //当前页数 length: 10, //每页能有多少个链接