稳定正式版

This commit is contained in:
2025-10-29 19:45:51 +08:00
parent ddd295565b
commit d0ace399f1
3 changed files with 46 additions and 40 deletions

View File

@@ -372,6 +372,7 @@ async function onTranslate() {
try {
const arr = await translate(sentences.slice(), lang)
translations[lang] = ensureLength(arr, sentences.length)
} finally {
loadingLangs[lang] = false // ✅ 不管成功/失败都清理 loading
}
@@ -466,7 +467,7 @@ function onConfirm() {
const out = JSON.parse(JSON.stringify(translations))
// 追加 yolo 为原始内容(源句子数组)
out.yolo = sentences.slice()
emit('confirm', { type: props.type, strings: out, auto: auto.value })
emit('confirm', { type: props.type, strings: out, autoBlo: auto.value })
}
function onClose() {

View File

@@ -79,7 +79,7 @@ import { getToken, setToken, setUser, setUserPass, getUserPass } from '@/stores/
import { ElLoading, ElMessage } from 'element-plus';
import { passToken } from '@/api/ios';
let version = ref('2.5.0');
let version = ref('2.7.0');
onMounted(() => {

View File

@@ -62,11 +62,11 @@
</div>
<img v-if="isWifi" style="position: absolute; right: 20px; top: 10px; height: 30px;" src="@/assets/wifi.png"></img>
<MultiLineInputDialog v-model:visible="showDialog" :initialText='initialTextStr' :title="dialogTitle"
:index="selectedDevice" @confirm="onDialogConfirm" @cancel="stopAll" />
:index="selectedDevice" @confirm="onDialogConfirm" @cancel="stopAll(100)" />
<HostListManagerDialog v-model:visible="showHostDlg" @save="onHostSaved" @invitType="invitTypeFun" />
<TranslationDialog v-model="showtransDlg" :type="transDlgType" :translateFn="doTranslate"
storage-key-prefix="demo-translation" @confirm="onConfirm" @cancel="stopAll" />
storage-key-prefix="demo-translation" @confirm="onConfirm" @cancel="stopAll(100)" />
</div>
<!-- <AgentGuildDialog v-model="showMyInfo" :model="formInit" @save="handleSave" /> -->
<AgentGuildDialog v-model="showMyInfo" :model="{
@@ -195,6 +195,9 @@ const borkerConfig = reactive({
//评论 自动化
let common = ref(true);
// 自动化
let auto = ref(true);
let initialTextStr = ref('') // 初始文本字符串
// 批次缓冲(仅用于当前“波”)
let batch = []; // [{ country, text }]
@@ -383,7 +386,7 @@ const buttons = [
// },
{
label: '全部停止',
onClick: () => stopAll(),
onClick: () => stopAll(100),
show: () => true,
img: {
normal: new URL('@/assets/video/leftBtn8.png', import.meta.url).href,
@@ -864,35 +867,36 @@ function getMesList(deviceId) {
})
}
async function stopAll() {
async function stopAll(time) {
stopLoading = ElLoading.service({
lock: true,
text: '停止中',
background: 'rgba(0, 0, 0, 0.7)',
});
// if (!runType.value) return
// 所有操作完成后执行以下代码
scheduleEnabled.value = false
runType.value = ''
isMsgPop.value = false; //弹窗状态(不是弹窗)
dropCurrentWave() // 丢弃当前波的残留缓冲
scheduleEnabled.value = false;
runType.value = '';
isMsgPop.value = false;
dropCurrentWave();
try {
stopAllTask(deviceInformation.value.map((item) => item.deviceId)).then((res) => {
setTimeout(() => {
stopLoading.close()
console.log(`全部停止成功`, printCurrentTime())
ElMessage.success(`全部停止成功`)
}, 2000)
})
// 1) 等待接口完成
await stopAllTask(deviceInformation.value.map(item => item.deviceId));
// 2) 等待 2 秒(和你原逻辑一致)
await new Promise(r => setTimeout(r, time));
} catch (error) {
console.log(`停止失败`, printCurrentTime())
ElMessage.error(`脚本已停止`)
stopLoading.close()
stopLoading.close();
console.log('全部停止成功', printCurrentTime());
ElMessage.success('全部停止成功');
// 3) 明确返回(可选)
return true;
} catch (e) {
console.log('停止失败', printCurrentTime(), e);
ElMessage.error('脚本已停止');
stopLoading.close();
return false;
}
}
//确认多行文本框内容
@@ -1022,7 +1026,7 @@ onMounted(async () => {
//当私信主播时,主播列表没有数据了,提示列表空了 并且关闭私信
if (runType.value == 'follow') {
if (hostsList.length <= 0) {
await stopAll()
await stopAll(5000)
runType.value = 'like'
deviceInformation.value.forEach((item) => growAccount({ udid: item.deviceId }))
ElMessageBox.alert('私信全部完成!(刷视频中)', '提示', {
@@ -1206,7 +1210,7 @@ function runTask(key, deviceId, type) {
console.log("进入follow", scheduleEnabled.value)
if (scheduleEnabled.value) {
if (!deviceId) {
await stopAll()
await stopAll(100)
} else {
passAnchorData(
{
@@ -1214,7 +1218,7 @@ function runTask(key, deviceId, type) {
anchorList: [],
prologueList: getContentpriList(),
comment: comonList,
needReply: false
needReply: auto.value
}
).then((res) => {
hostList = []
@@ -1232,7 +1236,7 @@ function runTask(key, deviceId, type) {
anchorList: [],
prologueList: getContentpriList(),
comment: comonList,
needReply: false
needReply: auto.value
}
).then((res) => {
hostList = []
@@ -1250,7 +1254,7 @@ function runTask(key, deviceId, type) {
} else if (key === 'like') {
if (!deviceId) {
await stopAll()
await stopAll(100)
} else {
growAccount({ udid: deviceId })
return
@@ -1264,7 +1268,7 @@ function runTask(key, deviceId, type) {
} else if (key === 'brushLive') {
if (!deviceId) {
await stopAll()
await stopAll(100)
} else {
watchLiveForGrowth({ udid: deviceId })
return
@@ -1278,7 +1282,7 @@ function runTask(key, deviceId, type) {
runType.value = 'brushLive'
} else if (key === 'listen') {
if (!deviceId) {
await stopAll()
await stopAll(100)
} else {
monitorMessages({ udid: deviceId })
return
@@ -1297,7 +1301,7 @@ function runTask(key, deviceId, type) {
async function stopCurrentMode() {
// 如果你希望“只停当前片段的设备”,也可以用 stopScript 针对设备循环
await stopAll()
await stopAll(100)
}
/** 恢复:回到 scheduleState.index 对应片段,并让 startTime 回到“暂停前进度” */
@@ -1382,12 +1386,12 @@ function startScheduleLoop() {
const now = Date.now()
if (!lastInterruptTs) lastInterruptTs = now // 首次初始化
const due = now - lastInterruptTs >= interruptEveryMin.value * 60_000 * 60_000
const due = now - lastInterruptTs >= interruptEveryMin.value * 60_000 * 60
console.log(
'due=', due,
'elapsed=', now - lastInterruptTs,
'threshold=', interruptEveryMin.value * 60_000 * 60_000
'threshold=', interruptEveryMin.value * 60_000 * 60
)
if (due) {
interrupting = true
@@ -1398,7 +1402,7 @@ function startScheduleLoop() {
pauseSnapshot = { index: scheduleState.index, elapsedBeforePause }
// 停掉当前片段
await stopAll()
await stopAll(100)
// 执行中断任务(带重试)
@@ -1621,8 +1625,9 @@ async function doTranslate(sentences, targetLang) {
}
// 接收“确定”事件返回结果
function onConfirm({ type, strings, auto }) {
console.log('✅ 确认返回:', type, strings, auto)
function onConfirm({ type, strings, autoBlo }) {
console.log('✅ 确认返回:', type, strings, autoBlo)
auto.value = autoBlo
showtransDlg.value = false
runType.value = 'follow'
setContentpriList(strings)
@@ -1638,7 +1643,7 @@ function onConfirm({ type, strings, auto }) {
state: stateByInvType(item.invitationType),
})),
prologueList: strings,
needReply: data.auto,
needReply: autoBlo,
// needTranslate: data.needTranslate,
}
).then((res) => {
@@ -1658,7 +1663,7 @@ function onConfirm({ type, strings, auto }) {
})),
prologueList: strings, //私信对象
comment: comonList, //评论列表
needReply: auto, //自动回复
needReply: autoBlo, //自动回复
// needTranslate: data.needTranslate,
isComment: common.value //是否评论
}