Commit a51857c2 authored by jyx's avatar jyx

微信官方阅读器

parent a779a283
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
<view v-if="agreementDto != null" @click="handleUnsign" <view v-if="agreementDto != null" @click="handleUnsign"
style="margin-top: 12rpx;margin-left: 10rpx;">自动续费管理></view> style="margin-top: 12rpx;margin-left: 10rpx;">自动续费管理></view>
<view style="margin-top: 12rpx;margin-left: auto;display: flex;flex-direction: row;"> <view style="margin-top: 15rpx;margin-left: auto;display: flex;flex-direction: row;">
<view @click="handleAgree" style="margin-right: 10rpx;">付费须知></view> <view @click="handleAgree" style="margin-right: 10rpx;">付费须知></view>
<image @click="handleClickClose" <image @click="handleClose"
style="width: 30rpx;height: 30rpx;display: flex;align-items: right;margin-top: 20rpx;margin-left: auto;margin-right: 20rpx;margin-bottom: 10rpx;" style="width: 30rpx;height: 30rpx;display: flex;align-items: right;margin-top: 13rpx;margin-left: 10rpx;margin-right: 20rpx;margin-bottom: 10rpx;"
src="@/static/index/ic_quit_white.png"></image> src="@/static/index/ic_quit_white.png"></image>
</view> </view>
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
import { import {
apiPOST apiPOST
} from "../common/utils/apiRequest.js" } from "@/common/utils/apiRequest.js"
export default { export default {
data() { data() {
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
vipList: [], vipList: [],
selectedIndex: 0, selectedIndex: 0,
agreeFlag: false, agreeFlag: false,
agreeText: "付费须知\n\n1、看点和会员属于虚拟商品,一经购买不可退换\n\n2、未满18岁的未成年人需要在监护人主导、同意下进行相关付费操作;\n\n3、充值看点一般5分钟内到账,如未到账请在“我的”页面联系客服;" agreeText: "付费须知\n\n1、看点和会员属于虚拟商品,一经购买不可退换\n\n2、未满18岁的未成年人需要在监护人主导、同意下进行相关付费操作;\n\n3、充值看点一般5分钟内到账,如未到账请在“我的”页面联系客服;",
userBean: {}, userBean: {},
agreementDto: null, agreementDto: null,
hintText: '', hintText: '',
...@@ -126,58 +126,76 @@ ...@@ -126,58 +126,76 @@
methods: { methods: {
// 支付完成回调 // 支付完成回调
paySuccess(largeType) { paySuccess(largeType) {
this.$emit('paySuccess', largeType); this.unlockSerial()
this.handleClose();
}, },
unlock() { // 解锁剧集
// 取出对应的阅读器实例 unlockSerial() {
const novelManager = novelPlugin.getNovelManager(this.properties.novelManagerId) let that = this
const novelManager = novelPlugin.getNovelManager(this.novelManagerId)
apiPOST({
url: '/book/info',
data: {
wxId: that.bookId,
reader: true
},
callback: (success, data) => {
if (success) {
novelManager.paymentCompleted()
that.$nextTick(() => {
novelManager.setContents({
contents: data.wechatRecord.wxChapter
})
})
// 告诉阅读器这一章已解锁 that.handleClose()
novelManager.paymentCompleted() }
}
})
}, },
handleShow() { handleShow() {
let that = this;
if (wx.getSystemInfoSync().platform === 'ios') { if (wx.getSystemInfoSync().platform === 'ios') {
this.os = 'ios'; this.os = 'ios';
} }
this.post({ // const novelManager = novelPlugin.getNovelManager(this.novelManagerId)
// novelManager.setChargeWay({
// globalConfig: {
// mode: 1,
// buttonText: '解锁全部',
// tip: '开通会员后可继续阅读',
// },
// })
let that = this;
apiPOST({
url: '/vip/getVipProducts/cyc', url: '/vip/getVipProducts/cyc',
data: { callback: (success, data) => {
bookId: that.vedioId if (success) {
}, that.vipList = data.list;
showLoading: false, if (data.list != null) {
success: ({ that.hintText = that.vipList[0].trailRemark;
data for (let i = 0; i < data.list.length; i++) {
}) => { if (data.list[i].activityType == 1) {
this.vipList = data.list; that.selectedIndex = i;
if (data.list != null) { break;
this.hintText = this.vipList[0].trailRemark; }
for (let i = 0; i < data.list.length; i++) {
if (data.list[i].activityType == 1) {
this.selectedIndex = i;
break;
} }
} }
} }
} }
}); });
this.post({ apiPOST({
url: '/vip/getOrderList', url: '/vip/getOrderList',
showLoading: false, callback: (success, data) => {
success: ({ if (success) {
data console.log("agreement=", data.agreement);
}) => { if (data.agreement == undefined) {
console.log("agreement=", data.agreement); this.agreementDto = null;
if (data.agreement == undefined) { } else {
this.agreementDto = null; this.agreementDto = data.agreement;
} else { }
this.agreementDto = data.agreement;
} }
} }
}); });
}, },
...@@ -190,12 +208,9 @@ ...@@ -190,12 +208,9 @@
handleAgree() { handleAgree() {
this.agreeFlag = true this.agreeFlag = true
}, },
handleClickClose() {
this.$emit('clickClose');
this.$emit('close');
},
handleClose() { handleClose() {
this.$emit('close'); const novelManager = novelPlugin.getNovelManager(this.novelManagerId)
novelManager.closeChargeDialog()
}, },
choosePack(item, index) { choosePack(item, index) {
this.selectedIndex = index; this.selectedIndex = index;
...@@ -213,24 +228,22 @@ ...@@ -213,24 +228,22 @@
if (this.os == 'ios') { if (this.os == 'ios') {
message.notify('暂不支持ios系统~'); message.notify('暂不支持ios系统~');
} else { } else {
this.post({ apiPOST({
url: '/vip/getVipPayParams/wechat', url: '/vip/getVipPayParams/wechat',
data: { data: {
pid: vipBean.pid, pid: vipBean.pid,
payChannel: 'WEIXIN' payChannel: 'WEIXIN'
}, },
showLoading: true, callback: (success, data) => {
success: ({ if (success) {
data if (vipBean.firstPayPrice == 0) {
}) => { //签约
if (vipBean.firstPayPrice == 0) { that.wxSign(data, vipBean.largeType);
//签约 } else {
that.wxSign(data, vipBean.largeType); //普通支付
} else { that.wxPay(data, vipBean.largeType);
//普通支付 }
that.wxPay(data, vipBean.largeType);
} }
} }
}); });
} }
...@@ -278,29 +291,18 @@ ...@@ -278,29 +291,18 @@
}, },
queryOrderStatus(largeType, tid) { queryOrderStatus(largeType, tid) {
let that = this; let that = this;
this.post({ apiPOST({
url: '/vip/queryVipOrder',
data: { data: {
tid: tid tid
}, },
url: '/vip/queryVipOrder', callback: (success, data) => {
showLoading: true, if (success) {
success: ({ that.paySuccess(largeType);
data }
}) => {
that.paySuccess(largeType);
} }
}); });
} }
},
watch: {
show: {
handler: function(newVal, oldVal) {
if (newVal) {
this.handleShow();
}
},
immediate: true
}
} }
}; };
</script> </script>
......
...@@ -13,6 +13,11 @@ import './filters' ...@@ -13,6 +13,11 @@ import './filters'
plus.screen.lockOrientation('portrait-primary'); plus.screen.lockOrientation('portrait-primary');
// #endif // #endif
// #ifdef MP-WEIXIN
import chargedialog from './components/charge-dialog/charge-dialog.vue'
Vue.component('charge-dialog', chargedialog)
// #endif
// let v = new vconsole(); // let v = new vconsole();
// #ifndef VUE3 // #ifndef VUE3
import Vue from 'vue' import Vue from 'vue'
...@@ -39,4 +44,4 @@ export function createApp() { ...@@ -39,4 +44,4 @@ export function createApp() {
app app
} }
} }
// #endif // #endif
\ No newline at end of file
...@@ -13,8 +13,9 @@ function navigateToNovel(wxId, customId) { ...@@ -13,8 +13,9 @@ function navigateToNovel(wxId, customId) {
const proto = { const proto = {
_onNovelLoad(data) { _onNovelLoad(data) {
const novelManager = novelPlugin.getNovelManager(data.id) const nm = novelPlugin.getNovelManager(data.id)
// this.nm = novelManager this.nm = nm
this.myId = data.id
novelPlugin.setLoggerConfig({ novelPlugin.setLoggerConfig({
info: true, info: true,
...@@ -24,21 +25,21 @@ const proto = { ...@@ -24,21 +25,21 @@ const proto = {
error: true, error: true,
}) })
const customId = novelManager.getCustomServerParams() const customId = nm.getCustomServerParams()
this.getContent(customId).then(res => { this.getContent(customId).then(res => {
novelManager.setContents({ nm.setContents({
contents: res.chapter contents: res.chapter
}) })
}) })
// 调整分享参数 // 调整分享参数
novelManager.setShareParams({ nm.setShareParams({
title: 'xxx', title: 'xxx',
imageUrl: 'xxx' imageUrl: 'xxx'
}) })
novelManager.onUserTriggerEvent((obj) => { nm.onUserTriggerEvent((obj) => {
console.log('onUserTriggerEvent----->' + obj.event_id) console.log('onUserTriggerEvent----->' + obj.event_id)
//开始阅读书籍时 //开始阅读书籍时
...@@ -97,18 +98,8 @@ const proto = { ...@@ -97,18 +98,8 @@ const proto = {
url: '/book/addReadRecord', url: '/book/addReadRecord',
data: { data: {
articleId articleId
},
success: (res) => {
console.log('ssssssss')
},
fail: (res) => {
console.log('eeeeeee')
} }
}) })
},
// 解锁剧集
unlockSerial() {
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment