From 815554aa18b703e757b1f33c9d2a08ba7f35f8ca Mon Sep 17 00:00:00 2001
From: "@fawn-nine" <1271023382@qq.com>
Date: Mon, 27 Nov 2023 17:28:46 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B9=A6=E7=B1=8D=E9=99=84=E5=8A=A0=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E6=B7=BB=E5=8A=A0=E6=9D=83=E9=99=90=E6=A3=80=E6=9F=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/utils.js | 26 ++
pages/comments/comments.vue | 22 +-
pages/comments/commentsList.vue | 58 +++-
pages/eBook/bookContent.vue | 507 ++++++++++++++++++++------------
pages/listen/listen.vue | 66 ++++-
pages/talkBook/talkBookML.vue | 26 +-
6 files changed, 495 insertions(+), 210 deletions(-)
diff --git a/config/utils.js b/config/utils.js
index 161d519..59ed9c1 100644
--- a/config/utils.js
+++ b/config/utils.js
@@ -235,6 +235,32 @@ export const getLatLon = function(tip) {
});
}
+// 查看是否有某本书的权限
+export const checkBookRight = function(data,callback) {
+ console.log('接受的值', data)
+ $http.request({
+ url: "/book/user/checkUserBook",
+ method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
+ data:data,
+ header: { //默认 无 说明:请求头1
+ 'Content-Type': 'application/json'
+ },
+ }).then(res => {
+ // console.log(res,'checkBookRight')
+ if(res.code === 0){
+ callback && callback({
+ success: true,
+ data: '有权限'
+ });
+ }
+ }).catch(e => {
+ callback && callback({
+ success: false,
+ data: '无权限'
+ });
+ })
+}
+
// 单独微信支付
export const setWXPay = function(payInfo, callback) {
$http.request({
diff --git a/pages/comments/comments.vue b/pages/comments/comments.vue
index e4b2cbe..164604a 100644
--- a/pages/comments/comments.vue
+++ b/pages/comments/comments.vue
@@ -139,6 +139,9 @@ import { data } from 'jquery';
import {
mapState
} from 'vuex';
+ import {
+ checkBookRight
+ } from '@/config/utils';
export default {
data() {
return {
@@ -218,9 +221,24 @@ import { data } from 'jquery';
}
if(e==2){
// 跳转到读书打卡
- uni.navigateTo({
- url: '../clock/clock?bookid='+ productInfo.id
+ let data = {
+ 'userId': this.userInfo.id,
+ 'bookId': productInfo.id
+ }
+ checkBookRight(data,res=>{
+ console.log(res)
+ if(res.success){
+ uni.navigateTo({
+ url: '../clock/clock?bookid='+ productInfo.id
+ })
+ }else{
+ uni.showToast({
+ title:'购买本书后方可参与打卡!',
+ icon:'none'
+ })
+ }
})
+
}
if(e==3){
// 跳转到购买
diff --git a/pages/comments/commentsList.vue b/pages/comments/commentsList.vue
index 85667f5..b96eeb7 100644
--- a/pages/comments/commentsList.vue
+++ b/pages/comments/commentsList.vue
@@ -102,10 +102,10 @@
{{item.name}}
{{item.forumNum}}篇书评
-
+
- {{item1.title}}
+ {{item1.title}}
@@ -142,6 +142,9 @@ import { data } from 'jquery';
import {
mapState, mapMutations
} from 'vuex';
+ import {
+ checkBookRight
+ } from '@/config/utils';
export default {
data() {
return {
@@ -265,17 +268,54 @@ import { data } from 'jquery';
},
// 查看本书更多书评
toMore(val){
- console.log(val,'val')
- uni.navigateTo({
- url: '../comments/comments?bookid='+val.id,
- });
+ // console.log(val,'val')
+ let data = {
+ 'userId': this.userInfo.id,
+ 'bookId': val.id
+ }
+ checkBookRight(data,res=>{
+ console.log(res)
+ if(res.success){
+ uni.navigateTo({
+ url: '../comments/comments?bookid='+val.id,
+ });
+ }else{
+ uni.showToast({
+ title:'购买本书后方可查看此内容!',
+ icon:'none'
+ })
+ }
+ })
+
},
// 书评详情
toDetail(val){
- console.log(val,'val')
- uni.navigateTo({
- url:'../comments/commentsDetail?bookid='+val.bookid+'&bfa_id='+val.id
+ // console.log(val,'val')
+ uni.navigateTo({
+ url:'../comments/commentsDetail?bookid='+val.bookid+'&bfa_id='+val.id
+ })
+ },
+ // 判断健全
+ toDetail1(val){
+ // console.log(val,'val')
+ let data = {
+ 'userId': this.userInfo.id,
+ 'bookId': val.bookid
+ }
+ checkBookRight(data,res=>{
+ console.log(res)
+ if(res.success){
+ uni.navigateTo({
+ url:'../comments/commentsDetail?bookid='+val.bookid+'&bfa_id='+val.id
+ })
+ }else{
+ uni.showToast({
+ title:'购买本书后方可查看此内容!',
+ icon:'none'
+ })
+ }
})
+
},
clickLike(item){
this.$http
diff --git a/pages/eBook/bookContent.vue b/pages/eBook/bookContent.vue
index f52340e..c905e35 100644
--- a/pages/eBook/bookContent.vue
+++ b/pages/eBook/bookContent.vue
@@ -4,7 +4,7 @@
-
+
@@ -20,10 +20,13 @@
-
+
-
-
+
+
@@ -43,52 +46,54 @@
{{bookMessage.description}}
-
-
-
-
- 精彩试听
-
-
-
-
-
-
- {{item.chapter}}
-
-
-
-
-
-
- 查看完整目录
-
-
-
-
-
- 热门书评
-
-
-
- {{item.title}}
-
-
+
+
+
+ 精彩试听
+
+
+
+
+
+
+ {{item.chapter}}
+
+
+
- 立即查看
+
+ 查看完整目录
+
-
- 查看更多
+
+
+
+
+ 热门书评
+
+
+ {{item.title}}
+
+
+
+
+ 立即查看
+
+
+ 查看更多
+
+
+
+
+
+
-
-
-
-
-
@@ -96,25 +101,29 @@
+
\ No newline at end of file
diff --git a/pages/listen/listen.vue b/pages/listen/listen.vue
index 11ddcbb..4671fc0 100644
--- a/pages/listen/listen.vue
+++ b/pages/listen/listen.vue
@@ -110,6 +110,9 @@
import {
mapState,mapMutations
} from 'vuex';
+ import {
+ checkBookRight
+ } from '@/config/utils';
export default {
components: {
// cxAdudioPlay,
@@ -218,10 +221,23 @@
// },
// 查看本书更多书评
toMore(val){
- console.log(val,'val')
- uni.navigateTo({
- url: '../comments/comments?bookid='+ this.bookid,
- });
+ let data = {
+ 'userId': this.userInfo.id,
+ 'bookId': this.bookid
+ }
+ checkBookRight(data,res=>{
+ // console.log(res)
+ if(res.success){
+ uni.navigateTo({
+ url: '../comments/comments?bookid='+ this.bookid,
+ });
+ }else{
+ uni.showToast({
+ title:'购买本书后方可查看此内容!',
+ icon:'none'
+ })
+ }
+ })
},
// 去听书
gotoListen(){
@@ -231,15 +247,43 @@
},
// 去讲书
goJiangShu(){
- uni.navigateTo({
- url: '../talkBook/talkBookDetail?bookId='+ this.bookid
- });
+ let data = {
+ 'userId': this.userInfo.id,
+ 'bookId': this.bookid
+ }
+ checkBookRight(data,res=>{
+ console.log(res)
+ if(res.success){
+ uni.navigateTo({
+ url: '../talkBook/talkBookML?bookid=' + this.bookid
+ });
+ }else{
+ uni.showToast({
+ title:'购买本书后方可查看此内容!',
+ icon:'none'
+ })
+ }
+ })
},
// 去打卡
- gotoclock(){
- uni.navigateTo({
- url: '../clock/clock?bookid='+ this.bookid,
- });
+ gotoclock(){
+ let data = {
+ 'userId': this.userInfo.id,
+ 'bookId': this.bookid
+ }
+ checkBookRight(data,res=>{
+ console.log(res)
+ if(res.success){
+ uni.navigateTo({
+ url: '../clock/clock?bookid='+ this.bookid,
+ });
+ }else{
+ uni.showToast({
+ title:'购买本书后方可参与打卡!',
+ icon:'none'
+ })
+ }
+ })
},
getBookInfo(){
// 获取书本基本信息
diff --git a/pages/talkBook/talkBookML.vue b/pages/talkBook/talkBookML.vue
index e2a6058..af989a8 100644
--- a/pages/talkBook/talkBookML.vue
+++ b/pages/talkBook/talkBookML.vue
@@ -86,6 +86,9 @@
mapState,
mapMutations
} from 'vuex';
+ import {
+ checkBookRight
+ } from '@/config/utils';
export default {
components: {
// cxAdudioPlay,
@@ -157,10 +160,25 @@
// 查看本书更多书评
toMore(val) {
- console.log(val, 'val')
- uni.navigateTo({
- url: '../comments/comments?bookid=' + this.bookid,
- });
+ // console.log(val, 'val')
+ let data = {
+ 'userId': this.userInfo.id,
+ 'bookId': this.bookid
+ }
+ checkBookRight(data,res=>{
+ console.log(res)
+ if(res.success){
+ uni.navigateTo({
+ url: '../comments/comments?bookid=' + this.bookid,
+ });
+ }else{
+ uni.showToast({
+ title:'购买本书后方可查看此内容!',
+ icon:'none'
+ })
+ }
+ })
+
},
// 去打卡
gotoclock() {