杂务:新增声明级注释覆盖率
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import { readonly, shallowRef } from 'vue'
|
||||
import { fileApi } from '@/api/file'
|
||||
/**
|
||||
* Purpose: ShopVO supports useShopTheme.ts by holding or executing the shop vo page or API role.
|
||||
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
import { shopApi, type ShopVO } from '@/api/shop'
|
||||
import {
|
||||
applyShopTheme,
|
||||
@@ -9,10 +13,22 @@ import {
|
||||
type ResolvedShopTheme
|
||||
} from '@/utils/shop-theme'
|
||||
|
||||
/**
|
||||
* Purpose: currentTheme supports useShopTheme.ts by holding or executing the current theme page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const currentTheme = shallowRef<ResolvedShopTheme>(DEFAULT_SHOP_THEME)
|
||||
let cleanupThemeSync: (() => void) | undefined
|
||||
/**
|
||||
* Purpose: refreshSequence supports useShopTheme.ts by holding or executing the refresh sequence page or API role.
|
||||
* Usage: import, call, read, or update this let from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
let refreshSequence = 0
|
||||
|
||||
/**
|
||||
* Purpose: useShopTheme supports useShopTheme.ts by holding or executing the use shop theme page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export function useShopTheme() {
|
||||
return {
|
||||
currentTheme: readonly(currentTheme),
|
||||
@@ -22,6 +38,10 @@ export function useShopTheme() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: refreshShopTheme supports useShopTheme.ts by holding or executing the refresh shop theme page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
async function refreshShopTheme() {
|
||||
const token = readToken()
|
||||
const userInfo = readStoredUserInfo()
|
||||
@@ -46,12 +66,20 @@ async function refreshShopTheme() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: resetShopTheme supports useShopTheme.ts by holding or executing the reset shop theme page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
function resetShopTheme() {
|
||||
refreshSequence += 1
|
||||
currentTheme.value = DEFAULT_SHOP_THEME
|
||||
applyShopTheme(DEFAULT_SHOP_THEME)
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: setupShopThemeSync supports useShopTheme.ts by holding or executing the setup shop theme sync page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
function setupShopThemeSync() {
|
||||
if (cleanupThemeSync || typeof window === 'undefined') {
|
||||
return cleanupThemeSync || (() => {})
|
||||
@@ -79,6 +107,10 @@ function setupShopThemeSync() {
|
||||
return cleanupThemeSync
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: applyThemeFromShop supports useShopTheme.ts by holding or executing the apply theme from shop page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
async function applyThemeFromShop(shop: ShopVO) {
|
||||
const theme = resolveShopTheme(shop)
|
||||
currentTheme.value = theme
|
||||
@@ -86,6 +118,10 @@ async function applyThemeFromShop(shop: ShopVO) {
|
||||
applyShopTheme(theme, backgroundImageUrl)
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: resolveBackgroundImageUrl supports useShopTheme.ts by holding or executing the resolve background image url page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
async function resolveBackgroundImageUrl(fileId?: string) {
|
||||
if (!fileId) {
|
||||
return null
|
||||
@@ -97,6 +133,10 @@ async function resolveBackgroundImageUrl(fileId?: string) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: readToken supports useShopTheme.ts by holding or executing the read token page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
function readToken() {
|
||||
if (typeof window === 'undefined') {
|
||||
return ''
|
||||
@@ -104,6 +144,10 @@ function readToken() {
|
||||
return localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken') || ''
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: readStoredUserInfo supports useShopTheme.ts by holding or executing the read stored user info page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
function readStoredUserInfo(): { shopId?: string | number } | null {
|
||||
if (typeof window === 'undefined') {
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user