consumer模块完成度95%,实现数据库多端注册登录,优化安卓端小程序bug
This commit is contained in:
@@ -157,6 +157,7 @@
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { supabaseService } from '@/utils/supabaseService.uts'
|
||||
|
||||
type ReviewItem = {
|
||||
@@ -222,18 +223,19 @@ const loadStats = async (): Promise<void> => {
|
||||
}
|
||||
}
|
||||
|
||||
stats.value = {
|
||||
const statsData: StatsType = {
|
||||
total_count: result.getNumber('total_count') ?? 0,
|
||||
avg_rating: result.getNumber('avg_rating') ?? 0,
|
||||
good_rate: result.getNumber('good_rate') ?? 0,
|
||||
rating_distribution: distMap
|
||||
}
|
||||
stats.value = statsData
|
||||
} catch (e) {
|
||||
console.error('加载统计失败:', e)
|
||||
}
|
||||
}
|
||||
|
||||
const loadReviews = async (pageNum: number = 1): Promise<void> => {
|
||||
const loadReviews = async (pageNum: number): Promise<void> => {
|
||||
loading.value = true
|
||||
|
||||
try {
|
||||
@@ -371,13 +373,11 @@ const formatTime = (timeStr: string | null): string => {
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const pages = getCurrentPages()
|
||||
if (pages.length > 0) {
|
||||
const currentPage = pages[pages.length - 1]
|
||||
const options = (currentPage as any).options
|
||||
if (options != null && options.product_id != null) {
|
||||
productId.value = options.product_id as string
|
||||
onLoad((options) => {
|
||||
if (options != null) {
|
||||
const idVal = options['product_id']
|
||||
if (idVal != null) {
|
||||
productId.value = idVal as string
|
||||
loadStats()
|
||||
loadReviews(1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user