优化
This commit is contained in:
parent
108fdcf3f2
commit
f709ef5204
@ -176,12 +176,20 @@
|
|||||||
// 长安删除多个
|
// 长安删除多个
|
||||||
swipeActionLongpress(row) {
|
swipeActionLongpress(row) {
|
||||||
if (!this.swipeActionBatch) {
|
if (!this.swipeActionBatch) {
|
||||||
const swipeActionList = [...this.swipeActionList];
|
// setTimeout(() => {
|
||||||
if (swipeActionList.indexOf(row.id) != -1) {
|
// uni.hideTabBar({
|
||||||
this.swipeActionList = swipeActionList.filter((m) => m != row.id);;
|
// animation: true
|
||||||
} else {
|
// })
|
||||||
this.swipeActionList = [...swipeActionList, row.id];
|
// this.swipeActionBatch = true;
|
||||||
}
|
// this.swipeActionList = [];
|
||||||
|
// this.$emit('bookshelfContentBodyZindexFn', 999);
|
||||||
|
// }, 1000)
|
||||||
|
// const swipeActionList = [...this.swipeActionList];
|
||||||
|
// if (swipeActionList.indexOf(row.id) != -1) {
|
||||||
|
// this.swipeActionList = swipeActionList.filter((m) => m != row.id);;
|
||||||
|
// } else {
|
||||||
|
// this.swipeActionList = [...swipeActionList, row.id];
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
<view class="classification_content">
|
<view class="classification_content">
|
||||||
<CommNavBar :navBarList="navBarList" @navBarClick="handelCommNavBar" :navBarActive="navBarActive" />
|
<CommNavBar :navBarList="navBarList" @navBarClick="handelCommNavBar" :navBarActive="navBarActive" />
|
||||||
<view class="classification_content_body">
|
<view class="classification_content_body">
|
||||||
|
|
||||||
<view class="classification_body_btn_list">
|
<view class="classification_body_btn_list">
|
||||||
|
<!-- <u-tabs :list="oneTitleList" lineColor="#FF728F" :inactiveStyle="inactiveStyle"></u-tabs> -->
|
||||||
<scroll-view scroll-x="true" class="btn_list_scroll_view">
|
<scroll-view scroll-x="true" class="btn_list_scroll_view">
|
||||||
<view :class="[`btn_list_scroll_view_item`,oneTitleActive == m.id?'active':''] "
|
<view :class="[`btn_list_scroll_view_item`,oneTitleActive == m.id?'active':''] "
|
||||||
v-for="m in oneTitleList" :key="m.id" :data-id="m.id" @tap="handelOneTitle">{{m.title}}
|
v-for="m in oneTitleList" :key="m.id" :data-id="m.id" @tap="handelOneTitle">{{m.name}}
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
@ -33,6 +33,12 @@
|
|||||||
import {
|
import {
|
||||||
baseUrlImage
|
baseUrlImage
|
||||||
} from '@/utils/utils';
|
} from '@/utils/utils';
|
||||||
|
|
||||||
|
const inactiveStyle = {
|
||||||
|
color: '#222222',
|
||||||
|
fontSize:'32rpx'
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
CommNavBar,
|
CommNavBar,
|
||||||
@ -47,7 +53,8 @@
|
|||||||
navBarActive: '1',
|
navBarActive: '1',
|
||||||
searchBooksList: [],
|
searchBooksList: [],
|
||||||
oneTitleActive: 0,
|
oneTitleActive: 0,
|
||||||
oneTitleList: []
|
oneTitleList: [],
|
||||||
|
inactiveStyle: inactiveStyle
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
@ -58,11 +65,16 @@
|
|||||||
const data = {}
|
const data = {}
|
||||||
uni.$u.http.post('/getCategory', data).then((res) => {
|
uni.$u.http.post('/getCategory', data).then((res) => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
if (res.status == 1) {
|
if (res.status == 1 && Array.isArray(res.data.list)) {
|
||||||
const list = res.data.list;
|
const list = res.data.list.map((m) => {
|
||||||
|
return {
|
||||||
|
...m,
|
||||||
|
name: m.title,
|
||||||
|
}
|
||||||
|
});
|
||||||
this.oneTitleList = [{
|
this.oneTitleList = [{
|
||||||
id: '0',
|
id: '0',
|
||||||
title: '全部'
|
name: '全部',
|
||||||
}, ...list];
|
}, ...list];
|
||||||
}
|
}
|
||||||
this.getBooks(0, 0);
|
this.getBooks(0, 0);
|
||||||
@ -137,8 +149,6 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.classification_body_btn_list {
|
.classification_body_btn_list {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0 32rpx 32rpx;
|
padding: 0 32rpx 32rpx;
|
||||||
@ -190,7 +200,6 @@
|
|||||||
|
|
||||||
.scroll_y_item {
|
.scroll_y_item {
|
||||||
|
|
||||||
|
|
||||||
._book_list_box {
|
._book_list_box {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
// display: flex;
|
// display: flex;
|
||||||
|
1014
pages/novelReading/novelReading - 副本 (5).vue
Normal file
1014
pages/novelReading/novelReading - 副本 (5).vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -10,12 +10,12 @@
|
|||||||
:line-height="defaultCharactersLineHeight" :color="novelContentColor" :bg-color="bodyReadingBg"
|
:line-height="defaultCharactersLineHeight" :color="novelContentColor" :bg-color="bodyReadingBg"
|
||||||
:slide="20" :enablePreload="false" @loadmore="loadmoreContent" @clickTo="handelShowStepUp"
|
:slide="20" :enablePreload="false" @loadmore="loadmoreContent" @clickTo="handelShowStepUp"
|
||||||
:clickOption="{width:200,height: 400,left:'auto',top:'auto'}" :topGap="0" :bottomGap="20"
|
:clickOption="{width:200,height: 400,left:'auto',top:'auto'}" :topGap="0" :bottomGap="20"
|
||||||
@change="currentChange">
|
@change="currentChange" :readChapterFlag="readChapterFlag">
|
||||||
<template slot="test">
|
<template slot="test">
|
||||||
<view class="balance_con">
|
<view class="balance_con">
|
||||||
<rich-text class="balance_con_rich_text"
|
<rich-text class="balance_con_rich_text"
|
||||||
:style="`color:${novelContentColor};font-size:${newCharactersSize}px;`"
|
:style="`color:${novelContentColor};font-size:${newCharactersSize}px;`"
|
||||||
:nodes="readChapterInfoObj.content"></rich-text>
|
:nodes="readChapterInfoObj.isContent"></rich-text>
|
||||||
<view class="balance_recharge_option"></view>
|
<view class="balance_recharge_option"></view>
|
||||||
<view class="balance_recharge" :style="`background:${bodyReadingBg}`">
|
<view class="balance_recharge" :style="`background:${bodyReadingBg}`">
|
||||||
<view class="balance_tips" :style="`color:${novelContentColor}`">
|
<view class="balance_tips" :style="`color:${novelContentColor}`">
|
||||||
@ -49,8 +49,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u_popup_all">
|
<view class="u_popup_all">
|
||||||
<u-popup :show="navbarPopupShow" @close="directoryPopupClose" mode="top" :overlay="false"
|
<u-popup :show="navbarPopupShow" mode="top" :overlay="false" bgColor="transparent">
|
||||||
bgColor="transparent">
|
|
||||||
<u-navbar :title="bookInfo.title" @rightClick="rightClick" :autoBack="true" :fixed="false"
|
<u-navbar :title="bookInfo.title" @rightClick="rightClick" :autoBack="true" :fixed="false"
|
||||||
:bgColor="mainBodyBg" :titleStyle="{ color: navigationBarTitleTextColor }"
|
:bgColor="mainBodyBg" :titleStyle="{ color: navigationBarTitleTextColor }"
|
||||||
:leftIconColor="navigationBarTitleTextBackColor" :shadow="true" :safeAreaInsetTop="true"
|
:leftIconColor="navigationBarTitleTextBackColor" :shadow="true" :safeAreaInsetTop="true"
|
||||||
@ -62,12 +61,12 @@
|
|||||||
<view class="reading_schedule_body">
|
<view class="reading_schedule_body">
|
||||||
<view class="_previous_chapter"
|
<view class="_previous_chapter"
|
||||||
:style="`color:${previousChapterBbuttonTextColor};background:${previousChapterBbuttonBg}`"
|
:style="`color:${previousChapterBbuttonTextColor};background:${previousChapterBbuttonBg}`"
|
||||||
@tap="previousChapter">
|
@tap="upperNextChapter('upper')">
|
||||||
上一章
|
上一章
|
||||||
</view>
|
</view>
|
||||||
<view class="_next_chapter"
|
<view class="_next_chapter"
|
||||||
:style="`color:${nextChapterBbuttonTextColor};background:${nextChapterBbuttonBg}`"
|
:style="`color:${nextChapterBbuttonTextColor};background:${nextChapterBbuttonBg}`"
|
||||||
@tap="nextChapter">下一章
|
@tap.prevent="upperNextChapter('next')">下一章
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="my_tabBar_Reading" :style="`background:${bodyReadingBg}`">
|
<view class="my_tabBar_Reading" :style="`background:${bodyReadingBg}`">
|
||||||
@ -122,6 +121,16 @@
|
|||||||
@tap="handelCharactersSize">
|
@tap="handelCharactersSize">
|
||||||
默认</view>
|
默认</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- <view class="step_up_item mt40rpx">
|
||||||
|
<view class="step_up_item_name" :style="`color:${dialogTextColor}`">翻页</view>
|
||||||
|
<view class="step_up_item_text_bg"
|
||||||
|
:style="`color:${dialogTextColor};background:${dialogATextBg}`"
|
||||||
|
@tap="handelPageType('real')">仿真</view>
|
||||||
|
<view class="step_up_item_text_bg"
|
||||||
|
:style="`color:${dialogTextColor};background:${dialogATextBg}`"
|
||||||
|
@tap="handelPageType('cover')">平移
|
||||||
|
</view>
|
||||||
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view style="height: 140rpx" />
|
<view style="height: 140rpx" />
|
||||||
</view>
|
</view>
|
||||||
@ -211,14 +220,15 @@
|
|||||||
// 小说信息
|
// 小说信息
|
||||||
novelReadingContentText: [],
|
novelReadingContentText: [],
|
||||||
charactersPageType: 'real',
|
charactersPageType: 'real',
|
||||||
defaultCharactersSize: 28,
|
defaultCharactersSize: 26,
|
||||||
newCharactersSize: 28,
|
newCharactersSize: 26,
|
||||||
defaultCharactersLineHeight: 20,
|
defaultCharactersLineHeight: 20,
|
||||||
readDirectoryActive: '',
|
readDirectoryActive: '',
|
||||||
readChapterid: '',
|
readChapterid: '',
|
||||||
readChapterInfoObj: {},
|
readChapterInfoObj: {},
|
||||||
readChapterLastid: '',
|
readChapterLastid: '',
|
||||||
readChapterNextid: '',
|
readChapterNextid: '',
|
||||||
|
readChapterFlag: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
@ -252,16 +262,17 @@
|
|||||||
const booksDirectorySid = this.booksDirectorySid;
|
const booksDirectorySid = this.booksDirectorySid;
|
||||||
const booksDirectoryPage = this.booksDirectoryPage;
|
const booksDirectoryPage = this.booksDirectoryPage;
|
||||||
const readChapterid = this.readChapterid ? this.readChapterid : '';
|
const readChapterid = this.readChapterid ? this.readChapterid : '';
|
||||||
const newReadChapterInfoObj = await this.isGetBookInfo(readChapterid);
|
this.isGetReadChapter(readChapterid);
|
||||||
this.novelReadingContentText = [newReadChapterInfoObj];
|
// const newReadChapterInfoObj = await this.isGetBookInfo(readChapterid);
|
||||||
this.readDirectoryActive = newReadChapterInfoObj.chapterorder;
|
// this.novelReadingContentText = [newReadChapterInfoObj];
|
||||||
this.readChapterLastid = newReadChapterInfoObj.lastid;
|
// this.readDirectoryActive = newReadChapterInfoObj.chapterorder;
|
||||||
this.readChapterNextid = newReadChapterInfoObj.nextid;
|
// this.readChapterLastid = newReadChapterInfoObj.lastid;
|
||||||
this.$refs.yingbingReadPage.init({
|
// this.readChapterNextid = newReadChapterInfoObj.nextid;
|
||||||
contents: [newReadChapterInfoObj],
|
// this.$refs.yingbingReadPage.init({
|
||||||
start: 0,
|
// contents: [newReadChapterInfoObj],
|
||||||
currentChapter: newReadChapterInfoObj.chapterorder
|
// start: 0,
|
||||||
})
|
// currentChapter: newReadChapterInfoObj.chapterorder
|
||||||
|
// })
|
||||||
},
|
},
|
||||||
isGetBookInfo(chapterId) {
|
isGetBookInfo(chapterId) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
@ -280,10 +291,12 @@
|
|||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
if (res.status == 1) {
|
if (res.status == 1) {
|
||||||
const resData = res.data;
|
const resData = res.data;
|
||||||
const is_novel_content = resData.novel_content.replace(/<\/p>/g, '\n')
|
const is_novel_content = resData.novel_content.replace(/<\/p>/g, '\n');
|
||||||
|
const isContent = is_novel_content.replace(/<p>/g, '');
|
||||||
const readChapterInfoObj = {
|
const readChapterInfoObj = {
|
||||||
...resData,
|
...resData,
|
||||||
content: is_novel_content.replace(/<p>/g, ''),
|
content: isContent,
|
||||||
|
isContent: isContent,
|
||||||
isStart: resData.lastid == '' ? true : false,
|
isStart: resData.lastid == '' ? true : false,
|
||||||
isEnd: resData.nextid == '' ? true : false,
|
isEnd: resData.nextid == '' ? true : false,
|
||||||
chapter: resData.chapterorder,
|
chapter: resData.chapterorder,
|
||||||
@ -291,7 +304,7 @@
|
|||||||
isTitle: resData.title
|
isTitle: resData.title
|
||||||
// richTextNodes: `<h3>${res.data.chaptername}</h3></br>${res.data.novel_content}`
|
// richTextNodes: `<h3>${res.data.chaptername}</h3></br>${res.data.novel_content}`
|
||||||
};
|
};
|
||||||
this.readChapterInfoObj = readChapterInfoObj;
|
// this.readChapterInfoObj = readChapterInfoObj;
|
||||||
resolve(readChapterInfoObj);
|
resolve(readChapterInfoObj);
|
||||||
}
|
}
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
@ -302,128 +315,153 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
async loadmoreContent(chapter, callback) {
|
async loadmoreContent(chapter, callback) {
|
||||||
|
console.log(chapter, "loadmoreContent")
|
||||||
|
const newNovelReadingContentText = this.novelReadingContentText;
|
||||||
const newReadDirectoryActive = this.readDirectoryActive;
|
const newReadDirectoryActive = this.readDirectoryActive;
|
||||||
const newReadChapterLastid = this.readChapterLastid;
|
const newReadChapterLastid = this.readChapterLastid;
|
||||||
const newNovelReadingContentText = this.novelReadingContentText;
|
|
||||||
const newReadChapterNextid = this.readChapterNextid;
|
const newReadChapterNextid = this.readChapterNextid;
|
||||||
|
const newReadChapterInfoObj = this.readChapterInfoObj;
|
||||||
|
console.log(newReadChapterInfoObj, "loadmoreContent________________")
|
||||||
|
let chapterId = '';
|
||||||
if (chapter < newReadDirectoryActive) {
|
if (chapter < newReadDirectoryActive) {
|
||||||
const readChapterInfoObj = await this.isGetBookInfo(newReadChapterLastid);
|
chapterId = newReadChapterLastid;
|
||||||
this.novelReadingContentText = [...newNovelReadingContentText, readChapterInfoObj];
|
} else if (chapter > newReadDirectoryActive) {
|
||||||
|
chapterId = newReadChapterNextid
|
||||||
|
}
|
||||||
|
const readChapterInfoObj = await this.isGetBookInfo(chapterId);
|
||||||
|
let newReadInfoObj = {};
|
||||||
if (readChapterInfoObj.chackpay == 1) {
|
if (readChapterInfoObj.chackpay == 1) {
|
||||||
callback('success', readChapterInfoObj);
|
newReadInfoObj = {
|
||||||
|
...readChapterInfoObj
|
||||||
|
}
|
||||||
|
callback('success', newReadInfoObj);
|
||||||
}
|
}
|
||||||
if (readChapterInfoObj.chackpay == 2 || readChapterInfoObj.chackpay == 3) {
|
if (readChapterInfoObj.chackpay == 2 || readChapterInfoObj.chackpay == 3) {
|
||||||
const custom = [`slot:test`];
|
const custom = [`slot:test`];
|
||||||
const obj = {
|
newReadInfoObj = {
|
||||||
...readChapterInfoObj,
|
...readChapterInfoObj,
|
||||||
custom,
|
custom,
|
||||||
content: '',
|
content: '',
|
||||||
}
|
}
|
||||||
callback('success', obj);
|
callback('success', newReadInfoObj);
|
||||||
}
|
}
|
||||||
}
|
const flag = newNovelReadingContentText.some((m) => m.id == readChapterInfoObj.id);
|
||||||
if (chapter > newReadDirectoryActive) {
|
let listContents = newNovelReadingContentText;
|
||||||
const readChapterInfoObj = await this.isGetBookInfo(newReadChapterNextid);
|
if (!flag) {
|
||||||
this.novelReadingContentText = [readChapterInfoObj, ...newNovelReadingContentText];
|
if (chapter < newReadDirectoryActive) {
|
||||||
if (readChapterInfoObj.chackpay == 1) {
|
listContents = [newReadInfoObj, ...newNovelReadingContentText];
|
||||||
callback('success', readChapterInfoObj);
|
} else if (chapter > newReadDirectoryActive) {
|
||||||
}
|
listContents = [...newNovelReadingContentText, newReadInfoObj];
|
||||||
if (readChapterInfoObj.chackpay == 2 || readChapterInfoObj.chackpay == 3) {
|
|
||||||
const custom = [`slot:test`];
|
|
||||||
const obj = {
|
|
||||||
...readChapterInfoObj,
|
|
||||||
custom,
|
|
||||||
content: '',
|
|
||||||
}
|
|
||||||
callback('success', obj);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.novelReadingContentText = listContents;
|
||||||
},
|
},
|
||||||
currentChange(pageInfo) {
|
currentChange(pageInfo) {
|
||||||
const novelReadingContentText = this.novelReadingContentText;
|
const novelReadingContentText = this.novelReadingContentText;
|
||||||
const chapter = pageInfo.chapter;
|
const chapter = pageInfo.chapter;
|
||||||
const itemTemp = novelReadingContentText.filter((m) => m.chapter == chapter);
|
console.log(pageInfo, chapter, pageInfo.nextid, "currentChange")
|
||||||
this.readChapterLastid = itemTemp[0].lastid;
|
|
||||||
this.readChapterNextid = itemTemp[0].nextid;
|
|
||||||
this.readingPopupshow = false;
|
|
||||||
this.navbarPopupShow = false;
|
|
||||||
this.readDirectoryActive = chapter;
|
this.readDirectoryActive = chapter;
|
||||||
this.readChapterInfoObj = itemTemp[0];
|
novelReadingContentText.forEach((m) => {
|
||||||
|
if (m.chapter == chapter) {
|
||||||
|
this.readChapterLastid = m.lastid;
|
||||||
|
this.readChapterNextid = m.nextid;
|
||||||
|
this.readChapterInfoObj = m;
|
||||||
|
if (m.isvip == 1) {
|
||||||
|
this.readChapterFlag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
async previousChapter() {
|
upperNextChapter(type) {
|
||||||
const newReadDirectoryActive = this.readDirectoryActive;
|
// const newNovelReadingContentText = this.novelReadingContentText;
|
||||||
|
// const newReadDirectoryActive = this.readDirectoryActive;
|
||||||
|
// const newReadChapterInfoObj = this.readChapterInfoObj;
|
||||||
const newReadChapterLastid = this.readChapterLastid;
|
const newReadChapterLastid = this.readChapterLastid;
|
||||||
const newNovelReadingContentText = this.novelReadingContentText;
|
const newReadChapterNextid = this.readChapterNextid;
|
||||||
if (!newReadChapterLastid) {
|
// console.log(newReadDirectoryActive, "=========")
|
||||||
uni.showToast({
|
let chapterId = '';
|
||||||
icon: 'none',
|
if (type == 'upper') {
|
||||||
title: "已经是第一章了",
|
chapterId = newReadChapterLastid;
|
||||||
})
|
} else if (type == 'next') {
|
||||||
return
|
// if (newReadChapterInfoObj.isvip == 1) {
|
||||||
|
// uni.showToast({
|
||||||
|
// icon: 'none',
|
||||||
|
// title: '当前章节未解锁,暂不支持跳章节观看',
|
||||||
|
// })
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
chapterId = newReadChapterNextid;
|
||||||
}
|
}
|
||||||
const readChapterInfoObj = await this.isGetBookInfo(newReadChapterLastid);
|
this.isGetReadChapter(chapterId);
|
||||||
this.novelReadingContentText = [readChapterInfoObj];
|
|
||||||
if (readChapterInfoObj.chackpay == 1) {
|
|
||||||
this.$refs.yingbingReadPage.init({
|
|
||||||
contents: [readChapterInfoObj],
|
|
||||||
start: 0,
|
|
||||||
currentChapter: newReadDirectoryActive - 1,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (readChapterInfoObj.chackpay == 2 || readChapterInfoObj.chackpay == 3) {
|
|
||||||
const custom = [`slot:test`];
|
|
||||||
const obj = {
|
|
||||||
...readChapterInfoObj,
|
|
||||||
custom,
|
|
||||||
content: ''
|
|
||||||
}
|
|
||||||
this.$refs.yingbingReadPage.init({
|
|
||||||
contents: [obj],
|
|
||||||
start: 0,
|
|
||||||
currentChapter: newReadDirectoryActive - 1,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.readDirectoryActive = newReadDirectoryActive - 1;
|
|
||||||
},
|
},
|
||||||
async nextChapter() {
|
isBooksObj(booksObj) {
|
||||||
const newReadDirectoryActive = this.readDirectoryActive;
|
let newBooksObj = {}
|
||||||
const readChapterNextid = this.readChapterNextid;
|
if (booksObj.chackpay == 1) {
|
||||||
const newNovelReadingContentText = this.novelReadingContentText;
|
newBooksObj = {
|
||||||
if (!readChapterNextid) {
|
...booksObj
|
||||||
uni.showToast({
|
|
||||||
icon: 'none',
|
|
||||||
title: "已经是最后一章了~"
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
const readChapterInfoObj = await this.isGetBookInfo(readChapterNextid);
|
|
||||||
this.novelReadingContentText = [readChapterInfoObj];
|
|
||||||
if (readChapterInfoObj.chackpay == 1) {
|
|
||||||
this.$refs.yingbingReadPage.init({
|
|
||||||
contents: [readChapterInfoObj],
|
|
||||||
start: 0,
|
|
||||||
currentChapter: newReadDirectoryActive + 1
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if (readChapterInfoObj.chackpay == 2 || readChapterInfoObj.chackpay == 3) {
|
if (booksObj.chackpay == 2 || booksObj.chackpay == 3) {
|
||||||
const custom = [`slot:test`];
|
const custom = [`slot:test`];
|
||||||
const obj = {
|
newBooksObj = {
|
||||||
...readChapterInfoObj,
|
...booksObj,
|
||||||
custom,
|
custom,
|
||||||
content: ''
|
content: '',
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return newBooksObj;
|
||||||
|
},
|
||||||
|
async isGetReadChapter(chapterId, type) {
|
||||||
|
let lastObj = {};
|
||||||
|
let nextObj = {};
|
||||||
|
let newReadInfoObj = {};
|
||||||
|
const newNovelReadingContentText = this.novelReadingContentText;
|
||||||
|
const resTemp = await this.isGetBookInfo(chapterId);
|
||||||
|
if (resTemp.lastid) {
|
||||||
|
const lastIdx = newNovelReadingContentText.findIndex((m) => m.lastid = resTemp.lastid);
|
||||||
|
if (lastIdx != -1) {
|
||||||
|
newReadInfoObj = newNovelReadingContentText[lastIdx];
|
||||||
|
} else {
|
||||||
|
const resLastObj = await this.isGetBookInfo(resTemp.lastid);
|
||||||
|
lastObj = this.isBooksObj(resLastObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (resTemp.nextid) {
|
||||||
|
const lastIdx = newNovelReadingContentText.findIndex((m) => m.nextid = resTemp.nextid);
|
||||||
|
if (lastIdx != -1) {
|
||||||
|
nextObj = newNovelReadingContentText[lastIdx];
|
||||||
|
} else {
|
||||||
|
const resNextObj = await this.isGetBookInfo(resTemp.nextid);
|
||||||
|
nextObj = this.isBooksObj(resNextObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newReadInfoObj = this.isBooksObj(resTemp);
|
||||||
|
const flag = newNovelReadingContentText.some((m) => m.id == newReadInfoObj.id);
|
||||||
|
let listContents = newNovelReadingContentText;
|
||||||
|
if (!flag) {
|
||||||
|
if (type == 'upper') {
|
||||||
|
listContents = [newReadInfoObj, ...newNovelReadingContentText, ];
|
||||||
|
} else if (type == 'next') {
|
||||||
|
listContents = [...newNovelReadingContentText, newReadInfoObj];
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
listContents = [lastObj, newReadInfoObj, nextObj]
|
||||||
|
}
|
||||||
|
this.novelReadingContentText = listContents;
|
||||||
|
this.readChapterInfoObj = newReadInfoObj;
|
||||||
this.$refs.yingbingReadPage.init({
|
this.$refs.yingbingReadPage.init({
|
||||||
contents: [obj],
|
contents: [lastObj, newReadInfoObj, nextObj],
|
||||||
start: 0,
|
start: 0,
|
||||||
currentChapter: newReadDirectoryActive + 1
|
currentChapter: newReadInfoObj.chapter,
|
||||||
});
|
})
|
||||||
}
|
this.readDirectoryActive = newReadInfoObj.chapterorder;
|
||||||
this.readDirectoryActive = newReadDirectoryActive + 1;
|
this.readChapterLastid = newReadInfoObj.lastid;
|
||||||
|
this.readChapterNextid = newReadInfoObj.nextid;
|
||||||
},
|
},
|
||||||
handelDirectoryItem(row) {},
|
handelDirectoryItem(row) {},
|
||||||
handelShowStepUp() {
|
handelShowStepUp() {
|
||||||
this.readingPopupshow = !this.readingPopupshow;
|
this.readingPopupshow = !this.readingPopupshow;
|
||||||
this.navbarPopupShow = !this.navbarPopupShow;
|
// this.navbarPopupShow = !this.navbarPopupShow;
|
||||||
this.stepUpPopupShow = false;
|
this.stepUpPopupShow = false;
|
||||||
},
|
},
|
||||||
handelDirectoryPopup() {
|
handelDirectoryPopup() {
|
||||||
@ -487,22 +525,22 @@
|
|||||||
// 字体减小
|
// 字体减小
|
||||||
reduceCharactersSize() {
|
reduceCharactersSize() {
|
||||||
const newCharactersSize = this.newCharactersSize;
|
const newCharactersSize = this.newCharactersSize;
|
||||||
this.newCharactersSize = newCharactersSize - 2;
|
this.newCharactersSize = newCharactersSize - 1;
|
||||||
const novelMainObj = myGetStorage('novelMainObj') || '{}';
|
const novelMainObj = myGetStorage('novelMainObj') || '{}';
|
||||||
const obj = {
|
const obj = {
|
||||||
...JSON.parse(novelMainObj),
|
...JSON.parse(novelMainObj),
|
||||||
charactersSize: newCharactersSize - 2,
|
charactersSize: newCharactersSize - 1,
|
||||||
}
|
}
|
||||||
mySetStorage('novelMainObj', JSON.stringify(obj));
|
mySetStorage('novelMainObj', JSON.stringify(obj));
|
||||||
},
|
},
|
||||||
// 字体加大
|
// 字体加大
|
||||||
addCharactersSize() {
|
addCharactersSize() {
|
||||||
const newCharactersSize = this.newCharactersSize;
|
const newCharactersSize = this.newCharactersSize;
|
||||||
this.newCharactersSize = newCharactersSize + 2;
|
this.newCharactersSize = newCharactersSize + 1;
|
||||||
const novelMainObj = myGetStorage('novelMainObj') || '{}';
|
const novelMainObj = myGetStorage('novelMainObj') || '{}';
|
||||||
const obj = {
|
const obj = {
|
||||||
...JSON.parse(novelMainObj),
|
...JSON.parse(novelMainObj),
|
||||||
charactersSize: newCharactersSize + 2,
|
charactersSize: newCharactersSize + 1,
|
||||||
}
|
}
|
||||||
mySetStorage('novelMainObj', JSON.stringify(obj));
|
mySetStorage('novelMainObj', JSON.stringify(obj));
|
||||||
},
|
},
|
||||||
@ -516,6 +554,10 @@
|
|||||||
charactersSize: defaultCharactersSize,
|
charactersSize: defaultCharactersSize,
|
||||||
}
|
}
|
||||||
mySetStorage('novelMainObj', JSON.stringify(obj));
|
mySetStorage('novelMainObj', JSON.stringify(obj));
|
||||||
|
this.$refs.yingbingReadPage.refresh();
|
||||||
|
},
|
||||||
|
handelPageType(type) {
|
||||||
|
this.charactersPageType = type;
|
||||||
},
|
},
|
||||||
// // 目录划到了最上边
|
// // 目录划到了最上边
|
||||||
// directoryPopupUpper() {
|
// directoryPopupUpper() {
|
||||||
@ -602,7 +644,7 @@
|
|||||||
} = isGetSystemInfo();
|
} = isGetSystemInfo();
|
||||||
// this.myData = myData;
|
// this.myData = myData;
|
||||||
this.novelMainTypeColor = novelMainTypeColor;
|
this.novelMainTypeColor = novelMainTypeColor;
|
||||||
this.newCharactersSize = JSON.parse(novelMainObj).charactersSize || 28;
|
this.newCharactersSize = JSON.parse(novelMainObj).charactersSize || 26;
|
||||||
this.setUpColorAll = setUpReadingColorAll;
|
this.setUpColorAll = setUpReadingColorAll;
|
||||||
this.barPopupIcon = {
|
this.barPopupIcon = {
|
||||||
'F3EFE9': {
|
'F3EFE9': {
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
}">
|
}">
|
||||||
<yingbing-flip ref="flip" class="yingbing-read-page-flip" :data="pages" :current="current"
|
<yingbing-flip ref="flip" class="yingbing-read-page-flip" :data="pages" :current="current"
|
||||||
:bgColor="bgColor" :duration="300" :unableClickPage="unableClickPage" :type="pageType"
|
:bgColor="bgColor" :duration="300" :unableClickPage="unableClickPage" :type="pageType"
|
||||||
@change="handleFlipChangeRender">
|
@change="handleFlipChangeRender" :readChapterFlag="readChapterFlag">
|
||||||
<!-- #ifdef MP -->
|
<!-- #ifdef MP -->
|
||||||
<template v-for="(item, index) in pages" :slot="index">
|
<template v-for="(item, index) in pages" :slot="index">
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
@ -301,6 +301,11 @@
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
// 是否能继续阅读后续章节
|
||||||
|
readChapterFlag: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
//翻页方式
|
//翻页方式
|
||||||
pageType: {
|
pageType: {
|
||||||
type: String,
|
type: String,
|
||||||
@ -397,6 +402,7 @@
|
|||||||
options() {
|
options() {
|
||||||
return {
|
return {
|
||||||
unableClickPage: this.unableClickPage,
|
unableClickPage: this.unableClickPage,
|
||||||
|
readChapterFlag: this.readChapterFlag,
|
||||||
pageType: this.pageType,
|
pageType: this.pageType,
|
||||||
color: this.color,
|
color: this.color,
|
||||||
bgColor: this.bgColor,
|
bgColor: this.bgColor,
|
||||||
@ -536,7 +542,7 @@
|
|||||||
}, 100)
|
}, 100)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.isRefreshing = true
|
this.isRefreshing = true;
|
||||||
this.resetPage({
|
this.resetPage({
|
||||||
start: this.pageInfo.start,
|
start: this.pageInfo.start,
|
||||||
currentChapter: this.pageInfo.chapter
|
currentChapter: this.pageInfo.chapter
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
function touchstart (event, ins) {
|
function touchstart(event, ins) {
|
||||||
var state = ins.getState()
|
var state = ins.getState()
|
||||||
if ( state.isTouch || state.disableTouch ) {
|
if (state.isTouch || state.disableTouch) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
state.isTouch = true
|
state.isTouch = true
|
||||||
@ -11,37 +11,48 @@ function touchstart (event, ins) {
|
|||||||
state.startX = touch.pageX
|
state.startX = touch.pageX
|
||||||
state.startY = touch.pageY
|
state.startY = touch.pageY
|
||||||
}
|
}
|
||||||
function touchmove (event, ins) {
|
|
||||||
var state = ins.getState()
|
function touchmove(event, ins) {
|
||||||
if ( state.isTouch && !state.disableTouch ) {
|
var state = ins.getState();
|
||||||
|
if (state.isTouch && !state.disableTouch) {
|
||||||
var touch = event.touches[0]
|
var touch = event.touches[0]
|
||||||
state.offset = state.vertical ? touch.pageY - state.startY : touch.pageX - state.startX;
|
state.offset = state.vertical ? touch.pageY - state.startY : touch.pageX - state.startX;
|
||||||
if (state.direction) {
|
if (state.direction) {
|
||||||
var rect = ins.getBoundingClientRect()
|
var rect = ins.getBoundingClientRect()
|
||||||
var size = state.vertical ? rect.height : rect.width
|
var size = state.vertical ? rect.height : rect.width
|
||||||
state.offset = state.direction == 'next' ? state.offset + state.sliderFault : state.offset - state.sliderFault
|
state.offset = state.direction == 'next' ? state.offset + state.sliderFault : state.offset - state
|
||||||
if ( (state.offset > 0 && state.direction == 'next') || (state.offset < 0 && state.direction == 'prev') ) {
|
.sliderFault
|
||||||
|
// if (state.direction == 'next' && state.readChapterFlag) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
if ((state.offset > 0 && state.direction == 'next') || (state.offset < 0 && state.direction == 'prev')) {
|
||||||
state.offset = 0
|
state.offset = 0
|
||||||
}
|
}
|
||||||
if ( Math.abs(state.offset) <= size ) {
|
if (Math.abs(state.offset) <= size) {
|
||||||
animation(state.offset, 0, ins)
|
animation(state.offset, 0, ins)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( Math.abs(state.offset) < state.sliderFault ) {
|
if (Math.abs(state.offset) < state.sliderFault) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if ( state.offset < 0 ) {
|
if (state.offset < 0) {
|
||||||
if ( state.nextIndex < state.count && state.nextIndex != 0 ) {
|
if (state.nextIndex < state.count && state.nextIndex != 0) {
|
||||||
if ( state.type != 'none' ) {state.direction = 'next'}
|
if (state.type != 'none') {
|
||||||
} else if ( state.pullupable && state.loadingState != 'loading' && state.loadingState != 'success' && state.loadingState != 'fail' ) {
|
state.direction = 'next'
|
||||||
|
}
|
||||||
|
} else if (state.pullupable && state.loadingState != 'loading' && state.loadingState != 'success' &&
|
||||||
|
state.loadingState != 'fail') {
|
||||||
state.loadingType = 'pullup'
|
state.loadingType = 'pullup'
|
||||||
state.offset = state.offset + state.sliderFault
|
state.offset = state.offset + state.sliderFault
|
||||||
pulling(state.offset, ins)
|
pulling(state.offset, ins)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( state.prevIndex >= 0 && state.prevIndex != state.count - 1 ) {
|
if (state.prevIndex >= 0 && state.prevIndex != state.count - 1) {
|
||||||
if ( state.type != 'none' ) {state.direction = 'prev'}
|
if (state.type != 'none') {
|
||||||
} else if ( state.pulldownable && state.loadingState != 'loading' && state.loadingState != 'success' && state.loadingState != 'fail' ) {
|
state.direction = 'prev'
|
||||||
|
}
|
||||||
|
} else if (state.pulldownable && state.loadingState != 'loading' && state.loadingState != 'success' &&
|
||||||
|
state.loadingState != 'fail') {
|
||||||
state.loadingType = 'pulldown'
|
state.loadingType = 'pulldown'
|
||||||
state.offset = state.offset - state.sliderFault
|
state.offset = state.offset - state.sliderFault
|
||||||
pulling(state.offset, ins)
|
pulling(state.offset, ins)
|
||||||
@ -50,35 +61,46 @@ function touchmove (event, ins) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function touchend (event, ins) {
|
|
||||||
|
function touchend(event, ins) {
|
||||||
touchaction(event, ins)
|
touchaction(event, ins)
|
||||||
}
|
}
|
||||||
function touchcancel (event, ins) {
|
|
||||||
|
function touchcancel(event, ins) {
|
||||||
touchaction(event, ins)
|
touchaction(event, ins)
|
||||||
}
|
}
|
||||||
function touchaction (event, ins,isFlipTo) {
|
|
||||||
var state = ins.getState()
|
function touchaction(event, ins, isFlipTo) {
|
||||||
|
var state = ins.getState();
|
||||||
clearInterval(ins)
|
clearInterval(ins)
|
||||||
if ( state.isTouch && !state.disableTouch ) {
|
if (state.isTouch && !state.disableTouch) {
|
||||||
var rect = ins.getBoundingClientRect()
|
var rect = ins.getBoundingClientRect()
|
||||||
var size = state.vertical ? rect.height : rect.width
|
var size = state.vertical ? rect.height : rect.width
|
||||||
var start = state.vertical ? state.startY : state.startX
|
var start = state.vertical ? state.startY : state.startX
|
||||||
if ( !state.direction && state.touchTime <= 200 && (!state.unableClickPage || state.type == 'none') && !isFlipTo ) {
|
if (!state.direction && state.touchTime <= 200 && (!state.unableClickPage || state.type == 'none') && !
|
||||||
|
isFlipTo) {
|
||||||
//获取点击位置,判断向哪里翻页
|
//获取点击位置,判断向哪里翻页
|
||||||
if (start > (size / 4) * 3 && state.nextIndex < state.count && state.nextIndex != 0 ) {
|
if (start > (size / 4) * 3 && state.nextIndex < state.count && state.nextIndex != 0) {
|
||||||
state.direction = 'next'
|
state.direction = 'next';
|
||||||
}
|
}
|
||||||
if (start < (size / 4) && state.prevIndex >= 0 && state.prevIndex != state.count - 1 ) {
|
if (start < (size / 4) && state.prevIndex >= 0 && state.prevIndex != state.count - 1) {
|
||||||
state.direction = 'prev'
|
state.direction = 'prev'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (state.direction) {
|
if (state.direction) {
|
||||||
|
// if (state.direction = 'next' && state.readChapterFlag) {
|
||||||
|
// uni.showToast({
|
||||||
|
// icon: 'none',
|
||||||
|
// title: '当前章节未解锁,暂不支持跳章节观看',
|
||||||
|
// })
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
state.disableTouch = true
|
state.disableTouch = true
|
||||||
if (state.touchTime <= 200) {
|
if (state.touchTime <= 200) {
|
||||||
var duration = state.type == 'none' ? 0 : state.duration;
|
var duration = state.type == 'none' ? 0 : state.duration;
|
||||||
var value = state.direction == 'next' ? 1 : -1;
|
var value = state.direction == 'next' ? 1 : -1;
|
||||||
animation(-value * size, duration, ins);
|
animation(-value * size, duration, ins);
|
||||||
ins.setTimeout(function () {
|
ins.setTimeout(function() {
|
||||||
resetShadow(ins, true)
|
resetShadow(ins, true)
|
||||||
ins.callMethod('handleFlipChange', value);
|
ins.callMethod('handleFlipChange', value);
|
||||||
}, duration + 50)
|
}, duration + 50)
|
||||||
@ -87,21 +109,21 @@ function touchaction (event, ins,isFlipTo) {
|
|||||||
if (Math.abs(state.offset) >= size / 4) {
|
if (Math.abs(state.offset) >= size / 4) {
|
||||||
var value = state.direction == 'next' ? 1 : -1;
|
var value = state.direction == 'next' ? 1 : -1;
|
||||||
animation(-value * size, duration, ins);
|
animation(-value * size, duration, ins);
|
||||||
ins.setTimeout(function () {
|
ins.setTimeout(function() {
|
||||||
resetShadow(ins, true)
|
resetShadow(ins, true)
|
||||||
ins.callMethod('handleFlipChange', value);
|
ins.callMethod('handleFlipChange', value);
|
||||||
}, duration + 50)
|
}, duration + 50)
|
||||||
} else {
|
} else {
|
||||||
animation(0, duration, ins);
|
animation(0, duration, ins);
|
||||||
ins.setTimeout(function () {
|
ins.setTimeout(function() {
|
||||||
resetShadow(ins)
|
resetShadow(ins)
|
||||||
resetFlip(ins);
|
resetFlip(ins);
|
||||||
}, duration + 50)
|
}, duration + 50)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ( state.loadingState == 'default' ) {
|
} else if (state.loadingState == 'default') {
|
||||||
resetPulling(ins)
|
resetPulling(ins)
|
||||||
} else if ( state.loadingState == 'ready' ) {
|
} else if (state.loadingState == 'ready') {
|
||||||
pullingRefresh(ins)
|
pullingRefresh(ins)
|
||||||
} else {
|
} else {
|
||||||
resetShadow(ins, false)
|
resetShadow(ins, false)
|
||||||
@ -109,8 +131,9 @@ function touchaction (event, ins,isFlipTo) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function propWatcher (newVal, oldVal, ins) {
|
|
||||||
ins.setTimeout(function () {
|
function propWatcher(newVal, oldVal, ins) {
|
||||||
|
ins.setTimeout(function() {
|
||||||
var state = ins.getState()
|
var state = ins.getState()
|
||||||
state.vertical = newVal.vertical
|
state.vertical = newVal.vertical
|
||||||
state.pulldownable = newVal.pulldownable
|
state.pulldownable = newVal.pulldownable
|
||||||
@ -126,23 +149,24 @@ function propWatcher (newVal, oldVal, ins) {
|
|||||||
state.count = newVal.count
|
state.count = newVal.count
|
||||||
state.type = newVal.type
|
state.type = newVal.type
|
||||||
state.unableClickPage = newVal.unableClickPage
|
state.unableClickPage = newVal.unableClickPage
|
||||||
|
state.readChapterFlag = newVal.readChapterFlag
|
||||||
state.translate = newVal.translate
|
state.translate = newVal.translate
|
||||||
if ( oldVal && newVal.currentIndex != oldVal.currentIndex ) {
|
if (oldVal && newVal.currentIndex != oldVal.currentIndex) {
|
||||||
resetFlip(ins);
|
resetFlip(ins);
|
||||||
}
|
}
|
||||||
if ( oldVal && newVal.loadingState != oldVal.loadingState && state.loadingState ) {
|
if (oldVal && newVal.loadingState != oldVal.loadingState && state.loadingState) {
|
||||||
resetPulling(ins)
|
resetPulling(ins)
|
||||||
ins.callMethod('resetLoading')
|
ins.callMethod('resetLoading')
|
||||||
}
|
}
|
||||||
if (oldVal && newVal.flipTo != oldVal.flipTo && newVal.flipTo != 0 ) {
|
if (oldVal && newVal.flipTo != oldVal.flipTo && newVal.flipTo != 0) {
|
||||||
if ( !state.disableTouch ) {
|
if (!state.disableTouch) {
|
||||||
if ( newVal.flipTo < 0 && state.prevIndex >= 0 && (state.prevIndex != state.count - 1) ) {
|
if (newVal.flipTo < 0 && state.prevIndex >= 0 && (state.prevIndex != state.count - 1)) {
|
||||||
state.isTouch = true
|
state.isTouch = true
|
||||||
state.touchTime = 0
|
state.touchTime = 0
|
||||||
state.direction = 'prev'
|
state.direction = 'prev'
|
||||||
touchaction(null, ins, true)
|
touchaction(null, ins, true)
|
||||||
}
|
}
|
||||||
if ( newVal.flipTo > 0 && state.nextIndex < state.count && state.nextIndex != 0 ) {
|
if (newVal.flipTo > 0 && state.nextIndex < state.count && state.nextIndex != 0) {
|
||||||
state.isTouch = true
|
state.isTouch = true
|
||||||
state.touchTime = 0
|
state.touchTime = 0
|
||||||
state.direction = 'next'
|
state.direction = 'next'
|
||||||
@ -152,43 +176,48 @@ function propWatcher (newVal, oldVal, ins) {
|
|||||||
}
|
}
|
||||||
}, 100)
|
}, 100)
|
||||||
}
|
}
|
||||||
function setInterval (ins) {
|
|
||||||
|
function setInterval(ins) {
|
||||||
var state = ins.getState()
|
var state = ins.getState()
|
||||||
state.touchTimer = ins.setTimeout(function () {
|
state.touchTimer = ins.setTimeout(function() {
|
||||||
state.touchTime += 10
|
state.touchTime += 10
|
||||||
if ( state.interval ) {
|
if (state.interval) {
|
||||||
setInterval(ins)
|
setInterval(ins)
|
||||||
}
|
}
|
||||||
}, 10)
|
}, 10)
|
||||||
}
|
}
|
||||||
function clearInterval (ins) {
|
|
||||||
|
function clearInterval(ins) {
|
||||||
var state = ins.getState()
|
var state = ins.getState()
|
||||||
state.interval = false
|
state.interval = false
|
||||||
if ( state.touchTimer ) {
|
if (state.touchTimer) {
|
||||||
ins.clearTimeout(state.touchTimer)
|
ins.clearTimeout(state.touchTimer)
|
||||||
state.touchTimer = null
|
state.touchTimer = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function resetShadow (ins, isChange) {
|
|
||||||
|
function resetShadow(ins, isChange) {
|
||||||
var state = ins.getState()
|
var state = ins.getState()
|
||||||
var direction = state.direction
|
var direction = state.direction
|
||||||
if ( !direction ) {
|
if (!direction) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var index = direction == 'next' ? state.currentIndex : state.prevIndex
|
var index = direction == 'next' ? state.currentIndex : state.prevIndex
|
||||||
var translate = state.translate
|
var translate = state.translate
|
||||||
var rect = ins.getBoundingClientRect()
|
var rect = ins.getBoundingClientRect()
|
||||||
var size = state.vertical ? rect.height : rect.width;
|
var size = state.vertical ? rect.height : rect.width;
|
||||||
var draw = function () {
|
var draw = function() {
|
||||||
ins.selectComponent('.yingbing-flip-item_' + index).setStyle({
|
ins.selectComponent('.yingbing-flip-item_' + index).setStyle({
|
||||||
'box-shadow': '',
|
'box-shadow': '',
|
||||||
transform: translate + '(' + (isChange ? (direction == 'next'? -size : 0) : (direction == 'next'? 0 : -size)) + 'px)',
|
transform: translate + '(' + (isChange ? (direction == 'next' ? -size : 0) : (direction ==
|
||||||
|
'next' ? 0 : -size)) + 'px)',
|
||||||
transition: ''
|
transition: ''
|
||||||
})
|
})
|
||||||
if ( state.type == 'real' ) {
|
if (state.type == 'real') {
|
||||||
ins.selectComponent('.yingbing-flip-item-bg_' + index).setStyle({
|
ins.selectComponent('.yingbing-flip-item-bg_' + index).setStyle({
|
||||||
'box-shadow': '',
|
'box-shadow': '',
|
||||||
transform: translate + '(' + (isChange ? (direction == 'next' ? 0 : size) : (direction == 'next' ? size : 0)) + 'px)',
|
transform: translate + '(' + (isChange ? (direction == 'next' ? 0 : size) : (direction ==
|
||||||
|
'next' ? size : 0)) + 'px)',
|
||||||
transition: ''
|
transition: ''
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -199,7 +228,8 @@ function resetShadow (ins, isChange) {
|
|||||||
}
|
}
|
||||||
ins.requestAnimationFrame(draw)
|
ins.requestAnimationFrame(draw)
|
||||||
}
|
}
|
||||||
function resetFlip (ins) {
|
|
||||||
|
function resetFlip(ins) {
|
||||||
var state = ins.getState()
|
var state = ins.getState()
|
||||||
state.direction = null
|
state.direction = null
|
||||||
state.isTouch = false
|
state.isTouch = false
|
||||||
@ -209,29 +239,32 @@ function resetFlip (ins) {
|
|||||||
state.startX = 0
|
state.startX = 0
|
||||||
state.startY = 0
|
state.startY = 0
|
||||||
}
|
}
|
||||||
function animation (offset, duration, ins, noshadow) {
|
|
||||||
|
function animation(offset, duration, ins, noshadow) {
|
||||||
var state = ins.getState()
|
var state = ins.getState()
|
||||||
var rect = ins.getBoundingClientRect()
|
var rect = ins.getBoundingClientRect()
|
||||||
var size = state.vertical ? rect.height : rect.width
|
var size = state.vertical ? rect.height : rect.width
|
||||||
var translate = state.translate
|
var translate = state.translate
|
||||||
var late = offset
|
var late = offset
|
||||||
var draw = function () {
|
var draw = function() {
|
||||||
if ( state.direction == 'prev' ) {
|
if (state.direction == 'prev') {
|
||||||
if ( state.prevIndex >= 0 ) {
|
if (state.prevIndex >= 0) {
|
||||||
ins.selectComponent('.yingbing-flip-item_' + state.prevIndex).setStyle({
|
ins.selectComponent('.yingbing-flip-item_' + state.prevIndex).setStyle({
|
||||||
transform: translate + '(' + (late - size) + 'px)',
|
transform: translate + '(' + (late - size) + 'px)',
|
||||||
'box-shadow': noshadow ? '' : state.type == 'real' ? '0 0 30px 20px rgba(0,0,0,0.4)' : state.type == 'cover' ? '0 0 10px 5px rgba(0,0,0,0.3)' : '',
|
'box-shadow': noshadow ? '' : state.type == 'real' ? '0 0 30px 20px rgba(0,0,0,0.4)' :
|
||||||
|
state.type == 'cover' ? '0 0 10px 5px rgba(0,0,0,0.3)' : '',
|
||||||
transition: duration > 0 ? 'transform ' + duration + 'ms' : ''
|
transition: duration > 0 ? 'transform ' + duration + 'ms' : ''
|
||||||
})
|
})
|
||||||
if ( state.type == 'real' ) {
|
if (state.type == 'real') {
|
||||||
ins.selectComponent('.yingbing-flip-item-content_' + state.prevIndex).setStyle({
|
ins.selectComponent('.yingbing-flip-item-content_' + state.prevIndex).setStyle({
|
||||||
transform: translate + '(' + (size-late) + 'px)',
|
transform: translate + '(' + (size - late) + 'px)',
|
||||||
transition: duration > 0 ? 'transform ' + duration + 'ms' : ''
|
transition: duration > 0 ? 'transform ' + duration + 'ms' : ''
|
||||||
})
|
})
|
||||||
ins.selectComponent('.yingbing-flip-item-bg_' + state.prevIndex).setStyle({
|
ins.selectComponent('.yingbing-flip-item-bg_' + state.prevIndex).setStyle({
|
||||||
transform: translate + '(' + (late) + 'px)',
|
transform: translate + '(' + (late) + 'px)',
|
||||||
'box-shadow': noshadow ? '' : '-5px 0 20px rgba(0,0,0,0.1)',
|
'box-shadow': noshadow ? '' : '-5px 0 20px rgba(0,0,0,0.1)',
|
||||||
transition: duration > 0 ? 'transform ' + duration + 'ms, ' + 'boxShadow ' + duration + 'ms' : ''
|
transition: duration > 0 ? 'transform ' + duration + 'ms, ' + 'boxShadow ' +
|
||||||
|
duration + 'ms' : ''
|
||||||
})
|
})
|
||||||
ins.selectComponent('.yingbing-flip-item-shadow_' + state.prevIndex).setStyle({
|
ins.selectComponent('.yingbing-flip-item-shadow_' + state.prevIndex).setStyle({
|
||||||
'box-shadow': noshadow ? '' : '0 0 60px 30px rgba(0,0,0,0.4)',
|
'box-shadow': noshadow ? '' : '0 0 60px 30px rgba(0,0,0,0.4)',
|
||||||
@ -240,7 +273,7 @@ function animation (offset, duration, ins, noshadow) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( state.nextIndex < state.count ) {
|
if (state.nextIndex < state.count) {
|
||||||
ins.selectComponent('.yingbing-flip-item_' + state.nextIndex).setStyle({
|
ins.selectComponent('.yingbing-flip-item_' + state.nextIndex).setStyle({
|
||||||
transform: translate + '(0)',
|
transform: translate + '(0)',
|
||||||
transition: ''
|
transition: ''
|
||||||
@ -248,10 +281,11 @@ function animation (offset, duration, ins, noshadow) {
|
|||||||
}
|
}
|
||||||
ins.selectComponent('.yingbing-flip-item_' + state.currentIndex).setStyle({
|
ins.selectComponent('.yingbing-flip-item_' + state.currentIndex).setStyle({
|
||||||
transform: translate + '(' + late + 'px)',
|
transform: translate + '(' + late + 'px)',
|
||||||
'box-shadow': noshadow ? '' : state.type == 'real' ? '0 0 30px 20px rgba(0,0,0,0.4)' : state.type == 'cover' ? '0 0 10px 5px rgba(0,0,0,0.3)' : '',
|
'box-shadow': noshadow ? '' : state.type == 'real' ? '0 0 30px 20px rgba(0,0,0,0.4)' : state
|
||||||
|
.type == 'cover' ? '0 0 10px 5px rgba(0,0,0,0.3)' : '',
|
||||||
transition: duration > 0 ? 'transform ' + duration + 'ms' : ''
|
transition: duration > 0 ? 'transform ' + duration + 'ms' : ''
|
||||||
})
|
})
|
||||||
if ( state.type == 'real' ) {
|
if (state.type == 'real') {
|
||||||
ins.selectComponent('.yingbing-flip-item-content_' + state.currentIndex).setStyle({
|
ins.selectComponent('.yingbing-flip-item-content_' + state.currentIndex).setStyle({
|
||||||
transform: translate + '(' + (-late) + 'px)',
|
transform: translate + '(' + (-late) + 'px)',
|
||||||
transition: duration > 0 ? 'transform ' + duration + 'ms' : ''
|
transition: duration > 0 ? 'transform ' + duration + 'ms' : ''
|
||||||
@ -259,7 +293,8 @@ function animation (offset, duration, ins, noshadow) {
|
|||||||
ins.selectComponent('.yingbing-flip-item-bg_' + state.currentIndex).setStyle({
|
ins.selectComponent('.yingbing-flip-item-bg_' + state.currentIndex).setStyle({
|
||||||
transform: translate + '(' + (late + size) + 'px)',
|
transform: translate + '(' + (late + size) + 'px)',
|
||||||
'box-shadow': noshadow ? '' : '-5px 0 20px rgba(0,0,0,0.1)',
|
'box-shadow': noshadow ? '' : '-5px 0 20px rgba(0,0,0,0.1)',
|
||||||
transition: duration > 0 ? 'transform ' + duration + 'ms, ' + 'boxShadow ' + duration + 'ms' : ''
|
transition: duration > 0 ? 'transform ' + duration + 'ms, ' + 'boxShadow ' + duration +
|
||||||
|
'ms' : ''
|
||||||
})
|
})
|
||||||
ins.selectComponent('.yingbing-flip-item-shadow_' + state.currentIndex).setStyle({
|
ins.selectComponent('.yingbing-flip-item-shadow_' + state.currentIndex).setStyle({
|
||||||
'box-shadow': noshadow ? '' : '0 0 60px 30px rgba(0,0,0,0.4)',
|
'box-shadow': noshadow ? '' : '0 0 60px 30px rgba(0,0,0,0.4)',
|
||||||
@ -270,21 +305,22 @@ function animation (offset, duration, ins, noshadow) {
|
|||||||
}
|
}
|
||||||
ins.requestAnimationFrame(draw)
|
ins.requestAnimationFrame(draw)
|
||||||
}
|
}
|
||||||
function pulling (offset, ins) {
|
|
||||||
|
function pulling(offset, ins) {
|
||||||
var state = ins.getState()
|
var state = ins.getState()
|
||||||
var loadingType = state.loadingType
|
var loadingType = state.loadingType
|
||||||
var translate = state.translate
|
var translate = state.translate
|
||||||
var size = loadingType == 'pullup' ? state.pullupHeight : state.pulldownHeight
|
var size = loadingType == 'pullup' ? state.pullupHeight : state.pulldownHeight
|
||||||
var late = offset
|
var late = offset
|
||||||
if ( Math.abs(state.offset) < size ) {
|
if (Math.abs(state.offset) < size) {
|
||||||
state.loadingState = 'default'
|
state.loadingState = 'default'
|
||||||
} else {
|
} else {
|
||||||
state.loadingState = 'ready'
|
state.loadingState = 'ready'
|
||||||
}
|
}
|
||||||
var draw = function () {
|
var draw = function() {
|
||||||
var pullingItems = ins.selectAllComponents('.yingbing-flip-' + loadingType + '-item')
|
var pullingItems = ins.selectAllComponents('.yingbing-flip-' + loadingType + '-item')
|
||||||
for ( var i = 0; i < pullingItems.length; i++ ) {
|
for (var i = 0; i < pullingItems.length; i++) {
|
||||||
if ( pullingItems[i].hasClass('yingbing-flip-' + loadingType + '-' + state.loadingState) ) {
|
if (pullingItems[i].hasClass('yingbing-flip-' + loadingType + '-' + state.loadingState)) {
|
||||||
pullingItems[i].setStyle({
|
pullingItems[i].setStyle({
|
||||||
visibility: 'visible'
|
visibility: 'visible'
|
||||||
})
|
})
|
||||||
@ -294,7 +330,7 @@ function pulling (offset, ins) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( Math.abs(late) <= size ) {
|
if (Math.abs(late) <= size) {
|
||||||
ins.selectComponent('.yingbing-flip-' + loadingType).setStyle({
|
ins.selectComponent('.yingbing-flip-' + loadingType).setStyle({
|
||||||
transform: translate + '(' + (loadingType == 'pullup' ? late + size : late - size) + 'px)',
|
transform: translate + '(' + (loadingType == 'pullup' ? late + size : late - size) + 'px)',
|
||||||
transition: ''
|
transition: ''
|
||||||
@ -303,15 +339,16 @@ function pulling (offset, ins) {
|
|||||||
}
|
}
|
||||||
ins.requestAnimationFrame(draw)
|
ins.requestAnimationFrame(draw)
|
||||||
}
|
}
|
||||||
function resetPulling (ins) {
|
|
||||||
|
function resetPulling(ins) {
|
||||||
var state = ins.getState()
|
var state = ins.getState()
|
||||||
var loadingType = state.loadingType
|
var loadingType = state.loadingType
|
||||||
var translate = state.translate
|
var translate = state.translate
|
||||||
var size = loadingType == 'pullup' ? state.pullupHeight : state.pulldownHeight
|
var size = loadingType == 'pullup' ? state.pullupHeight : state.pulldownHeight
|
||||||
var draw = function () {
|
var draw = function() {
|
||||||
var pullingItems = ins.selectAllComponents('.yingbing-flip-' + loadingType + '-item')
|
var pullingItems = ins.selectAllComponents('.yingbing-flip-' + loadingType + '-item')
|
||||||
for ( var i = 0; i < pullingItems.length; i++ ) {
|
for (var i = 0; i < pullingItems.length; i++) {
|
||||||
if ( pullingItems[i].hasClass('yingbing-flip-' + loadingType + '-' + state.loadingState) ) {
|
if (pullingItems[i].hasClass('yingbing-flip-' + loadingType + '-' + state.loadingState)) {
|
||||||
pullingItems[i].setStyle({
|
pullingItems[i].setStyle({
|
||||||
visibility: 'visible'
|
visibility: 'visible'
|
||||||
})
|
})
|
||||||
@ -327,8 +364,8 @@ function resetPulling (ins) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
ins.requestAnimationFrame(draw)
|
ins.requestAnimationFrame(draw)
|
||||||
if ( state.loadingState ) {
|
if (state.loadingState) {
|
||||||
ins.setTimeout( function () {
|
ins.setTimeout(function() {
|
||||||
state.loadingState = ''
|
state.loadingState = ''
|
||||||
resetPulling(ins)
|
resetPulling(ins)
|
||||||
}, 300)
|
}, 300)
|
||||||
@ -337,14 +374,15 @@ function resetPulling (ins) {
|
|||||||
resetFlip(ins)
|
resetFlip(ins)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function pullingRefresh (ins) {
|
|
||||||
|
function pullingRefresh(ins) {
|
||||||
var state = ins.getState()
|
var state = ins.getState()
|
||||||
state.loadingState = 'loading'
|
state.loadingState = 'loading'
|
||||||
var loadingType = state.loadingType
|
var loadingType = state.loadingType
|
||||||
var draw = function () {
|
var draw = function() {
|
||||||
var pullingItems = ins.selectAllComponents('.yingbing-flip-' + loadingType + '-item')
|
var pullingItems = ins.selectAllComponents('.yingbing-flip-' + loadingType + '-item')
|
||||||
for ( var i = 0; i < pullingItems.length; i++ ) {
|
for (var i = 0; i < pullingItems.length; i++) {
|
||||||
if ( pullingItems[i].hasClass('yingbing-flip-' + loadingType + '-loading') ) {
|
if (pullingItems[i].hasClass('yingbing-flip-' + loadingType + '-loading')) {
|
||||||
pullingItems[i].setStyle({
|
pullingItems[i].setStyle({
|
||||||
visibility: 'visible'
|
visibility: 'visible'
|
||||||
})
|
})
|
||||||
|
@ -149,6 +149,11 @@
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
// 是否能继续阅读后续章节
|
||||||
|
readChapterFlag:{
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
//开启下拉刷新
|
//开启下拉刷新
|
||||||
pulldownable: {
|
pulldownable: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@ -201,6 +206,7 @@
|
|||||||
loadingState: this.loadingState,
|
loadingState: this.loadingState,
|
||||||
duration: this.duration,
|
duration: this.duration,
|
||||||
unableClickPage: this.unableClickPage,
|
unableClickPage: this.unableClickPage,
|
||||||
|
readChapterFlag: this.readChapterFlag,
|
||||||
nextIndex: this.nextIndex,
|
nextIndex: this.nextIndex,
|
||||||
prevIndex: this.prevIndex,
|
prevIndex: this.prevIndex,
|
||||||
currentIndex: this.currentIndex,
|
currentIndex: this.currentIndex,
|
||||||
|
9
unpackage/dist/dev/app-plus/app-service.js
vendored
9
unpackage/dist/dev/app-plus/app-service.js
vendored
File diff suppressed because one or more lines are too long
9
unpackage/dist/dev/app-plus/app-view.js
vendored
9
unpackage/dist/dev/app-plus/app-view.js
vendored
@ -19804,14 +19804,7 @@ var render = function () {
|
|||||||
[
|
[
|
||||||
_c(
|
_c(
|
||||||
"u-popup",
|
"u-popup",
|
||||||
{
|
{ attrs: { _i: 25 } },
|
||||||
attrs: { _i: 25 },
|
|
||||||
on: {
|
|
||||||
close: function ($event) {
|
|
||||||
return _vm.$handleViewEvent($event)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
[
|
[
|
||||||
_c("u-navbar", {
|
_c("u-navbar", {
|
||||||
attrs: { _i: 26 },
|
attrs: { _i: 26 },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user