11
This commit is contained in:
@@ -118,7 +118,7 @@ pub async fn publish_login(
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
if result.get("success").and_then(|v| v.as_bool()) == Some(true) {
|
if result.get("success").and_then(|v| v.as_bool()) == Some(true) {
|
||||||
let nickname = result
|
let nickname: String = result
|
||||||
.get("nickname")
|
.get("nickname")
|
||||||
.and_then(|v| v.as_str())
|
.and_then(|v| v.as_str())
|
||||||
.unwrap_or("")
|
.unwrap_or("")
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ const scheduleDate = ref(null);
|
|||||||
const accountDialogVisible = ref(false);
|
const accountDialogVisible = ref(false);
|
||||||
const activePlatformKey = ref("douyin");
|
const activePlatformKey = ref("douyin");
|
||||||
const checkingAccountId = ref(null);
|
const checkingAccountId = ref(null);
|
||||||
|
const openingAccountId = ref(null);
|
||||||
|
|
||||||
const hasVideo = computed(
|
const hasVideo = computed(
|
||||||
() => Boolean(processedVideoPath.value || generatedVideoPath.value),
|
() => Boolean(processedVideoPath.value || generatedVideoPath.value),
|
||||||
@@ -133,6 +134,13 @@ async function onTestAccount(platform, account) {
|
|||||||
showFeedback(result);
|
showFeedback(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function onOpenAccount(platform, account) {
|
||||||
|
openingAccountId.value = account.id;
|
||||||
|
const result = await workflow.openPublishAccount(platform.key, account.id);
|
||||||
|
openingAccountId.value = null;
|
||||||
|
showFeedback(result);
|
||||||
|
}
|
||||||
|
|
||||||
function onDeleteAccount(platform, account) {
|
function onDeleteAccount(platform, account) {
|
||||||
platform.accounts = (platform.accounts || []).filter((a) => a.id !== account.id);
|
platform.accounts = (platform.accounts || []).filter((a) => a.id !== account.id);
|
||||||
if (platform.accountId === account.id) {
|
if (platform.accountId === account.id) {
|
||||||
@@ -337,6 +345,14 @@ function formatUpdateTime(account) {
|
|||||||
:loading="checkingAccountId === account.id"
|
:loading="checkingAccountId === account.id"
|
||||||
@click="onTestAccount(activePlatform, account)"
|
@click="onTestAccount(activePlatform, account)"
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
label="打开"
|
||||||
|
size="small"
|
||||||
|
severity="secondary"
|
||||||
|
outlined
|
||||||
|
:loading="openingAccountId === account.id"
|
||||||
|
@click="onOpenAccount(activePlatform, account)"
|
||||||
|
/>
|
||||||
<Button
|
<Button
|
||||||
label="删除"
|
label="删除"
|
||||||
size="small"
|
size="small"
|
||||||
|
|||||||
@@ -126,6 +126,40 @@ export async function checkPublishLoginStatus(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {ReturnType<typeof import('../stores/workflow.js').useWorkflowStore>} store
|
||||||
|
* @param {string} platformKey
|
||||||
|
* @param {number | null} accountId
|
||||||
|
*/
|
||||||
|
export async function openPublishAccount(store, platformKey, accountId = null) {
|
||||||
|
try {
|
||||||
|
if (accountId != null) {
|
||||||
|
const check = await invoke("publish_check_login", {
|
||||||
|
params: {
|
||||||
|
platform: platformKey,
|
||||||
|
accountId,
|
||||||
|
checkBrowser: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (!check?.isLoggedIn) {
|
||||||
|
return { ok: false, message: "该账号未登录,请先扫码登录" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await invoke("run_nodejs_script", {
|
||||||
|
scriptName: "publish_open.js",
|
||||||
|
params: {
|
||||||
|
platform: platformKey,
|
||||||
|
accountId,
|
||||||
|
cookies: [],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return { ok: true, message: "已打开平台页面" };
|
||||||
|
} catch (err) {
|
||||||
|
const msg = err instanceof Error ? err.message : String(err);
|
||||||
|
return { ok: false, message: `打开失败:${msg}` };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ReturnType<typeof import('../stores/workflow.js').useWorkflowStore>} store
|
* @param {ReturnType<typeof import('../stores/workflow.js').useWorkflowStore>} store
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import {
|
|||||||
createDefaultPublishPlatforms,
|
createDefaultPublishPlatforms,
|
||||||
executePublishVideo,
|
executePublishVideo,
|
||||||
checkPublishLoginStatus,
|
checkPublishLoginStatus,
|
||||||
|
openPublishAccount,
|
||||||
loginPublishPlatform,
|
loginPublishPlatform,
|
||||||
refreshPublishAccounts,
|
refreshPublishAccounts,
|
||||||
} from "../services/videoPublish.js";
|
} from "../services/videoPublish.js";
|
||||||
@@ -694,6 +695,10 @@ export const useWorkflowStore = defineStore("workflow", {
|
|||||||
return checkPublishLoginStatus(this, platformKey, accountId, checkBrowser);
|
return checkPublishLoginStatus(this, platformKey, accountId, checkBrowser);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async openPublishAccount(platformKey, accountId = null) {
|
||||||
|
return openPublishAccount(this, platformKey, accountId);
|
||||||
|
},
|
||||||
|
|
||||||
async publishVideo(options) {
|
async publishVideo(options) {
|
||||||
return executePublishVideo(this, options);
|
return executePublishVideo(this, options);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user