解决登录显示、首页显示bug

This commit is contained in:
2026-05-19 11:06:46 +08:00
parent 2f7e097e6c
commit 00a859c551
181 changed files with 55329 additions and 998 deletions

View File

@@ -96,6 +96,7 @@
<script lang="uts">
import supa from '@/components/supadb/aksupainstance.uts'
import { requireMerchantAuth } from '@/utils/merchantAuth.uts'
import { USE_MOCK, MOCK_MERCHANT_ID, getMockInventoryStats, MOCK_INVENTORY_PRODUCTS } from '@/pages/mall/merchant/mock/merchant-mock-data.uts'
type ProductType = {
@@ -131,12 +132,29 @@
},
onShow() {
this.page = 1
this.loadProducts()
this.loadStats()
this.handlePageShow()
},
methods: {
async ensureMerchantAuth(): Promise<boolean> {
if (USE_MOCK) return true
const result = await requireMerchantAuth({ redirectOnFail: true, toastOnFail: true })
if (!result.ok) {
this.merchantId = ''
return false
}
this.merchantId = result.userInfo != null && result.userInfo.id != null ? result.userInfo.id : ''
return this.merchantId !== ''
},
async handlePageShow() {
const passed = await this.ensureMerchantAuth()
if (!passed) return
this.page = 1
this.loadProducts()
this.loadStats()
},
async initMerchantId() {
if (USE_MOCK) {
this.merchantId = MOCK_MERCHANT_ID