feat(distribution): 完善分销收号资产双视图、商户提现、自主加价、品牌装修与数据大盘
This commit is contained in:
@@ -2,6 +2,19 @@ import { defineStore } from 'pinia'
|
||||
import { apiClient } from '@/shared/api/client'
|
||||
import type { ApiResponse } from '@/shared/types/types'
|
||||
|
||||
export interface DistributionBanner {
|
||||
image_url: string
|
||||
link_url?: string
|
||||
title?: string
|
||||
}
|
||||
|
||||
export interface DistributionFooterInfo {
|
||||
icp?: string
|
||||
copyright?: string
|
||||
contact?: string
|
||||
disclaimer?: string
|
||||
}
|
||||
|
||||
export interface DistributionSiteInfo {
|
||||
site_code: string
|
||||
site_name: string
|
||||
@@ -9,6 +22,11 @@ export interface DistributionSiteInfo {
|
||||
status: string
|
||||
display_account_enabled: boolean
|
||||
default_support_group_id?: number | null
|
||||
logo_url?: string
|
||||
favicon_url?: string
|
||||
banners_json?: string
|
||||
announcements_json?: string
|
||||
footer_info_json?: string
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,6 +67,11 @@ export const useDistributionSiteStore = defineStore('distributionSite', {
|
||||
isDistribution: Boolean(code),
|
||||
displayAccountEnabled: true,
|
||||
defaultSupportGroupId: null as number | null,
|
||||
logoUrl: '',
|
||||
faviconUrl: '',
|
||||
banners: [] as DistributionBanner[],
|
||||
announcements: [] as string[],
|
||||
footerInfo: null as DistributionFooterInfo | null,
|
||||
initialized: false,
|
||||
}
|
||||
},
|
||||
@@ -119,12 +142,53 @@ export const useDistributionSiteStore = defineStore('distributionSite', {
|
||||
this.isDistribution = true
|
||||
this.displayAccountEnabled = info.display_account_enabled ?? true
|
||||
this.defaultSupportGroupId = info.default_support_group_id ?? null
|
||||
this.logoUrl = info.logo_url || ''
|
||||
this.faviconUrl = info.favicon_url || ''
|
||||
|
||||
if (info.banners_json) {
|
||||
try {
|
||||
this.banners = JSON.parse(info.banners_json)
|
||||
} catch {
|
||||
this.banners = []
|
||||
}
|
||||
} else {
|
||||
this.banners = []
|
||||
}
|
||||
|
||||
if (info.announcements_json) {
|
||||
try {
|
||||
this.announcements = JSON.parse(info.announcements_json)
|
||||
} catch {
|
||||
this.announcements = []
|
||||
}
|
||||
} else {
|
||||
this.announcements = []
|
||||
}
|
||||
|
||||
if (info.footer_info_json) {
|
||||
try {
|
||||
this.footerInfo = JSON.parse(info.footer_info_json)
|
||||
} catch {
|
||||
this.footerInfo = null
|
||||
}
|
||||
} else {
|
||||
this.footerInfo = null
|
||||
}
|
||||
|
||||
sessionStorage.setItem('hfb_site_code', this.siteCode)
|
||||
sessionStorage.setItem('hfb_site_name', this.siteName)
|
||||
|
||||
// 更新页面标题
|
||||
// 更新页面标题和 Favicon
|
||||
document.title = `【${this.siteName}】租号商城 - 精选游戏账号平台`
|
||||
if (this.faviconUrl && typeof document !== 'undefined') {
|
||||
let link = document.querySelector("link[rel*='icon']") as HTMLLinkElement | null
|
||||
if (!link) {
|
||||
link = document.createElement('link')
|
||||
link.rel = 'icon'
|
||||
document.head.appendChild(link)
|
||||
}
|
||||
link.href = this.faviconUrl
|
||||
}
|
||||
} else {
|
||||
this.resetToMainSite()
|
||||
}
|
||||
@@ -143,6 +207,11 @@ export const useDistributionSiteStore = defineStore('distributionSite', {
|
||||
this.isDistribution = false
|
||||
this.displayAccountEnabled = true
|
||||
this.defaultSupportGroupId = null
|
||||
this.logoUrl = ''
|
||||
this.faviconUrl = ''
|
||||
this.banners = []
|
||||
this.announcements = []
|
||||
this.footerInfo = null
|
||||
sessionStorage.removeItem('hfb_site_code')
|
||||
sessionStorage.removeItem('hfb_site_name')
|
||||
localStorage.removeItem('hfb_site_code')
|
||||
|
||||
Reference in New Issue
Block a user