This commit is contained in:
lipnggao 2023-09-25 14:53:36 +08:00
parent 108fdcf3f2
commit f709ef5204
9 changed files with 1350 additions and 235 deletions

View File

@ -176,12 +176,20 @@
//
swipeActionLongpress(row) {
if (!this.swipeActionBatch) {
const swipeActionList = [...this.swipeActionList];
if (swipeActionList.indexOf(row.id) != -1) {
this.swipeActionList = swipeActionList.filter((m) => m != row.id);;
} else {
this.swipeActionList = [...swipeActionList, row.id];
}
// setTimeout(() => {
// uni.hideTabBar({
// animation: true
// })
// 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];
// }
}
},

View File

@ -2,11 +2,11 @@
<view class="classification_content">
<CommNavBar :navBarList="navBarList" @navBarClick="handelCommNavBar" :navBarActive="navBarActive" />
<view class="classification_content_body">
<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">
<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>
</scroll-view>
</view>
@ -33,6 +33,12 @@
import {
baseUrlImage
} from '@/utils/utils';
const inactiveStyle = {
color: '#222222',
fontSize:'32rpx'
}
export default {
components: {
CommNavBar,
@ -47,7 +53,8 @@
navBarActive: '1',
searchBooksList: [],
oneTitleActive: 0,
oneTitleList: []
oneTitleList: [],
inactiveStyle: inactiveStyle
}
},
onShow() {
@ -58,11 +65,16 @@
const data = {}
uni.$u.http.post('/getCategory', data).then((res) => {
uni.hideLoading();
if (res.status == 1) {
const list = res.data.list;
if (res.status == 1 && Array.isArray(res.data.list)) {
const list = res.data.list.map((m) => {
return {
...m,
name: m.title,
}
});
this.oneTitleList = [{
id: '0',
title: '全部'
name: '全部',
}, ...list];
}
this.getBooks(0, 0);
@ -137,8 +149,6 @@
position: relative;
z-index: 2;
.classification_body_btn_list {
width: 100%;
padding: 0 32rpx 32rpx;
@ -190,7 +200,6 @@
.scroll_y_item {
._book_list_box {
width: 100%;
// display: flex;

File diff suppressed because it is too large Load Diff

View File

@ -10,12 +10,12 @@
:line-height="defaultCharactersLineHeight" :color="novelContentColor" :bg-color="bodyReadingBg"
:slide="20" :enablePreload="false" @loadmore="loadmoreContent" @clickTo="handelShowStepUp"
:clickOption="{width:200,height: 400,left:'auto',top:'auto'}" :topGap="0" :bottomGap="20"
@change="currentChange">
@change="currentChange" :readChapterFlag="readChapterFlag">
<template slot="test">
<view class="balance_con">
<rich-text class="balance_con_rich_text"
: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" :style="`background:${bodyReadingBg}`">
<view class="balance_tips" :style="`color:${novelContentColor}`">
@ -49,8 +49,7 @@
</view>
</view>
<view class="u_popup_all">
<u-popup :show="navbarPopupShow" @close="directoryPopupClose" mode="top" :overlay="false"
bgColor="transparent">
<u-popup :show="navbarPopupShow" mode="top" :overlay="false" bgColor="transparent">
<u-navbar :title="bookInfo.title" @rightClick="rightClick" :autoBack="true" :fixed="false"
:bgColor="mainBodyBg" :titleStyle="{ color: navigationBarTitleTextColor }"
:leftIconColor="navigationBarTitleTextBackColor" :shadow="true" :safeAreaInsetTop="true"
@ -62,12 +61,12 @@
<view class="reading_schedule_body">
<view class="_previous_chapter"
:style="`color:${previousChapterBbuttonTextColor};background:${previousChapterBbuttonBg}`"
@tap="previousChapter">
@tap="upperNextChapter('upper')">
上一章
</view>
<view class="_next_chapter"
:style="`color:${nextChapterBbuttonTextColor};background:${nextChapterBbuttonBg}`"
@tap="nextChapter">下一章
@tap.prevent="upperNextChapter('next')">下一章
</view>
</view>
<view class="my_tabBar_Reading" :style="`background:${bodyReadingBg}`">
@ -122,6 +121,16 @@
@tap="handelCharactersSize">
默认</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 style="height: 140rpx" />
</view>
@ -211,14 +220,15 @@
//
novelReadingContentText: [],
charactersPageType: 'real',
defaultCharactersSize: 28,
newCharactersSize: 28,
defaultCharactersSize: 26,
newCharactersSize: 26,
defaultCharactersLineHeight: 20,
readDirectoryActive: '',
readChapterid: '',
readChapterInfoObj: {},
readChapterLastid: '',
readChapterNextid: '',
readChapterFlag: false,
};
},
onLoad(options) {
@ -252,16 +262,17 @@
const booksDirectorySid = this.booksDirectorySid;
const booksDirectoryPage = this.booksDirectoryPage;
const readChapterid = this.readChapterid ? this.readChapterid : '';
const newReadChapterInfoObj = await this.isGetBookInfo(readChapterid);
this.novelReadingContentText = [newReadChapterInfoObj];
this.readDirectoryActive = newReadChapterInfoObj.chapterorder;
this.readChapterLastid = newReadChapterInfoObj.lastid;
this.readChapterNextid = newReadChapterInfoObj.nextid;
this.$refs.yingbingReadPage.init({
contents: [newReadChapterInfoObj],
start: 0,
currentChapter: newReadChapterInfoObj.chapterorder
})
this.isGetReadChapter(readChapterid);
// const newReadChapterInfoObj = await this.isGetBookInfo(readChapterid);
// this.novelReadingContentText = [newReadChapterInfoObj];
// this.readDirectoryActive = newReadChapterInfoObj.chapterorder;
// this.readChapterLastid = newReadChapterInfoObj.lastid;
// this.readChapterNextid = newReadChapterInfoObj.nextid;
// this.$refs.yingbingReadPage.init({
// contents: [newReadChapterInfoObj],
// start: 0,
// currentChapter: newReadChapterInfoObj.chapterorder
// })
},
isGetBookInfo(chapterId) {
return new Promise((resolve) => {
@ -280,10 +291,12 @@
uni.hideLoading();
if (res.status == 1) {
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 = {
...resData,
content: is_novel_content.replace(/<p>/g, ''),
content: isContent,
isContent: isContent,
isStart: resData.lastid == '' ? true : false,
isEnd: resData.nextid == '' ? true : false,
chapter: resData.chapterorder,
@ -291,7 +304,7 @@
isTitle: resData.title
// richTextNodes: `<h3>${res.data.chaptername}</h3></br>${res.data.novel_content}`
};
this.readChapterInfoObj = readChapterInfoObj;
// this.readChapterInfoObj = readChapterInfoObj;
resolve(readChapterInfoObj);
}
}).catch((err) => {
@ -302,128 +315,153 @@
},
async loadmoreContent(chapter, callback) {
console.log(chapter, "loadmoreContent")
const newNovelReadingContentText = this.novelReadingContentText;
const newReadDirectoryActive = this.readDirectoryActive;
const newReadChapterLastid = this.readChapterLastid;
const newNovelReadingContentText = this.novelReadingContentText;
const newReadChapterNextid = this.readChapterNextid;
const newReadChapterInfoObj = this.readChapterInfoObj;
console.log(newReadChapterInfoObj, "loadmoreContent________________")
let chapterId = '';
if (chapter < newReadDirectoryActive) {
const readChapterInfoObj = await this.isGetBookInfo(newReadChapterLastid);
this.novelReadingContentText = [...newNovelReadingContentText, readChapterInfoObj];
chapterId = newReadChapterLastid;
} else if (chapter > newReadDirectoryActive) {
chapterId = newReadChapterNextid
}
const readChapterInfoObj = await this.isGetBookInfo(chapterId);
let newReadInfoObj = {};
if (readChapterInfoObj.chackpay == 1) {
callback('success', readChapterInfoObj);
newReadInfoObj = {
...readChapterInfoObj
}
callback('success', newReadInfoObj);
}
if (readChapterInfoObj.chackpay == 2 || readChapterInfoObj.chackpay == 3) {
const custom = [`slot:test`];
const obj = {
newReadInfoObj = {
...readChapterInfoObj,
custom,
content: '',
}
callback('success', obj);
}
}
if (chapter > newReadDirectoryActive) {
const readChapterInfoObj = await this.isGetBookInfo(newReadChapterNextid);
this.novelReadingContentText = [readChapterInfoObj, ...newNovelReadingContentText];
if (readChapterInfoObj.chackpay == 1) {
callback('success', readChapterInfoObj);
}
if (readChapterInfoObj.chackpay == 2 || readChapterInfoObj.chackpay == 3) {
const custom = [`slot:test`];
const obj = {
...readChapterInfoObj,
custom,
content: '',
}
callback('success', obj);
callback('success', newReadInfoObj);
}
const flag = newNovelReadingContentText.some((m) => m.id == readChapterInfoObj.id);
let listContents = newNovelReadingContentText;
if (!flag) {
if (chapter < newReadDirectoryActive) {
listContents = [newReadInfoObj, ...newNovelReadingContentText];
} else if (chapter > newReadDirectoryActive) {
listContents = [...newNovelReadingContentText, newReadInfoObj];
}
}
this.novelReadingContentText = listContents;
},
currentChange(pageInfo) {
const novelReadingContentText = this.novelReadingContentText;
const chapter = pageInfo.chapter;
const itemTemp = novelReadingContentText.filter((m) => m.chapter == chapter);
this.readChapterLastid = itemTemp[0].lastid;
this.readChapterNextid = itemTemp[0].nextid;
this.readingPopupshow = false;
this.navbarPopupShow = false;
console.log(pageInfo, chapter, pageInfo.nextid, "currentChange")
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() {
const newReadDirectoryActive = this.readDirectoryActive;
upperNextChapter(type) {
// const newNovelReadingContentText = this.novelReadingContentText;
// const newReadDirectoryActive = this.readDirectoryActive;
// const newReadChapterInfoObj = this.readChapterInfoObj;
const newReadChapterLastid = this.readChapterLastid;
const newNovelReadingContentText = this.novelReadingContentText;
if (!newReadChapterLastid) {
uni.showToast({
icon: 'none',
title: "已经是第一章了",
})
return
const newReadChapterNextid = this.readChapterNextid;
// console.log(newReadDirectoryActive, "=========")
let chapterId = '';
if (type == 'upper') {
chapterId = newReadChapterLastid;
} else if (type == 'next') {
// if (newReadChapterInfoObj.isvip == 1) {
// uni.showToast({
// icon: 'none',
// title: ',',
// })
// return;
// }
chapterId = newReadChapterNextid;
}
const readChapterInfoObj = await this.isGetBookInfo(newReadChapterLastid);
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;
this.isGetReadChapter(chapterId);
},
async nextChapter() {
const newReadDirectoryActive = this.readDirectoryActive;
const readChapterNextid = this.readChapterNextid;
const newNovelReadingContentText = this.novelReadingContentText;
if (!readChapterNextid) {
uni.showToast({
icon: 'none',
title: "已经是最后一章了~"
})
return
isBooksObj(booksObj) {
let newBooksObj = {}
if (booksObj.chackpay == 1) {
newBooksObj = {
...booksObj
}
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 obj = {
...readChapterInfoObj,
newBooksObj = {
...booksObj,
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({
contents: [obj],
contents: [lastObj, newReadInfoObj, nextObj],
start: 0,
currentChapter: newReadDirectoryActive + 1
});
}
this.readDirectoryActive = newReadDirectoryActive + 1;
currentChapter: newReadInfoObj.chapter,
})
this.readDirectoryActive = newReadInfoObj.chapterorder;
this.readChapterLastid = newReadInfoObj.lastid;
this.readChapterNextid = newReadInfoObj.nextid;
},
handelDirectoryItem(row) {},
handelShowStepUp() {
this.readingPopupshow = !this.readingPopupshow;
this.navbarPopupShow = !this.navbarPopupShow;
// this.navbarPopupShow = !this.navbarPopupShow;
this.stepUpPopupShow = false;
},
handelDirectoryPopup() {
@ -487,22 +525,22 @@
//
reduceCharactersSize() {
const newCharactersSize = this.newCharactersSize;
this.newCharactersSize = newCharactersSize - 2;
this.newCharactersSize = newCharactersSize - 1;
const novelMainObj = myGetStorage('novelMainObj') || '{}';
const obj = {
...JSON.parse(novelMainObj),
charactersSize: newCharactersSize - 2,
charactersSize: newCharactersSize - 1,
}
mySetStorage('novelMainObj', JSON.stringify(obj));
},
//
addCharactersSize() {
const newCharactersSize = this.newCharactersSize;
this.newCharactersSize = newCharactersSize + 2;
this.newCharactersSize = newCharactersSize + 1;
const novelMainObj = myGetStorage('novelMainObj') || '{}';
const obj = {
...JSON.parse(novelMainObj),
charactersSize: newCharactersSize + 2,
charactersSize: newCharactersSize + 1,
}
mySetStorage('novelMainObj', JSON.stringify(obj));
},
@ -516,6 +554,10 @@
charactersSize: defaultCharactersSize,
}
mySetStorage('novelMainObj', JSON.stringify(obj));
this.$refs.yingbingReadPage.refresh();
},
handelPageType(type) {
this.charactersPageType = type;
},
// //
// directoryPopupUpper() {
@ -602,7 +644,7 @@
} = isGetSystemInfo();
// this.myData = myData;
this.novelMainTypeColor = novelMainTypeColor;
this.newCharactersSize = JSON.parse(novelMainObj).charactersSize || 28;
this.newCharactersSize = JSON.parse(novelMainObj).charactersSize || 26;
this.setUpColorAll = setUpReadingColorAll;
this.barPopupIcon = {
'F3EFE9': {

View File

@ -27,7 +27,7 @@
}">
<yingbing-flip ref="flip" class="yingbing-read-page-flip" :data="pages" :current="current"
:bgColor="bgColor" :duration="300" :unableClickPage="unableClickPage" :type="pageType"
@change="handleFlipChangeRender">
@change="handleFlipChangeRender" :readChapterFlag="readChapterFlag">
<!-- #ifdef MP -->
<template v-for="(item, index) in pages" :slot="index">
<!-- #endif -->
@ -301,6 +301,11 @@
type: Boolean,
default: false
},
//
readChapterFlag: {
type: Boolean,
default: false
},
//
pageType: {
type: String,
@ -397,6 +402,7 @@
options() {
return {
unableClickPage: this.unableClickPage,
readChapterFlag: this.readChapterFlag,
pageType: this.pageType,
color: this.color,
bgColor: this.bgColor,
@ -536,7 +542,7 @@
}, 100)
return
}
this.isRefreshing = true
this.isRefreshing = true;
this.resetPage({
start: this.pageInfo.start,
currentChapter: this.pageInfo.chapter

View File

@ -1,6 +1,6 @@
function touchstart (event, ins) {
function touchstart(event, ins) {
var state = ins.getState()
if ( state.isTouch || state.disableTouch ) {
if (state.isTouch || state.disableTouch) {
return
}
state.isTouch = true
@ -11,37 +11,48 @@ function touchstart (event, ins) {
state.startX = touch.pageX
state.startY = touch.pageY
}
function touchmove (event, ins) {
var state = ins.getState()
if ( state.isTouch && !state.disableTouch ) {
function touchmove(event, ins) {
var state = ins.getState();
if (state.isTouch && !state.disableTouch) {
var touch = event.touches[0]
state.offset = state.vertical ? touch.pageY - state.startY : touch.pageX - state.startX;
if (state.direction) {
var rect = ins.getBoundingClientRect()
var size = state.vertical ? rect.height : rect.width
state.offset = state.direction == 'next' ? state.offset + state.sliderFault : state.offset - state.sliderFault
if ( (state.offset > 0 && state.direction == 'next') || (state.offset < 0 && state.direction == 'prev') ) {
state.offset = state.direction == 'next' ? state.offset + state.sliderFault : state.offset - state
.sliderFault
// if (state.direction == 'next' && state.readChapterFlag) {
// return;
// }
if ((state.offset > 0 && state.direction == 'next') || (state.offset < 0 && state.direction == 'prev')) {
state.offset = 0
}
if ( Math.abs(state.offset) <= size ) {
if (Math.abs(state.offset) <= size) {
animation(state.offset, 0, ins)
}
} else {
if ( Math.abs(state.offset) < state.sliderFault ) {
if (Math.abs(state.offset) < state.sliderFault) {
return
}
if ( state.offset < 0 ) {
if ( state.nextIndex < state.count && state.nextIndex != 0 ) {
if ( state.type != 'none' ) {state.direction = 'next'}
} else if ( state.pullupable && state.loadingState != 'loading' && state.loadingState != 'success' && state.loadingState != 'fail' ) {
if (state.offset < 0) {
if (state.nextIndex < state.count && state.nextIndex != 0) {
if (state.type != 'none') {
state.direction = 'next'
}
} else if (state.pullupable && state.loadingState != 'loading' && state.loadingState != 'success' &&
state.loadingState != 'fail') {
state.loadingType = 'pullup'
state.offset = state.offset + state.sliderFault
pulling(state.offset, ins)
}
} else {
if ( state.prevIndex >= 0 && state.prevIndex != state.count - 1 ) {
if ( state.type != 'none' ) {state.direction = 'prev'}
} else if ( state.pulldownable && state.loadingState != 'loading' && state.loadingState != 'success' && state.loadingState != 'fail' ) {
if (state.prevIndex >= 0 && state.prevIndex != state.count - 1) {
if (state.type != 'none') {
state.direction = 'prev'
}
} else if (state.pulldownable && state.loadingState != 'loading' && state.loadingState != 'success' &&
state.loadingState != 'fail') {
state.loadingType = 'pulldown'
state.offset = state.offset - state.sliderFault
pulling(state.offset, ins)
@ -50,35 +61,46 @@ function touchmove (event, ins) {
}
}
}
function touchend (event, ins) {
function touchend(event, ins) {
touchaction(event, ins)
}
function touchcancel (event, ins) {
function touchcancel(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)
if ( state.isTouch && !state.disableTouch ) {
if (state.isTouch && !state.disableTouch) {
var rect = ins.getBoundingClientRect()
var size = state.vertical ? rect.height : rect.width
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 ) {
state.direction = 'next'
if (start > (size / 4) * 3 && state.nextIndex < state.count && state.nextIndex != 0) {
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'
}
}
if (state.direction) {
// if (state.direction = 'next' && state.readChapterFlag) {
// uni.showToast({
// icon: 'none',
// title: '当前章节未解锁,暂不支持跳章节观看',
// })
// return;
// }
state.disableTouch = true
if (state.touchTime <= 200) {
var duration = state.type == 'none' ? 0 : state.duration;
var value = state.direction == 'next' ? 1 : -1;
animation(-value * size, duration, ins);
ins.setTimeout(function () {
ins.setTimeout(function() {
resetShadow(ins, true)
ins.callMethod('handleFlipChange', value);
}, duration + 50)
@ -87,21 +109,21 @@ function touchaction (event, ins,isFlipTo) {
if (Math.abs(state.offset) >= size / 4) {
var value = state.direction == 'next' ? 1 : -1;
animation(-value * size, duration, ins);
ins.setTimeout(function () {
ins.setTimeout(function() {
resetShadow(ins, true)
ins.callMethod('handleFlipChange', value);
}, duration + 50)
} else {
animation(0, duration, ins);
ins.setTimeout(function () {
ins.setTimeout(function() {
resetShadow(ins)
resetFlip(ins);
}, duration + 50)
}
}
} else if ( state.loadingState == 'default' ) {
} else if (state.loadingState == 'default') {
resetPulling(ins)
} else if ( state.loadingState == 'ready' ) {
} else if (state.loadingState == 'ready') {
pullingRefresh(ins)
} else {
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()
state.vertical = newVal.vertical
state.pulldownable = newVal.pulldownable
@ -126,23 +149,24 @@ function propWatcher (newVal, oldVal, ins) {
state.count = newVal.count
state.type = newVal.type
state.unableClickPage = newVal.unableClickPage
state.readChapterFlag = newVal.readChapterFlag
state.translate = newVal.translate
if ( oldVal && newVal.currentIndex != oldVal.currentIndex ) {
if (oldVal && newVal.currentIndex != oldVal.currentIndex) {
resetFlip(ins);
}
if ( oldVal && newVal.loadingState != oldVal.loadingState && state.loadingState ) {
if (oldVal && newVal.loadingState != oldVal.loadingState && state.loadingState) {
resetPulling(ins)
ins.callMethod('resetLoading')
}
if (oldVal && newVal.flipTo != oldVal.flipTo && newVal.flipTo != 0 ) {
if ( !state.disableTouch ) {
if ( newVal.flipTo < 0 && state.prevIndex >= 0 && (state.prevIndex != state.count - 1) ) {
if (oldVal && newVal.flipTo != oldVal.flipTo && newVal.flipTo != 0) {
if (!state.disableTouch) {
if (newVal.flipTo < 0 && state.prevIndex >= 0 && (state.prevIndex != state.count - 1)) {
state.isTouch = true
state.touchTime = 0
state.direction = 'prev'
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.touchTime = 0
state.direction = 'next'
@ -152,43 +176,48 @@ function propWatcher (newVal, oldVal, ins) {
}
}, 100)
}
function setInterval (ins) {
function setInterval(ins) {
var state = ins.getState()
state.touchTimer = ins.setTimeout(function () {
state.touchTimer = ins.setTimeout(function() {
state.touchTime += 10
if ( state.interval ) {
if (state.interval) {
setInterval(ins)
}
}, 10)
}
function clearInterval (ins) {
function clearInterval(ins) {
var state = ins.getState()
state.interval = false
if ( state.touchTimer ) {
if (state.touchTimer) {
ins.clearTimeout(state.touchTimer)
state.touchTimer = null
}
}
function resetShadow (ins, isChange) {
function resetShadow(ins, isChange) {
var state = ins.getState()
var direction = state.direction
if ( !direction ) {
if (!direction) {
return
}
var index = direction == 'next' ? state.currentIndex : state.prevIndex
var translate = state.translate
var rect = ins.getBoundingClientRect()
var size = state.vertical ? rect.height : rect.width;
var draw = function () {
var draw = function() {
ins.selectComponent('.yingbing-flip-item_' + index).setStyle({
'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: ''
})
if ( state.type == 'real' ) {
if (state.type == 'real') {
ins.selectComponent('.yingbing-flip-item-bg_' + index).setStyle({
'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: ''
})
}
@ -199,7 +228,8 @@ function resetShadow (ins, isChange) {
}
ins.requestAnimationFrame(draw)
}
function resetFlip (ins) {
function resetFlip(ins) {
var state = ins.getState()
state.direction = null
state.isTouch = false
@ -209,29 +239,32 @@ function resetFlip (ins) {
state.startX = 0
state.startY = 0
}
function animation (offset, duration, ins, noshadow) {
function animation(offset, duration, ins, noshadow) {
var state = ins.getState()
var rect = ins.getBoundingClientRect()
var size = state.vertical ? rect.height : rect.width
var translate = state.translate
var late = offset
var draw = function () {
if ( state.direction == 'prev' ) {
if ( state.prevIndex >= 0 ) {
var draw = function() {
if (state.direction == 'prev') {
if (state.prevIndex >= 0) {
ins.selectComponent('.yingbing-flip-item_' + state.prevIndex).setStyle({
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' : ''
})
if ( state.type == 'real' ) {
if (state.type == 'real') {
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' : ''
})
ins.selectComponent('.yingbing-flip-item-bg_' + state.prevIndex).setStyle({
transform: translate + '(' + (late) + 'px)',
'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({
'box-shadow': noshadow ? '' : '0 0 60px 30px rgba(0,0,0,0.4)',
@ -240,7 +273,7 @@ function animation (offset, duration, ins, noshadow) {
}
}
} else {
if ( state.nextIndex < state.count ) {
if (state.nextIndex < state.count) {
ins.selectComponent('.yingbing-flip-item_' + state.nextIndex).setStyle({
transform: translate + '(0)',
transition: ''
@ -248,10 +281,11 @@ function animation (offset, duration, ins, noshadow) {
}
ins.selectComponent('.yingbing-flip-item_' + state.currentIndex).setStyle({
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' : ''
})
if ( state.type == 'real' ) {
if (state.type == 'real') {
ins.selectComponent('.yingbing-flip-item-content_' + state.currentIndex).setStyle({
transform: translate + '(' + (-late) + 'px)',
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({
transform: translate + '(' + (late + size) + 'px)',
'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({
'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)
}
function pulling (offset, ins) {
function pulling(offset, ins) {
var state = ins.getState()
var loadingType = state.loadingType
var translate = state.translate
var size = loadingType == 'pullup' ? state.pullupHeight : state.pulldownHeight
var late = offset
if ( Math.abs(state.offset) < size ) {
if (Math.abs(state.offset) < size) {
state.loadingState = 'default'
} else {
state.loadingState = 'ready'
}
var draw = function () {
var draw = function() {
var pullingItems = ins.selectAllComponents('.yingbing-flip-' + loadingType + '-item')
for ( var i = 0; i < pullingItems.length; i++ ) {
if ( pullingItems[i].hasClass('yingbing-flip-' + loadingType + '-' + state.loadingState) ) {
for (var i = 0; i < pullingItems.length; i++) {
if (pullingItems[i].hasClass('yingbing-flip-' + loadingType + '-' + state.loadingState)) {
pullingItems[i].setStyle({
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({
transform: translate + '(' + (loadingType == 'pullup' ? late + size : late - size) + 'px)',
transition: ''
@ -303,15 +339,16 @@ function pulling (offset, ins) {
}
ins.requestAnimationFrame(draw)
}
function resetPulling (ins) {
function resetPulling(ins) {
var state = ins.getState()
var loadingType = state.loadingType
var translate = state.translate
var size = loadingType == 'pullup' ? state.pullupHeight : state.pulldownHeight
var draw = function () {
var draw = function() {
var pullingItems = ins.selectAllComponents('.yingbing-flip-' + loadingType + '-item')
for ( var i = 0; i < pullingItems.length; i++ ) {
if ( pullingItems[i].hasClass('yingbing-flip-' + loadingType + '-' + state.loadingState) ) {
for (var i = 0; i < pullingItems.length; i++) {
if (pullingItems[i].hasClass('yingbing-flip-' + loadingType + '-' + state.loadingState)) {
pullingItems[i].setStyle({
visibility: 'visible'
})
@ -327,8 +364,8 @@ function resetPulling (ins) {
})
}
ins.requestAnimationFrame(draw)
if ( state.loadingState ) {
ins.setTimeout( function () {
if (state.loadingState) {
ins.setTimeout(function() {
state.loadingState = ''
resetPulling(ins)
}, 300)
@ -337,14 +374,15 @@ function resetPulling (ins) {
resetFlip(ins)
}
}
function pullingRefresh (ins) {
function pullingRefresh(ins) {
var state = ins.getState()
state.loadingState = 'loading'
var loadingType = state.loadingType
var draw = function () {
var draw = function() {
var pullingItems = ins.selectAllComponents('.yingbing-flip-' + loadingType + '-item')
for ( var i = 0; i < pullingItems.length; i++ ) {
if ( pullingItems[i].hasClass('yingbing-flip-' + loadingType + '-loading') ) {
for (var i = 0; i < pullingItems.length; i++) {
if (pullingItems[i].hasClass('yingbing-flip-' + loadingType + '-loading')) {
pullingItems[i].setStyle({
visibility: 'visible'
})

View File

@ -149,6 +149,11 @@
type: Boolean,
default: false
},
//
readChapterFlag:{
type: Boolean,
default: false
},
//
pulldownable: {
type: Boolean,
@ -201,6 +206,7 @@
loadingState: this.loadingState,
duration: this.duration,
unableClickPage: this.unableClickPage,
readChapterFlag: this.readChapterFlag,
nextIndex: this.nextIndex,
prevIndex: this.prevIndex,
currentIndex: this.currentIndex,

File diff suppressed because one or more lines are too long

View File

@ -19804,14 +19804,7 @@ var render = function () {
[
_c(
"u-popup",
{
attrs: { _i: 25 },
on: {
close: function ($event) {
return _vm.$handleViewEvent($event)
},
},
},
{ attrs: { _i: 25 } },
[
_c("u-navbar", {
attrs: { _i: 26 },