foucui 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -0
- package/components/QiuAffix/index.vue +186 -0
- package/components/QiuAlert/index.vue +208 -0
- package/components/QiuAnchor/context.ts +18 -0
- package/components/QiuAnchor/index.vue +180 -0
- package/components/QiuAnchorLink/index.vue +67 -0
- package/components/QiuApp/index.vue +9 -0
- package/components/QiuAutocomplete/index.vue +408 -0
- package/components/QiuAvatar/index.vue +140 -0
- package/components/QiuBacktop/index.vue +121 -0
- package/components/QiuBadge/api/index.ts +389 -0
- package/components/QiuBadge/components/BadgeImagePickerDialog.vue +243 -0
- package/components/QiuBadge/components/BadgeLibraryManagerDialog.vue +30 -0
- package/components/QiuBadge/components/BadgeLibraryPanel.vue +182 -0
- package/components/QiuBadge/composables/useTableHostHeight.ts +53 -0
- package/components/QiuBadge/index.ts +18 -0
- package/components/QiuBadge/shared/BadgeTemplateRenderer.vue +32 -0
- package/components/QiuBadge/shared/assetUrl.ts +26 -0
- package/components/QiuBadge/shared/badgeTemplate.ts +309 -0
- package/components/QiuBadge/utils/chinaAreaData.ts +44 -0
- package/components/QiuBadge/utils/hostRegion.ts +22 -0
- package/components/QiuBadge/utils/pca-code.json +1 -0
- package/components/QiuBadge/utils/pdfFromElement.ts +348 -0
- package/components/QiuBadge/views/BadgeLibraryView.vue +32 -0
- package/components/QiuBadge/views/BadgeManageView.vue +1364 -0
- package/components/QiuBadge/views/BadgeTemplateEditorView.vue +10 -0
- package/components/QiuBadge/views/BadgeTemplateListView.vue +229 -0
- package/components/QiuBadge/views/DeskLabelTemplateListView.vue +227 -0
- package/components/QiuBadge/views/DeskLabelView.vue +683 -0
- package/components/QiuBadgeDot/index.vue +87 -0
- package/components/QiuButton/index.vue +247 -0
- package/components/QiuButtonGroup/index.vue +63 -0
- package/components/QiuCanvasKit/QiuCanvasEditor.vue +5503 -0
- package/components/QiuCanvasKit/QiuCanvasRenderer.vue +348 -0
- package/components/QiuCanvasKit/assetUrl.ts +11 -0
- package/components/QiuCanvasKit/components/DataModulesPanel.vue +352 -0
- package/components/QiuCanvasKit/export/html.ts +132 -0
- package/components/QiuCanvasKit/export/pdf.ts +48 -0
- package/components/QiuCanvasKit/export/png.ts +50 -0
- package/components/QiuCanvasKit/index.ts +20 -0
- package/components/QiuCanvasKit/modules/badgeCompat.ts +84 -0
- package/components/QiuCanvasKit/modules/dataRegistry.ts +207 -0
- package/components/QiuCanvasKit/modules/merge.ts +71 -0
- package/components/QiuCanvasKit/presets/badge.ts +67 -0
- package/components/QiuCanvasKit/presets/banner.ts +79 -0
- package/components/QiuCanvasKit/types.ts +138 -0
- package/components/QiuCard/index.vue +104 -0
- package/components/QiuCarousel/context.ts +16 -0
- package/components/QiuCarousel/index.vue +343 -0
- package/components/QiuCarouselItem/index.vue +47 -0
- package/components/QiuCascader/index.vue +879 -0
- package/components/QiuCascader/types.ts +48 -0
- package/components/QiuCheckbox/QiuCheckboxGroup.vue +78 -0
- package/components/QiuCheckbox/index.vue +231 -0
- package/components/QiuCheckbox/types.ts +8 -0
- package/components/QiuCode/index.vue +64 -0
- package/components/QiuCol/col.scss +55 -0
- package/components/QiuCol/index.vue +64 -0
- package/components/QiuCollapse/context.ts +10 -0
- package/components/QiuCollapse/index.vue +70 -0
- package/components/QiuCollapseItem/index.vue +167 -0
- package/components/QiuColorField/index.vue +296 -0
- package/components/QiuColorPicker/README.md +118 -0
- package/components/QiuColorPicker/index.vue +60 -0
- package/components/QiuColorfulCard/index.vue +101 -0
- package/components/QiuCombobox/index.vue +277 -0
- package/components/QiuConfigProvider/index.vue +31 -0
- package/components/QiuContextMenu/index.vue +209 -0
- package/components/QiuDate/index.vue +1134 -0
- package/components/QiuDescriptions/context.ts +20 -0
- package/components/QiuDescriptions/index.vue +115 -0
- package/components/QiuDescriptionsItem/index.vue +103 -0
- package/components/QiuDialog/index.vue +828 -0
- package/components/QiuDigitalCard/index.vue +159 -0
- package/components/QiuDivider/index.vue +185 -0
- package/components/QiuDot/index.vue +83 -0
- package/components/QiuDrawer/index.vue +350 -0
- package/components/QiuDropdown/QiuDropdownItem.vue +74 -0
- package/components/QiuDropdown/QiuDropdownMenu.vue +22 -0
- package/components/QiuDropdown/context.ts +9 -0
- package/components/QiuDropdown/index.vue +189 -0
- package/components/QiuEmpty/index.vue +73 -0
- package/components/QiuForm/index.vue +172 -0
- package/components/QiuForm/types.ts +39 -0
- package/components/QiuFormItem/index.vue +276 -0
- package/components/QiuFullscreen/index.vue +11 -0
- package/components/QiuGrid/index.vue +408 -0
- package/components/QiuHoverCard/index.vue +192 -0
- package/components/QiuIcon/index.vue +117 -0
- package/components/QiuIconPicker/iconify.libraries.ts +182 -0
- package/components/QiuIconPicker/icons.catalog.ts +3072 -0
- package/components/QiuIconPicker/index.vue +488 -0
- package/components/QiuImage/index.vue +177 -0
- package/components/QiuInput/index.vue +328 -0
- package/components/QiuInputNumber/index.vue +295 -0
- package/components/QiuInputOtp/index.vue +190 -0
- package/components/QiuKbd/index.vue +57 -0
- package/components/QiuLayoutContainer/index.vue +50 -0
- package/components/QiuLinkPreview/index.vue +224 -0
- package/components/QiuLoading/index.ts +176 -0
- package/components/QiuLoading/spinner.vue +820 -0
- package/components/QiuLoading/types.ts +44 -0
- package/components/QiuMention/index.vue +299 -0
- package/components/QiuMenu/QiuMenuRoot.vue +241 -0
- package/components/QiuMenu/components/QiuMenuItem.vue +340 -0
- package/components/QiuMenu/components/QiuSubMenu.vue +504 -0
- package/components/QiuMenu/context.ts +21 -0
- package/components/QiuMenu/index.vue +43 -0
- package/components/QiuMenuNav/QiuMenuNavItem.vue +100 -0
- package/components/QiuMenuNav/QiuMenuNavSub.vue +120 -0
- package/components/QiuMenuNav/context.ts +14 -0
- package/components/QiuMenuNav/index.vue +148 -0
- package/components/QiuMsg/QiuMsgItem.vue +180 -0
- package/components/QiuMsg/index.ts +158 -0
- package/components/QiuMsg/types.ts +23 -0
- package/components/QiuMsgBox/index.ts +147 -0
- package/components/QiuNotification/QiuNotificationItem.vue +168 -0
- package/components/QiuNotification/index.ts +155 -0
- package/components/QiuNotification/types.ts +14 -0
- package/components/QiuPage/index.vue +12 -0
- package/components/QiuPageHeader/index.vue +115 -0
- package/components/QiuPageMain/index.vue +78 -0
- package/components/QiuPagination/index.vue +421 -0
- package/components/QiuPasswordStrength/index.vue +101 -0
- package/components/QiuPopconfirm/index.vue +196 -0
- package/components/QiuPopover/index.vue +277 -0
- package/components/QiuProgress/index.vue +235 -0
- package/components/QiuQrcode/index.vue +302 -0
- package/components/QiuQueryForm/components/QiuQueryFormBottomPanel.vue +13 -0
- package/components/QiuQueryForm/components/QiuQueryFormLeftPanel.vue +37 -0
- package/components/QiuQueryForm/components/QiuQueryFormRightPanel.vue +37 -0
- package/components/QiuQueryForm/components/QiuQueryFormTopPanel.vue +13 -0
- package/components/QiuQueryForm/index.vue +117 -0
- package/components/QiuRadio/QiuRadioGroup.vue +75 -0
- package/components/QiuRadio/index.vue +191 -0
- package/components/QiuRadio/types.ts +9 -0
- package/components/QiuRate/index.vue +184 -0
- package/components/QiuRefresh/index.vue +32 -0
- package/components/QiuResult/index.vue +103 -0
- package/components/QiuRow/index.vue +60 -0
- package/components/QiuRow/types.ts +5 -0
- package/components/QiuScrollbar/index.vue +107 -0
- package/components/QiuSearchBar/index.vue +154 -0
- package/components/QiuSegmented/index.vue +120 -0
- package/components/QiuSelect/QiuOption.vue +93 -0
- package/components/QiuSelect/index.vue +452 -0
- package/components/QiuSelect/types.ts +15 -0
- package/components/QiuSkeleton/index.vue +78 -0
- package/components/QiuSlider/index.vue +266 -0
- package/components/QiuSpace/index.vue +95 -0
- package/components/QiuSparkline/index.vue +92 -0
- package/components/QiuStatistic/index.vue +4 -0
- package/components/QiuStatistics/index.vue +123 -0
- package/components/QiuStep/index.vue +220 -0
- package/components/QiuSteps/context.ts +25 -0
- package/components/QiuSteps/index.vue +84 -0
- package/components/QiuSwitch/index.vue +145 -0
- package/components/QiuTabBar/index.vue +218 -0
- package/components/QiuTabBar/types.ts +19 -0
- package/components/QiuTabPane/index.vue +82 -0
- package/components/QiuTable/columns.ts +16 -0
- package/components/QiuTable/export.ts +102 -0
- package/components/QiuTable/index.ts +24 -0
- package/components/QiuTable/index.vue +3503 -0
- package/components/QiuTable/registry.ts +75 -0
- package/components/QiuTable/styles/table.scss +1230 -0
- package/components/QiuTable/types.ts +413 -0
- package/components/QiuTable/useArea.ts +202 -0
- package/components/QiuTable/useColumns.ts +325 -0
- package/components/QiuTable/useEdit.ts +136 -0
- package/components/QiuTable/useExtras.ts +115 -0
- package/components/QiuTable/useHistory.ts +77 -0
- package/components/QiuTable/useMerge.ts +105 -0
- package/components/QiuTable/useResize.ts +86 -0
- package/components/QiuTable/useScrollSync.ts +152 -0
- package/components/QiuTable/useVirtual.ts +97 -0
- package/components/QiuTable/utils.ts +165 -0
- package/components/QiuTableColumn/index.vue +101 -0
- package/components/QiuTag/index.vue +143 -0
- package/components/QiuText/index.vue +99 -0
- package/components/QiuTime/index.vue +548 -0
- package/components/QiuTimeAgo/index.vue +103 -0
- package/components/QiuTimeline/index.vue +54 -0
- package/components/QiuTimelineItem/index.vue +140 -0
- package/components/QiuTips/index.vue +323 -0
- package/components/QiuTooltip/index.vue +237 -0
- package/components/QiuTransfer/index.vue +277 -0
- package/components/QiuTree/QiuTreeNode.vue +146 -0
- package/components/QiuTree/index.vue +143 -0
- package/components/QiuTree/types.ts +30 -0
- package/components/QiuTreeSelect/index.vue +259 -0
- package/components/QiuTrend/index.vue +92 -0
- package/components/QiuUpload/index.vue +628 -0
- package/components/QiuUploadCrop/index.vue +1267 -0
- package/components/QiuWatermark/index.vue +121 -0
- package/components/useBodyScrollLock.ts +28 -0
- package/dist/components/QiuAnchor/context.d.ts +15 -0
- package/dist/components/QiuAnchorLink/index.vue.d.ts +23 -0
- package/dist/components/QiuBadge/api/index.d.ts +110 -0
- package/dist/components/QiuBadge/components/BadgeImagePickerDialog.vue.d.ts +16 -0
- package/dist/components/QiuBadge/components/BadgeLibraryManagerDialog.vue.d.ts +9 -0
- package/dist/components/QiuBadge/components/BadgeLibraryPanel.vue.d.ts +5 -0
- package/dist/components/QiuBadge/composables/useTableHostHeight.d.ts +7 -0
- package/dist/components/QiuBadge/index.d.ts +18 -0
- package/dist/components/QiuBadge/shared/BadgeTemplateRenderer.vue.d.ts +14 -0
- package/dist/components/QiuBadge/shared/assetUrl.d.ts +1 -0
- package/dist/components/QiuBadge/shared/badgeTemplate.d.ts +132 -0
- package/dist/components/QiuBadge/utils/chinaAreaData.d.ts +9 -0
- package/dist/components/QiuBadge/utils/hostRegion.d.ts +3 -0
- package/dist/components/QiuBadge/utils/pca-code.json.d.ts +3 -0
- package/dist/components/QiuBadge/utils/pdfFromElement.d.ts +14 -0
- package/dist/components/QiuBadge/views/BadgeLibraryView.vue.d.ts +2 -0
- package/dist/components/QiuBadge/views/BadgeManageView.vue.d.ts +7 -0
- package/dist/components/QiuBadge/views/BadgeTemplateListView.vue.d.ts +4 -0
- package/dist/components/QiuBadge/views/DeskLabelTemplateListView.vue.d.ts +4 -0
- package/dist/components/QiuBadge/views/DeskLabelView.vue.d.ts +4 -0
- package/dist/components/QiuButton/index.vue.d.ts +52 -0
- package/dist/components/QiuCanvasKit/QiuCanvasEditor.vue.d.ts +24 -0
- package/dist/components/QiuCanvasKit/QiuCanvasRenderer.vue.d.ts +13 -0
- package/dist/components/QiuCanvasKit/assetUrl.d.ts +7 -0
- package/dist/components/QiuCanvasKit/components/DataModulesPanel.vue.d.ts +23 -0
- package/dist/components/QiuCanvasKit/export/html.d.ts +12 -0
- package/dist/components/QiuCanvasKit/export/pdf.d.ts +9 -0
- package/dist/components/QiuCanvasKit/export/png.d.ts +8 -0
- package/dist/components/QiuCanvasKit/index.d.ts +19 -0
- package/dist/components/QiuCanvasKit/modules/badgeCompat.d.ts +8 -0
- package/dist/components/QiuCanvasKit/modules/dataRegistry.d.ts +23 -0
- package/dist/components/QiuCanvasKit/modules/merge.d.ts +12 -0
- package/dist/components/QiuCanvasKit/presets/badge.d.ts +12 -0
- package/dist/components/QiuCanvasKit/presets/banner.d.ts +4 -0
- package/dist/components/QiuCanvasKit/types.d.ts +119 -0
- package/dist/components/QiuCarousel/context.d.ts +13 -0
- package/dist/components/QiuCarouselItem/index.vue.d.ts +20 -0
- package/dist/components/QiuCascader/types.d.ts +25 -0
- package/dist/components/QiuCheckbox/QiuCheckboxGroup.vue.d.ts +33 -0
- package/dist/components/QiuCheckbox/index.vue.d.ts +38 -0
- package/dist/components/QiuCheckbox/types.d.ts +7 -0
- package/dist/components/QiuCode/index.vue.d.ts +15 -0
- package/dist/components/QiuCollapse/context.d.ts +8 -0
- package/dist/components/QiuCollapseItem/index.vue.d.ts +30 -0
- package/dist/components/QiuColorField/index.vue.d.ts +23 -0
- package/dist/components/QiuColorPicker/index.vue.d.ts +21 -0
- package/dist/components/QiuCombobox/index.vue.d.ts +54 -0
- package/dist/components/QiuContextMenu/index.vue.d.ts +46 -0
- package/dist/components/QiuDescriptions/context.d.ts +16 -0
- package/dist/components/QiuDescriptionsItem/index.vue.d.ts +25 -0
- package/dist/components/QiuDigitalCard/index.vue.d.ts +45 -0
- package/dist/components/QiuDropdown/QiuDropdownItem.vue.d.ts +30 -0
- package/dist/components/QiuDropdown/QiuDropdownMenu.vue.d.ts +17 -0
- package/dist/components/QiuDropdown/context.d.ts +7 -0
- package/dist/components/QiuDropdown/index.vue.d.ts +46 -0
- package/dist/components/QiuForm/types.d.ts +31 -0
- package/dist/components/QiuHoverCard/index.vue.d.ts +44 -0
- package/dist/components/QiuIcon/index.vue.d.ts +18 -0
- package/dist/components/QiuIconPicker/iconify.libraries.d.ts +18 -0
- package/dist/components/QiuIconPicker/icons.catalog.d.ts +12 -0
- package/dist/components/QiuInput/index.vue.d.ts +71 -0
- package/dist/components/QiuInputNumber/index.vue.d.ts +38 -0
- package/dist/components/QiuInputOtp/index.vue.d.ts +28 -0
- package/dist/components/QiuKbd/index.vue.d.ts +22 -0
- package/dist/components/QiuLayoutContainer/index.vue.d.ts +29 -0
- package/dist/components/QiuLinkPreview/index.vue.d.ts +43 -0
- package/dist/components/QiuLoading/index.d.ts +26 -0
- package/dist/components/QiuLoading/spinner.vue.d.ts +14 -0
- package/dist/components/QiuLoading/types.d.ts +2 -0
- package/dist/components/QiuMention/index.vue.d.ts +35 -0
- package/dist/components/QiuMenu/QiuMenuRoot.vue.d.ts +36 -0
- package/dist/components/QiuMenu/context.d.ts +19 -0
- package/dist/components/QiuMenuNav/QiuMenuNavItem.vue.d.ts +26 -0
- package/dist/components/QiuMenuNav/QiuMenuNavSub.vue.d.ts +25 -0
- package/dist/components/QiuMenuNav/context.d.ts +12 -0
- package/dist/components/QiuMenuNav/index.vue.d.ts +35 -0
- package/dist/components/QiuMsg/QiuMsgItem.vue.d.ts +15 -0
- package/dist/components/QiuMsg/index.d.ts +30 -0
- package/dist/components/QiuMsg/types.d.ts +12 -0
- package/dist/components/QiuMsgBox/index.d.ts +14 -0
- package/dist/components/QiuNotification/QiuNotificationItem.vue.d.ts +16 -0
- package/dist/components/QiuNotification/index.d.ts +30 -0
- package/dist/components/QiuNotification/types.d.ts +12 -0
- package/dist/components/QiuPageMain/index.vue.d.ts +27 -0
- package/dist/components/QiuPagination/index.vue.d.ts +44 -0
- package/dist/components/QiuPasswordStrength/index.vue.d.ts +9 -0
- package/dist/components/QiuQrcode/index.vue.d.ts +20 -0
- package/dist/components/QiuRadio/QiuRadioGroup.vue.d.ts +33 -0
- package/dist/components/QiuRadio/types.d.ts +8 -0
- package/dist/components/QiuRow/types.d.ts +4 -0
- package/dist/components/QiuSearchBar/index.vue.d.ts +38 -0
- package/dist/components/QiuSelect/QiuOption.vue.d.ts +24 -0
- package/dist/components/QiuSelect/index.vue.d.ts +52 -0
- package/dist/components/QiuSelect/types.d.ts +13 -0
- package/dist/components/QiuSparkline/index.vue.d.ts +18 -0
- package/dist/components/QiuStep/index.vue.d.ts +31 -0
- package/dist/components/QiuSteps/context.d.ts +21 -0
- package/dist/components/QiuSwitch/index.vue.d.ts +25 -0
- package/dist/components/QiuTabBar/index.vue.d.ts +32 -0
- package/dist/components/QiuTabBar/types.d.ts +16 -0
- package/dist/components/QiuTabPane/index.vue.d.ts +25 -0
- package/dist/components/QiuTable/columns.d.ts +1 -0
- package/dist/components/QiuTable/export.d.ts +18 -0
- package/dist/components/QiuTable/index.d.ts +3 -0
- package/dist/components/QiuTable/index.vue.d.ts +322 -0
- package/dist/components/QiuTable/registry.d.ts +39 -0
- package/dist/components/QiuTable/types.d.ts +353 -0
- package/dist/components/QiuTable/useArea.d.ts +51 -0
- package/dist/components/QiuTable/useColumns.d.ts +67 -0
- package/dist/components/QiuTable/useEdit.d.ts +36 -0
- package/dist/components/QiuTable/useExtras.d.ts +38 -0
- package/dist/components/QiuTable/useHistory.d.ts +44 -0
- package/dist/components/QiuTable/useMerge.d.ts +28 -0
- package/dist/components/QiuTable/useResize.d.ts +19 -0
- package/dist/components/QiuTable/useScrollSync.d.ts +25 -0
- package/dist/components/QiuTable/useVirtual.d.ts +30 -0
- package/dist/components/QiuTable/utils.d.ts +54 -0
- package/dist/components/QiuTime/index.vue.d.ts +43 -0
- package/dist/components/QiuTimeAgo/index.vue.d.ts +35 -0
- package/dist/components/QiuTimelineItem/index.vue.d.ts +35 -0
- package/dist/components/QiuTooltip/index.vue.d.ts +38 -0
- package/dist/components/QiuTree/types.d.ts +13 -0
- package/dist/components/QiuTrend/index.vue.d.ts +34 -0
- package/dist/components/QiuUpload/index.vue.d.ts +86 -0
- package/dist/components/QiuUploadCrop/index.vue.d.ts +136 -0
- package/dist/components/useBodyScrollLock.d.ts +4 -0
- package/dist/foucui.css +1 -0
- package/dist/foucui.js +26509 -0
- package/dist/foucui.umd.cjs +125 -0
- package/dist/index.d.ts +46 -0
- package/dist/src/bridge/@/api/media.d.ts +7 -0
- package/dist/src/bridge/@/api/notice.d.ts +5 -0
- package/dist/src/bridge/@/config/index.d.ts +29 -0
- package/dist/src/bridge/@/config/media.config.d.ts +15 -0
- package/dist/src/bridge/@/config/security.config.d.ts +7 -0
- package/dist/src/bridge/@/i18n/index.d.ts +7 -0
- package/dist/src/bridge/@/store/modules/bing.d.ts +3 -0
- package/dist/src/bridge/@/store/modules/errorLog.d.ts +3 -0
- package/dist/src/bridge/@/store/modules/media.d.ts +4 -0
- package/dist/src/bridge/@/store/modules/routes.d.ts +3 -0
- package/dist/src/bridge/@/store/modules/settings.d.ts +3 -0
- package/dist/src/bridge/@/store/modules/tabs.d.ts +3 -0
- package/dist/src/bridge/@/store/modules/user.d.ts +3 -0
- package/dist/src/bridge/@/utils/convertToCamelCase.d.ts +2 -0
- package/dist/src/bridge/@/utils/index.d.ts +5 -0
- package/dist/src/bridge/@/utils/pageTitle.d.ts +1 -0
- package/dist/src/bridge/@/utils/routes.d.ts +11 -0
- package/dist/src/bridge/@/utils/validate.d.ts +13 -0
- package/dist/src/bridge/@qiu/plugins/shortcuts.d.ts +2 -0
- package/dist/src/i18n.d.ts +2 -0
- package/package.json +83 -0
- package/plugins/qiu.ts +83 -0
- package/plugins/shortcuts.ts +69 -0
- package/src/bridge/@/api/media.ts +8 -0
- package/src/bridge/@/api/notice.ts +5 -0
- package/src/bridge/@/config/index.ts +38 -0
- package/src/bridge/@/config/media.config.ts +37 -0
- package/src/bridge/@/config/security.config.ts +8 -0
- package/src/bridge/@/i18n/index.ts +6 -0
- package/src/bridge/@/store/modules/bing.ts +9 -0
- package/src/bridge/@/store/modules/errorLog.ts +9 -0
- package/src/bridge/@/store/modules/media.ts +10 -0
- package/src/bridge/@/store/modules/routes.ts +10 -0
- package/src/bridge/@/store/modules/settings.ts +9 -0
- package/src/bridge/@/store/modules/tabs.ts +9 -0
- package/src/bridge/@/store/modules/user.ts +9 -0
- package/src/bridge/@/utils/convertToCamelCase.ts +11 -0
- package/src/bridge/@/utils/index.ts +9 -0
- package/src/bridge/@/utils/pageTitle.ts +4 -0
- package/src/bridge/@/utils/routes.ts +14 -0
- package/src/bridge/@/utils/validate.ts +17 -0
- package/src/bridge/@qiu/plugins/shortcuts.ts +3 -0
- package/src/i18n.ts +8 -0
- package/src/icons/qiu-logo.svg +1 -0
- package/styles/dark.scss +194 -0
- package/styles/normalize.css +349 -0
- package/styles/plain.scss +423 -0
- package/styles/qiu-tokens.scss +40 -0
- package/styles/qiu.scss +1149 -0
- package/styles/technology.scss +452 -0
- package/styles/var.scss +382 -0
- package/styles/variables.scss +77 -0
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QiuBadge 本地演示 API(localStorage)
|
|
3
|
+
* 先保证编辑器可独立跑通;后续再对接真实后端。
|
|
4
|
+
*/
|
|
5
|
+
import type { BadgeTemplateDoc } from '../shared/badgeTemplate'
|
|
6
|
+
|
|
7
|
+
const LS_TEMPLATES = 'qiu-badge-templates'
|
|
8
|
+
const LS_DESK = 'qiu-badge-desk-templates'
|
|
9
|
+
const LS_LIBRARY = 'qiu-badge-library'
|
|
10
|
+
const LS_COMPETITIONS = 'qiu-badge-competitions'
|
|
11
|
+
|
|
12
|
+
type ApiOk<T> = { code: number; data: T; msg?: string }
|
|
13
|
+
|
|
14
|
+
const ok = <T>(data: T): ApiOk<T> => ({ code: 0, data })
|
|
15
|
+
|
|
16
|
+
const readJson = <T>(key: string, fallback: T): T => {
|
|
17
|
+
try {
|
|
18
|
+
const raw = localStorage.getItem(key)
|
|
19
|
+
if (!raw) return fallback
|
|
20
|
+
return JSON.parse(raw) as T
|
|
21
|
+
} catch {
|
|
22
|
+
return fallback
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const writeJson = (key: string, value: unknown) => {
|
|
27
|
+
localStorage.setItem(key, JSON.stringify(value))
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface BadgeTemplateRow {
|
|
31
|
+
id: number
|
|
32
|
+
competition_id: number
|
|
33
|
+
name: string
|
|
34
|
+
width_mm: number
|
|
35
|
+
height_mm: number
|
|
36
|
+
is_default: boolean
|
|
37
|
+
update_time: string
|
|
38
|
+
doc?: BadgeTemplateDoc | null
|
|
39
|
+
default_test_json?: Record<string, unknown> | null
|
|
40
|
+
kind?: 'badge' | 'desk'
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface BadgeLibraryImage {
|
|
44
|
+
id: number
|
|
45
|
+
url: string
|
|
46
|
+
name: string
|
|
47
|
+
create_time: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const nowText = () => {
|
|
51
|
+
const d = new Date()
|
|
52
|
+
const p = (n: number) => String(n).padStart(2, '0')
|
|
53
|
+
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const ensureDemoCompetitions = () => {
|
|
57
|
+
let list = readJson<any[]>(LS_COMPETITIONS, [])
|
|
58
|
+
if (!list.length) {
|
|
59
|
+
list = [
|
|
60
|
+
{
|
|
61
|
+
id: 1,
|
|
62
|
+
name: '演示比赛 A',
|
|
63
|
+
area_code: 'A01',
|
|
64
|
+
host_region: '110000',
|
|
65
|
+
start_date: '2026-08-01',
|
|
66
|
+
status: 1,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 2,
|
|
70
|
+
name: '演示比赛 B',
|
|
71
|
+
area_code: 'B02',
|
|
72
|
+
host_region: '310000',
|
|
73
|
+
start_date: '2026-09-01',
|
|
74
|
+
status: 2,
|
|
75
|
+
},
|
|
76
|
+
]
|
|
77
|
+
writeJson(LS_COMPETITIONS, list)
|
|
78
|
+
}
|
|
79
|
+
return list
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const listStore = (kind: 'badge' | 'desk') =>
|
|
83
|
+
readJson<BadgeTemplateRow[]>(kind === 'badge' ? LS_TEMPLATES : LS_DESK, [])
|
|
84
|
+
|
|
85
|
+
const saveStore = (kind: 'badge' | 'desk', rows: BadgeTemplateRow[]) =>
|
|
86
|
+
writeJson(kind === 'badge' ? LS_TEMPLATES : LS_DESK, rows)
|
|
87
|
+
|
|
88
|
+
const nextId = (rows: BadgeTemplateRow[]) =>
|
|
89
|
+
rows.reduce((m, r) => Math.max(m, Number(r.id) || 0), 0) + 1
|
|
90
|
+
|
|
91
|
+
const emptyDoc = (name: string, w = 90, h = 54): BadgeTemplateDoc =>
|
|
92
|
+
({
|
|
93
|
+
version: 1,
|
|
94
|
+
canvas: {
|
|
95
|
+
widthMm: w,
|
|
96
|
+
heightMm: h,
|
|
97
|
+
background: '#ffffff',
|
|
98
|
+
},
|
|
99
|
+
elements: [],
|
|
100
|
+
guides: [],
|
|
101
|
+
regions: [],
|
|
102
|
+
}) as BadgeTemplateDoc
|
|
103
|
+
|
|
104
|
+
/** —— competition / template —— */
|
|
105
|
+
export const getCompetitions = async (params?: any) => {
|
|
106
|
+
const list = ensureDemoCompetitions()
|
|
107
|
+
const page = Number(params?.page || 1)
|
|
108
|
+
const pageSize = Number(params?.page_size || params?.pageSize || 20)
|
|
109
|
+
const kw = String(params?.keyword || params?.q || '').trim()
|
|
110
|
+
let rows = list
|
|
111
|
+
if (kw) rows = rows.filter((r) => `${r.name}${r.area_code}`.includes(kw))
|
|
112
|
+
const start = (page - 1) * pageSize
|
|
113
|
+
return ok({
|
|
114
|
+
list: rows.slice(start, start + pageSize),
|
|
115
|
+
total: rows.length,
|
|
116
|
+
page,
|
|
117
|
+
page_size: pageSize,
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const getCompetition = async (id: number) => {
|
|
122
|
+
const row = ensureDemoCompetitions().find((r) => r.id === Number(id))
|
|
123
|
+
return ok(row || { id, name: `比赛 ${id}`, status: 1 })
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export const listBadgeTemplates = async (competitionId: number) => {
|
|
127
|
+
const rows = listStore('badge').filter((r) => r.competition_id === Number(competitionId))
|
|
128
|
+
return ok({ list: rows })
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export const createBadgeTemplate = async (competitionId: number, data: { name: string }) => {
|
|
132
|
+
const rows = listStore('badge')
|
|
133
|
+
const id = nextId(rows)
|
|
134
|
+
const row: BadgeTemplateRow = {
|
|
135
|
+
id,
|
|
136
|
+
competition_id: Number(competitionId),
|
|
137
|
+
name: data.name || '未命名模板',
|
|
138
|
+
width_mm: 90,
|
|
139
|
+
height_mm: 54,
|
|
140
|
+
is_default: rows.filter((r) => r.competition_id === Number(competitionId)).length === 0,
|
|
141
|
+
update_time: nowText(),
|
|
142
|
+
doc: emptyDoc(data.name || '未命名模板'),
|
|
143
|
+
kind: 'badge',
|
|
144
|
+
}
|
|
145
|
+
rows.push(row)
|
|
146
|
+
saveStore('badge', rows)
|
|
147
|
+
return ok(row)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export const getBadgeTemplateOne = async (competitionId: number, templateId: number) => {
|
|
151
|
+
const row = listStore('badge').find(
|
|
152
|
+
(r) => r.id === Number(templateId) && r.competition_id === Number(competitionId)
|
|
153
|
+
)
|
|
154
|
+
if (!row) return ok(null)
|
|
155
|
+
return ok({
|
|
156
|
+
...row,
|
|
157
|
+
template_json: row.doc || emptyDoc(row.name, row.width_mm, row.height_mm),
|
|
158
|
+
doc: row.doc || emptyDoc(row.name, row.width_mm, row.height_mm),
|
|
159
|
+
default_test_json: row.default_test_json || {},
|
|
160
|
+
})
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export const getBadgeTemplate = async (competitionId: number) => {
|
|
164
|
+
const rows = listStore('badge').filter((r) => r.competition_id === Number(competitionId))
|
|
165
|
+
const row = rows.find((r) => r.is_default) || rows[0]
|
|
166
|
+
if (!row) return ok(null)
|
|
167
|
+
return getBadgeTemplateOne(competitionId, row.id)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export const putBadgeTemplateOne = async (
|
|
171
|
+
competitionId: number,
|
|
172
|
+
templateId: number,
|
|
173
|
+
data: Record<string, unknown>
|
|
174
|
+
) => {
|
|
175
|
+
const rows = listStore('badge')
|
|
176
|
+
const idx = rows.findIndex(
|
|
177
|
+
(r) => r.id === Number(templateId) && r.competition_id === Number(competitionId)
|
|
178
|
+
)
|
|
179
|
+
if (idx < 0) return ok(null)
|
|
180
|
+
const doc = (data.doc || data.template_json || data.template || rows[idx].doc) as BadgeTemplateDoc
|
|
181
|
+
const name = String(data.name || rows[idx].name)
|
|
182
|
+
const width = Number((doc as any)?.canvas?.widthMm || data.width_mm || rows[idx].width_mm)
|
|
183
|
+
const height = Number((doc as any)?.canvas?.heightMm || data.height_mm || rows[idx].height_mm)
|
|
184
|
+
rows[idx] = {
|
|
185
|
+
...rows[idx],
|
|
186
|
+
name,
|
|
187
|
+
width_mm: width,
|
|
188
|
+
height_mm: height,
|
|
189
|
+
doc,
|
|
190
|
+
default_test_json: (data.default_test_json as Record<string, unknown>) ?? rows[idx].default_test_json ?? {},
|
|
191
|
+
update_time: nowText(),
|
|
192
|
+
}
|
|
193
|
+
saveStore('badge', rows)
|
|
194
|
+
return ok(rows[idx])
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export const deleteBadgeTemplate = async (competitionId: number, templateId: number) => {
|
|
198
|
+
const rows = listStore('badge').filter(
|
|
199
|
+
(r) => !(r.id === Number(templateId) && r.competition_id === Number(competitionId))
|
|
200
|
+
)
|
|
201
|
+
saveStore('badge', rows)
|
|
202
|
+
return ok(true)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export const setDefaultBadgeTemplate = async (competitionId: number, templateId: number) => {
|
|
206
|
+
const rows = listStore('badge').map((r) =>
|
|
207
|
+
r.competition_id === Number(competitionId)
|
|
208
|
+
? { ...r, is_default: r.id === Number(templateId) }
|
|
209
|
+
: r
|
|
210
|
+
)
|
|
211
|
+
saveStore('badge', rows)
|
|
212
|
+
return ok(true)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** desk label templates */
|
|
216
|
+
export const listDeskLabelTemplates = async (competitionId: number) => {
|
|
217
|
+
const rows = listStore('desk').filter((r) => r.competition_id === Number(competitionId))
|
|
218
|
+
return ok({ list: rows })
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export const createDeskLabelTemplate = async (competitionId: number, data: { name: string }) => {
|
|
222
|
+
const rows = listStore('desk')
|
|
223
|
+
const id = nextId(rows)
|
|
224
|
+
const row: BadgeTemplateRow = {
|
|
225
|
+
id,
|
|
226
|
+
competition_id: Number(competitionId),
|
|
227
|
+
name: data.name || '未命名桌签',
|
|
228
|
+
width_mm: 150,
|
|
229
|
+
height_mm: 50,
|
|
230
|
+
is_default: rows.filter((r) => r.competition_id === Number(competitionId)).length === 0,
|
|
231
|
+
update_time: nowText(),
|
|
232
|
+
doc: emptyDoc(data.name || '未命名桌签', 150, 50),
|
|
233
|
+
kind: 'desk',
|
|
234
|
+
}
|
|
235
|
+
rows.push(row)
|
|
236
|
+
saveStore('desk', rows)
|
|
237
|
+
return ok(row)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export const getDeskLabelTemplateOne = async (competitionId: number, templateId: number) => {
|
|
241
|
+
const row = listStore('desk').find(
|
|
242
|
+
(r) => r.id === Number(templateId) && r.competition_id === Number(competitionId)
|
|
243
|
+
)
|
|
244
|
+
if (!row) return ok(null)
|
|
245
|
+
return ok({
|
|
246
|
+
...row,
|
|
247
|
+
template_json: row.doc || emptyDoc(row.name, row.width_mm, row.height_mm),
|
|
248
|
+
doc: row.doc || emptyDoc(row.name, row.width_mm, row.height_mm),
|
|
249
|
+
default_test_json: row.default_test_json || {},
|
|
250
|
+
})
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export const getDeskLabelTemplate = async (competitionId: number) => {
|
|
254
|
+
const rows = listStore('desk').filter((r) => r.competition_id === Number(competitionId))
|
|
255
|
+
const row = rows.find((r) => r.is_default) || rows[0]
|
|
256
|
+
if (!row) return ok(null)
|
|
257
|
+
return getDeskLabelTemplateOne(competitionId, row.id)
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export const putDeskLabelTemplateOne = async (
|
|
261
|
+
competitionId: number,
|
|
262
|
+
templateId: number,
|
|
263
|
+
data: Record<string, unknown>
|
|
264
|
+
) => {
|
|
265
|
+
const rows = listStore('desk')
|
|
266
|
+
const idx = rows.findIndex(
|
|
267
|
+
(r) => r.id === Number(templateId) && r.competition_id === Number(competitionId)
|
|
268
|
+
)
|
|
269
|
+
if (idx < 0) return ok(null)
|
|
270
|
+
const doc = (data.doc || data.template_json || data.template || rows[idx].doc) as BadgeTemplateDoc
|
|
271
|
+
const name = String(data.name || rows[idx].name)
|
|
272
|
+
const width = Number((doc as any)?.canvas?.widthMm || data.width_mm || rows[idx].width_mm)
|
|
273
|
+
const height = Number((doc as any)?.canvas?.heightMm || data.height_mm || rows[idx].height_mm)
|
|
274
|
+
rows[idx] = {
|
|
275
|
+
...rows[idx],
|
|
276
|
+
name,
|
|
277
|
+
width_mm: width,
|
|
278
|
+
height_mm: height,
|
|
279
|
+
doc,
|
|
280
|
+
default_test_json: (data.default_test_json as Record<string, unknown>) ?? rows[idx].default_test_json ?? {},
|
|
281
|
+
update_time: nowText(),
|
|
282
|
+
}
|
|
283
|
+
saveStore('desk', rows)
|
|
284
|
+
return ok(rows[idx])
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export const deleteDeskLabelTemplate = async (competitionId: number, templateId: number) => {
|
|
288
|
+
const rows = listStore('desk').filter(
|
|
289
|
+
(r) => !(r.id === Number(templateId) && r.competition_id === Number(competitionId))
|
|
290
|
+
)
|
|
291
|
+
saveStore('desk', rows)
|
|
292
|
+
return ok(true)
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export const setDefaultDeskLabelTemplate = async (competitionId: number, templateId: number) => {
|
|
296
|
+
const rows = listStore('desk').map((r) =>
|
|
297
|
+
r.competition_id === Number(competitionId)
|
|
298
|
+
? { ...r, is_default: r.id === Number(templateId) }
|
|
299
|
+
: r
|
|
300
|
+
)
|
|
301
|
+
saveStore('desk', rows)
|
|
302
|
+
return ok(true)
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** —— upload / library —— */
|
|
306
|
+
export const getBadgeLibraryImages = async (params?: { page?: number; page_size?: number }) => {
|
|
307
|
+
const list = readJson<BadgeLibraryImage[]>(LS_LIBRARY, [])
|
|
308
|
+
const page = Number(params?.page || 1)
|
|
309
|
+
const pageSize = Number(params?.page_size || 40)
|
|
310
|
+
const start = (page - 1) * pageSize
|
|
311
|
+
return ok({ list: list.slice(start, start + pageSize), total: list.length, page, page_size: pageSize })
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export const uploadBadgeLibraryImage = async (file: File) => {
|
|
315
|
+
const url = await new Promise<string>((resolve, reject) => {
|
|
316
|
+
const reader = new FileReader()
|
|
317
|
+
reader.onload = () => resolve(String(reader.result || ''))
|
|
318
|
+
reader.onerror = () => reject(new Error('read failed'))
|
|
319
|
+
reader.readAsDataURL(file)
|
|
320
|
+
})
|
|
321
|
+
const list = readJson<BadgeLibraryImage[]>(LS_LIBRARY, [])
|
|
322
|
+
const id = list.reduce((m, r) => Math.max(m, r.id), 0) + 1
|
|
323
|
+
const row: BadgeLibraryImage = {
|
|
324
|
+
id,
|
|
325
|
+
url,
|
|
326
|
+
name: file.name,
|
|
327
|
+
create_time: nowText(),
|
|
328
|
+
}
|
|
329
|
+
list.unshift(row)
|
|
330
|
+
writeJson(LS_LIBRARY, list)
|
|
331
|
+
return ok(row)
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export const deleteBadgeLibraryImage = async (id: number) => {
|
|
335
|
+
const list = readJson<BadgeLibraryImage[]>(LS_LIBRARY, []).filter((r) => r.id !== Number(id))
|
|
336
|
+
writeJson(LS_LIBRARY, list)
|
|
337
|
+
return ok(true)
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** —— student / print data stubs —— */
|
|
341
|
+
export const getBadgeSchools = async (_competitionId: number) =>
|
|
342
|
+
ok([
|
|
343
|
+
{ id: 1, name: '演示学校一', short_name: '校一' },
|
|
344
|
+
{ id: 2, name: '演示学校二', short_name: '校二' },
|
|
345
|
+
])
|
|
346
|
+
|
|
347
|
+
export const getBadges = async (_competitionId: number, _params?: any) =>
|
|
348
|
+
ok({
|
|
349
|
+
list: [
|
|
350
|
+
{
|
|
351
|
+
id: 1,
|
|
352
|
+
student_name: '张三',
|
|
353
|
+
competition_no: 'A001',
|
|
354
|
+
school_name: '演示学校一',
|
|
355
|
+
age_group: '小学组',
|
|
356
|
+
competition_room: '101',
|
|
357
|
+
seat_no: '01',
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
id: 2,
|
|
361
|
+
student_name: '李四',
|
|
362
|
+
competition_no: 'A002',
|
|
363
|
+
school_name: '演示学校一',
|
|
364
|
+
age_group: '小学组',
|
|
365
|
+
competition_room: '101',
|
|
366
|
+
seat_no: '02',
|
|
367
|
+
},
|
|
368
|
+
],
|
|
369
|
+
total: 2,
|
|
370
|
+
})
|
|
371
|
+
|
|
372
|
+
export const getBadgesExportData = async (competitionId: number, params?: any) =>
|
|
373
|
+
getBadges(competitionId, params)
|
|
374
|
+
|
|
375
|
+
export const getStudents = async (_competitionId: number, _params?: any) =>
|
|
376
|
+
ok({ list: [], total: 0 })
|
|
377
|
+
|
|
378
|
+
export const finalizeSeatAssignmentLock = async (_competitionId: number, _data?: any) => ok(true)
|
|
379
|
+
|
|
380
|
+
export const getDeskLabels = async (_competitionId: number) =>
|
|
381
|
+
ok([
|
|
382
|
+
{
|
|
383
|
+
id: 1,
|
|
384
|
+
competition_room: '101',
|
|
385
|
+
seat_no: '01',
|
|
386
|
+
student_name: '张三',
|
|
387
|
+
school_name: '演示学校一',
|
|
388
|
+
},
|
|
389
|
+
])
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<qiu-dialog
|
|
3
|
+
v-model="visibleInner"
|
|
4
|
+
title="添加图片"
|
|
5
|
+
width="720px"
|
|
6
|
+
destroy-on-close
|
|
7
|
+
class="badge-img-picker-dlg"
|
|
8
|
+
@opened="load"
|
|
9
|
+
>
|
|
10
|
+
<qiu-tab-bar v-model="tab">
|
|
11
|
+
<qiu-tab-pane label="图片库" name="lib">
|
|
12
|
+
<p class="dlg-hint">双击缩略图插入到画布;删除后模板里若仍引用该地址将无法显示。</p>
|
|
13
|
+
<div v-qiu-loading="loading" class="lib-grid">
|
|
14
|
+
<div
|
|
15
|
+
v-for="it in list"
|
|
16
|
+
:key="it.id"
|
|
17
|
+
class="lib-cell"
|
|
18
|
+
@dblclick="pick(it)"
|
|
19
|
+
>
|
|
20
|
+
<img :src="fullUrl(it.url)" alt="" class="thumb" loading="lazy" />
|
|
21
|
+
<div class="meta" :title="it.orig_name">{{ it.orig_name || '未命名' }}</div>
|
|
22
|
+
<qiu-button type="danger" link size="small" class="del" @click.stop="remove(it)">删除</qiu-button>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<qiu-empty v-if="!loading && !list.length" description="暂无图片,可到「上传本地文件」添加" />
|
|
26
|
+
</qiu-tab-pane>
|
|
27
|
+
<qiu-tab-pane label="上传本地文件" name="up">
|
|
28
|
+
<p class="dlg-hint">上传后会写入图片库,并自动插入当前画布;可多选文件或一次拖拽多张。</p>
|
|
29
|
+
<div
|
|
30
|
+
class="upload-drop"
|
|
31
|
+
@dragover.prevent
|
|
32
|
+
@drop.prevent="onDrop"
|
|
33
|
+
@click="fileInputRef?.click()"
|
|
34
|
+
>
|
|
35
|
+
<qiu-icon icon="upload-cloud-2-line" class="upload-ico" />
|
|
36
|
+
<div class="upload-text">拖到此处,或 <em>点击选择多个文件</em></div>
|
|
37
|
+
<div class="upload-sub">支持 JPG / PNG / GIF / WebP / BMP,单文件不超过 8MB</div>
|
|
38
|
+
<input
|
|
39
|
+
ref="fileInputRef"
|
|
40
|
+
type="file"
|
|
41
|
+
multiple
|
|
42
|
+
accept="image/jpeg,image/png,image/gif,image/webp,image/bmp"
|
|
43
|
+
class="upload-input"
|
|
44
|
+
@change="onFileInput"
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
</qiu-tab-pane>
|
|
48
|
+
</qiu-tab-bar>
|
|
49
|
+
|
|
50
|
+
<qiu-dialog v-model="deleteConfirmVisible" title="删除确认" width="400px" append-to-body>
|
|
51
|
+
<p>确定删除「{{ deleteTarget?.orig_name || '该图片' }}」?</p>
|
|
52
|
+
<template #footer>
|
|
53
|
+
<qiu-button @click="deleteConfirmVisible = false">取消</qiu-button>
|
|
54
|
+
<qiu-button type="danger" @click="doRemove">删除</qiu-button>
|
|
55
|
+
</template>
|
|
56
|
+
</qiu-dialog>
|
|
57
|
+
</qiu-dialog>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script setup lang="ts">
|
|
61
|
+
import { ref, watch, computed } from 'vue'
|
|
62
|
+
import { qiuMsg } from '../../QiuMsg'
|
|
63
|
+
import { getBadgeLibraryImages, uploadBadgeLibraryImage, deleteBadgeLibraryImage } from '../api/index'
|
|
64
|
+
import { resolveAssetUrl } from '../shared/assetUrl'
|
|
65
|
+
|
|
66
|
+
const props = withDefaults(
|
|
67
|
+
defineProps<{ modelValue: boolean; defaultTab?: 'lib' | 'up' }>(),
|
|
68
|
+
{ defaultTab: 'lib' }
|
|
69
|
+
)
|
|
70
|
+
const emit = defineEmits<{ 'update:modelValue': [boolean]; pick: [string] }>()
|
|
71
|
+
|
|
72
|
+
const visibleInner = computed({
|
|
73
|
+
get: () => props.modelValue,
|
|
74
|
+
set: (v: boolean) => emit('update:modelValue', v),
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
const tab = ref('lib')
|
|
78
|
+
const loading = ref(false)
|
|
79
|
+
const list = ref<any[]>([])
|
|
80
|
+
const fileInputRef = ref<HTMLInputElement | null>(null)
|
|
81
|
+
const deleteConfirmVisible = ref(false)
|
|
82
|
+
const deleteTarget = ref<{ id: number; orig_name?: string } | null>(null)
|
|
83
|
+
|
|
84
|
+
function fullUrl(path: string) {
|
|
85
|
+
return resolveAssetUrl(path)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async function load() {
|
|
89
|
+
loading.value = true
|
|
90
|
+
try {
|
|
91
|
+
const res: any = await getBadgeLibraryImages({ page: 1, page_size: 120 })
|
|
92
|
+
list.value = res.data?.list ?? []
|
|
93
|
+
} catch {
|
|
94
|
+
list.value = []
|
|
95
|
+
} finally {
|
|
96
|
+
loading.value = false
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
watch(
|
|
101
|
+
() => props.modelValue,
|
|
102
|
+
(v) => {
|
|
103
|
+
if (v) tab.value = props.defaultTab
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
function pick(it: { url: string }) {
|
|
108
|
+
if (!it?.url) return
|
|
109
|
+
emit('pick', resolveAssetUrl(it.url))
|
|
110
|
+
visibleInner.value = false
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function remove(it: { id: number; orig_name?: string }) {
|
|
114
|
+
deleteTarget.value = it
|
|
115
|
+
deleteConfirmVisible.value = true
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async function doRemove() {
|
|
119
|
+
const it = deleteTarget.value
|
|
120
|
+
if (!it) return
|
|
121
|
+
deleteConfirmVisible.value = false
|
|
122
|
+
try {
|
|
123
|
+
await deleteBadgeLibraryImage(Number(it.id))
|
|
124
|
+
qiuMsg.success('已删除')
|
|
125
|
+
await load()
|
|
126
|
+
} catch {
|
|
127
|
+
/* 拦截器 */
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const MAX_BADGE_UPLOAD_MB = 8
|
|
132
|
+
|
|
133
|
+
async function uploadFiles(files: FileList | File[]) {
|
|
134
|
+
for (const file of Array.from(files)) {
|
|
135
|
+
const mb = file.size / (1024 * 1024)
|
|
136
|
+
if (mb > MAX_BADGE_UPLOAD_MB) {
|
|
137
|
+
qiuMsg.error(`「${file.name}」超过 ${MAX_BADGE_UPLOAD_MB}MB,已跳过`)
|
|
138
|
+
continue
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
const res: any = await uploadBadgeLibraryImage(file)
|
|
142
|
+
const url = res?.data?.url
|
|
143
|
+
if (!url) {
|
|
144
|
+
qiuMsg.error(`「${file.name}」上传失败`)
|
|
145
|
+
continue
|
|
146
|
+
}
|
|
147
|
+
emit('pick', resolveAssetUrl(url))
|
|
148
|
+
await load()
|
|
149
|
+
} catch {
|
|
150
|
+
/* 拦截器已提示 */
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function onFileInput(e: Event) {
|
|
156
|
+
const input = e.target as HTMLInputElement
|
|
157
|
+
if (input.files?.length) uploadFiles(input.files)
|
|
158
|
+
input.value = ''
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function onDrop(e: DragEvent) {
|
|
162
|
+
if (e.dataTransfer?.files?.length) uploadFiles(e.dataTransfer.files)
|
|
163
|
+
}
|
|
164
|
+
</script>
|
|
165
|
+
|
|
166
|
+
<style scoped>
|
|
167
|
+
.dlg-hint {
|
|
168
|
+
font-size: 13px;
|
|
169
|
+
color: #909399;
|
|
170
|
+
margin: 0 0 12px;
|
|
171
|
+
line-height: 1.5;
|
|
172
|
+
}
|
|
173
|
+
.lib-grid {
|
|
174
|
+
display: grid;
|
|
175
|
+
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
|
176
|
+
gap: 12px;
|
|
177
|
+
max-height: 420px;
|
|
178
|
+
overflow-y: auto;
|
|
179
|
+
padding: 4px 0;
|
|
180
|
+
}
|
|
181
|
+
.lib-cell {
|
|
182
|
+
border: 1px solid #ebeef5;
|
|
183
|
+
border-radius: 8px;
|
|
184
|
+
padding: 8px;
|
|
185
|
+
cursor: pointer;
|
|
186
|
+
transition: border-color 0.15s, box-shadow 0.15s;
|
|
187
|
+
position: relative;
|
|
188
|
+
}
|
|
189
|
+
.lib-cell:hover {
|
|
190
|
+
border-color: #409eff;
|
|
191
|
+
box-shadow: 0 2px 8px rgba(64, 158, 255, 0.15);
|
|
192
|
+
}
|
|
193
|
+
.thumb {
|
|
194
|
+
width: 100%;
|
|
195
|
+
height: 100px;
|
|
196
|
+
object-fit: contain;
|
|
197
|
+
background: #f5f7fa;
|
|
198
|
+
border-radius: 4px;
|
|
199
|
+
}
|
|
200
|
+
.meta {
|
|
201
|
+
font-size: 11px;
|
|
202
|
+
color: #606266;
|
|
203
|
+
margin-top: 6px;
|
|
204
|
+
overflow: hidden;
|
|
205
|
+
text-overflow: ellipsis;
|
|
206
|
+
white-space: nowrap;
|
|
207
|
+
}
|
|
208
|
+
.del {
|
|
209
|
+
margin-top: 4px;
|
|
210
|
+
}
|
|
211
|
+
.upload-drop {
|
|
212
|
+
padding: 40px 20px;
|
|
213
|
+
text-align: center;
|
|
214
|
+
cursor: pointer;
|
|
215
|
+
border: 1px dashed #dcdfe6;
|
|
216
|
+
border-radius: 8px;
|
|
217
|
+
background: #fafafa;
|
|
218
|
+
}
|
|
219
|
+
.upload-drop:hover {
|
|
220
|
+
border-color: #409eff;
|
|
221
|
+
}
|
|
222
|
+
.upload-input {
|
|
223
|
+
display: none;
|
|
224
|
+
}
|
|
225
|
+
.upload-ico {
|
|
226
|
+
font-size: 48px;
|
|
227
|
+
color: #c0c4cc;
|
|
228
|
+
margin-bottom: 8px;
|
|
229
|
+
}
|
|
230
|
+
.upload-text {
|
|
231
|
+
font-size: 14px;
|
|
232
|
+
color: #606266;
|
|
233
|
+
}
|
|
234
|
+
.upload-text em {
|
|
235
|
+
color: #409eff;
|
|
236
|
+
font-style: normal;
|
|
237
|
+
}
|
|
238
|
+
.upload-sub {
|
|
239
|
+
font-size: 12px;
|
|
240
|
+
color: #909399;
|
|
241
|
+
margin-top: 8px;
|
|
242
|
+
}
|
|
243
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<qiu-dialog
|
|
3
|
+
:model-value="modelValue"
|
|
4
|
+
title="证件图片库"
|
|
5
|
+
width="min(920px, 94vw)"
|
|
6
|
+
class="badge-library-manager-dialog"
|
|
7
|
+
append-to-body
|
|
8
|
+
destroy-on-close
|
|
9
|
+
@update:model-value="$emit('update:modelValue', $event)"
|
|
10
|
+
>
|
|
11
|
+
<p class="dlg-tip">管理模板编辑中上传的图片;删除后已保存模板里若仍引用该地址将无法显示。</p>
|
|
12
|
+
<BadgeLibraryPanel v-if="modelValue" />
|
|
13
|
+
</qiu-dialog>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import BadgeLibraryPanel from './BadgeLibraryPanel.vue'
|
|
18
|
+
|
|
19
|
+
defineProps<{ modelValue: boolean }>()
|
|
20
|
+
defineEmits<{ 'update:modelValue': [boolean] }>()
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<style scoped>
|
|
24
|
+
.dlg-tip {
|
|
25
|
+
margin: 0 0 14px;
|
|
26
|
+
font-size: 13px;
|
|
27
|
+
color: #909399;
|
|
28
|
+
line-height: 1.5;
|
|
29
|
+
}
|
|
30
|
+
</style>
|