File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ function handleUrlChange(value: string | number) {
8787}
8888
8989function handleApiKeyChange(value : string | number ) {
90- printService .updateConfig ({ apiKey: String (value ) || undefined })
90+ printService .updateConfig ({ apiKey: String (value ). trim () || undefined })
9191}
9292
9393function handleCopiesChange(value : string | number ) {
@@ -269,7 +269,7 @@ onMounted(() => {
269269 <div class =" space-y-1" >
270270 <Label >审计演示</Label >
271271 <p class =" text-xs text-muted-foreground" >
272- 这里的 UserId 和 DocumentType 会随打印请求一起发送,打印后可在 EasyInk Printer 审计日志中看到对应两列 。留空则不发送。
272+ 这里的 UserId 和 DocumentType 会随打印请求一起发送,打印后可在 EasyInk Printer 审计日志中看到 User 和 Label Type 列 。留空则不发送。
273273 </p >
274274 </div >
275275 <div class =" grid gap-3 sm:grid-cols-2" >
Original file line number Diff line number Diff line change @@ -41,9 +41,13 @@ function normalizeUserData(input: unknown): EasyInkPrinterUserData | undefined {
4141 if ( ! input || typeof input !== 'object' )
4242 return undefined
4343
44- const record = input as { userId ?: unknown , documentType ?: unknown }
44+ const record = input as { userId ?: unknown , documentType ?: unknown , labelType ?: unknown }
4545 const userId = typeof record . userId === 'string' ? record . userId . trim ( ) : ''
46- const documentType = typeof record . documentType === 'string' ? record . documentType . trim ( ) : ''
46+ const documentType = typeof record . documentType === 'string'
47+ ? record . documentType . trim ( )
48+ : typeof record . labelType === 'string'
49+ ? record . labelType . trim ( )
50+ : ''
4751
4852 if ( ! userId && ! documentType )
4953 return undefined
@@ -141,7 +145,11 @@ async function connect(): Promise<void> {
141145 connectionState . value = 'connecting'
142146 try {
143147 await client . connect ( )
144- await client . refreshPrinters ( ) . catch ( ( ) => [ ] )
148+ await client . refreshPrinters ( )
149+ }
150+ catch ( e ) {
151+ client . lastError = e instanceof Error ? e . message : '连接 EasyInk Printer 服务失败'
152+ throw e
145153 }
146154 finally {
147155 syncState ( )
You can’t perform that action at this time.
0 commit comments