添加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

@@ -97,6 +97,7 @@
<script lang="uts">
import supa from '@/components/supadb/aksupainstance.uts'
import { USE_MOCK, MOCK_MEMBER_LEVELS, MOCK_SERVICE_USERS } from '@/pages/mall/merchant/mock/merchant-mock-data.uts'
type MemberLevel = {
id: string
@@ -138,6 +139,11 @@
}
},
onLoad() {
if (USE_MOCK) {
this.merchantId = 'mock-merchant'
this.loadLevels()
return
}
this.merchantId = uni.getStorageSync('user_id') || ''
this.loadLevels()
},
@@ -154,6 +160,10 @@
this.loadUsers();
},
async loadLevels() {
if (USE_MOCK) {
this.levels = MOCK_MEMBER_LEVELS as MemberLevel[]
return
}
const res = await supa.from('ml_member_levels').select('*').order('level_rank', { ascending: true }).execute()
if (res.data != null) {
const raw = res.data as any[]
@@ -172,6 +182,10 @@
},
async loadUsers() {
console.log('--- 启动 ak_users 全量加载 (不带 limit 限制) ---');
if (USE_MOCK) {
this.users = MOCK_SERVICE_USERS as UserInfo[]
return
}
try {
// 1. 移除 limit 限制或设置极大值,确保读到全部数据
// 同时通过 count 参数确认数据库到底给了多少条