修复:开发测试问题修改

This commit is contained in:
2025-11-28 10:48:41 +08:00
parent 435a23f995
commit 85ca0c7a28
19 changed files with 144 additions and 146 deletions

View File

@@ -114,31 +114,6 @@
@confirm="handlePurchase"
@close="closePurchasePopup"
/>
<!-- <wd-popup v-model="purchaseVisible" position="bottom">
<view class="purchase-popup">
<view class="book-info-mini">
<image :src="bookInfo.images" mode="aspectFill" />
<view class="info">
<text class="name">{{ bookInfo.name }}</text>
<text v-if="bookInfo.priceData" class="price">
$ {{ bookInfo.priceData.dictValue }} NZD
</text>
</view>
</view>
<view class="spec-section">
<text class="spec-title">{{ $t('bookDetails.list') }}</text>
<view class="spec-item active">
<text>{{ bookInfo.name }}</text>
<text v-if="bookInfo.priceData" class="spec-price">
${{ bookInfo.priceData.dictValue }} NZD
</text>
</view>
</view>
<wd-button type="primary" block @click="handlePurchase">
{{ $t('bookDetails.buy') }}
</wd-button>
</view>
</wd-popup> -->
</view>
</template>

View File

@@ -162,10 +162,7 @@
>
<image :src="item.images" />
<text class="book-text">{{ item.name }}</text>
<text class="book-price">{{ item.minPrice }} {{ t('global.coin') }}</text>
<text v-if="formatStats(item)" class="book-flag">{{
formatStats(item)
}}</text>
<BookPrice :data="item" class="book-price-container" />
</view>
</view>
<text v-else class="zanwu" style="padding: 100rpx 0">{{ $t('global.dataNull') }}</text>
@@ -177,9 +174,9 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import { homeApi } from '@/api/modules/book_home'
import { getNotchHeight } from '@/utils/system'
import BookPrice from '@/components/book/BookPrice.vue'
import type {
IBook,
IBookWithStats,
@@ -187,8 +184,6 @@ import type {
IVipInfo
} from '@/types/book'
const { t } = useI18n()
// 状态定义
const showMyBooks = ref(false)
const showActivity = ref(false)
@@ -320,43 +315,6 @@ const getBooksByLabel = async (
}
}
/**
* 格式化价格
*/
const formatPrice = (book: IBookWithStats): string => {
// 已购买不显示价格
if (book.isBuy) return ''
// VIP用户且图书为VIP专享
if (vipInfo.value?.id && book.isVip === '2') {
const price = book.sysDictData?.dictValue
return price ? `$ ${price} NZD` : ''
}
// 普通用户
if (!vipInfo.value?.id) {
const price = book.sysDictData?.dictValue
return price ? `$ ${price} NZD` : ''
}
return ''
}
/**
* 格式化统计信息
*/
const formatStats = (book: IBookWithStats): string => {
if (book.readCount && book.readCount > 0) {
return `${book.readCount}${t('bookHome.readingCount')}`
}
if (book.buyCount && book.buyCount > 0) {
return `${book.buyCount}${t('bookHome.purchased')}`
}
return ''
}
/**
* 处理搜索点击
*/
@@ -388,8 +346,8 @@ const handleBookClick = (bookId: number) => {
* 处理更多按钮点击
*/
const handleMoreClick = () => {
uni.switchTab({
url: '/pages/book/index'
uni.navigateTo({
url: '/pages/user/myBook/index'
})
}
@@ -779,21 +737,9 @@ onShow(() => {
overflow: hidden;
}
.book-price {
position: absolute;
font-size: 28rpx;
color: #ff4703;
left: 30rpx;
bottom: 20rpx;
}
.book-flag {
display: block;
font-size: 26rpx;
color: #999;
position: absolute;
right: 6%;
bottom: 20rpx;
.book-price-container {
width: 80%;
margin: 15rpx auto 0;
}
}
}

View File

@@ -381,7 +381,7 @@ async function prevChapter() {
playChapter(chapterList.value[currentChapterIndex.value])
} else {
uni.showToast({
title: t('listen.earlier'),
title: t('listen.isFirst'),
icon: 'none'
})
}
@@ -412,7 +412,7 @@ async function nextChapter() {
playChapter(chapterList.value[currentChapterIndex.value])
} else {
uni.showToast({
title: t('listen.behind'),
title: t('listen.isLast'),
icon: 'none'
})
}

View File

@@ -606,7 +606,7 @@ function changeReadMode(mode: 'scroll' | 'page') {
const bookLanguages = ref([])
const currentLanguage = ref('')
onMounted(() => {
currentLanguage.value = uni.getStorageSync('currentBookLanguage') || ''
currentLanguage.value = uni.getStorageSync('currentBookLanguage') || '中文'
console.log('currentLanguage', currentLanguage.value)
})
const getBookLanguages = async () => {