diff --git a/src/api/types.ts b/src/api/types.ts index ce1d7ab7..a4a38b49 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -144,6 +144,38 @@ export interface SubscribeShare { episode_group?: string } +// 工作流分享 +export interface WorkflowShare { + // 分享ID + id?: number + // 工作流ID + workflow_id?: string + // 分享标题 + share_title?: string + // 分享说明 + share_comment?: string + // 分享人 + share_user?: string + // 分享人唯一ID + share_uid?: string + // 工作流名称 + name?: string + // 工作流描述 + description?: string + // 定时器 + timer?: string + // 动作列表 + actions?: any[] + // 动作流 + flows?: any[] + // 上下文 + context?: string + // 时间 + date?: string + // 复用次数 + count?: number +} + // 历史记录 export interface TransferHistory { // ID diff --git a/src/components/cards/WorkflowShareCard.vue b/src/components/cards/WorkflowShareCard.vue new file mode 100644 index 00000000..4e364ee1 --- /dev/null +++ b/src/components/cards/WorkflowShareCard.vue @@ -0,0 +1,121 @@ + + + + + + + + + + + + + {{ props.media?.share_title }} + + + {{ props.media?.share_comment }} + + + + + + + + {{ props.media?.share_user }} + + + + {{ props.media?.count.toLocaleString() }} + + + + + + {{ dateText }} + + + + + + + + + + + + \ No newline at end of file diff --git a/src/components/cards/WorkflowTaskCard.vue b/src/components/cards/WorkflowTaskCard.vue index 6ba75b4d..39b65e34 100644 --- a/src/components/cards/WorkflowTaskCard.vue +++ b/src/components/cards/WorkflowTaskCard.vue @@ -4,6 +4,7 @@ import { useToast } from 'vue-toastification' import { useConfirm } from '@/composables/useConfirm' import WorkflowAddEditDialog from '@/components/dialog/WorkflowAddEditDialog.vue' import WorkflowActionsDialog from '@/components/dialog/WorkflowActionsDialog.vue' +import WorkflowShareDialog from '@/components/dialog/WorkflowShareDialog.vue' import api from '@/api' import { useI18n } from 'vue-i18n' @@ -32,6 +33,9 @@ const editDialog = ref(false) // 流程对话框 const flowDialog = ref(false) +// 分享对话框 +const shareDialog = ref(false) + // 加载中 const loading = ref(false) @@ -45,10 +49,16 @@ function handleFlow(item: Workflow) { flowDialog.value = true } +// 分享工作流 +function handleShare(item: Workflow) { + shareDialog.value = true +} + // 编辑完成 function editDone() { editDialog.value = false flowDialog.value = false + shareDialog.value = false emit('refresh') } @@ -240,6 +250,12 @@ const resolveProgress = (item: Workflow) => { {{ t('workflow.task.reset') }} + + + + + {{ t('workflow.task.share') }} + @@ -317,5 +333,11 @@ const resolveProgress = (item: Workflow) => { @save="editDone" :workflow="workflow" /> + + diff --git a/src/components/dialog/ForkWorkflowDialog.vue b/src/components/dialog/ForkWorkflowDialog.vue new file mode 100644 index 00000000..d4db5a62 --- /dev/null +++ b/src/components/dialog/ForkWorkflowDialog.vue @@ -0,0 +1,173 @@ + + + + + + + + + + + + {{ props.media?.share_title }} + + + {{ props.media?.share_comment }} + + + + + {{ t('workflow.sharer') }}: + {{ media?.share_user }} + + + + + {{ t('workflow.timer') }}: + {{ media?.timer }} + + + + + {{ t('workflow.actionCount') }}: + {{ media?.actions?.length }} + + + + + + + {{ t('workflow.normalFork') }} + + + {{ t('workflow.cancelShare') }} + + + + {{ + t('workflow.usageCount', { count: props.media?.count?.toLocaleString() }) + }} + + + + + + + + + + \ No newline at end of file diff --git a/src/components/dialog/WorkflowShareDialog.vue b/src/components/dialog/WorkflowShareDialog.vue new file mode 100644 index 00000000..0ec4951e --- /dev/null +++ b/src/components/dialog/WorkflowShareDialog.vue @@ -0,0 +1,122 @@ + + + + + + + + + + {{ t('dialog.workflowShare.shareWorkflow') }} + + {{ props.workflow?.name }} + + + + + + {}" class="pt-2"> + + + + + + + + + + + + + + + + + {{ t('dialog.workflowShare.confirmShare') }} + + + + + \ No newline at end of file diff --git a/src/locales/en-US.ts b/src/locales/en-US.ts index 202fdd37..1ad91734 100644 --- a/src/locales/en-US.ts +++ b/src/locales/en-US.ts @@ -329,6 +329,10 @@ export default { share: 'Subscription Shares', }, }, + workflowTabs: { + list: 'Workflow', + share: 'Workflow Share', + }, pluginTabs: { installed: 'My Plugins', market: 'Plugin Market', @@ -488,6 +492,7 @@ export default { dragComponentHint: 'Drag component to canvas', task: { edit: 'Edit Task', + share: 'Share', continue: 'Continue', restart: 'Restart', run: 'Run Now', @@ -655,6 +660,19 @@ export default { loadPluginSettingFailed: 'Failed to load plugin settings', }, title: 'Workflow', + share: 'Workflow Share', + searchShares: 'Search Workflow Shares', + noShareData: 'No shared workflows', + sharer: 'Sharer', + timer: 'Timer', + actionCount: 'Action Count', + normalFork: 'Fork Workflow', + cancelShare: 'Cancel Share', + cancelSuccess: 'Share cancelled successfully', + cancelFailed: 'Failed to cancel share: {message}', + usageCount: 'Used {count} times', + addSuccess: 'Forked {name} successfully!', + addFailed: 'Failed to fork {name}: {message}', noWorkflow: 'No Workflow', noWorkflowDescription: 'Click the add button to create a workflow task.', }, @@ -1730,6 +1748,18 @@ export default { shareSuccess: '{name} shared successfully!', shareFailed: '{name} share failed: {message}!', }, + workflowShare: { + shareWorkflow: 'Share Workflow', + title: 'Title', + description: 'Description', + descriptionHint: + 'Add a description about this workflow. Actions and flows will be included in the share by default', + shareUser: 'Share User', + shareUserHint: "Sharer's nickname", + confirmShare: 'Confirm Share', + shareSuccess: '{name} shared successfully!', + shareFailed: '{name} share failed: {message}!', + }, u115Auth: { loginTitle: '115 Cloud Login', scanQrCode: 'Please scan with WeChat or 115 client', diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 76841819..b03b8faa 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -328,6 +328,10 @@ export default { share: '订阅分享', }, }, + workflowTabs: { + list: '工作流', + share: '工作流分享', + }, pluginTabs: { installed: '我的插件', market: '插件市场', @@ -486,6 +490,7 @@ export default { dragComponentHint: '拖动组件到画布', task: { edit: '编辑任务', + share: '分享', continue: '继续执行', restart: '重新执行', run: '立即执行', @@ -653,6 +658,19 @@ export default { loadPluginSettingFailed: '加载插件设置失败', }, title: '工作流', + share: '工作流分享', + searchShares: '搜索工作流分享', + noShareData: '暂无分享的工作流', + sharer: '分享人', + timer: '定时器', + actionCount: '动作数量', + normalFork: '复用工作流', + cancelShare: '取消分享', + cancelSuccess: '取消分享成功', + cancelFailed: '取消分享失败:{message}', + usageCount: '复用 {count} 次', + addSuccess: '复用 {name} 成功!', + addFailed: '复用 {name} 失败:{message}', noWorkflow: '没有工作流', noWorkflowDescription: '点击添加按钮创建工作流任务。', }, @@ -1709,6 +1727,17 @@ export default { shareSuccess: '{name} 分享成功!', shareFailed: '{name} 分享失败:{message}!', }, + workflowShare: { + shareWorkflow: '分享工作流', + title: '标题', + description: '说明', + descriptionHint: '填写关于该工作流的说明,工作流的动作和流程将会默认包含在分享中', + shareUser: '分享用户', + shareUserHint: '分享人的昵称', + confirmShare: '确认分享', + shareSuccess: '{name} 分享成功!', + shareFailed: '{name} 分享失败:{message}!', + }, u115Auth: { loginTitle: '115网盘登录', scanQrCode: '请使用微信或115客户端扫码', diff --git a/src/locales/zh-TW.ts b/src/locales/zh-TW.ts index e2a82a4b..7057e523 100644 --- a/src/locales/zh-TW.ts +++ b/src/locales/zh-TW.ts @@ -329,6 +329,10 @@ export default { share: '訂閱分享', }, }, + workflowTabs: { + list: '工作流', + share: '工作流分享', + }, pluginTabs: { installed: '我的插件', market: '插件市場', @@ -484,6 +488,7 @@ export default { dragComponentHint: '拖曳組件到畫布', task: { edit: '編輯任務', + share: '分享', continue: '繼續', restart: '重新開始', run: '立即執行', @@ -651,6 +656,19 @@ export default { loadPluginSettingFailed: '加載插件設置失敗', }, title: '工作流', + share: '工作流分享', + searchShares: '搜索工作流分享', + noShareData: '暫無分享的工作流', + sharer: '分享人', + timer: '定時器', + actionCount: '動作數量', + normalFork: '復用工作流', + cancelShare: '取消分享', + cancelSuccess: '取消分享成功', + cancelFailed: '取消分享失敗:{message}', + usageCount: '復用 {count} 次', + addSuccess: '復用 {name} 成功!', + addFailed: '復用 {name} 失敗:{message}', noWorkflow: '沒有工作流', noWorkflowDescription: '點擊添加按鈕創建工作流任務。', }, @@ -1708,6 +1726,17 @@ export default { shareSuccess: '{name} 分享成功!', shareFailed: '{name} 分享失敗:{message}!', }, + workflowShare: { + shareWorkflow: '分享工作流', + title: '標題', + description: '說明', + descriptionHint: '填寫關於該工作流的說明,工作流的動作和流程將會默認包含在分享中', + shareUser: '分享用戶', + shareUserHint: '分享人的暱稱', + confirmShare: '確認分享', + shareSuccess: '{name} 分享成功!', + shareFailed: '{name} 分享失敗:{message}!', + }, u115Auth: { loginTitle: '115網盤登錄', scanQrCode: '請使用微信或115客戶端掃碼', diff --git a/src/pages/workflow.vue b/src/pages/workflow.vue index f6574d3d..403a820b 100644 --- a/src/pages/workflow.vue +++ b/src/pages/workflow.vue @@ -1,9 +1,133 @@ - + + + + + + + + + + + + + + + + + + + {{ t('workflow.searchShares') }} + + + + + + + + + + + + + + diff --git a/src/router/i18n-menu.ts b/src/router/i18n-menu.ts index f385b5d3..c3cdc9e6 100644 --- a/src/router/i18n-menu.ts +++ b/src/router/i18n-menu.ts @@ -293,3 +293,21 @@ export function getDiscoverTabs() { }, ] } + +// 获取工作流标签页 +export function getWorkflowTabs() { + const { t } = useI18n() + + return [ + { + title: t('workflowTabs.list'), + tab: 'list', + icon: 'mdi-format-list-bulleted', + }, + { + title: t('workflowTabs.share'), + tab: 'share', + icon: 'mdi-share', + }, + ] +} diff --git a/src/styles/custom.scss b/src/styles/custom.scss index 916617e1..aad4236e 100644 --- a/src/styles/custom.scss +++ b/src/styles/custom.scss @@ -236,6 +236,10 @@ body { grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); } +.grid-workflow-share-card { + grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); +} + .v-tabs:not(.v-tabs-pill).v-tabs--horizontal { border-block-end: 1px solid rgba(var(--v-border-color), var(--v-border-opacity)); } diff --git a/src/views/workflow/WorkflowListView.vue b/src/views/workflow/WorkflowListView.vue index f96675d0..ae3cd0d2 100644 --- a/src/views/workflow/WorkflowListView.vue +++ b/src/views/workflow/WorkflowListView.vue @@ -4,7 +4,6 @@ import { Workflow } from '@/api/types' import WorkflowAddEditDialog from '@/components/dialog/WorkflowAddEditDialog.vue' import WorkflowTaskCard from '@/components/cards/WorkflowTaskCard.vue' import NoDataFound from '@/components/NoDataFound.vue' -import { useDynamicButton } from '@/composables/useDynamicButton' import { useI18n } from 'vue-i18n' import { usePWA } from '@/composables/usePWA' @@ -49,14 +48,6 @@ onMounted(() => { onActivated(() => { fetchData() }) - -// 使用动态按钮钩子 新增 -useDynamicButton({ - icon: 'mdi-plus', - onClick: () => { - addDialog.value = true - }, -}) @@ -72,21 +63,4 @@ useDynamicButton({ :error-description="t('workflow.noWorkflowDescription')" /> - - - - - - - diff --git a/src/views/workflow/WorkflowShareView.vue b/src/views/workflow/WorkflowShareView.vue new file mode 100644 index 00000000..bfe3db54 --- /dev/null +++ b/src/views/workflow/WorkflowShareView.vue @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 87e2ace5..827b758d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1068,6 +1068,11 @@ resolved "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.4.tgz" integrity sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw== +"@img/sharp-libvips-linuxmusl-x64@1.0.4": + version "1.0.4" + resolved "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.4.tgz" + integrity sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw== + "@img/sharp-linux-x64@0.33.5": version "0.33.5" resolved "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.5.tgz" @@ -1075,6 +1080,13 @@ optionalDependencies: "@img/sharp-libvips-linux-x64" "1.0.4" +"@img/sharp-linuxmusl-x64@0.33.5": + version "0.33.5" + resolved "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.5.tgz" + integrity sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw== + optionalDependencies: + "@img/sharp-libvips-linuxmusl-x64" "1.0.4" + "@intlify/bundle-utils@^10.0.1": version "10.0.1" resolved "https://registry.npmjs.org/@intlify/bundle-utils/-/bundle-utils-10.0.1.tgz" @@ -1292,6 +1304,11 @@ resolved "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.5.1.tgz" integrity sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A== +"@parcel/watcher-linux-x64-musl@2.5.1": + version "2.5.1" + resolved "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.1.tgz" + integrity sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg== + "@parcel/watcher@^2.4.1": version "2.5.1" resolved "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.1.tgz" @@ -1385,6 +1402,11 @@ resolved "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.40.1.tgz" integrity sha512-XiK5z70PEFEFqcNj3/zRSz/qX4bp4QIraTy9QjwJAb/Z8GM7kVUsD0Uk8maIPeTyPCP03ChdI+VVmJriKYbRHQ== +"@rollup/rollup-linux-x64-musl@4.40.1": + version "4.40.1" + resolved "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.40.1.tgz" + integrity sha512-2BRORitq5rQ4Da9blVovzNCMaUlyKrzMSvkVR0D4qPuOy/+pMCrh1d7o01RATwVy+6Fa1WBw+da7QPeLWU/1mQ== + "@rtsao/scc@^1.1.0": version "1.1.0" resolved "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz" @@ -1437,6 +1459,11 @@ resolved "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.12.9.tgz" integrity sha512-SFUxyhWLZRNL8QmgGNqdi2Q43PNyFVkRZ2zIif30SOGFSxnxcf2JNeSeBgKIGVgaLSuk6xFVVCtJ3KIeaStgRg== +"@swc/core-linux-x64-musl@1.12.9": + version "1.12.9" + resolved "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.12.9.tgz" + integrity sha512-9FB0wM+6idCGTI20YsBNBg9xSWtkDBymnpaTCsZM3qDc0l4uOpJMqbfWhQvp17x7r/ulZfb2QY8RDvQmCL6AcQ== + "@swc/core@^1.10.16": version "1.12.9" resolved "https://registry.npmjs.org/@swc/core/-/core-1.12.9.tgz" @@ -1692,6 +1719,11 @@ resolved "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-gnu/-/resolver-binding-linux-x64-gnu-1.7.2.tgz" integrity sha512-dEidzJDubxxhUCBJ/SHSMJD/9q7JkyfBMT77Px1npl4xpg9t0POLvnWywSk66BgZS/b2Hy9Y1yFaoMTFJUe9yg== +"@unrs/resolver-binding-linux-x64-musl@1.7.2": + version "1.7.2" + resolved "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-musl/-/resolver-binding-linux-x64-musl-1.7.2.tgz" + integrity sha512-RvP+Ux3wDjmnZDT4XWFfNBRVG0fMsc+yVzNFUqOflnDfZ9OYujv6nkh+GOr+watwrW4wdp6ASfG/e7bkDradsw== + "@vitejs/plugin-vue-jsx@^4.1.1": version "4.1.2" resolved "https://registry.npmjs.org/@vitejs/plugin-vue-jsx/-/plugin-vue-jsx-4.1.2.tgz"