修复:开发测试问题修改

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

@@ -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;
}
}
}