Merge branch 'main' of https://git.nuttyreading.com/zm/taimed-international-app
This commit is contained in:
@@ -79,15 +79,15 @@
|
||||
|
||||
<!-- 底部操作栏 -->
|
||||
<view class="action-bar">
|
||||
<template v-if="bookInfo.isBuy">
|
||||
<template v-if="bookInfo.isBuy || hasVip">
|
||||
<view class="action-btn read" @click="goToReader">
|
||||
<text>{{ $t('bookDetails.startReading') }}</text>
|
||||
</view>
|
||||
<view class="action-btn purchased">
|
||||
<!-- <view class="action-btn purchased">
|
||||
<wd-button disabled custom-class="purchased-btn">
|
||||
{{ $t('bookDetails.buttonText2') }}
|
||||
</wd-button>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="action-btn listen" @click="goToListen">
|
||||
<text>{{ $t('bookDetails.startListening') }}</text>
|
||||
</view>
|
||||
@@ -120,19 +120,23 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { t } from '@/utils/i18n'
|
||||
import { bookApi } from '@/api/modules/book'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import type { IBookDetail, IBook, IComment } from '@/types/book'
|
||||
import type { IGoods } from '@/types/order'
|
||||
import GoodsSelector from '@/components/order/GoodsSelector.vue'
|
||||
import CommentList from '@/components/book/CommentList.vue'
|
||||
|
||||
const { t } = useI18n()
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 路由参数
|
||||
const bookId = ref(0)
|
||||
const pageFrom = ref('')
|
||||
|
||||
// 会员状态
|
||||
const hasVip = computed(() => userStore.userInfo?.userEbookVip?.length > 0 || false)
|
||||
|
||||
// 数据状态
|
||||
const bookInfo = ref<IBookDetail>({
|
||||
id: 0,
|
||||
|
||||
@@ -172,10 +172,11 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { homeApi } from '@/api/modules/book_home'
|
||||
import { getNotchHeight } from '@/utils/system'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import BookPrice from '@/components/book/BookPrice.vue'
|
||||
import type {
|
||||
IBook,
|
||||
@@ -184,6 +185,8 @@ import type {
|
||||
IVipInfo
|
||||
} from '@/types/book'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 状态定义
|
||||
const showMyBooks = ref(false)
|
||||
const showActivity = ref(false)
|
||||
@@ -208,17 +211,7 @@ const currentLevel1Index = ref(0)
|
||||
const currentLevel2Index = ref(0)
|
||||
|
||||
// VIP信息
|
||||
const vipInfo = ref<IVipInfo | null>(null)
|
||||
|
||||
/**
|
||||
* 获取VIP信息
|
||||
*/
|
||||
const getVipInfo = async () => {
|
||||
const res = await homeApi.getVipInfo()
|
||||
if (res.vipInfo) {
|
||||
vipInfo.value = res.vipInfo
|
||||
}
|
||||
}
|
||||
const vipInfo = computed(() => userStore.userInfo?.userEbookVip?.[0] || null)
|
||||
|
||||
/**
|
||||
* 获取我的书单
|
||||
@@ -388,7 +381,6 @@ onMounted(() => {
|
||||
*/
|
||||
onShow(() => {
|
||||
// 刷新数据
|
||||
getVipInfo()
|
||||
getMyBooks()
|
||||
getRecommendBooks()
|
||||
getActivityLabels()
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<text class="author">{{ $t('bookDetails.authorName') }}{{ bookInfo.author?.authorName }}</text>
|
||||
</view>
|
||||
<wd-button
|
||||
v-if="!bookInfo.isBuy"
|
||||
v-if="!bookInfo.isBuy && !hasVip"
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="purchaseVisible = true"
|
||||
@@ -63,18 +63,22 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { t } from '@/utils/i18n'
|
||||
import { bookApi } from '@/api/modules/book'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import type { IBookDetail, IChapter } from '@/types/book'
|
||||
import type { IGoods } from '@/types/order'
|
||||
import GoodsSelector from '@/components/order/GoodsSelector.vue'
|
||||
|
||||
const { t } = useI18n()
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 路由参数
|
||||
const bookId = ref(0)
|
||||
const fromIndex = ref(-1)
|
||||
|
||||
// 会员状态
|
||||
const hasVip = computed(() => userStore.userInfo?.userEbookVip?.length > 0 || false)
|
||||
|
||||
// 数据状态
|
||||
const bookInfo = ref<IBookDetail>({
|
||||
id: 0,
|
||||
@@ -163,7 +167,7 @@ async function loadChapterList() {
|
||||
|
||||
// 判断章节是否锁定
|
||||
function isLocked(index: number): boolean {
|
||||
return !bookInfo.value.isBuy && index + 1 > bookInfo.value.freeChapterCount
|
||||
return !bookInfo.value.isBuy && index + 1 > bookInfo.value.freeChapterCount && !hasVip.value
|
||||
}
|
||||
|
||||
// 播放章节
|
||||
|
||||
@@ -80,7 +80,8 @@
|
||||
:class="{ 'chapter-item-active': currentChapterIndex === index }"
|
||||
@click="selectChapter(index)"
|
||||
>
|
||||
<text class="chapter-title">{{ chapter.chapter }}</text>
|
||||
<text class="chapter-title" :class="{ locked: isLocked(index) }">{{ chapter.chapter }}</text>
|
||||
<wd-icon v-if="isLocked(index)" name="lock-on" size="20px" />
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
@@ -92,10 +93,15 @@
|
||||
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
||||
import { onLoad, onHide, onUnload } from '@dcloudio/uni-app'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { bookApi } from '@/api/modules/book'
|
||||
import type { IBookDetail, IChapter } from '@/types/book'
|
||||
|
||||
const { t } = useI18n()
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 会员状态
|
||||
const hasVip = computed(() => userStore.userInfo?.userEbookVip?.length > 0 || false)
|
||||
|
||||
// 路由参数
|
||||
const bookId = ref(0)
|
||||
@@ -284,6 +290,11 @@ async function loadChapterList() {
|
||||
}
|
||||
}
|
||||
|
||||
// 判断章节是否锁定
|
||||
function isLocked(index: number): boolean {
|
||||
return !bookInfo.value.isBuy && index + 1 > bookInfo.value.freeChapterCount && !hasVip.value
|
||||
}
|
||||
|
||||
// 加载章节内容(带音频时间点)
|
||||
async function loadChapterContent(chapterId: number) {
|
||||
try {
|
||||
@@ -375,7 +386,7 @@ function togglePlay() {
|
||||
|
||||
// 上一章
|
||||
async function prevChapter() {
|
||||
if (currentChapterIndex.value > 0) {
|
||||
if (currentChapterIndex.value > 0 && !isLocked(currentChapterIndex.value - 1)) {
|
||||
currentChapterIndex.value--
|
||||
await loadChapterContent(chapterList.value[currentChapterIndex.value].id)
|
||||
playChapter(chapterList.value[currentChapterIndex.value])
|
||||
@@ -390,19 +401,23 @@ async function prevChapter() {
|
||||
// 下一章
|
||||
async function nextChapter() {
|
||||
// 检查是否锁定
|
||||
if (isBuy.value === '1' && currentChapterIndex.value + 1 >= count.value) {
|
||||
uni.showModal({
|
||||
title: t('common.limit_title'),
|
||||
content: t('book.afterPurchase'),
|
||||
confirmText: t('common.confirm_text'),
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/book/order?id=${bookId.value}`
|
||||
})
|
||||
}
|
||||
}
|
||||
if (isLocked(currentChapterIndex.value + 1)) {
|
||||
uni.showToast({
|
||||
title: t('book.afterPurchase'),
|
||||
icon: 'none'
|
||||
})
|
||||
// uni.showModal({
|
||||
// title: t('common.limit_title'),
|
||||
// content: t('book.afterPurchase'),
|
||||
// confirmText: t('common.confirm_text'),
|
||||
// success: (res) => {
|
||||
// if (res.confirm) {
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/book/order?id=${bookId.value}`
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
return
|
||||
}
|
||||
|
||||
@@ -491,7 +506,7 @@ async function selectChapter(index: number) {
|
||||
}
|
||||
|
||||
// 检查是否锁定
|
||||
if (isBuy.value === '1' && index >= count.value) {
|
||||
if (isLocked(index)) {
|
||||
uni.showToast({
|
||||
title: t('book.afterPurchase'),
|
||||
icon: 'none'
|
||||
@@ -698,6 +713,10 @@ function formatTime(seconds: number): string {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
|
||||
&.locked {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.chapter-item-active .chapter-title {
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
<text class="popup-title">{{ $t('book.zjContents') }}</text>
|
||||
<scroll-view scroll-y class="chapter-list">
|
||||
<view
|
||||
v-if="chapterList.length > 0"
|
||||
v-for="(chapter, index) in chapterList"
|
||||
:key="chapter.id"
|
||||
class="chapter-item"
|
||||
@@ -111,8 +112,9 @@
|
||||
<text class="chapter-text" :class="{ locked: isLocked(index) }">
|
||||
{{ chapter.chapter }}{{ chapter.content ? ' - ' + chapter.content : '' }}
|
||||
</text>
|
||||
<wd-icon v-if="isLocked(index)" name="lock-on" size="20px" />
|
||||
<wd-icon v-if="isLocked(index) && !hasVip" name="lock-on" size="20px" />
|
||||
</view>
|
||||
<wd-status-tip v-else image="content" :tip="$t('global.dataNull')" />
|
||||
</scroll-view>
|
||||
</view>
|
||||
</wd-popup>
|
||||
@@ -191,6 +193,7 @@
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { onLoad, onShow, onHide, onBackPress } from '@dcloudio/uni-app'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useBookStore } from '@/stores/book'
|
||||
import { bookApi } from '@/api/modules/book'
|
||||
import type { IChapter, IChapterContent, IReadProgress } from '@/types/book'
|
||||
@@ -198,6 +201,10 @@ import { onPageBack } from '@/utils/index'
|
||||
|
||||
const { t } = useI18n()
|
||||
const bookStore = useBookStore()
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 会员状态
|
||||
const hasVip = computed(() => userStore.userInfo?.userEbookVip?.length > 0 || false)
|
||||
|
||||
// 路由参数
|
||||
const bookId = ref(0)
|
||||
@@ -430,7 +437,7 @@ async function switchChapter(chapter: IChapter, index: number) {
|
||||
|
||||
// 判断章节是否锁定
|
||||
function isLocked(index: number): boolean {
|
||||
return !isBuy.value && index + 1 > count.value
|
||||
return !isBuy.value && index + 1 > count.value && !hasVip.value
|
||||
}
|
||||
|
||||
// 判断是否是图片
|
||||
@@ -604,10 +611,9 @@ function changeReadMode(mode: 'scroll' | 'page') {
|
||||
|
||||
// 语言配置
|
||||
const bookLanguages = ref([])
|
||||
const currentLanguage = ref('')
|
||||
const currentLanguage = ref('中文')
|
||||
onMounted(() => {
|
||||
currentLanguage.value = uni.getStorageSync('currentBookLanguage') || '中文'
|
||||
console.log('currentLanguage', currentLanguage.value)
|
||||
})
|
||||
const getBookLanguages = async () => {
|
||||
const res = await bookApi.getBookLanguages(bookId.value)
|
||||
@@ -658,7 +664,7 @@ async function saveProgress() {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 999;
|
||||
z-index: 90;
|
||||
background: inherit;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -122,14 +122,6 @@ const loadChapterDetail = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择视频
|
||||
*/
|
||||
const selectVideo = async (index: number) => {
|
||||
if (index === currentVideoIndex.value) return
|
||||
currentVideoIndex.value = index
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览图片
|
||||
*/
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 锁定图标 -->
|
||||
<view v-if="!canAccess(chapter)" class="lock-icon">
|
||||
<view v-if="!canAccess(chapter) && currentCatalogue.type != 0" class="lock-icon">
|
||||
<wd-icon name="lock-on" size="24px" color="#258feb" />
|
||||
</view>
|
||||
</view>
|
||||
@@ -252,7 +252,7 @@ const canAccess = (chapter: IChapter): boolean => {
|
||||
if (chapter.isAudition === 1) return true
|
||||
|
||||
// 免费课程可以访问
|
||||
if (currentCatalogue.value.type === 0) return true
|
||||
// if (currentCatalogue.value.type === 0) return true
|
||||
|
||||
return false
|
||||
}
|
||||
@@ -261,18 +261,18 @@ const canAccess = (chapter: IChapter): boolean => {
|
||||
* 点击章节
|
||||
*/
|
||||
const handleChapterClick = (chapter: IChapter, catalogue: ICatalogue) => {
|
||||
if (!isPurchased.value && currentCatalogue.value.type === 0) {
|
||||
uni.showToast({
|
||||
title: '请先领取课程',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!canAccess(chapter)) {
|
||||
uni.showToast({
|
||||
title: '请先购买课程',
|
||||
icon: 'none'
|
||||
})
|
||||
if (currentCatalogue.value.type === 0) {
|
||||
uni.showToast({
|
||||
title: '请先领取课程',
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '请先购买课程',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!-- 自定义导航栏 -->
|
||||
<nav-bar :title="$t('news.newsDetail')" />
|
||||
|
||||
<web-view v-if="urlVisible" :webview-styles="{ progress: { color: '#55aaff' } }" :src="surl"></web-view>
|
||||
<view v-if="urlVisible" class="web-view-container"><web-view :webview-styles="{ progress: { color: '#55aaff' } }" :src="surl"></web-view></view>
|
||||
<view v-else class="box">
|
||||
<view class="title">{{ news.title }}</view>
|
||||
<view
|
||||
@@ -32,28 +32,27 @@ onLoad((e: any) => {
|
||||
source.value = e.source || ''
|
||||
if(type.value == 1 && surl.value != ''){
|
||||
urlVisible.value = true
|
||||
// APP 设置导航栏按钮
|
||||
// #ifdef APP-PLUS
|
||||
const pages = getCurrentPages()
|
||||
const page = pages[pages.length - 1]
|
||||
const currentWebview = page.$getAppWebview()
|
||||
|
||||
currentWebview.setStyle({
|
||||
titleNView: {
|
||||
buttons: [{
|
||||
float: 'right',
|
||||
type: 'close',
|
||||
onclick: () => {
|
||||
uni.navigateBack({ delta: 1 })
|
||||
}
|
||||
}]
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
} else {
|
||||
getData()
|
||||
}
|
||||
|
||||
// APP 设置导航栏按钮
|
||||
// #ifdef APP-PLUS
|
||||
// const pages = getCurrentPages()
|
||||
// const page = pages[pages.length - 1]
|
||||
// const currentWebview = page.$getAppWebview()
|
||||
|
||||
// currentWebview.setStyle({
|
||||
// titleNView: {
|
||||
// buttons: [{
|
||||
// float: 'right',
|
||||
// type: 'close',
|
||||
// onclick: () => {
|
||||
// uni.navigateBack({ delta: 1 })
|
||||
// }
|
||||
// }]
|
||||
// }
|
||||
// })
|
||||
// #endif
|
||||
})
|
||||
|
||||
// 新闻详情
|
||||
@@ -102,6 +101,9 @@ const formattedContent = computed(() => formatRichText(news.value.content))
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.web-view-container {
|
||||
padding-top: 60px;
|
||||
}
|
||||
.box {
|
||||
background-color: #fff;
|
||||
padding: 10px;
|
||||
|
||||
@@ -133,13 +133,13 @@
|
||||
url: '/pages/user/feedback/index',
|
||||
type: 'pageJump'
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: t('user.dataMigrate'),
|
||||
url: '/pages/user/migrate/index',
|
||||
desc: t('user.migrateSubtitle'),
|
||||
type: 'pageJump'
|
||||
}
|
||||
// {
|
||||
// id: 6,
|
||||
// name: t('user.dataMigrate'),
|
||||
// url: '/pages/user/migrate/index',
|
||||
// desc: t('user.migrateSubtitle'),
|
||||
// type: 'pageJump'
|
||||
// }
|
||||
])
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,6 +54,8 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<wd-message-box />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -61,6 +63,9 @@
|
||||
import { ref } from 'vue'
|
||||
import { t } from '@/utils/i18n'
|
||||
import { migrateUserData } from '@/api/modules/user'
|
||||
import { useMessage } from '@/uni_modules/wot-design-uni'
|
||||
|
||||
const message = useMessage()
|
||||
|
||||
// 表单引用
|
||||
const migrateForm = ref()
|
||||
@@ -85,14 +90,20 @@ const rules = ref({
|
||||
const handleSubmit = async () => {
|
||||
migrateForm.value.validate().then(({ valid, errors }: any) => {
|
||||
if (valid) {
|
||||
uni.showModal({
|
||||
message.confirm({
|
||||
title: t('global.tips'),
|
||||
content: t('user.migrateWarning'),
|
||||
success: (res: any) => {
|
||||
if (res.confirm) {
|
||||
submitMigrate()
|
||||
}
|
||||
}
|
||||
msg: t('user.instruction2'),
|
||||
}).then(() => {
|
||||
message.confirm({
|
||||
title: t('global.tips'),
|
||||
msg: t('user.migrateWarning'),
|
||||
}).then(() => {
|
||||
submitMigrate()
|
||||
}).catch(() => {
|
||||
// 取消数据迁移
|
||||
})
|
||||
}).catch(() => {
|
||||
// 取消数据迁移
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<ProductInfo v-if="order.orderType === 'vip'" :data="order.vipBuyConfigEntity" :type="order.orderType" />
|
||||
<ProductInfo v-if="order.orderType === 'abroadVip'" :data="order.ebookvipBuyConfig" :type="order.orderType" />
|
||||
<!-- 三种订单类型商品信息 end -->
|
||||
<view class="order-item-total-price">实付款:{{ order.orderMoney }} {{ t('global.coin') }}</view>
|
||||
<view class="order-item-total-price">实付款:{{ order.realMoney }} {{ t('global.coin') }}</view>
|
||||
|
||||
<template #footer>
|
||||
<view>
|
||||
|
||||
Reference in New Issue
Block a user