稳定正式版
This commit is contained in:
@@ -372,6 +372,7 @@ async function onTranslate() {
|
|||||||
try {
|
try {
|
||||||
const arr = await translate(sentences.slice(), lang)
|
const arr = await translate(sentences.slice(), lang)
|
||||||
translations[lang] = ensureLength(arr, sentences.length)
|
translations[lang] = ensureLength(arr, sentences.length)
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
loadingLangs[lang] = false // ✅ 不管成功/失败都清理 loading
|
loadingLangs[lang] = false // ✅ 不管成功/失败都清理 loading
|
||||||
}
|
}
|
||||||
@@ -466,7 +467,7 @@ function onConfirm() {
|
|||||||
const out = JSON.parse(JSON.stringify(translations))
|
const out = JSON.parse(JSON.stringify(translations))
|
||||||
// 追加 yolo 为原始内容(源句子数组)
|
// 追加 yolo 为原始内容(源句子数组)
|
||||||
out.yolo = sentences.slice()
|
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() {
|
function onClose() {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ import { getToken, setToken, setUser, setUserPass, getUserPass } from '@/stores/
|
|||||||
import { ElLoading, ElMessage } from 'element-plus';
|
import { ElLoading, ElMessage } from 'element-plus';
|
||||||
import { passToken } from '@/api/ios';
|
import { passToken } from '@/api/ios';
|
||||||
|
|
||||||
let version = ref('2.5.0');
|
let version = ref('2.7.0');
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -62,11 +62,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<img v-if="isWifi" style="position: absolute; right: 20px; top: 10px; height: 30px;" src="@/assets/wifi.png"></img>
|
<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"
|
<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" />
|
<HostListManagerDialog v-model:visible="showHostDlg" @save="onHostSaved" @invitType="invitTypeFun" />
|
||||||
|
|
||||||
<TranslationDialog v-model="showtransDlg" :type="transDlgType" :translateFn="doTranslate"
|
<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>
|
</div>
|
||||||
<!-- <AgentGuildDialog v-model="showMyInfo" :model="formInit" @save="handleSave" /> -->
|
<!-- <AgentGuildDialog v-model="showMyInfo" :model="formInit" @save="handleSave" /> -->
|
||||||
<AgentGuildDialog v-model="showMyInfo" :model="{
|
<AgentGuildDialog v-model="showMyInfo" :model="{
|
||||||
@@ -195,6 +195,9 @@ const borkerConfig = reactive({
|
|||||||
|
|
||||||
//评论 自动化
|
//评论 自动化
|
||||||
let common = ref(true);
|
let common = ref(true);
|
||||||
|
// 自动化
|
||||||
|
let auto = ref(true);
|
||||||
|
|
||||||
let initialTextStr = ref('') // 初始文本字符串
|
let initialTextStr = ref('') // 初始文本字符串
|
||||||
// 批次缓冲(仅用于当前“波”)
|
// 批次缓冲(仅用于当前“波”)
|
||||||
let batch = []; // [{ country, text }]
|
let batch = []; // [{ country, text }]
|
||||||
@@ -383,7 +386,7 @@ const buttons = [
|
|||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
label: '全部停止',
|
label: '全部停止',
|
||||||
onClick: () => stopAll(),
|
onClick: () => stopAll(100),
|
||||||
show: () => true,
|
show: () => true,
|
||||||
img: {
|
img: {
|
||||||
normal: new URL('@/assets/video/leftBtn8.png', import.meta.url).href,
|
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({
|
stopLoading = ElLoading.service({
|
||||||
lock: true,
|
lock: true,
|
||||||
text: '停止中',
|
text: '停止中',
|
||||||
background: 'rgba(0, 0, 0, 0.7)',
|
background: 'rgba(0, 0, 0, 0.7)',
|
||||||
});
|
});
|
||||||
// if (!runType.value) return
|
|
||||||
// 所有操作完成后执行以下代码
|
scheduleEnabled.value = false;
|
||||||
scheduleEnabled.value = false
|
runType.value = '';
|
||||||
runType.value = ''
|
isMsgPop.value = false;
|
||||||
isMsgPop.value = false; //弹窗状态(不是弹窗)
|
dropCurrentWave();
|
||||||
dropCurrentWave() // 丢弃当前波的残留缓冲
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
stopAllTask(deviceInformation.value.map((item) => item.deviceId)).then((res) => {
|
// 1) 等待接口完成
|
||||||
setTimeout(() => {
|
await stopAllTask(deviceInformation.value.map(item => item.deviceId));
|
||||||
stopLoading.close()
|
// 2) 等待 2 秒(和你原逻辑一致)
|
||||||
console.log(`全部停止成功`, printCurrentTime())
|
await new Promise(r => setTimeout(r, time));
|
||||||
ElMessage.success(`全部停止成功`)
|
|
||||||
}, 2000)
|
|
||||||
})
|
|
||||||
|
|
||||||
} catch (error) {
|
stopLoading.close();
|
||||||
console.log(`停止失败`, printCurrentTime())
|
console.log('全部停止成功', printCurrentTime());
|
||||||
ElMessage.error(`脚本已停止`)
|
ElMessage.success('全部停止成功');
|
||||||
stopLoading.close()
|
|
||||||
|
// 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 (runType.value == 'follow') {
|
||||||
if (hostsList.length <= 0) {
|
if (hostsList.length <= 0) {
|
||||||
await stopAll()
|
await stopAll(5000)
|
||||||
runType.value = 'like'
|
runType.value = 'like'
|
||||||
deviceInformation.value.forEach((item) => growAccount({ udid: item.deviceId }))
|
deviceInformation.value.forEach((item) => growAccount({ udid: item.deviceId }))
|
||||||
ElMessageBox.alert('私信全部完成!(刷视频中)', '提示', {
|
ElMessageBox.alert('私信全部完成!(刷视频中)', '提示', {
|
||||||
@@ -1206,7 +1210,7 @@ function runTask(key, deviceId, type) {
|
|||||||
console.log("进入follow", scheduleEnabled.value)
|
console.log("进入follow", scheduleEnabled.value)
|
||||||
if (scheduleEnabled.value) {
|
if (scheduleEnabled.value) {
|
||||||
if (!deviceId) {
|
if (!deviceId) {
|
||||||
await stopAll()
|
await stopAll(100)
|
||||||
} else {
|
} else {
|
||||||
passAnchorData(
|
passAnchorData(
|
||||||
{
|
{
|
||||||
@@ -1214,7 +1218,7 @@ function runTask(key, deviceId, type) {
|
|||||||
anchorList: [],
|
anchorList: [],
|
||||||
prologueList: getContentpriList(),
|
prologueList: getContentpriList(),
|
||||||
comment: comonList,
|
comment: comonList,
|
||||||
needReply: false
|
needReply: auto.value
|
||||||
}
|
}
|
||||||
).then((res) => {
|
).then((res) => {
|
||||||
hostList = []
|
hostList = []
|
||||||
@@ -1232,7 +1236,7 @@ function runTask(key, deviceId, type) {
|
|||||||
anchorList: [],
|
anchorList: [],
|
||||||
prologueList: getContentpriList(),
|
prologueList: getContentpriList(),
|
||||||
comment: comonList,
|
comment: comonList,
|
||||||
needReply: false
|
needReply: auto.value
|
||||||
}
|
}
|
||||||
).then((res) => {
|
).then((res) => {
|
||||||
hostList = []
|
hostList = []
|
||||||
@@ -1250,7 +1254,7 @@ function runTask(key, deviceId, type) {
|
|||||||
} else if (key === 'like') {
|
} else if (key === 'like') {
|
||||||
|
|
||||||
if (!deviceId) {
|
if (!deviceId) {
|
||||||
await stopAll()
|
await stopAll(100)
|
||||||
} else {
|
} else {
|
||||||
growAccount({ udid: deviceId })
|
growAccount({ udid: deviceId })
|
||||||
return
|
return
|
||||||
@@ -1264,7 +1268,7 @@ function runTask(key, deviceId, type) {
|
|||||||
|
|
||||||
} else if (key === 'brushLive') {
|
} else if (key === 'brushLive') {
|
||||||
if (!deviceId) {
|
if (!deviceId) {
|
||||||
await stopAll()
|
await stopAll(100)
|
||||||
} else {
|
} else {
|
||||||
watchLiveForGrowth({ udid: deviceId })
|
watchLiveForGrowth({ udid: deviceId })
|
||||||
return
|
return
|
||||||
@@ -1278,7 +1282,7 @@ function runTask(key, deviceId, type) {
|
|||||||
runType.value = 'brushLive'
|
runType.value = 'brushLive'
|
||||||
} else if (key === 'listen') {
|
} else if (key === 'listen') {
|
||||||
if (!deviceId) {
|
if (!deviceId) {
|
||||||
await stopAll()
|
await stopAll(100)
|
||||||
} else {
|
} else {
|
||||||
monitorMessages({ udid: deviceId })
|
monitorMessages({ udid: deviceId })
|
||||||
return
|
return
|
||||||
@@ -1297,7 +1301,7 @@ function runTask(key, deviceId, type) {
|
|||||||
|
|
||||||
async function stopCurrentMode() {
|
async function stopCurrentMode() {
|
||||||
// 如果你希望“只停当前片段的设备”,也可以用 stopScript 针对设备循环
|
// 如果你希望“只停当前片段的设备”,也可以用 stopScript 针对设备循环
|
||||||
await stopAll()
|
await stopAll(100)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 恢复:回到 scheduleState.index 对应片段,并让 startTime 回到“暂停前进度” */
|
/** 恢复:回到 scheduleState.index 对应片段,并让 startTime 回到“暂停前进度” */
|
||||||
@@ -1382,12 +1386,12 @@ function startScheduleLoop() {
|
|||||||
const now = Date.now()
|
const now = Date.now()
|
||||||
if (!lastInterruptTs) lastInterruptTs = 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(
|
console.log(
|
||||||
'due=', due,
|
'due=', due,
|
||||||
'elapsed=', now - lastInterruptTs,
|
'elapsed=', now - lastInterruptTs,
|
||||||
'threshold=', interruptEveryMin.value * 60_000 * 60_000
|
'threshold=', interruptEveryMin.value * 60_000 * 60
|
||||||
)
|
)
|
||||||
if (due) {
|
if (due) {
|
||||||
interrupting = true
|
interrupting = true
|
||||||
@@ -1398,7 +1402,7 @@ function startScheduleLoop() {
|
|||||||
pauseSnapshot = { index: scheduleState.index, elapsedBeforePause }
|
pauseSnapshot = { index: scheduleState.index, elapsedBeforePause }
|
||||||
|
|
||||||
// 停掉当前片段
|
// 停掉当前片段
|
||||||
await stopAll()
|
await stopAll(100)
|
||||||
|
|
||||||
|
|
||||||
// 执行中断任务(带重试)
|
// 执行中断任务(带重试)
|
||||||
@@ -1621,8 +1625,9 @@ async function doTranslate(sentences, targetLang) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 接收“确定”事件返回结果
|
// 接收“确定”事件返回结果
|
||||||
function onConfirm({ type, strings, auto }) {
|
function onConfirm({ type, strings, autoBlo }) {
|
||||||
console.log('✅ 确认返回:', type, strings, auto)
|
console.log('✅ 确认返回:', type, strings, autoBlo)
|
||||||
|
auto.value = autoBlo
|
||||||
showtransDlg.value = false
|
showtransDlg.value = false
|
||||||
runType.value = 'follow'
|
runType.value = 'follow'
|
||||||
setContentpriList(strings)
|
setContentpriList(strings)
|
||||||
@@ -1638,7 +1643,7 @@ function onConfirm({ type, strings, auto }) {
|
|||||||
state: stateByInvType(item.invitationType),
|
state: stateByInvType(item.invitationType),
|
||||||
})),
|
})),
|
||||||
prologueList: strings,
|
prologueList: strings,
|
||||||
needReply: data.auto,
|
needReply: autoBlo,
|
||||||
// needTranslate: data.needTranslate,
|
// needTranslate: data.needTranslate,
|
||||||
}
|
}
|
||||||
).then((res) => {
|
).then((res) => {
|
||||||
@@ -1658,7 +1663,7 @@ function onConfirm({ type, strings, auto }) {
|
|||||||
})),
|
})),
|
||||||
prologueList: strings, //私信对象
|
prologueList: strings, //私信对象
|
||||||
comment: comonList, //评论列表
|
comment: comonList, //评论列表
|
||||||
needReply: auto, //自动回复
|
needReply: autoBlo, //自动回复
|
||||||
// needTranslate: data.needTranslate,
|
// needTranslate: data.needTranslate,
|
||||||
isComment: common.value //是否评论
|
isComment: common.value //是否评论
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user