杂务:新增声明级注释覆盖率

This commit is contained in:
xiaowang
2026-05-23 18:44:57 +08:00
parent 8f038894e7
commit 844516988b
234 changed files with 8356 additions and 0 deletions
+92
View File
@@ -423,6 +423,10 @@ import { useRouter } from 'vue-router'
import { InfoCircleOutlined, LockOutlined, UserOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import type { Rule } from 'ant-design-vue/es/form'
/**
* Purpose: LegalAgreement supports AuthView.vue by holding or executing the legal agreement 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 { authApi, legalAgreementApi, type LegalAgreement } from '@/api/auth'
import { shopApi } from '@/api/shop'
import { ACCOUNT_REGEX, ACCOUNT_RULE_MESSAGE, sanitizeAccountInput } from '@/utils/account'
@@ -436,20 +440,52 @@ import {
} from '@/api/user'
import type { IdType } from '@/utils/id'
/**
* Purpose: router supports AuthView.vue by holding or executing the router 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 router = useRouter()
/**
* Purpose: activeTab supports AuthView.vue by holding or executing the active tab 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 activeTab = ref<'login' | 'register'>('login')
/**
* Purpose: loginType supports AuthView.vue by holding or executing the login type 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 loginType = ref<'password' | 'phone'>('password')
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
/** loadingShops is a reactive state variable used by the template and event handlers. */
const loadingShops = ref(false)
/**
* Purpose: shops supports AuthView.vue by holding or executing the shops 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 shops = ref<any[]>([])
/**
* Purpose: loginShops supports AuthView.vue by holding or executing the login shops 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 loginShops = ref<Array<{ id: IdType; shopName: string }>>([])
/** countdown is a reactive state variable used by the template and event handlers. */
const countdown = ref(0)
/**
* Purpose: loginAccountStatus supports AuthView.vue by holding or executing the login account status 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 loginAccountStatus = ref<LoginAccountCheckResponse | null>(null)
/**
* Purpose: registerAccountStatus supports AuthView.vue by holding or executing the register account status 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 registerAccountStatus = ref<AvailabilityCheckResponse | null>(null)
/**
* Purpose: registerPhoneStatus supports AuthView.vue by holding or executing the register phone status 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 registerPhoneStatus = ref<AvailabilityCheckResponse | null>(null)
/** loginShopMessage is a reactive state variable used by the template and event handlers. */
const loginShopMessage = ref('')
@@ -462,17 +498,41 @@ const forgotPasswordVisible = ref(false)
const forgotCountdown = ref(0)
/** resettingPassword is a reactive state variable used by the template and event handlers. */
const resettingPassword = ref(false)
/**
* Purpose: agreementAccepted supports AuthView.vue by holding or executing the agreement accepted 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 agreementAccepted = ref(false)
/**
* Purpose: agreements supports AuthView.vue by holding or executing the agreements 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 agreements = ref<LegalAgreement[]>([])
/**
* Purpose: agreementModalOpen supports AuthView.vue by holding or executing the agreement modal open 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 agreementModalOpen = ref(false)
/**
* Purpose: selectedAgreement supports AuthView.vue by holding or executing the selected agreement 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 selectedAgreement = ref<LegalAgreement | null>(null)
/**
* Purpose: forgotPasswordForm supports AuthView.vue by holding or executing the forgot password form 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 forgotPasswordForm = reactive({
phone: '',
verificationCode: '',
newPassword: ''
})
/**
* Purpose: formData supports AuthView.vue by holding or executing the form data 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 formData = reactive({
account: '',
password: '',
@@ -485,6 +545,10 @@ const formData = reactive({
rememberMe: false
})
/**
* Purpose: agreementVersions supports AuthView.vue by holding or executing the agreement versions 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 agreementVersions = computed<Record<string, string>>(() => {
return agreements.value.reduce((result, agreement) => {
result[agreement.agreementType] = agreement.version
@@ -492,6 +556,10 @@ const agreementVersions = computed<Record<string, string>>(() => {
}, {} as Record<string, string>)
})
/**
* Purpose: agreementPayload supports AuthView.vue by holding or executing the agreement payload 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 agreementPayload = () => ({
agreementAccepted: agreementAccepted.value,
agreementVersions: agreementVersions.value,
@@ -501,8 +569,20 @@ const agreementPayload = () => ({
let loginAccountCheckTimer: number | undefined
let loginPhoneShopCheckTimer: number | undefined
/**
* Purpose: phoneRegex supports AuthView.vue by holding or executing the phone regex 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 phoneRegex = /^1[3-9]\d{9}$/
/**
* Purpose: verificationCodeRegex supports AuthView.vue by holding or executing the verification code regex 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 verificationCodeRegex = /^\d{6}$/
/**
* Purpose: loginShopUnsupportedMessage supports AuthView.vue by holding or executing the login shop unsupported 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 loginShopUnsupportedMessage = '可直接登录;如账号绑定多家门店,登录后可在个人中心切换当前门店。'
/** loginShopPlaceholder is a reactive state variable used by the template and event handlers. */
const loginShopPlaceholder = computed(() => {
@@ -636,6 +716,10 @@ const forgotPasswordRules: Record<string, Rule[]> = {
]
}
/**
* Purpose: currentRules supports AuthView.vue by holding or executing the current rules 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 currentRules = computed<Record<string, Rule[]>>(() => {
if (activeTab.value === 'register') {
return registerRules
@@ -861,6 +945,10 @@ const checkRegisterPhoneAvailability = async (showWarning = true) => {
return response.available
}
/**
* Purpose: loadAgreements supports AuthView.vue by holding or executing the load agreements 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 loadAgreements = async () => {
try {
agreements.value = await legalAgreementApi.listCurrent() as unknown as LegalAgreement[]
@@ -870,6 +958,10 @@ const loadAgreements = async () => {
}
}
/**
* Purpose: openAgreement supports AuthView.vue by holding or executing the open agreement 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 openAgreement = async (type: 'USER_TERMS' | 'PRIVACY_POLICY') => {
const cached = agreements.value.find(item => item.agreementType === type)
if (cached) {