|
@@ -12,17 +12,62 @@
|
|
|
class="top-nav__logo"
|
|
|
draggable="false"
|
|
|
src="@/assets/images/logo_02-min.png"
|
|
|
+ @click="$router.push({ name: 'home' })"
|
|
|
/>
|
|
|
+
|
|
|
+ <div v-if="isDetail" class="top-nav-detail">
|
|
|
+ <img :src="isDark ? LogoWhiteIcon : LogoIcon" draggable="false" />
|
|
|
+ <div class="top-nav-detail__inner">
|
|
|
+ <h1>刘少奇传</h1>
|
|
|
+ <p>金冲及 中共中央文献研究室 编</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
<div class="top-nav-rg">
|
|
|
<ul class="top-nav-rg-first">
|
|
|
<li>手机版</li>
|
|
|
- <li>书库</li>
|
|
|
+ <li v-if="!isDetail" @click="$router.push({ name: 'stack' })">
|
|
|
+ 书库
|
|
|
+ </li>
|
|
|
+ <li
|
|
|
+ v-else
|
|
|
+ v-loading="joinLoading"
|
|
|
+ element-loading-custom-class="top-nav__loading"
|
|
|
+ >
|
|
|
+ 加入书架
|
|
|
+ </li>
|
|
|
</ul>
|
|
|
|
|
|
<div class="top-nav-rg__divider" />
|
|
|
|
|
|
+ <template v-if="isDetail">
|
|
|
+ <div class="top-nav-detail-nav">
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in DETAIL_NAV"
|
|
|
+ :key="item.text"
|
|
|
+ class="top-nav-detail-nav__item"
|
|
|
+ :class="{ active: index === curNav }"
|
|
|
+ >
|
|
|
+ <img :src="index === curNav ? item.activeIcon : item.icon" />
|
|
|
+ <p>{{ item.text }}</p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 简/繁体 -->
|
|
|
+ <img
|
|
|
+ :src="isSimplified ? jtIcon : ftIcon"
|
|
|
+ @click="epubStore.toggleText"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 书库 -->
|
|
|
+ <router-link :to="{ name: 'stack' }">
|
|
|
+ <img :src="isDark ? skDarkIcon : skIcon" />
|
|
|
+ </router-link>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="top-nav-rg__divider" />
|
|
|
+ </template>
|
|
|
+
|
|
|
<el-popover
|
|
|
v-if="isLogin"
|
|
|
:width="124"
|
|
@@ -54,15 +99,59 @@
|
|
|
<script setup>
|
|
|
import { watch, ref } from "vue";
|
|
|
import { useRoute } from "vue-router";
|
|
|
-import { useBaseStore } from "@/stores";
|
|
|
+import { useDark } from "@vueuse/core";
|
|
|
+import { storeToRefs } from "pinia";
|
|
|
+import { useBaseStore, useDetailStore, useEpubStore } from "@/stores";
|
|
|
+
|
|
|
+import LogoIcon from "@/assets/images/logo_03-min.png";
|
|
|
+import LogoWhiteIcon from "@/assets/images/logo-min.png";
|
|
|
+import TextIcon from "./images/icon_text-min.png";
|
|
|
+import TextActiveIcon from "./images/icon_text_active-min.png";
|
|
|
+import VideoIcon from "./images/icon_video-min.png";
|
|
|
+import VideoActiveIcon from "./images/icon_video_active-min.png";
|
|
|
+import ImgIcon from "./images/icon_img-min.png";
|
|
|
+import ImgActiveIcon from "./images/icon_img_active-min.png";
|
|
|
+import jtIcon from "./images/icon_font-min.png";
|
|
|
+import ftIcon from "./images/icon_font_active-min.png";
|
|
|
+import skIcon from "./images/icon_book-min.png";
|
|
|
+import skDarkIcon from "./images/icon_book_dark-min.png";
|
|
|
+
|
|
|
+const DETAIL_NAV = [
|
|
|
+ {
|
|
|
+ icon: TextIcon,
|
|
|
+ activeIcon: TextActiveIcon,
|
|
|
+ text: "文本",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ icon: VideoIcon,
|
|
|
+ activeIcon: VideoActiveIcon,
|
|
|
+ text: "视频",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ icon: ImgIcon,
|
|
|
+ activeIcon: ImgActiveIcon,
|
|
|
+ text: "影印",
|
|
|
+ },
|
|
|
+];
|
|
|
|
|
|
const route = useRoute();
|
|
|
-const { isLogin } = useBaseStore();
|
|
|
+const isDark = useDark();
|
|
|
+
|
|
|
+const baseStore = useBaseStore();
|
|
|
+const { isLogin } = storeToRefs(baseStore);
|
|
|
+const detailStore = useDetailStore();
|
|
|
+const { curNav } = storeToRefs(detailStore);
|
|
|
+const epubStore = useEpubStore();
|
|
|
+const { isSimplified } = storeToRefs(epubStore);
|
|
|
+
|
|
|
+const isDetail = ref(false);
|
|
|
const showLogo = ref(false);
|
|
|
const hideBgColor = ref(false);
|
|
|
const bgColor = ref("");
|
|
|
+const joinLoading = ref(false);
|
|
|
|
|
|
watch(route, (v) => {
|
|
|
+ isDetail.value = v.name === "detail";
|
|
|
showLogo.value = v.meta.showLogo ?? false;
|
|
|
hideBgColor.value =
|
|
|
(v.meta.hideTopNavBgColor || Boolean(v.meta.topNavBgColor)) ?? true;
|
|
@@ -79,4 +168,13 @@ watch(route, (v) => {
|
|
|
--el-popover-padding: 10px;
|
|
|
min-width: 124px;
|
|
|
}
|
|
|
+
|
|
|
+.top-nav__loading {
|
|
|
+ --el-loading-spinner-size: 20px;
|
|
|
+
|
|
|
+ top: -5px;
|
|
|
+ left: -10px;
|
|
|
+ right: -10px;
|
|
|
+ bottom: -5px;
|
|
|
+}
|
|
|
</style>
|