284284
285285 <!-- Signature Management Dialog -->
286286 <SignatureManagementDialog ref =" signatureDialogRef" />
287+
288+ <!-- Signature Select Dialog for Export -->
289+ <SignatureSelectDialog ref =" signatureSelectDialogRef" />
287290</template >
288291
289292<script setup lang="ts">
@@ -294,8 +297,10 @@ import { nanoid } from 'nanoid';
294297import { computed , nextTick , useTemplateRef } from ' vue' ;
295298import KeytoneAlbum from ' src/components/Keytone_album.vue' ;
296299import SignatureManagementDialog from ' src/components/SignatureManagementDialog.vue' ;
300+ import SignatureSelectDialog from ' src/components/SignatureSelectDialog.vue' ;
297301import { ref , onMounted , onUnmounted , watch } from ' vue' ;
298302import { useI18n } from ' vue-i18n' ;
303+ import { api } from ' src/boot/axios' ;
299304import {
300305 DeleteAlbum ,
301306 GetAudioPackageName ,
@@ -325,6 +330,7 @@ const keytoneAlbum_store = useKeytoneAlbumStore();
325330const selectedKeyTonePkgRef = useTemplateRef <QSelect >(' selectedKeyTonePkgRef' );
326331const keytoneAlbumRef = ref <InstanceType <typeof KeytoneAlbum > | null >(null );
327332const signatureDialogRef = ref <InstanceType <typeof SignatureManagementDialog > | null >(null );
333+ const signatureSelectDialogRef = ref <InstanceType <typeof SignatureSelectDialog > | null >(null );
328334const isCollapsed = ref (false );
329335let lastScrollTop = 0 ;
330336const isAtTop = ref (true );
@@ -413,6 +419,55 @@ const exportAlbumLegacy = async () => {
413419 }
414420 const albumName = albumNameResponse .name ;
415421
422+ // Check if album has signatures - get album config to see if it has signatures
423+ let selectedSignature = null ;
424+ try {
425+ const albumConfigResponse = await api .get (' /keytone_pkg/get' , {
426+ params: {
427+ key: ' album_signatures' ,
428+ audioPkgUUID: albumNameResponse .audioPkgUUID || setting_store .mainHome .selectedKeyTonePkg .split (/ [\\ /] / ).pop ()
429+ }
430+ });
431+
432+ const hasSignatures = albumConfigResponse .data .value && Object .keys (albumConfigResponse .data .value ).length > 0 ;
433+
434+ // Show signature selection dialog
435+ try {
436+ selectedSignature = await signatureSelectDialogRef .value ?.open (hasSignatures );
437+ } catch (err ) {
438+ // User cancelled signature selection
439+ return ;
440+ }
441+
442+ // If album has signatures but no signature selected, prevent export
443+ if (hasSignatures && ! selectedSignature ) {
444+ q .notify ({
445+ type: ' warning' ,
446+ message: $t (' signature.exportFlow.signatureRequired' ),
447+ });
448+ return ;
449+ }
450+ } catch (error ) {
451+ console .log (' No signatures check or album config not found, proceeding without signature selection' );
452+ }
453+
454+ // If signature was selected, call the sign bridge
455+ if (selectedSignature ) {
456+ try {
457+ await api .post (' /export/sign-bridge' , {
458+ albumId: albumNameResponse .audioPkgUUID || setting_store .mainHome .selectedKeyTonePkg .split (/ [\\ /] / ).pop (),
459+ signatureName: selectedSignature .name
460+ });
461+ } catch (error ) {
462+ console .error (' Failed to add signature to album:' , error );
463+ q .notify ({
464+ type: ' warning' ,
465+ message: $t (' signature.notify.exportFailed' ) + ' : ' + (error instanceof Error ? error .message : String (error )),
466+ });
467+ // Continue with export even if signature bridge fails
468+ }
469+ }
470+
416471 // 调用导出函数获取zip文件blob
417472 const blob = await ExportAlbum (setting_store .mainHome .selectedKeyTonePkg );
418473 const url = window .URL .createObjectURL (blob );
@@ -456,6 +511,55 @@ const exportAlbum = async () => {
456511 }
457512 const albumName = albumNameResponse .name ;
458513
514+ // Check if album has signatures - get album config to see if it has signatures
515+ let selectedSignature = null ;
516+ try {
517+ const albumConfigResponse = await api .get (' /keytone_pkg/get' , {
518+ params: {
519+ key: ' album_signatures' ,
520+ audioPkgUUID: albumNameResponse .audioPkgUUID || setting_store .mainHome .selectedKeyTonePkg .split (/ [\\ /] / ).pop ()
521+ }
522+ });
523+
524+ const hasSignatures = albumConfigResponse .data .value && Object .keys (albumConfigResponse .data .value ).length > 0 ;
525+
526+ // Show signature selection dialog
527+ try {
528+ selectedSignature = await signatureSelectDialogRef .value ?.open (hasSignatures );
529+ } catch (err ) {
530+ // User cancelled signature selection
531+ return ;
532+ }
533+
534+ // If album has signatures but no signature selected, prevent export
535+ if (hasSignatures && ! selectedSignature ) {
536+ q .notify ({
537+ type: ' warning' ,
538+ message: $t (' signature.exportFlow.signatureRequired' ),
539+ });
540+ return ;
541+ }
542+ } catch (error ) {
543+ console .log (' No signatures check or album config not found, proceeding without signature selection' );
544+ }
545+
546+ // If signature was selected, call the sign bridge
547+ if (selectedSignature ) {
548+ try {
549+ await api .post (' /export/sign-bridge' , {
550+ albumId: albumNameResponse .audioPkgUUID || setting_store .mainHome .selectedKeyTonePkg .split (/ [\\ /] / ).pop (),
551+ signatureName: selectedSignature .name
552+ });
553+ } catch (error ) {
554+ console .error (' Failed to add signature to album:' , error );
555+ q .notify ({
556+ type: ' warning' ,
557+ message: $t (' signature.notify.exportFailed' ) + ' : ' + (error instanceof Error ? error .message : String (error )),
558+ });
559+ // Continue with export even if signature bridge fails
560+ }
561+ }
562+
459563 // 获取导出数据
460564 const blob = await ExportAlbum (setting_store .mainHome .selectedKeyTonePkg );
461565
0 commit comments