|
@@ -91,7 +91,7 @@ import githubUrl from "@/assets/imgs/github.png";
|
|
|
import { useLoading } from "@/hooks/loading";
|
|
import { useLoading } from "@/hooks/loading";
|
|
|
import { Search } from "@element-plus/icons-vue";
|
|
import { Search } from "@element-plus/icons-vue";
|
|
|
import API from "@api";
|
|
import API from "@api";
|
|
|
-import ajax from "@/api/axios.js";
|
|
|
|
|
|
|
+import { baseUrl, setRemoteIp } from "@/api/axios.js";
|
|
|
|
|
|
|
|
const store = useBookStore();
|
|
const store = useBookStore();
|
|
|
const { connectStatus, connectType, newConnect, shelf } = storeToRefs(store);
|
|
const { connectStatus, connectType, newConnect, shelf } = storeToRefs(store);
|
|
@@ -164,15 +164,15 @@ const searchBook = () => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const ipInput = reactive({
|
|
const ipInput = reactive({
|
|
|
- ip: "",
|
|
|
|
|
|
|
+ ip: baseUrl(),
|
|
|
disable: true,
|
|
disable: true,
|
|
|
});
|
|
});
|
|
|
const toggleIpConfig = () => {
|
|
const toggleIpConfig = () => {
|
|
|
- ipInput.ip = localStorage.getItem("remoteIp");
|
|
|
|
|
|
|
+ ipInput.ip = baseUrl();
|
|
|
ipInput.disable = !ipInput.disable;
|
|
ipInput.disable = !ipInput.disable;
|
|
|
};
|
|
};
|
|
|
const setIP = () => {
|
|
const setIP = () => {
|
|
|
- localStorage.setItem("remoteIp", ipInput.ip);
|
|
|
|
|
|
|
+ setRemoteIp(ipInput.ip);
|
|
|
ipInput.disable = true;
|
|
ipInput.disable = true;
|
|
|
loadShelf();
|
|
loadShelf();
|
|
|
};
|
|
};
|
|
@@ -212,11 +212,6 @@ const toDetail = (bookUrl, bookName, bookAuthor, chapterIndex, chapterPos) => {
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
//获取最近阅读书籍
|
|
//获取最近阅读书籍
|
|
|
let readingRecentStr = localStorage.getItem("readingRecent");
|
|
let readingRecentStr = localStorage.getItem("readingRecent");
|
|
|
- ipInput.ip = localStorage.getItem("remoteIp");
|
|
|
|
|
- ajax.interceptors.request.use((config) => {
|
|
|
|
|
- config.baseURL = ipInput.ip;
|
|
|
|
|
- return config;
|
|
|
|
|
- });
|
|
|
|
|
if (readingRecentStr != null) {
|
|
if (readingRecentStr != null) {
|
|
|
readingRecent.value = JSON.parse(readingRecentStr);
|
|
readingRecent.value = JSON.parse(readingRecentStr);
|
|
|
if (typeof readingRecent.value.chapterIndex == "undefined") {
|
|
if (typeof readingRecent.value.chapterIndex == "undefined") {
|