解决登录显示、首页显示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

@@ -61,6 +61,7 @@
<script lang="uts">
import supa from '@/components/supadb/aksupainstance.uts'
import { requireMerchantAuth } from '@/utils/merchantAuth.uts'
export default {
data() {
@@ -83,19 +84,20 @@
},
methods: {
async initMerchantId() {
try {
const session = supa.getSession()
if (session != null && session.user != null) {
this.merchantId = session.user.getString('id') || ''
}
if (!this.merchantId) {
this.merchantId = uni.getStorageSync('user_id') || ''
}
this.loadShop()
} catch (e) {
console.error('获取商户ID失败:', e)
async ensureMerchantAuth(): Promise<boolean> {
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 initMerchantId() {
const passed = await this.ensureMerchantAuth()
if (!passed) return
this.loadShop()
},
async loadShop() {