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, //每页能有多少个链接