解决登录显示、首页显示bug
This commit is contained in:
@@ -78,6 +78,7 @@
|
||||
|
||||
<script lang="uts">
|
||||
import supa from '@/components/supadb/aksupainstance.uts'
|
||||
import { requireMerchantAuth } from '@/utils/merchantAuth.uts'
|
||||
import { USE_MOCK, MOCK_MERCHANT_ID, MOCK_BALANCE, MOCK_FINANCE_STATS, getMockFinanceRecords } from '@/pages/mall/merchant/mock/merchant-mock-data.uts'
|
||||
|
||||
type RecordType = {
|
||||
@@ -108,11 +109,28 @@
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.loadBalance()
|
||||
this.loadRecords()
|
||||
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.loadBalance()
|
||||
this.loadRecords()
|
||||
},
|
||||
|
||||
async initMerchantId() {
|
||||
if (USE_MOCK) {
|
||||
this.merchantId = MOCK_MERCHANT_ID
|
||||
|
||||
Reference in New Issue
Block a user