|
@@ -178,7 +178,8 @@ import {
|
|
|
getWechatJsConfig,
|
|
|
recordAdClickStatus,
|
|
|
getReaderAdBanner,
|
|
|
- getRecentReader
|
|
|
+ getRecentReader,
|
|
|
+ getUserInfo
|
|
|
} from "../api";
|
|
|
import {
|
|
|
clearStorageChapter,
|
|
@@ -192,7 +193,7 @@ import {
|
|
|
} from "../util";
|
|
|
import XReader from "../components/reader";
|
|
|
import bus from "../components/reader/bus.js";
|
|
|
-
|
|
|
+import goLogin from "../../src/components/gologin";
|
|
|
export default {
|
|
|
name: Reader.name,
|
|
|
components: {
|
|
@@ -671,56 +672,54 @@ export default {
|
|
|
window.history.replaceState({}, "", url);
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
- this.$nextTick(async () => {
|
|
|
- const { yun } = this.$route.query;
|
|
|
- if (yun == "1" && this.firstReader && window.navigator.standalone) {
|
|
|
- let data = await getRecentReader();
|
|
|
- if (data.bid) {
|
|
|
- this.$router.replace(
|
|
|
- `/reader?bid=${data.bid}&cid=${data.cid}&yun=&{yun}`
|
|
|
- );
|
|
|
- return;
|
|
|
- }
|
|
|
+ async created() {
|
|
|
+ let data = await getUserInfo();
|
|
|
+ if(!data.bind_phone){
|
|
|
+ goLogin();
|
|
|
+ }
|
|
|
+ const { yun,bid,cid } = this.$route.query;
|
|
|
+ if (
|
|
|
+ yun == "1" &&
|
|
|
+ window.firstName == this.$route.name &&
|
|
|
+ window.navigator.standalone
|
|
|
+ ) {
|
|
|
+ let sare = await getRecentReader();
|
|
|
+ if (sare.bid && sare.bid!= bid && sare.cid !=cid ) {
|
|
|
+ this.$router.replace(
|
|
|
+ `/reader?bid=${sare.bid}&cid=${sare.cid}&yun=${yun}`
|
|
|
+ );
|
|
|
+ return;
|
|
|
}
|
|
|
- if (!this.justifyRouter(this.$route)) return;
|
|
|
- this.href = window.location.href;
|
|
|
- // 获取书籍详情
|
|
|
- await getDetail(this.$route.query.bid).then(m => {
|
|
|
- this.bookdetail = m;
|
|
|
- this.is_on = !!m.is_on_user_shelf;
|
|
|
- });
|
|
|
+ }
|
|
|
+ if (!this.justifyRouter(this.$route)) return;
|
|
|
+ this.href = window.location.href;
|
|
|
+ // 获取书籍详情
|
|
|
+ await getDetail(this.$route.query.bid).then(m => {
|
|
|
+ this.bookdetail = m;
|
|
|
+ this.is_on = !!m.is_on_user_shelf;
|
|
|
+ });
|
|
|
|
|
|
- // 获取章节内容
|
|
|
- let isFromCatalog = !!~window.prevPage.indexOf("/catalog");
|
|
|
- let page_from = isFromCatalog ? "chapter_dir" : "";
|
|
|
+ // 获取章节内容
|
|
|
+ let isFromCatalog = !!~window.prevPage.indexOf("/catalog");
|
|
|
+ let page_from = isFromCatalog ? "chapter_dir" : "";
|
|
|
|
|
|
- this.getContent(
|
|
|
- this.$route.query.bid,
|
|
|
- this.$route.query.cid,
|
|
|
- "",
|
|
|
- page_from
|
|
|
- )
|
|
|
- .then(r => {
|
|
|
- this.text = r;
|
|
|
- this.isFromSubscribe = false;
|
|
|
+ this.getContent(this.$route.query.bid, this.$route.query.cid, "", page_from)
|
|
|
+ .then(r => {
|
|
|
+ this.text = r;
|
|
|
+ this.isFromSubscribe = false;
|
|
|
|
|
|
- if (r.sign_status) {
|
|
|
- this.showSignNoticeWrap = true;
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(r => {
|
|
|
- console.log("get content err", r);
|
|
|
- this.text = {
|
|
|
- content: r.msg
|
|
|
- };
|
|
|
- });
|
|
|
- });
|
|
|
+ if (r.sign_status) {
|
|
|
+ this.showSignNoticeWrap = true;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(r => {
|
|
|
+ console.log("get content err", r);
|
|
|
+ this.text = {
|
|
|
+ content: r.msg
|
|
|
+ };
|
|
|
+ });
|
|
|
},
|
|
|
async beforeRouteEnter(to, from, next) {
|
|
|
- // * 初次进入加载iframe
|
|
|
- let detail = null;
|
|
|
- let u = navigator.userAgent;
|
|
|
if (from.name !== BookCatalog.name && from.name !== Subscribe.name) {
|
|
|
// 清除所有和章节相关的缓存
|
|
|
clearStorageChapter();
|