1
This commit is contained in:
@@ -20,6 +20,7 @@ const scheduleDialogVisible = ref(false);
|
|||||||
const scheduleDate = ref(null);
|
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 hasVideo = computed(
|
const hasVideo = computed(
|
||||||
() => Boolean(processedVideoPath.value || generatedVideoPath.value),
|
() => Boolean(processedVideoPath.value || generatedVideoPath.value),
|
||||||
@@ -125,6 +126,13 @@ async function onAddAccount(platform) {
|
|||||||
await onLogin(platform, null);
|
await onLogin(platform, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function onTestAccount(platform, account) {
|
||||||
|
checkingAccountId.value = account.id;
|
||||||
|
const result = await workflow.checkPublishLoginStatus(platform.key, account.id, true);
|
||||||
|
checkingAccountId.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) {
|
||||||
@@ -320,6 +328,15 @@ function formatUpdateTime(account) {
|
|||||||
:loading="publishLoggingIn === activePlatform.key"
|
:loading="publishLoggingIn === activePlatform.key"
|
||||||
@click="onLoginAccount(activePlatform, account)"
|
@click="onLoginAccount(activePlatform, account)"
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
v-if="account.hasCookies"
|
||||||
|
label="测试"
|
||||||
|
size="small"
|
||||||
|
severity="secondary"
|
||||||
|
outlined
|
||||||
|
:loading="checkingAccountId === account.id"
|
||||||
|
@click="onTestAccount(activePlatform, account)"
|
||||||
|
/>
|
||||||
<Button
|
<Button
|
||||||
label="删除"
|
label="删除"
|
||||||
size="small"
|
size="small"
|
||||||
|
|||||||
@@ -90,6 +90,42 @@ export async function loginPublishPlatform(store, platformKey, accountId = undef
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {ReturnType<typeof import('../stores/workflow.js').useWorkflowStore>} store
|
||||||
|
* @param {string} platformKey
|
||||||
|
* @param {number | null} accountId
|
||||||
|
*/
|
||||||
|
export async function checkPublishLoginStatus(
|
||||||
|
store,
|
||||||
|
platformKey,
|
||||||
|
accountId = null,
|
||||||
|
checkBrowser = true,
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
const result = await invoke("publish_check_login", {
|
||||||
|
params: {
|
||||||
|
platform: platformKey,
|
||||||
|
accountId,
|
||||||
|
checkBrowser,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (!result?.success) {
|
||||||
|
return {
|
||||||
|
ok: false,
|
||||||
|
message: String(result?.error || result?.message || "登录状态检测失败"),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (result?.isLoggedIn) {
|
||||||
|
await refreshPublishAccounts(store);
|
||||||
|
return { ok: true, message: "登录状态有效" };
|
||||||
|
}
|
||||||
|
return { ok: false, 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
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
createDefaultPublishPlatforms,
|
createDefaultPublishPlatforms,
|
||||||
executePublishVideo,
|
executePublishVideo,
|
||||||
|
checkPublishLoginStatus,
|
||||||
loginPublishPlatform,
|
loginPublishPlatform,
|
||||||
refreshPublishAccounts,
|
refreshPublishAccounts,
|
||||||
} from "../services/videoPublish.js";
|
} from "../services/videoPublish.js";
|
||||||
@@ -689,6 +690,10 @@ export const useWorkflowStore = defineStore("workflow", {
|
|||||||
return loginPublishPlatform(this, platformKey, accountId);
|
return loginPublishPlatform(this, platformKey, accountId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async checkPublishLoginStatus(platformKey, accountId = null, checkBrowser = true) {
|
||||||
|
return checkPublishLoginStatus(this, platformKey, accountId, checkBrowser);
|
||||||
|
},
|
||||||
|
|
||||||
async publishVideo(options) {
|
async publishVideo(options) {
|
||||||
return executePublishVideo(this, options);
|
return executePublishVideo(this, options);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user