修复一些的过时测试 优化readme
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
import { computed, ref, type Ref, type ComputedRef } from 'vue'
|
||||
import { computed, ref, type ComputedRef } from 'vue'
|
||||
|
||||
import { POLL_INTERVAL_MS, POLL_FAILURE_LIMIT } from './sessionConstants'
|
||||
|
||||
export interface UseSessionPollingOptions<T> {
|
||||
export interface UseSessionPollingOptions {
|
||||
/** Whether there is an active session – used as a guard inside the poll loop. */
|
||||
hasSession: ComputedRef<boolean>
|
||||
/** Called on each poll tick (typically refreshSessionSummary). */
|
||||
onPollTick: () => Promise<void>
|
||||
onPollTick: () => Promise<unknown>
|
||||
/** Optional: determines whether polling should continue. Defaults to checking hasSession. */
|
||||
shouldKeepPolling?: ComputedRef<boolean>
|
||||
/** Context-specific warning message prefix when polling fails repeatedly. */
|
||||
pollWarningPrefix: string
|
||||
}
|
||||
|
||||
export function useSessionPolling(options: UseSessionPollingOptions<unknown>) {
|
||||
export function useSessionPolling(options: UseSessionPollingOptions) {
|
||||
const { hasSession, onPollTick, pollWarningPrefix } = options
|
||||
|
||||
const pollWarningMessage = ref('')
|
||||
|
||||
@@ -5,6 +5,8 @@ import type { TencentLoginType } from '@/types/tencent/session'
|
||||
|
||||
import { DEFAULT_LOGIN_TYPE } from './sessionConstants'
|
||||
|
||||
type ReadableRef<T> = Pick<Ref<T>, 'value'>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// syncLoginTypeFromDetail
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -102,7 +104,7 @@ export interface UseSessionPresentationOptions {
|
||||
}
|
||||
|
||||
export function useSessionRoleFacts(options: UseSessionPresentationOptions) {
|
||||
const { activityInfo, statusLabel, roleFactDefaults } = options
|
||||
const { activityInfo, roleFactDefaults } = options
|
||||
|
||||
const roleFacts = computed<FactItem[]>(() => [
|
||||
{
|
||||
@@ -168,17 +170,17 @@ export function useSessionResultFacts(options: UseSessionResultFactsOptions) {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function buildRedeemBlockedReason(options: {
|
||||
detail: ComputedRef<unknown | null>
|
||||
hasSession: ComputedRef<boolean>
|
||||
loginTypeLabel: ComputedRef<string>
|
||||
redeemLoading: ComputedRef<boolean>
|
||||
roleReady: ComputedRef<boolean>
|
||||
roleConfirmed: ComputedRef<boolean>
|
||||
sessionNotice: ComputedRef<string>
|
||||
detail: ReadableRef<unknown | null>
|
||||
hasSession: ReadableRef<boolean>
|
||||
loginTypeLabel: ReadableRef<string>
|
||||
redeemLoading: ReadableRef<boolean>
|
||||
roleReady: ReadableRef<boolean>
|
||||
roleConfirmed: ReadableRef<boolean>
|
||||
sessionNotice: ReadableRef<string>
|
||||
context: 'claim' | 'admin'
|
||||
/** Claim-specific fields */
|
||||
tokenStatus?: ComputedRef<string>
|
||||
requiresSupportReview?: ComputedRef<boolean>
|
||||
tokenStatus?: ReadableRef<string>
|
||||
requiresSupportReview?: ReadableRef<boolean>
|
||||
}): string {
|
||||
const {
|
||||
detail,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { computed, ref, watch, type Ref, type ComputedRef } from 'vue'
|
||||
import { computed, ref, watch, type ComputedRef } from 'vue'
|
||||
|
||||
/**
|
||||
* Shared QR code display logic: renders the base64 QR image, tracks its
|
||||
|
||||
@@ -122,7 +122,7 @@ export function useAdminManualRedeemPage() {
|
||||
() => `请让客户使用${loginTypeLabel.value}扫码,并在手机上确认登录`,
|
||||
)
|
||||
|
||||
const { roleFacts } = useSessionRoleFacts({
|
||||
useSessionRoleFacts({
|
||||
activityInfo,
|
||||
statusLabel,
|
||||
roleFactDefaults: { nickname: '等待客户登录' },
|
||||
@@ -230,10 +230,6 @@ export function useAdminManualRedeemPage() {
|
||||
})
|
||||
|
||||
// ── Helpers ────────────────────────────────────────────────────────
|
||||
function applyLoginTypeFromDetail(nextDetail: AdminManualRedeemDetail) {
|
||||
loginType.value = syncLoginTypeFromDetail(nextDetail, loginType.value)
|
||||
}
|
||||
|
||||
function restartPollingIfNeeded(nextDetail = detail.value) {
|
||||
resetPolling()
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ export function useClaimPage(token: string) {
|
||||
() => `请使用${loginTypeLabel.value}扫描二维码,并在手机上确认登录`,
|
||||
)
|
||||
|
||||
const { roleFacts } = useSessionRoleFacts({
|
||||
useSessionRoleFacts({
|
||||
activityInfo,
|
||||
statusLabel,
|
||||
roleFactDefaults: { nickname: '等待扫码登录' },
|
||||
|
||||
Reference in New Issue
Block a user