添加mock数据

This commit is contained in:
2026-04-13 11:32:31 +08:00
parent 334e5936c9
commit 37141c1d6b
17 changed files with 1843 additions and 330 deletions

View File

@@ -66,6 +66,7 @@
<script lang="uts">
import supa from '@/components/supadb/aksupainstance.uts'
import { USE_MOCK, MOCK_MERCHANT_ID, getMockReviews } from '@/pages/mall/merchant/mock/merchant-mock-data.uts'
type ReviewType = {
id: string
@@ -100,6 +101,11 @@
},
onLoad() {
if (USE_MOCK) {
this.merchantId = MOCK_MERCHANT_ID
this.loadReviews()
return
}
// 同步设置 merchantId不用 async 包裹,避免 generator 内 this 绑定异常
try {
const session = supa.getSession()
@@ -117,6 +123,13 @@
if (!this.merchantId || this.merchantId.split('-').length !== 5) return
if (this.loading) return
this.loading = true
if (USE_MOCK) {
this.reviews = getMockReviews(this.currentFilter) as ReviewType[]
this.hasMore = false
this.loading = false
this.refreshing = false
return
}
try {
let query = supa
.from('ml_product_reviews')