杂务:新增声明级注释覆盖率
This commit is contained in:
@@ -587,7 +587,15 @@ import { PlusOutlined } from '@ant-design/icons-vue'
|
||||
import DraftActions from '@/components/DraftActions.vue'
|
||||
import TableEllipsisText from '@/components/TableEllipsisText.vue'
|
||||
import { DEFAULT_SHOP_IMAGE } from '@/constants'
|
||||
/**
|
||||
* Purpose: Shop supports ShopsView.vue by holding or executing the shop 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 { adminShopApi, adminFileApi, adminSystemParameterConfigApi, type Shop } from '@/api/admin'
|
||||
/**
|
||||
* Purpose: ChunkUploadTask supports ShopsView.vue by holding or executing the chunk upload task 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 { createChunkUploadTask, type ChunkUploadTask } from '@/utils/chunk-upload'
|
||||
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
|
||||
import { usePermission } from '@/utils/permission'
|
||||
@@ -601,6 +609,10 @@ import AdminResponsiveModal from '@/components/admin/AdminResponsiveModal.vue'
|
||||
const { hasPermission, loadUserPermissions } = usePermission()
|
||||
const { isMobile } = useAdminViewport()
|
||||
|
||||
/**
|
||||
* Purpose: ShopThemeTemplateColors supports ShopsView.vue by holding or executing the shop theme template colors page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
interface ShopThemeTemplateColors {
|
||||
themePrimaryColor: string
|
||||
themeSecondaryColor: string
|
||||
@@ -609,6 +621,10 @@ interface ShopThemeTemplateColors {
|
||||
themeCardBgColor: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: ShopThemeTemplate supports ShopsView.vue by holding or executing the shop theme template page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
interface ShopThemeTemplate extends ShopThemeTemplateColors {
|
||||
id: string
|
||||
name: string
|
||||
@@ -616,7 +632,15 @@ interface ShopThemeTemplate extends ShopThemeTemplateColors {
|
||||
createdAt?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: CUSTOM_THEME_TEMPLATE_STORAGE_KEY supports ShopsView.vue by holding or executing the custom theme template storage key 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 CUSTOM_THEME_TEMPLATE_STORAGE_KEY = 'yuminail:admin:shop-theme-templates'
|
||||
/**
|
||||
* Purpose: CUSTOM_THEME_TEMPLATE_LIMIT supports ShopsView.vue by holding or executing the custom theme template limit 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 CUSTOM_THEME_TEMPLATE_LIMIT = 20
|
||||
|
||||
const PRESET_THEME_TEMPLATES: ShopThemeTemplate[] = [
|
||||
@@ -726,6 +750,10 @@ const PRESET_THEME_TEMPLATES: ShopThemeTemplate[] = [
|
||||
const loading = ref(false)
|
||||
/** searchText is a reactive state variable used by the template and event handlers. */
|
||||
const searchText = ref('')
|
||||
/**
|
||||
* Purpose: shopList supports ShopsView.vue by holding or executing the shop list 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 shopList = ref<Shop[]>([])
|
||||
/** modalVisible is a reactive state variable used by the template and event handlers. */
|
||||
const modalVisible = ref(false)
|
||||
@@ -735,18 +763,50 @@ const viewModalVisible = ref(false)
|
||||
const modalLoading = ref(false)
|
||||
/** isEdit is a reactive state variable used by the template and event handlers. */
|
||||
const isEdit = ref(false)
|
||||
/**
|
||||
* Purpose: mapPickerVisible supports ShopsView.vue by holding or executing the map picker visible 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 mapPickerVisible = ref(false)
|
||||
/**
|
||||
* Purpose: mapPickerKey supports ShopsView.vue by holding or executing the map picker key 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 mapPickerKey = ref('')
|
||||
/**
|
||||
* Purpose: mapPickerUrl supports ShopsView.vue by holding or executing the map picker url 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 mapPickerUrl = ref('')
|
||||
/**
|
||||
* Purpose: mapPickerProvider supports ShopsView.vue by holding or executing the map picker provider 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 mapPickerProvider = ref<'TENCENT' | 'AMAP'>('TENCENT')
|
||||
/**
|
||||
* Purpose: locating supports ShopsView.vue by holding or executing the locating 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 locating = ref(false)
|
||||
/**
|
||||
* Purpose: formRef supports ShopsView.vue by holding or executing the form ref 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 formRef = ref<FormInstance>()
|
||||
/**
|
||||
* Purpose: currentShop supports ShopsView.vue by holding or executing the current shop 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 currentShop = ref<Shop | null>(null)
|
||||
/** isAdmin is a reactive state variable used by the template and event handlers. */
|
||||
const isAdmin = ref(false)
|
||||
|
||||
// Banner图片相关
|
||||
const bannerFileList = ref<any[]>([])
|
||||
/**
|
||||
* Purpose: uploadedBannerIds supports ShopsView.vue by holding or executing the uploaded banner ids 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 uploadedBannerIds = ref<string[]>([])
|
||||
/** bannerPreviewVisible is a reactive state variable used by the template and event handlers. */
|
||||
const bannerPreviewVisible = ref(false)
|
||||
@@ -755,13 +815,45 @@ const bannerPreviewImage = ref('')
|
||||
|
||||
// 店铺图片相关
|
||||
const imageFileList = ref<any[]>([])
|
||||
/**
|
||||
* Purpose: uploadedFileIds supports ShopsView.vue by holding or executing the uploaded file ids 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 uploadedFileIds = ref<string[]>([])
|
||||
/**
|
||||
* Purpose: themeBackgroundFileList supports ShopsView.vue by holding or executing the theme background file list 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 themeBackgroundFileList = ref<any[]>([])
|
||||
/**
|
||||
* Purpose: uploadedThemeBackgroundId supports ShopsView.vue by holding or executing the uploaded theme background id 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 uploadedThemeBackgroundId = ref('')
|
||||
/**
|
||||
* Purpose: imageIdCache supports ShopsView.vue by holding or executing the image id cache 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 imageIdCache = ref<Record<string, string>>({})
|
||||
/**
|
||||
* Purpose: shopImageUrls supports ShopsView.vue by holding or executing the shop image urls 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 shopImageUrls = ref<Record<string, string[]>>({})
|
||||
/**
|
||||
* Purpose: shopBannerUrls supports ShopsView.vue by holding or executing the shop banner urls 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 shopBannerUrls = ref<Record<string, string[]>>({})
|
||||
/**
|
||||
* Purpose: viewImageUrls supports ShopsView.vue by holding or executing the view image urls 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 viewImageUrls = ref<string[]>([])
|
||||
/**
|
||||
* Purpose: viewBannerUrls supports ShopsView.vue by holding or executing the view banner urls 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 viewBannerUrls = ref<string[]>([])
|
||||
/** previewVisible is a reactive state variable used by the template and event handlers. */
|
||||
const previewVisible = ref(false)
|
||||
@@ -771,14 +863,34 @@ const previewImage = ref('')
|
||||
const businessStartTime = ref('')
|
||||
/** businessEndTime is a reactive state variable used by the template and event handlers. */
|
||||
const businessEndTime = ref('')
|
||||
/**
|
||||
* Purpose: uploadTaskMap supports ShopsView.vue by holding or executing the upload task map 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 uploadTaskMap = new Map<string, ChunkUploadTask<any>>()
|
||||
/** activeUploadCount is a reactive state variable used by the template and event handlers. */
|
||||
const activeUploadCount = ref(0)
|
||||
/** isUploadPending is a reactive state variable used by the template and event handlers. */
|
||||
const isUploadPending = computed(() => activeUploadCount.value > 0)
|
||||
/**
|
||||
* Purpose: draftSavedAt supports ShopsView.vue by holding or executing the draft saved at 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 draftSavedAt = ref<number | null>(null)
|
||||
/**
|
||||
* Purpose: customThemeTemplates supports ShopsView.vue by holding or executing the custom theme templates 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 customThemeTemplates = ref<ShopThemeTemplate[]>([])
|
||||
/**
|
||||
* Purpose: themeTemplateSaveVisible supports ShopsView.vue by holding or executing the theme template save visible 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 themeTemplateSaveVisible = ref(false)
|
||||
/**
|
||||
* Purpose: themeTemplateName supports ShopsView.vue by holding or executing the theme template name 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 themeTemplateName = ref('')
|
||||
|
||||
// 查看店铺相关状态
|
||||
@@ -805,6 +917,10 @@ const viewFormState = reactive({
|
||||
themeBackgroundImageFileId: ''
|
||||
})
|
||||
|
||||
/**
|
||||
* Purpose: pagination supports ShopsView.vue by holding or executing the pagination 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 pagination = reactive({
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
@@ -814,6 +930,10 @@ const pagination = reactive({
|
||||
showTotal: (total: number) => `共 ${total} 条`
|
||||
})
|
||||
|
||||
/**
|
||||
* Purpose: formState supports ShopsView.vue by holding or executing the form state 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 formState = reactive({
|
||||
shopName: '',
|
||||
description: '',
|
||||
@@ -836,19 +956,35 @@ const formState = reactive({
|
||||
themeBackgroundImageFileId: ''
|
||||
})
|
||||
|
||||
/**
|
||||
* Purpose: selectedLocationText supports ShopsView.vue by holding or executing the selected location text 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 selectedLocationText = computed(() => {
|
||||
if (formState.address) return formState.address
|
||||
if (formState.longitude && formState.latitude) return '已选择地图位置'
|
||||
return '暂未选择地图位置'
|
||||
})
|
||||
|
||||
/**
|
||||
* Purpose: selectedCoordinateText supports ShopsView.vue by holding or executing the selected coordinate text 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 selectedCoordinateText = computed(() => {
|
||||
if (!formState.longitude || !formState.latitude) return '点击“地图选点”搜索店铺名称或地址'
|
||||
return '已选择地图位置,可重新选点'
|
||||
})
|
||||
|
||||
/**
|
||||
* Purpose: mapPickerTitle supports ShopsView.vue by holding or executing the map picker title 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 mapPickerTitle = computed(() => mapPickerProvider.value === 'AMAP' ? '高德地图选点' : '腾讯地图选点')
|
||||
|
||||
/**
|
||||
* Purpose: computedAuthorizationExpireTime supports ShopsView.vue by holding or executing the computed authorization expire time 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 computedAuthorizationExpireTime = computed(() => {
|
||||
if (!formState.authorizationStartDate || !formState.authorizationDays || formState.authorizationDays <= 0) {
|
||||
return formState.authorizationExpireTime || ''
|
||||
@@ -861,29 +997,69 @@ const computedAuthorizationExpireTime = computed(() => {
|
||||
return `${yyyy}-${mm}-${dd} 23:59:59`
|
||||
})
|
||||
|
||||
/**
|
||||
* Purpose: computedAuthorizationExpireTimeText supports ShopsView.vue by holding or executing the computed authorization expire time text 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 computedAuthorizationExpireTimeText = computed(() => formatAuthorizationExpireTime(computedAuthorizationExpireTime.value))
|
||||
|
||||
/**
|
||||
* Purpose: themePreview supports ShopsView.vue by holding or executing the theme preview 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 themePreview = computed(() => resolveShopTheme(formState))
|
||||
/**
|
||||
* Purpose: viewThemePreview supports ShopsView.vue by holding or executing the view theme preview 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 viewThemePreview = computed(() => resolveShopTheme(viewFormState))
|
||||
/**
|
||||
* Purpose: themePreviewStyle supports ShopsView.vue by holding or executing the theme preview style 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 themePreviewStyle = computed(() => ({
|
||||
color: themePreview.value.textPrimary,
|
||||
borderColor: themePreview.value.borderColor,
|
||||
background: themePreview.value.softGradient
|
||||
}))
|
||||
/**
|
||||
* Purpose: themePreviewButtonStyle supports ShopsView.vue by holding or executing the theme preview button style 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 themePreviewButtonStyle = computed(() => ({
|
||||
color: '#ffffff',
|
||||
background: themePreview.value.gradient,
|
||||
boxShadow: themePreview.value.cssVars['--theme-button-shadow']
|
||||
}))
|
||||
/**
|
||||
* Purpose: themeTemplates supports ShopsView.vue by holding or executing the theme templates 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 themeTemplates = computed(() => [...PRESET_THEME_TEMPLATES, ...customThemeTemplates.value])
|
||||
/**
|
||||
* Purpose: currentThemeTemplateColors supports ShopsView.vue by holding or executing the current theme template colors 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 currentThemeTemplateColors = computed(() => buildThemeTemplateColors(formState))
|
||||
/**
|
||||
* Purpose: currentThemeTemplateSwatches supports ShopsView.vue by holding or executing the current theme template swatches 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 currentThemeTemplateSwatches = computed(() => getThemeTemplateSwatches(currentThemeTemplateColors.value))
|
||||
|
||||
/**
|
||||
* Purpose: normalizeTemplateColor supports ShopsView.vue by holding or executing the normalize template color 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 normalizeTemplateColor = (value?: string) => {
|
||||
const normalized = String(value || '').trim().toUpperCase()
|
||||
return /^#[0-9A-F]{6}$/.test(normalized) ? normalized : ''
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: buildThemeTemplateColors supports ShopsView.vue by holding or executing the build theme template colors 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 buildThemeTemplateColors = (source: Record<string, any>): ShopThemeTemplateColors => {
|
||||
const resolvedTheme = resolveShopTheme(source)
|
||||
return {
|
||||
@@ -895,6 +1071,10 @@ const buildThemeTemplateColors = (source: Record<string, any>): ShopThemeTemplat
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: getThemeTemplateSwatches supports ShopsView.vue by holding or executing the get theme template swatches 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 getThemeTemplateSwatches = (template: ShopThemeTemplateColors) => [
|
||||
template.themePrimaryColor,
|
||||
template.themeSecondaryColor,
|
||||
@@ -903,6 +1083,10 @@ const getThemeTemplateSwatches = (template: ShopThemeTemplateColors) => [
|
||||
template.themeCardBgColor
|
||||
]
|
||||
|
||||
/**
|
||||
* Purpose: normalizeThemeTemplate supports ShopsView.vue by holding or executing the normalize theme template 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 normalizeThemeTemplate = (value: any): ShopThemeTemplate | null => {
|
||||
if (!value || typeof value !== 'object') {
|
||||
return null
|
||||
@@ -927,6 +1111,10 @@ const normalizeThemeTemplate = (value: any): ShopThemeTemplate | null => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: persistCustomThemeTemplates supports ShopsView.vue by holding or executing the persist custom theme templates 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 persistCustomThemeTemplates = () => {
|
||||
if (typeof window === 'undefined') {
|
||||
return
|
||||
@@ -934,6 +1122,10 @@ const persistCustomThemeTemplates = () => {
|
||||
window.localStorage.setItem(getThemeTemplateStorageKey(), JSON.stringify(customThemeTemplates.value))
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: loadCustomThemeTemplates supports ShopsView.vue by holding or executing the load custom theme templates 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 loadCustomThemeTemplates = () => {
|
||||
if (typeof window === 'undefined') {
|
||||
return
|
||||
@@ -949,11 +1141,19 @@ const loadCustomThemeTemplates = () => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: isThemeTemplateActive supports ShopsView.vue by holding or executing the is theme template active 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 isThemeTemplateActive = (template: ShopThemeTemplateColors) => {
|
||||
const currentColors = currentThemeTemplateColors.value
|
||||
return getThemeTemplateSwatches(template).every((color, index) => color === getThemeTemplateSwatches(currentColors)[index])
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: themeColorValidator supports ShopsView.vue by holding or executing the theme color validator 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 themeColorValidator = async (_rule: any, value?: string) => {
|
||||
if (!value) {
|
||||
return Promise.resolve()
|
||||
@@ -996,6 +1196,10 @@ const formRules: any = {
|
||||
themeCardBgColor: [{ validator: themeColorValidator, trigger: 'blur' }]
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: columns supports ShopsView.vue by holding or executing the columns 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 columns = [
|
||||
{ title: '图片', key: 'image', width: 150 },
|
||||
{ title: 'Banner', key: 'banner', width: 200 },
|
||||
@@ -1025,6 +1229,10 @@ const getCurrentUserInfo = () => {
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: getThemeTemplateStorageKey supports ShopsView.vue by holding or executing the get theme template storage key 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 getThemeTemplateStorageKey = () => {
|
||||
const currentUser = getCurrentUserInfo()
|
||||
const userKey = currentUser?.id ?? currentUser?.userId ?? currentUser?.account ?? currentUser?.username ?? 'default'
|
||||
@@ -1122,12 +1330,20 @@ const formatAuthorizationExpireTime = (value?: string) => {
|
||||
return value.replace('T', ' ').slice(0, 16)
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: formatLocation supports ShopsView.vue by holding or executing the format location 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 formatLocation = (shop?: Partial<Shop> | Record<string, any>) => {
|
||||
const locationName = shop?.address || shop?.shopName || ''
|
||||
if (!locationName) return '未设置地图位置'
|
||||
return locationName || '未设置地图位置'
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: buildTencentLocationPickerUrl supports ShopsView.vue by holding or executing the build tencent location picker url 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 buildTencentLocationPickerUrl = (options: { latitude?: string | number; longitude?: string | number } = {}) => {
|
||||
const params = new URLSearchParams({
|
||||
search: '1',
|
||||
@@ -1144,6 +1360,10 @@ const buildTencentLocationPickerUrl = (options: { latitude?: string | number; lo
|
||||
return `https://apis.map.qq.com/tools/locpicker?${params.toString()}`
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: buildAmapLocationPickerUrl supports ShopsView.vue by holding or executing the build amap location picker url 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 buildAmapLocationPickerUrl = (options: { latitude?: string | number; longitude?: string | number } = {}) => {
|
||||
const params = new URLSearchParams({
|
||||
key: mapPickerKey.value,
|
||||
@@ -1158,19 +1378,35 @@ const buildAmapLocationPickerUrl = (options: { latitude?: string | number; longi
|
||||
return `https://m.amap.com/picker/?${params.toString()}`
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: buildMapLocationPickerUrl supports ShopsView.vue by holding or executing the build map location picker url 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 buildMapLocationPickerUrl = (options: { latitude?: string | number; longitude?: string | number } = {}) => {
|
||||
return mapPickerProvider.value === 'AMAP'
|
||||
? buildAmapLocationPickerUrl(options)
|
||||
: buildTencentLocationPickerUrl(options)
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: closeTencentLocationPicker supports ShopsView.vue by holding or executing the close tencent location picker 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 closeTencentLocationPicker = () => {
|
||||
mapPickerVisible.value = false
|
||||
window.removeEventListener('message', handleMapLocationMessage)
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: closeMapLocationPicker supports ShopsView.vue by holding or executing the close map location picker 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 closeMapLocationPicker = closeTencentLocationPicker
|
||||
|
||||
/**
|
||||
* Purpose: applyTencentLocation supports ShopsView.vue by holding or executing the apply tencent location 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 applyTencentLocation = (data: any) => {
|
||||
const location = data.loclatlng || data.latlng || data.location
|
||||
if (!location) return
|
||||
@@ -1194,6 +1430,10 @@ const applyTencentLocation = (data: any) => {
|
||||
closeTencentLocationPicker()
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: applyAmapLocation supports ShopsView.vue by holding or executing the apply amap location 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 applyAmapLocation = (data: any) => {
|
||||
const rawLocation = data.location || data.lnglat || data.position
|
||||
let longitude = ''
|
||||
@@ -1227,6 +1467,10 @@ const applyAmapLocation = (data: any) => {
|
||||
closeTencentLocationPicker()
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: handleMapLocationMessage supports ShopsView.vue by holding or executing the handle map location message 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 handleMapLocationMessage = (event: MessageEvent) => {
|
||||
const data = event.data || {}
|
||||
if (!data || typeof data !== 'object') return
|
||||
@@ -1239,6 +1483,10 @@ const handleMapLocationMessage = (event: MessageEvent) => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: openMapLocationPicker supports ShopsView.vue by holding or executing the open map location picker 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 openMapLocationPicker = async () => {
|
||||
const response = await adminSystemParameterConfigApi.getMapConfig()
|
||||
const provider = response?.provider === 'AMAP' ? 'AMAP' : 'TENCENT'
|
||||
@@ -1258,10 +1506,18 @@ const openMapLocationPicker = async () => {
|
||||
window.addEventListener('message', handleMapLocationMessage)
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: handleMapPickerFrameLoad supports ShopsView.vue by holding or executing the handle map picker frame load 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 handleMapPickerFrameLoad = () => {
|
||||
// 高德/腾讯选点页均通过 postMessage 回传结果,此处保留钩子便于后续接入加载态。
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: useCurrentLocation supports ShopsView.vue by holding or executing the use current location 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 useCurrentLocation = () => {
|
||||
if (!navigator.geolocation) {
|
||||
message.warning('当前浏览器不支持定位')
|
||||
@@ -1937,6 +2193,10 @@ const syncUploadedThemeBackgroundId = (fileId: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: handleResetTheme supports ShopsView.vue by holding or executing the handle reset 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 handleResetTheme = () => {
|
||||
Object.assign(formState, {
|
||||
themePrimaryColor: '',
|
||||
@@ -1950,6 +2210,10 @@ const handleResetTheme = () => {
|
||||
syncUploadedThemeBackgroundId('')
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: applyThemeTemplate supports ShopsView.vue by holding or executing the apply theme template 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 applyThemeTemplate = (template: ShopThemeTemplate) => {
|
||||
Object.assign(formState, {
|
||||
themePrimaryColor: template.themePrimaryColor,
|
||||
@@ -1961,16 +2225,28 @@ const applyThemeTemplate = (template: ShopThemeTemplate) => {
|
||||
message.success(`已应用「${template.name}」配色`)
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: openSaveThemeTemplate supports ShopsView.vue by holding or executing the open save theme template 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 openSaveThemeTemplate = () => {
|
||||
themeTemplateName.value = formState.shopName ? `${formState.shopName}主题` : '我的配色模板'
|
||||
themeTemplateSaveVisible.value = true
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: handleCancelSaveThemeTemplate supports ShopsView.vue by holding or executing the handle cancel save theme template 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 handleCancelSaveThemeTemplate = () => {
|
||||
themeTemplateSaveVisible.value = false
|
||||
themeTemplateName.value = ''
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: handleConfirmSaveThemeTemplate supports ShopsView.vue by holding or executing the handle confirm save theme template 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 handleConfirmSaveThemeTemplate = () => {
|
||||
const name = themeTemplateName.value.trim()
|
||||
if (!name) {
|
||||
@@ -2000,6 +2276,10 @@ const handleConfirmSaveThemeTemplate = () => {
|
||||
message.success(existedIndex >= 0 ? '已更新同名配色模板' : '已保存配色模板')
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: handleDeleteCustomThemeTemplate supports ShopsView.vue by holding or executing the handle delete custom theme template 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 handleDeleteCustomThemeTemplate = (id: string) => {
|
||||
customThemeTemplates.value = customThemeTemplates.value.filter(template => template.id !== id)
|
||||
persistCustomThemeTemplates()
|
||||
|
||||
Reference in New Issue
Block a user