0309 听书
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "E-crazy",
|
"name" : "E-crazy",
|
||||||
"appid" : "__UNI__23F6060",
|
"appid" : "__UNI__9788EB5",
|
||||||
"description" : "E-crazy-案例",
|
"description" : "E-crazy-案例",
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
"icons" : [
|
"icons" : [
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
:activeStyle="{color: '#303133',fontWeight: 'bold', transform: 'scale(1.01)'}"></u-tabs>
|
:activeStyle="{color: '#303133',fontWeight: 'bold', transform: 'scale(1.01)'}"></u-tabs>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="search_box" @click="onPageJump('./searchFor')">
|
<view class="search_box" @click="onPageJump('../peanut/searchFor')">
|
||||||
<text class="icon_search"></text>
|
<text class="icon_search"></text>
|
||||||
<text class="prompt">搜索...</text>
|
<text class="prompt">搜索...</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -36,15 +36,15 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="commodityPrice">
|
<view class="commodityPrice">
|
||||||
<text class="price" v-if="item.price">¥
|
<text class="price" v-if="item.price">¥
|
||||||
<b style="font-size: 40rpx;">{{item.price}}</b><span class="priceTag">折后价</span>
|
<b style="font-size: 40rpx;">{{item.price}}</b>
|
||||||
|
<span class="priceTag" v-if="item.activityPrice">原价:¥{{item.activityPrice}}</span>
|
||||||
</text>
|
</text>
|
||||||
|
<text class="SoldNumber" v-if="item.sumSales">已售<span>{{item.sumSales}}</span>件</text>
|
||||||
<text class="SoldNumber">已售<span>400</span>件</text>
|
|
||||||
<!-- <text class="icon" @click.stop="addShopCar(item)" v-if="item.productStock">
|
<!-- <text class="icon" @click.stop="addShopCar(item)" v-if="item.productStock">
|
||||||
<u-icon name="shopping-cart" :size="26" color="#eba00b"></u-icon>
|
<u-icon name="shopping-cart" :size="26" color="#eba00b"></u-icon>
|
||||||
</text> -->
|
</text> -->
|
||||||
<view class="publierInfo">
|
<view class="publierInfo" v-if="item.author && item.publisher">
|
||||||
<span class="c999 f24">张三1著</span><span class="c999 f24">/ xx出版社出版</span>
|
<span class="c999 f24">{{item.author}}著</span><span class="c999 f24">/ {{item.publisher}}</span>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -80,12 +80,6 @@
|
|||||||
// contentButtonClick(e) {
|
// contentButtonClick(e) {
|
||||||
// console.log(e)
|
// console.log(e)
|
||||||
// },
|
// },
|
||||||
// 跳转
|
|
||||||
onPageJump(url) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: url
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// onLoad(e) {
|
// onLoad(e) {
|
||||||
// //获取一级分类
|
// //获取一级分类
|
||||||
// this.$http
|
// this.$http
|
||||||
@@ -104,6 +98,12 @@
|
|||||||
...mapState(['userInfo']),
|
...mapState(['userInfo']),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 跳转
|
||||||
|
onPageJump(url) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: url
|
||||||
|
});
|
||||||
|
},
|
||||||
// 获取一级分类
|
// 获取一级分类
|
||||||
getOneLevel() {
|
getOneLevel() {
|
||||||
this.$http
|
this.$http
|
||||||
@@ -123,6 +123,14 @@
|
|||||||
if (this.towLevel == '') {
|
if (this.towLevel == '') {
|
||||||
this.commodityList = []
|
this.commodityList = []
|
||||||
} else {
|
} else {
|
||||||
|
let newo = {
|
||||||
|
catId:0,
|
||||||
|
name:'全部',
|
||||||
|
parentCid:e.catId
|
||||||
|
}
|
||||||
|
this.towLevel.splice(0,0,newo)
|
||||||
|
// this.getCategoryList(res.list[0])
|
||||||
|
// console.log(this.towLevel, 'towLevel')
|
||||||
this.getCategoryList(res.list[0])
|
this.getCategoryList(res.list[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,9 +380,9 @@
|
|||||||
|
|
||||||
.priceTag {
|
.priceTag {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
color: #f56c6c;
|
color: #999;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
zoom: .7;
|
zoom: .8;
|
||||||
margin-left: 6rpx;
|
margin-left: 6rpx;
|
||||||
margin-bottom: 6px;
|
margin-bottom: 6px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,15 +30,17 @@
|
|||||||
<u-row customStyle="margin-bottom: 10px">
|
<u-row customStyle="margin-bottom: 10px">
|
||||||
<u-col span="6"><span>书名:{{productInfo.productName}}</span></u-col>
|
<u-col span="6"><span>书名:{{productInfo.productName}}</span></u-col>
|
||||||
<u-col span="6" v-if="productInfo.author"><span>作者:{{productInfo.author}}</span></u-col>
|
<u-col span="6" v-if="productInfo.author"><span>作者:{{productInfo.author}}</span></u-col>
|
||||||
|
</u-row>
|
||||||
|
<u-row>
|
||||||
|
|
||||||
<u-col span="6" v-if="productInfo.publisher"><span>出版社:{{productInfo.publisher}}</span></u-col>
|
<u-col span="6" v-if="productInfo.publisher"><span>出版社:{{productInfo.publisher}}</span></u-col>
|
||||||
<u-col span="6" v-if="productInfo.pubDate"><span>出版时间:{{ productInfo.pubDate | formatDate }}</span></u-col>
|
<u-col span="6" v-if="productInfo.pubDate"><span>出版时间:{{ productInfo.pubDate | formatDate }}</span></u-col>
|
||||||
|
</u-row>
|
||||||
|
<u-row>
|
||||||
<u-col span="6" v-if="productInfo.format"><span>开本:{{productInfo.format}}</span></u-col>
|
<u-col span="6" v-if="productInfo.format"><span>开本:{{productInfo.format}}</span></u-col>
|
||||||
<u-col span="6" v-if="productInfo.pageNum"><span>页数:{{productInfo.pageNum}}</span></u-col>
|
<u-col span="6" v-if="productInfo.pageNum"><span>页数:{{productInfo.pageNum}}</span></u-col>
|
||||||
|
</u-row>
|
||||||
|
<u-row>
|
||||||
<u-col span="6" v-if="productInfo.quality"><span>内文用纸材质:{{productInfo.quality}}</span></u-col>
|
<u-col span="6" v-if="productInfo.quality"><span>内文用纸材质:{{productInfo.quality}}</span></u-col>
|
||||||
|
|
||||||
</u-row>
|
</u-row>
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
<view class="itemPrice">
|
<view class="itemPrice">
|
||||||
<text>¥{{item.price*item.productAmount}}</text>
|
<text>¥{{item.price*item.productAmount}}</text>
|
||||||
<u-number-box v-model="item.productAmount" @change="valChange($event, item)" :input-width="50"
|
<u-number-box v-model="item.productAmount" @change="valChange($event, item)" :input-width="50"
|
||||||
:input-height="20" :min="1" :max="item.productStock" integer @overlimit='overlimit'></u-number-box>
|
:input-height="20" :min="1" :max="item.productStock" integer ></u-number-box>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -72,29 +72,39 @@
|
|||||||
<view class="zhif_radio">
|
<view class="zhif_radio">
|
||||||
<u-radio-group v-model="payType">
|
<u-radio-group v-model="payType">
|
||||||
<view style="width: 100%;">
|
<view style="width: 100%;">
|
||||||
<view v-for="(item, index) in paylist" @click="choseType(item.id)" class="zhif_xuanx">
|
<view v-for="(item, index) in paylist" class="zhif_xuanx">
|
||||||
<image :src="item.img"></image>
|
<image :src="item.img"></image>
|
||||||
{{item.title}}
|
{{item.title}}
|
||||||
|
<span v-if="item.id == 4" style="color: #bbb; margin-left: 10px;">{{userMes.peanutCoin}}疯币可用</span>
|
||||||
|
<span @click.stop="buPoint" style="color: #bf0c0c; margin-left: 10px;" v-if="item.id == 4" class="chongBtn">去充值</span>
|
||||||
<u-radio :key="index" activeColor="#fe6e09" :name='item.id'
|
<u-radio :key="index" activeColor="#fe6e09" :name='item.id'
|
||||||
style="float: right;margin-top: 5rpx;"></u-radio>
|
style="float: right;margin-top: 5rpx;" ></u-radio>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-radio-group>
|
</u-radio-group>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="footer">
|
<view class="footer" >
|
||||||
<view class="commodityPrice">
|
<view class="commodityPrice" v-if="payType != 4">
|
||||||
<span style="color: #666;margin-right: 10rpx; font-size: 15px;">实付款: </span>
|
<span style="color: #666;margin-right: 10rpx; font-size: 15px;">实付款: </span>
|
||||||
<span>¥</span>{{realPrice}}
|
<span>¥</span>{{realPrice}}
|
||||||
</view>
|
</view>
|
||||||
<view class="operate" @click="goBuyJie">
|
<view class="commodityPrice" v-if="payType == 4">
|
||||||
|
<span style="color: #666;margin-right: 10rpx; font-size: 15px;">实付款: </span>
|
||||||
|
{{realPrice}}<span>疯币</span>
|
||||||
|
</view>
|
||||||
|
<view class="operate" @click="goBuyJie" v-if="payType != 4">
|
||||||
|
<view class="goBuy">
|
||||||
|
立即支付
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="operate" @click="goPoinBuy" v-if="payType == 4">
|
||||||
<view class="goBuy">
|
<view class="goBuy">
|
||||||
立即支付
|
立即支付
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 地址弹出 -->
|
<!-- 地址弹出 -->
|
||||||
<u-popup :show="dizhiShow" :round="10" @close="dizhiShow=false">
|
<u-popup :show="dizhiShow" :round="10" @close="dizhiShow=false">
|
||||||
<view class="tanchu">
|
<view class="tanchu">
|
||||||
@@ -185,6 +195,7 @@
|
|||||||
shangIDNum: 0,
|
shangIDNum: 0,
|
||||||
cartIDNum: [],
|
cartIDNum: [],
|
||||||
cartList: [],
|
cartList: [],
|
||||||
|
userMes:{}, // 用户信息
|
||||||
amount:null, // 商品总价
|
amount:null, // 商品总价
|
||||||
addressList: [],
|
addressList: [],
|
||||||
adressMoRen: {},
|
adressMoRen: {},
|
||||||
@@ -206,6 +217,11 @@
|
|||||||
title: '支付宝',
|
title: '支付宝',
|
||||||
id: 1,
|
id: 1,
|
||||||
img: '../../static/icon/pay_1.png'
|
img: '../../static/icon/pay_1.png'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '疯币购买',
|
||||||
|
id: 4,
|
||||||
|
img: '../../static/icon/oder_chong.png'
|
||||||
}
|
}
|
||||||
// {
|
// {
|
||||||
// title: '微信',
|
// title: '微信',
|
||||||
@@ -238,12 +254,34 @@
|
|||||||
} else if (this.typeId == 0) {
|
} else if (this.typeId == 0) {
|
||||||
this.getShangList(this.shangIDNum);
|
this.getShangList(this.shangIDNum);
|
||||||
}
|
}
|
||||||
// this.getUserAddress()
|
this.getData()
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['userInfo']),
|
...mapState(['userInfo']),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 充值疯币
|
||||||
|
buPoint() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '../peanut/reCharge'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getData() {
|
||||||
|
let that = this
|
||||||
|
// 获取个人信息
|
||||||
|
// 用户详情
|
||||||
|
if (this.userInfo.id != undefined) {
|
||||||
|
this.$http
|
||||||
|
.post('book/user/info/' + this.userInfo.id)
|
||||||
|
.then(res => {
|
||||||
|
this.userMes = res.user
|
||||||
|
// consol.log(this.userMes.peanutCoin,'呼呼')
|
||||||
|
if (this.userMes.vip != 0) {
|
||||||
|
this.typeFen = 2
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
// 获取地址列表
|
// 获取地址列表
|
||||||
getUserAddress() {
|
getUserAddress() {
|
||||||
this.$http
|
this.$http
|
||||||
@@ -264,7 +302,18 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
goPoinBuy(){
|
||||||
|
if(this.realPrice > this.userMes.peanutCoin){
|
||||||
|
uni.showToast({
|
||||||
|
title:'疯币不足,请充值',
|
||||||
|
icon: 'error',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}else{
|
||||||
|
this.goBuyJie()
|
||||||
|
}
|
||||||
|
},
|
||||||
// 获取优惠券列表
|
// 获取优惠券列表
|
||||||
getCourpe() {
|
getCourpe() {
|
||||||
let proId = ''
|
let proId = ''
|
||||||
@@ -470,7 +519,7 @@
|
|||||||
city: this.adressMoRen.areaidpathtext.split(' ')[1], //市
|
city: this.adressMoRen.areaidpathtext.split(' ')[1], //市
|
||||||
district: this.adressMoRen.areaidpathtext.split(' ')[2], //区
|
district: this.adressMoRen.areaidpathtext.split(' ')[2], //区
|
||||||
address: this.adressMoRen.useraddress, //地址
|
address: this.adressMoRen.useraddress, //地址
|
||||||
paymentMethod: this.payType, //支付方式 1支付宝,2微信,3ios内购
|
paymentMethod: this.payType, //支付方式 2支付宝,1微信,3ios内购 4,疯币购买
|
||||||
orderMoney: this.totalPrice, //订单金额
|
orderMoney: this.totalPrice, //订单金额
|
||||||
realMoney: this.realPrice, //实收金额
|
realMoney: this.realPrice, //实收金额
|
||||||
shippingMoney: this.farePrice, //运费
|
shippingMoney: this.farePrice, //运费
|
||||||
@@ -483,7 +532,6 @@
|
|||||||
orderType: "order", //订单类型
|
orderType: "order", //订单类型
|
||||||
addressId:this.adressMoRen.addressid // 地址ID
|
addressId:this.adressMoRen.addressid // 地址ID
|
||||||
}
|
}
|
||||||
|
|
||||||
$http.request({
|
$http.request({
|
||||||
url: "book/buyorder/save",
|
url: "book/buyorder/save",
|
||||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||||
@@ -500,6 +548,8 @@
|
|||||||
image: '../../static/icon/ic_close.png'
|
image: '../../static/icon/ic_close.png'
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
if(this.payType != 4){
|
||||||
|
// 常规支付
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "正在支付",
|
title: "正在支付",
|
||||||
icon: "loading"
|
icon: "loading"
|
||||||
@@ -534,6 +584,18 @@
|
|||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}else{
|
||||||
|
// 疯币支付
|
||||||
|
uni.showToast({
|
||||||
|
title: "购买成功",
|
||||||
|
icon: "success"
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: './orderList'
|
||||||
|
});
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -875,4 +937,13 @@
|
|||||||
border-color: #fd6004;
|
border-color: #fd6004;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.chongBtn {
|
||||||
|
background-color: #54a966;
|
||||||
|
color: #fff !important;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
padding: 2rpx 10rpx;
|
||||||
|
font-size: 20rpx;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -404,9 +404,7 @@
|
|||||||
url: url
|
url: url
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 电子书阅读跳转
|
// 电子书阅读跳转
|
||||||
onBokReadJump(e) {
|
onBokReadJump(e) {
|
||||||
const that = this;
|
const that = this;
|
||||||
@@ -474,7 +472,7 @@
|
|||||||
// 充值疯币
|
// 充值疯币
|
||||||
buPoint() {
|
buPoint() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '../../peanut/reCharge'
|
url: '../peanut/reCharge'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -266,7 +266,8 @@
|
|||||||
this.$http
|
this.$http
|
||||||
.get(`book/shopseckill/getSeckillProd`)
|
.get(`book/shopseckill/getSeckillProd`)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.seckillList = res.list
|
//this.seckillList = res.list
|
||||||
|
this.seckillList = null
|
||||||
})
|
})
|
||||||
|
|
||||||
// 获取精选商品
|
// 获取精选商品
|
||||||
@@ -309,7 +310,6 @@
|
|||||||
url: '../eBook/bookContent?Id=' + e.bookid
|
url: '../eBook/bookContent?Id=' + e.bookid
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// 商品详情页
|
// 商品详情页
|
||||||
goDetail(id) {
|
goDetail(id) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
|||||||
@@ -66,6 +66,8 @@
|
|||||||
<view v-for="(item, index) in paylist" @click="choseType(item.id)" class="vf_xuanx">
|
<view v-for="(item, index) in paylist" @click="choseType(item.id)" class="vf_xuanx">
|
||||||
<image :src="item.img"></image>
|
<image :src="item.img"></image>
|
||||||
{{item.title}}
|
{{item.title}}
|
||||||
|
<span v-if="item.id == 4" style="color: #bbb; margin-left: 10px;">{{userMes.peanutCoin}}疯币可用</span>
|
||||||
|
<span @click.stop="buPoint" style="color: #bf0c0c; margin-left: 10px;" v-if="item.id == 4" class="chongBtn">去充值</span>
|
||||||
<u-radio :key="index" activeColor="#fe6e09" :name='item.id'
|
<u-radio :key="index" activeColor="#fe6e09" :name='item.id'
|
||||||
style="float: right;margin-top: 5rpx;"></u-radio>
|
style="float: right;margin-top: 5rpx;"></u-radio>
|
||||||
</view>
|
</view>
|
||||||
@@ -76,7 +78,7 @@
|
|||||||
<view class="agree_wo">* 我已阅读并同意《会员服务协议》</view>
|
<view class="agree_wo">* 我已阅读并同意《会员服务协议》</view>
|
||||||
|
|
||||||
<view class="vip_btn">
|
<view class="vip_btn">
|
||||||
<view @click="kaiVip">立即开通会员</view>
|
<view @click="goPoinBuy">立即开通会员</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -95,11 +97,18 @@
|
|||||||
return {
|
return {
|
||||||
stepsVc: {},
|
stepsVc: {},
|
||||||
vcList: [],
|
vcList: [],
|
||||||
payType: 2,
|
userMes:{},
|
||||||
paylist: [{
|
payType: 4,
|
||||||
title: '支付宝',
|
paylist: [
|
||||||
id: 1,
|
// {
|
||||||
img: '../../static/icon/pay_1.png'
|
// title: '支付宝',
|
||||||
|
// id: 1,
|
||||||
|
// img: '../../static/icon/pay_1.png'
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: '疯币充值',
|
||||||
|
id: 4,
|
||||||
|
img: '../../static/icon/oder_chong.png'
|
||||||
}
|
}
|
||||||
// {
|
// {
|
||||||
// title: '微信',
|
// title: '微信',
|
||||||
@@ -117,6 +126,7 @@
|
|||||||
},
|
},
|
||||||
//页面显示
|
//页面显示
|
||||||
onShow() {
|
onShow() {
|
||||||
|
this.getDataPoint()
|
||||||
// 隐藏原生的tabbar
|
// 隐藏原生的tabbar
|
||||||
uni.hideTabBar();
|
uni.hideTabBar();
|
||||||
},
|
},
|
||||||
@@ -125,6 +135,40 @@
|
|||||||
},
|
},
|
||||||
//方法
|
//方法
|
||||||
methods: {
|
methods: {
|
||||||
|
goPoinBuy(){
|
||||||
|
if(this.stepsVc.money > this.userMes.peanutCoin){
|
||||||
|
uni.showToast({
|
||||||
|
title:'疯币不足,请充值',
|
||||||
|
icon: 'error',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}else{
|
||||||
|
this.kaiVip()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 充值疯币
|
||||||
|
buPoint() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '../peanut/reCharge'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getDataPoint() {
|
||||||
|
let that = this
|
||||||
|
// 获取个人信息
|
||||||
|
// 用户详情
|
||||||
|
if (this.userInfo.id != undefined) {
|
||||||
|
this.$http
|
||||||
|
.post('book/user/info/' + this.userInfo.id)
|
||||||
|
.then(res => {
|
||||||
|
this.userMes = res.user
|
||||||
|
// consol.log(this.userMes.peanutCoin,'呼呼')
|
||||||
|
if (this.userMes.vip != 0) {
|
||||||
|
this.typeFen = 2
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
// 获取会员类型
|
// 获取会员类型
|
||||||
getData() {
|
getData() {
|
||||||
let that = this
|
let that = this
|
||||||
@@ -151,7 +195,7 @@
|
|||||||
that.payType = e
|
that.payType = e
|
||||||
},
|
},
|
||||||
|
|
||||||
// 开通vip
|
// 开通vip 常规支付
|
||||||
kaiVip() {
|
kaiVip() {
|
||||||
let that = this
|
let that = this
|
||||||
|
|
||||||
@@ -165,7 +209,6 @@
|
|||||||
orderStatus: 0, //订单状态
|
orderStatus: 0, //订单状态
|
||||||
orderType: "vip", //订单类型
|
orderType: "vip", //订单类型
|
||||||
}
|
}
|
||||||
|
|
||||||
$http.request({
|
$http.request({
|
||||||
url: "book/buyorder/rechargeSave",
|
url: "book/buyorder/rechargeSave",
|
||||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||||
@@ -175,6 +218,8 @@
|
|||||||
},
|
},
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
|
console.log(res)
|
||||||
|
if(that.payType != 4){
|
||||||
setPay({
|
setPay({
|
||||||
typePay: 'alipay',
|
typePay: 'alipay',
|
||||||
subject: 'vip',
|
subject: 'vip',
|
||||||
@@ -195,6 +240,37 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}else{
|
||||||
|
console.log(that.userMes)
|
||||||
|
this.$http
|
||||||
|
.post('book/user/openVipByVirtualCoin', {
|
||||||
|
'configId': that.stepsVc.priceTypeId,
|
||||||
|
'userId': that.userMes.id,
|
||||||
|
'orderSn':res.orderSn
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
if(res.code == 0){
|
||||||
|
console.log(res, 'res')
|
||||||
|
uni.showToast({
|
||||||
|
title: "充值成功",
|
||||||
|
icon:'success',
|
||||||
|
duration:2000
|
||||||
|
});
|
||||||
|
setTimeout(()=>{
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '../bookShop/orderList'
|
||||||
|
});
|
||||||
|
},1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
title: "下单失败",
|
||||||
|
icon:'Error',
|
||||||
|
duration:2000
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -214,7 +290,15 @@
|
|||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import '@/style/mixin.scss';
|
@import '@/style/mixin.scss';
|
||||||
|
.chongBtn {
|
||||||
|
background-color: #54a966;
|
||||||
|
color: #fff !important;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
padding: 2rpx 10rpx;
|
||||||
|
font-size: 20rpx;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
.vip_top {
|
.vip_top {
|
||||||
// background-color: #2c271d;
|
// background-color: #2c271d;
|
||||||
background-image: url('../../static/icon/mine_back.png');
|
background-image: url('../../static/icon/mine_back.png');
|
||||||
|
|||||||
@@ -56,12 +56,13 @@
|
|||||||
@click="showMenu">
|
@click="showMenu">
|
||||||
<!-- 章节名 -->
|
<!-- 章节名 -->
|
||||||
<view class="chapter">{{ verticalData.chapterName }}</view>
|
<view class="chapter">{{ verticalData.chapterName }}</view>
|
||||||
<scroll-view scroll-y="true" :scroll-top="scrollTop" scroll-with-animation="true" style="height: 600px;"
|
<scroll-view :scroll-anchoring="true" scroll-y="true" :scroll-top="scrollTop" scroll-with-animation="true" style="height: 600px; "
|
||||||
@scrolltoupper="scrolltoupper" @scrolltolower="scrolltolower" @scroll="scroll">
|
@scrolltoupper="scrolltoupper" @scrolltolower="scrolltolower" @scroll="scroll" @touchend="touchEnd" @touchstart="touchStart">
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="inner-box" :style="{ height: `${innerHeight}px` }" v-if="verticalData.canRead">
|
<view class="inner-box" :style="{ height: `${innerHeight}px` }" v-if="verticalData.canRead">
|
||||||
<view>
|
<view>
|
||||||
<p class="book-inner" :class="highlight === index ? 'highlight' : ''"
|
<p
|
||||||
|
class="book-inner" :class="highlight === index ? 'highlight' : ''"
|
||||||
v-for="(item, index) in verticalData.text" :key="index" v-html="item.picAndWord"
|
v-for="(item, index) in verticalData.text" :key="index" v-html="item.picAndWord"
|
||||||
:style="{
|
:style="{
|
||||||
fontWeight: item.level == 2 ? 'bold' : item.level == 3 ? 'bold' : '',
|
fontWeight: item.level == 2 ? 'bold' : item.level == 3 ? 'bold' : '',
|
||||||
@@ -109,14 +110,15 @@
|
|||||||
<!-- 内层class="inner-box"利用innerHeight将内容截取至整行,防止文字不完整的情况出现 -->
|
<!-- 内层class="inner-box"利用innerHeight将内容截取至整行,防止文字不完整的情况出现 -->
|
||||||
<view class="inner-box" :style="{ height: `${innerHeight}px` }" v-if="prePage.canRead">
|
<view class="inner-box" :style="{ height: `${innerHeight}px` }" v-if="prePage.canRead">
|
||||||
<!-- 最里层class="book-inner"的用于获取文本总高度,计算总页数,注意不可以overflow:hidden -->
|
<!-- 最里层class="book-inner"的用于获取文本总高度,计算总页数,注意不可以overflow:hidden -->
|
||||||
<view class="book-inner" v-for="(item, index) in prePage.text" :key="index" v-html="item"
|
|
||||||
:style="{
|
<view class="book-inner" >
|
||||||
fontWeight: item.level == 2 ? 'bold' : item.level == 3 ? 'bold' : '',
|
|
||||||
fontSize: `${fontSize}px`,
|
<p v-for="(item, index) in curPage.text" v-html="item.list" :key="index"
|
||||||
lineHeight: `${lineHeight * fontSize}px`,
|
:class="highlight === item.paragraph ? 'highlight' : ''"
|
||||||
color: `${colorList[background - 1]}`,
|
:style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight * fontSize}px`, color: `${colorList[background - 1]}`, transform: `translateY(0px)` }"></p>
|
||||||
transform: `translateY(0)`
|
|
||||||
}"></view>
|
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
style="display:flex;flex-flow: column;justify-content: center;align-items: center;height: 100%;"
|
style="display:flex;flex-flow: column;justify-content: center;align-items: center;height: 100%;"
|
||||||
@@ -149,9 +151,14 @@
|
|||||||
<view class="chapter">{{ curPage.chapterName }}</view>
|
<view class="chapter">{{ curPage.chapterName }}</view>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="inner-box" :style="{ height: `${innerHeight}px` }" v-if="curPage.canRead">
|
<view class="inner-box" :style="{ height: `${innerHeight}px` }" v-if="curPage.canRead">
|
||||||
<view class="book-inner" :class="fhighlight== true ? 'fhighlight' : ''"
|
<view class="book-inner" >
|
||||||
v-for="(item, index) in curPage.text" :key="index" v-html="item"
|
<!-- <pre>
|
||||||
:style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight * fontSize}px`, color: `${colorList[background - 1]}`, transform: `translateY(0px)` }">
|
{{curPage.text}}
|
||||||
|
</pre> -->
|
||||||
|
<p v-for="(item, index) in curPage.text" v-html="item.list" :key="index"
|
||||||
|
:class="highlight === item.paragraph ? 'highlight' : ''"
|
||||||
|
:style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight * fontSize}px`, color: `${colorList[background - 1]}`, transform: `translateY(0px)` }"></p>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
@@ -248,7 +255,6 @@
|
|||||||
<view class="head">
|
<view class="head">
|
||||||
|
|
||||||
<image class="backiconfont" @click="back" src="../../static/icon/back.svg" mode="aspectFit"></image>
|
<image class="backiconfont" @click="back" src="../../static/icon/back.svg" mode="aspectFit"></image>
|
||||||
<!-- <text decode="true"><</text> -->
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 菜单主体 -->
|
<!-- 菜单主体 -->
|
||||||
@@ -312,8 +318,8 @@
|
|||||||
@click="changeTurnType(0)">覆盖</view>
|
@click="changeTurnType(0)">覆盖</view>
|
||||||
<view class="icon" :class="{ active: turnType === 1 }" style="padding: 5px 8px;"
|
<view class="icon" :class="{ active: turnType === 1 }" style="padding: 5px 8px;"
|
||||||
@click="changeTurnType(1)">左右平移</view>
|
@click="changeTurnType(1)">左右平移</view>
|
||||||
<view class="icon" :class="{ active: turnType === 2 }" style="padding: 5px 8px;"
|
<!-- <view class="icon" :class="{ active: turnType === 2 }" style="padding: 5px 8px;"
|
||||||
@click="changeTurnType(2)">上下平移</view>
|
@click="changeTurnType(2)">上下平移</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="item-name">背景</view>
|
<view class="item-name">背景</view>
|
||||||
@@ -366,6 +372,7 @@
|
|||||||
precent: null,
|
precent: null,
|
||||||
updateReadId: null
|
updateReadId: null
|
||||||
},
|
},
|
||||||
|
scrollTop1:0,
|
||||||
bookName: '我是书名',
|
bookName: '我是书名',
|
||||||
bookId: 1,
|
bookId: 1,
|
||||||
bookId_mark: '',
|
bookId_mark: '',
|
||||||
@@ -581,13 +588,24 @@
|
|||||||
...mapState(['userInfo']),
|
...mapState(['userInfo']),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// scroll1: function(e) {
|
||||||
|
// // console.log(e)
|
||||||
|
// // this.old.scrollTop = e.detail.scrollTop
|
||||||
|
// },
|
||||||
|
// upper: function(e) {
|
||||||
|
// console.log(e)
|
||||||
|
// },
|
||||||
|
// lower: function(e) {
|
||||||
|
// console.log(e)
|
||||||
|
// },
|
||||||
// view的滑动事件
|
// view的滑动事件
|
||||||
scroll: function(e) {
|
scroll: function(e) {
|
||||||
// this.oldType = "Vertical"
|
// this.oldType = "Vertical"
|
||||||
// console.log(e)
|
// console.log(e.detail)
|
||||||
this.scrollTop = e.detail.scrollTop
|
// this.scrollTop = e.detail.scrollTop
|
||||||
|
// this.scrollTop1 = e.detail.scrollTop
|
||||||
// 计算当前的page
|
// 计算当前的page
|
||||||
this.page = parseInt(e.detail.scrollTop / (this.NumCol * this.lineHeight * this.fontSize))
|
// this.page = parseInt(e.detail.scrollTop / (this.NumCol * this.lineHeight * this.fontSize))
|
||||||
|
|
||||||
},
|
},
|
||||||
bookMessage() {
|
bookMessage() {
|
||||||
@@ -619,30 +637,32 @@
|
|||||||
forGet(colSize, NumCol) {
|
forGet(colSize, NumCol) {
|
||||||
let that = this
|
let that = this
|
||||||
let arr = [] //数组每一项代表一行
|
let arr = [] //数组每一项代表一行
|
||||||
|
// console.log(copyBookText,'拆分前')
|
||||||
copyBookText.map((res, index) => {
|
copyBookText.map((res, index) => {
|
||||||
res.picAndWord = ' ' + res.picAndWord
|
res.picAndWord = ' ' + res.picAndWord
|
||||||
if (res.picAndWord.length > colSize) {
|
if (res.picAndWord.length > colSize) {
|
||||||
arr.push(res.picAndWord.substr(0, colSize))
|
arr.push({'paragraph':index,'list':res.picAndWord.substr(0, colSize), 'level':0})
|
||||||
let text = res.picAndWord.substr(colSize)
|
let text = res.picAndWord.substr(colSize)
|
||||||
that.aginForget(text, arr, colSize)
|
that.aginForget(text, arr, colSize, index)
|
||||||
} else {
|
} else {
|
||||||
arr.push(res.picAndWord.substr(0, colSize))
|
arr.push({'paragraph':index,list:res.picAndWord.substr(0, colSize), 'level':0})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
copyBookText = arr
|
copyBookText = arr
|
||||||
// console.log(copyBookText,'copyBookText')
|
// console.log(copyBookText,'copyBookText')
|
||||||
this.getSizePage(NumCol)
|
this.getSizePage(NumCol)
|
||||||
},
|
},
|
||||||
|
|
||||||
//获取后面的字符,再去计算能放几行
|
//获取后面的字符,再去计算能放几行
|
||||||
aginForget(text, arr, colSize) {
|
aginForget(text, arr, colSize, index) {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
let strBR = "</br>"
|
||||||
if (text.length > colSize) {
|
if (text.length > colSize) {
|
||||||
arr.push(text.substr(0, colSize))
|
arr.push({'paragraph':index,'list':text.substr(0, colSize), 'level':0})
|
||||||
let newText = text.substr(colSize)
|
let newText = text.substr(colSize)
|
||||||
that.aginForget(newText, arr, colSize)
|
that.aginForget(newText, arr, colSize, index)
|
||||||
} else {
|
} else {
|
||||||
arr.push(text.substr(0, colSize))
|
arr.push({'paragraph':index,'list':text.substr(0, colSize),'level':0})
|
||||||
|
// arr.push(strBR)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -669,7 +689,7 @@
|
|||||||
}
|
}
|
||||||
arr.push(newArr)
|
arr.push(newArr)
|
||||||
copyBookText = arr // 每一页显示的内容
|
copyBookText = arr // 每一页显示的内容
|
||||||
// console.log(copyBookText,'copyBookText')
|
console.log(copyBookText,'copyBookText')
|
||||||
},
|
},
|
||||||
|
|
||||||
setStorage() {
|
setStorage() {
|
||||||
@@ -852,7 +872,7 @@
|
|||||||
this.history.chapterIndex = 0
|
this.history.chapterIndex = 0
|
||||||
}
|
}
|
||||||
await this.getThreeChapter(this.history.chapterIndex)
|
await this.getThreeChapter(this.history.chapterIndex)
|
||||||
this.counlSystemInfo()
|
// this.counlSystemInfo()
|
||||||
let page = Math.floor((this.curChapter.totalPage - 1) * this.history.progress)
|
let page = Math.floor((this.curChapter.totalPage - 1) * this.history.progress)
|
||||||
this.goToPage(page)
|
this.goToPage(page)
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
@@ -906,10 +926,10 @@
|
|||||||
query.select('#curChapter').boundingClientRect(data => {
|
query.select('#curChapter').boundingClientRect(data => {
|
||||||
let height = data.height;
|
let height = data.height;
|
||||||
// #ifdef APP-PLUS || MP-WEIXIN
|
// #ifdef APP-PLUS || MP-WEIXIN
|
||||||
|
|
||||||
height = Math.round(height * this.pixelRatio) / this.pixelRatio
|
height = Math.round(height * this.pixelRatio) / this.pixelRatio
|
||||||
// #endif
|
// #endif
|
||||||
this.curChapter.totalPage = Math.ceil(height / this.innerHeight) || 1
|
// this.curChapter.totalPage = Math.floor(height / this.innerHeight) || 1
|
||||||
|
this.curChapter.totalPage = copyBookText.length
|
||||||
this.curChapter.ready = true //章节准备完毕
|
this.curChapter.ready = true //章节准备完毕
|
||||||
resolve()
|
resolve()
|
||||||
}).exec();
|
}).exec();
|
||||||
@@ -973,25 +993,6 @@
|
|||||||
this.down = false
|
this.down = false
|
||||||
}, 300)
|
}, 300)
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* 滑动事件
|
|
||||||
**/
|
|
||||||
onScroll(e) {
|
|
||||||
this.sliderValue = Number(((e.detail.scrollTop / (this.contentHeight - (this.windowHeight - 100))) * 100))
|
|
||||||
if (!isAudioMenu) {
|
|
||||||
this.scrollTop = e.detail.scrollTop
|
|
||||||
}
|
|
||||||
|
|
||||||
let page = Number(((e.detail.scrollTop / (this.contentHeight - (this.windowHeight - 100))) * 100))
|
|
||||||
// console.log(page,66)
|
|
||||||
// if(page != this.page){
|
|
||||||
// console.log(page,66)
|
|
||||||
// this.goToPage(page) // 跳转到制定页面
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 听书事件
|
* 听书事件
|
||||||
**/
|
**/
|
||||||
@@ -1007,20 +1008,18 @@
|
|||||||
})
|
})
|
||||||
if (this.domList.length > 0) {
|
if (this.domList.length > 0) {
|
||||||
console.log('读取到数据,继续执行');
|
console.log('读取到数据,继续执行');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log('读取到的数据为空,进行赋值');
|
console.log('读取到的数据为空,进行赋值');
|
||||||
this.domList = data;
|
this.domList = data;
|
||||||
}
|
}
|
||||||
// this.getNowReadIndex()
|
this.getNowReadIndex()
|
||||||
this.createAudio()
|
// this.$nextTick(()=>{
|
||||||
this.musicManuShow = false
|
// this.createAudio()
|
||||||
this.isAudioMenu = true
|
// })
|
||||||
}).exec();
|
}).exec();
|
||||||
},
|
},
|
||||||
|
|
||||||
getNowReadIndex() {
|
getNowReadIndex() {
|
||||||
|
|
||||||
let progress = this.progress //记录阅读进度用于调整字体后跳转
|
let progress = this.progress //记录阅读进度用于调整字体后跳转
|
||||||
// let page = Math.floor((this.curChapter.totalPage - 1) * progress)
|
// let page = Math.floor((this.curChapter.totalPage - 1) * progress)
|
||||||
let page = 0
|
let page = 0
|
||||||
@@ -1030,55 +1029,54 @@
|
|||||||
} else {
|
} else {
|
||||||
page = Math.floor((this.curChapter.totalPage - 1) * progress)
|
page = Math.floor((this.curChapter.totalPage - 1) * progress)
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log(this.curChapter.totalPage, 'curChapter')
|
// console.log(this.curChapter.totalPage, 'curChapter')
|
||||||
// 通过page 判断当前读到了哪里
|
// 通过page 判断当前读到了哪里
|
||||||
// console.log(page+1, '当前页')
|
// console.log(page+1, '当前页')
|
||||||
// console.log(copyBookText[page][0],'顶部第一句话')
|
|
||||||
let nowRead = copyBookText[page][0]
|
|
||||||
let nowReadIndex = 0
|
|
||||||
this.verticalData.text.forEach((item, itemIndex) => {
|
|
||||||
if (item.content.indexOf(copyBookText[page][0]) != -1) {
|
|
||||||
if (page == 1) {
|
|
||||||
return this.scrollTop = 0
|
|
||||||
} else {
|
|
||||||
let topOfsset = Number(this.fontSize * this.NumCol * this.lineHeight * page)
|
|
||||||
|
|
||||||
this.scrollTop = topOfsset
|
let nowRead = copyBookText[page][0].list
|
||||||
}
|
console.log(nowRead,'顶部第一句话')
|
||||||
return nowReadIndex = itemIndex
|
//let nowReadIndex = 0
|
||||||
|
//console.log(page,'page')
|
||||||
|
if (page == 0) {
|
||||||
|
// return this.scrollTop = 0
|
||||||
|
this.domIndex = 0
|
||||||
|
this.createAudio()
|
||||||
|
this.musicManuShow = false
|
||||||
|
this.isAudioMenu = true
|
||||||
|
}else{
|
||||||
|
let found = false
|
||||||
|
this.verticalData.text.forEach((item, itemIndex) => {
|
||||||
|
// console.log(copyBookText[page][0][0],'copyBookText')
|
||||||
|
//console.log(item.content,'item')
|
||||||
|
if (item.content.indexOf(nowRead) != -1) {
|
||||||
|
// 找到了
|
||||||
|
console.log(item.number,'找到了')
|
||||||
|
found = true
|
||||||
|
this.domIndex = itemIndex
|
||||||
|
this.createAudio()
|
||||||
|
this.musicManuShow = false
|
||||||
|
this.isAudioMenu = true
|
||||||
|
return
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// console.log(this.scrollTop,'距离顶部距离')
|
if(!found){
|
||||||
this.domIndex = nowReadIndex
|
uni.showToast({
|
||||||
// this.scrollTop = Number((this.NumCol * this.lineHeight * this.fontSize * this.page) / 100)
|
title:'未找到音频',
|
||||||
|
icon:'none',
|
||||||
|
duration:2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 创建音频
|
// 创建音频
|
||||||
createAudio() {
|
createAudio() {
|
||||||
this.domList.map((item, index) => {
|
|
||||||
if (item.top >= this.scrollTop && this.scrollTop >= item.bottom) {
|
|
||||||
return this.domIndex = index
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
)
|
|
||||||
console.log('读到的位置', this.domIndex);
|
console.log('读到的位置', this.domIndex);
|
||||||
this.music = uni.createInnerAudioContext()
|
this.music = uni.createInnerAudioContext()
|
||||||
this.music.src = this.verticalData.text[this.domIndex].voices; // static文件夹下的音频地址
|
this.music.src = this.verticalData.text[this.domIndex].voices; // static文件夹下的音频地址
|
||||||
console.log(this.verticalData.text, '文本')
|
console.log(this.verticalData.text, '文本')
|
||||||
// 找到对应dom
|
|
||||||
console.log(this.scrollTop, '滚动后的top值')
|
|
||||||
// 找到符合条件的dom
|
// 找到符合条件的dom
|
||||||
|
|
||||||
|
|
||||||
console.log('domList', this.domList)
|
console.log('domList', this.domList)
|
||||||
console.log('scrollTop', this.scrollTop)
|
|
||||||
// 获取当前的页码
|
|
||||||
//let page = Math.ceil(((this.scrollTop / (this.windowHeight - 100)) * 10)) - 1
|
|
||||||
//console.log(page,'当前的页码')
|
|
||||||
//this.goToPage(page)
|
|
||||||
|
|
||||||
// 给对应dom高亮
|
// 给对应dom高亮
|
||||||
this.highlight = this.domIndex
|
this.highlight = this.domIndex
|
||||||
this.fhighlight = true
|
this.fhighlight = true
|
||||||
@@ -1101,9 +1099,18 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 加载下一条音频
|
// 加载下一条音频
|
||||||
addDomIndex() {
|
addDomIndex(page) {
|
||||||
this.domIndex += 1
|
this.domIndex += 1
|
||||||
|
//console.log(this.domIndex, '下一条domIndex')
|
||||||
|
//console.log(this.curPage.text, '最大值')
|
||||||
|
setTimeout(()=>{
|
||||||
this.createAudio()
|
this.createAudio()
|
||||||
|
if(this.domIndex > this.curPage.text[this.curPage.length -1].paragraph){
|
||||||
|
console.log(this.curPage.text[this.curPage.length -1].paragraph)
|
||||||
|
this.goNextPage()
|
||||||
|
}
|
||||||
|
},2000)
|
||||||
|
|
||||||
},
|
},
|
||||||
// 暂停事件
|
// 暂停事件
|
||||||
audioPause() {
|
audioPause() {
|
||||||
@@ -1204,6 +1211,7 @@
|
|||||||
this.touchStartX = e.touches[0].clientX;
|
this.touchStartX = e.touches[0].clientX;
|
||||||
this.touchY = e.touches[0].clientY;
|
this.touchY = e.touches[0].clientY;
|
||||||
this.touchStartY = e.touches[0].clientY;
|
this.touchStartY = e.touches[0].clientY;
|
||||||
|
// console.log(touchStartY, '触摸开始')
|
||||||
|
|
||||||
if (this.turnType === 0) {
|
if (this.turnType === 0) {
|
||||||
// this.$refs.pageBackRef.$el.style.transition = 'unset'
|
// this.$refs.pageBackRef.$el.style.transition = 'unset'
|
||||||
@@ -1263,12 +1271,10 @@
|
|||||||
this.touchY = e.touches[0].clientY;
|
this.touchY = e.touches[0].clientY;
|
||||||
// console.log(this.delta, 'delta')
|
// console.log(this.delta, 'delta')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.next && this.nextPage.ready) { //首次翻下一页之后
|
if (this.next && this.nextPage.ready) { //首次翻下一页之后
|
||||||
if (this.nextPage.isEnd) {
|
if (this.nextPage.isEnd) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 限制边界
|
// 限制边界
|
||||||
if (delta > 0) {
|
if (delta > 0) {
|
||||||
delta = 0
|
delta = 0
|
||||||
@@ -1479,7 +1485,12 @@
|
|||||||
delta = e.changedTouches[0].clientX - this.touchStartX;
|
delta = e.changedTouches[0].clientX - this.touchStartX;
|
||||||
} else {
|
} else {
|
||||||
delta = e.changedTouches[0].clientY - this.touchStartY;
|
delta = e.changedTouches[0].clientY - this.touchStartY;
|
||||||
console.log(delta, '触摸')
|
console.log(delta, '触摸结束')
|
||||||
|
this.scrollTop += -delta
|
||||||
|
console.log(this.scrollTop, 'scrollTop')
|
||||||
|
this.page = parseInt(this.scrollTop / (this.NumCol * this.lineHeight * this.fontSize))
|
||||||
|
console.log(this.page, 'page')
|
||||||
|
//this.getNowReadIndex()
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((delta < 0.8 && delta > -0.8)) { //部分手机点击屏幕时无法做到delta===0
|
if ((delta < 0.8 && delta > -0.8)) { //部分手机点击屏幕时无法做到delta===0
|
||||||
@@ -1788,6 +1799,7 @@
|
|||||||
}
|
}
|
||||||
this.currentPage += 1
|
this.currentPage += 1
|
||||||
let showChapter = false
|
let showChapter = false
|
||||||
|
console.log(this.currentPage,this.curChapter.totalPage)
|
||||||
if (this.currentPage === this.curChapter.totalPage) { //翻至下一章了
|
if (this.currentPage === this.curChapter.totalPage) { //翻至下一章了
|
||||||
showChapter = true
|
showChapter = true
|
||||||
this.currentPage = 0
|
this.currentPage = 0
|
||||||
@@ -1867,9 +1879,11 @@
|
|||||||
if (type === 'next') {
|
if (type === 'next') {
|
||||||
this.preChapter = Object.assign({}, this.curChapter)
|
this.preChapter = Object.assign({}, this.curChapter)
|
||||||
this.curChapter = Object.assign({}, this.nextChapter)
|
this.curChapter = Object.assign({}, this.nextChapter)
|
||||||
console.log(this.curChapter)
|
console.log(this.curChapter.chapterIndex, 'chapterIndex')
|
||||||
copyBookText = this.curChapter.text;
|
copyBookText = this.curChapter.text;
|
||||||
|
|
||||||
this.counlSystemInfo()
|
this.counlSystemInfo()
|
||||||
|
console.log(copyBookText,1111111111)
|
||||||
if (this.curChapter.chapterIndex !== this.directoryList.length - 1) { //最后一章是根据目录列表长度判断
|
if (this.curChapter.chapterIndex !== this.directoryList.length - 1) { //最后一章是根据目录列表长度判断
|
||||||
this.nextChapter = {
|
this.nextChapter = {
|
||||||
ready: false,
|
ready: false,
|
||||||
@@ -1886,6 +1900,8 @@
|
|||||||
isEnd: true
|
isEnd: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.getThreeChapter(this.curChapter.chapterIndex)
|
||||||
|
|
||||||
}
|
}
|
||||||
if (type === 'pre') {
|
if (type === 'pre') {
|
||||||
this.nextChapter = Object.assign({}, this.curChapter)
|
this.nextChapter = Object.assign({}, this.curChapter)
|
||||||
@@ -1907,7 +1923,9 @@
|
|||||||
ready: true,
|
ready: true,
|
||||||
isCover: true
|
isCover: true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
this.getThreeChapter(this.curChapter.chapterIndex)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1970,7 +1988,6 @@
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isVertical) {
|
if (this.isVertical) {
|
||||||
if (this.curChapter.chapterIndex > 0) {
|
if (this.curChapter.chapterIndex > 0) {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
@@ -1978,7 +1995,8 @@
|
|||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.getThreeChapter(this.curChapter.chapterIndex - 1)
|
this.getThreeChapter(this.curChapter.chapterIndex - 1)
|
||||||
this.counlSystemInfo()
|
// this.counlSystemInfo()
|
||||||
|
console.log(copyBookText,'翻页后')
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}, 300)
|
}, 300)
|
||||||
} else {
|
} else {
|
||||||
@@ -2012,6 +2030,7 @@
|
|||||||
this.currentPage = page
|
this.currentPage = page
|
||||||
this.showAnimation = false
|
this.showAnimation = false
|
||||||
console.log(page, '======>')
|
console.log(page, '======>')
|
||||||
|
// console.log(copyBookText[page],'当前页')
|
||||||
this.$nextTick(function() {
|
this.$nextTick(function() {
|
||||||
this.curPage = {
|
this.curPage = {
|
||||||
ready: this.curChapter.ready,
|
ready: this.curChapter.ready,
|
||||||
@@ -2030,19 +2049,6 @@
|
|||||||
// console.log(copyBookText[page][0],'顶部第一句话')
|
// console.log(copyBookText[page][0],'顶部第一句话')
|
||||||
let nowRead = copyBookText[page][0]
|
let nowRead = copyBookText[page][0]
|
||||||
let nowReadIndex = 0
|
let nowReadIndex = 0
|
||||||
this.verticalData.text.forEach((item, itemIndex) => {
|
|
||||||
if (item.content.indexOf(copyBookText[page][0]) != -1) {
|
|
||||||
if (page == 1) {
|
|
||||||
return this.scrollTop = 0
|
|
||||||
} else {
|
|
||||||
let topOfsset = Number(this.fontSize * this.NumCol * this.lineHeight * page)
|
|
||||||
|
|
||||||
this.scrollTop = topOfsset
|
|
||||||
}
|
|
||||||
return nowReadIndex = itemIndex
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// console.log(this.scrollTop,'翻页后的顶部距离')
|
|
||||||
this.domIndex = nowReadIndex
|
this.domIndex = nowReadIndex
|
||||||
this.setStorage() // 设置缓存
|
this.setStorage() // 设置缓存
|
||||||
if (this.currentPage === 0) {
|
if (this.currentPage === 0) {
|
||||||
@@ -2248,7 +2254,6 @@
|
|||||||
}
|
}
|
||||||
if (turnType == 2) {
|
if (turnType == 2) {
|
||||||
this.oldType = "Vertical"
|
this.oldType = "Vertical"
|
||||||
|
|
||||||
// 获取当前的domIndex
|
// 获取当前的domIndex
|
||||||
this.getNowReadIndex()
|
this.getNowReadIndex()
|
||||||
this.isVertical = true
|
this.isVertical = true
|
||||||
@@ -2345,6 +2350,7 @@
|
|||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.tmpChapter.text = res.bookCatalogue
|
this.tmpChapter.text = res.bookCatalogue
|
||||||
|
// console.log(this.tmpChapter.text,'tmpChapter')
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
// 此处是网络连接失败的逻辑
|
// 此处是网络连接失败的逻辑
|
||||||
@@ -2390,8 +2396,8 @@
|
|||||||
text: this.tmpChapter.text,
|
text: this.tmpChapter.text,
|
||||||
canRead: this.tmpChapter.canRead
|
canRead: this.tmpChapter.canRead
|
||||||
}
|
}
|
||||||
console.log(this.verticalData)
|
|
||||||
copyBookText = this.curChapter.text;
|
copyBookText = this.curChapter.text;
|
||||||
|
this.counlSystemInfo()
|
||||||
this.domIndex = 0;
|
this.domIndex = 0;
|
||||||
if (this.curChapter.chapterIndex !== 0) {
|
if (this.curChapter.chapterIndex !== 0) {
|
||||||
await this.getOneChapter(this.directoryList[Number(index) - 1].chapterId)
|
await this.getOneChapter(this.directoryList[Number(index) - 1].chapterId)
|
||||||
@@ -2409,6 +2415,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.curChapter.chapterIndex !== this.directoryList.length - 1) {
|
if (this.curChapter.chapterIndex !== this.directoryList.length - 1) {
|
||||||
|
|
||||||
await this.getOneChapter(this.directoryList[Number(index) + 1].chapterId)
|
await this.getOneChapter(this.directoryList[Number(index) + 1].chapterId)
|
||||||
this.nextChapter = {
|
this.nextChapter = {
|
||||||
chapterIndex: Number(index) + 1,
|
chapterIndex: Number(index) + 1,
|
||||||
@@ -2530,7 +2537,7 @@
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import url("@/pages/yRead/iconfont.css");
|
@import url("@/pages/yRead/iconfont.css");
|
||||||
|
.scroll-Y{height: 600px;}
|
||||||
page {
|
page {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -2627,16 +2634,16 @@
|
|||||||
.inner-box {
|
.inner-box {
|
||||||
.book-inner {}
|
.book-inner {}
|
||||||
|
|
||||||
.highlight {
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.highlight {
|
||||||
color: #e5d6a0 !important;
|
color: #e5d6a0 !important;
|
||||||
// padding: 10rpx 20rpx;
|
// padding: 10rpx 20rpx;
|
||||||
// border-radius: 10rpx;
|
// border-radius: 10rpx;
|
||||||
// background-color: #cbcbcb;
|
// background-color: #cbcbcb;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.fhighlight {}
|
.fhighlight {}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
|
|||||||
Reference in New Issue
Block a user