2.0版本
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
<el-button @click="clickPrivatetext(device.udid, index)">私信输入</el-button>
|
||||
<el-button @click="clickPrivatePush(device.udid, index)">私信发送</el-button> -->
|
||||
<el-button type="warning" @click="reload()">刷新</el-button>
|
||||
<el-button type="warning" @click="opentanchuan()">123</el-button>
|
||||
<div></div>
|
||||
<!-- <el-button @click="wsActions.clickCopy(device.udid, index)">找私信</el-button> -->
|
||||
<!-- <el-button @click="wsActions.clickCopyList(device.udid, index)">私信列表</el-button> -->
|
||||
@@ -33,7 +34,10 @@
|
||||
<!-- <el-button @click="wsActions.slideRight(device.udid, index)">右滑</el-button> -->
|
||||
<!-- <el-button @click="wsActions.isHost(device.udid, index)">一键养号</el-button> -->
|
||||
<el-button type="success" @click="openTk()">打开tiktok</el-button>
|
||||
<el-button type="success" @click="showDialog = true; dialogTitle = '评论'; selectedDevice = 999">一键养号</el-button>
|
||||
<el-button type="success" @click="resetTk()">重置tiktok</el-button>
|
||||
|
||||
<el-button :type="runType[0] == 'like' ? 'danger' : 'success'" @click="parentNum()">{{ runType[0] == 'like' ?
|
||||
'养号中' : '一键养号' }}</el-button>
|
||||
<el-button type="success"
|
||||
@click="showDialog = true; dialogTitle = '主播ID'; selectedDevice = 999">一键关注并打招呼</el-button>
|
||||
<el-button type="success" v-if="!isShowMes" @click="openMonitor()">开启监测消息</el-button>
|
||||
@@ -44,8 +48,8 @@
|
||||
<div></div>
|
||||
<!-- <el-button @click="wsActions.test(device.udid, index)">截屏</el-button> -->
|
||||
<div></div>
|
||||
<!-- <el-button @click="wsActions.search(device.udid, index)">搜索</el-button>
|
||||
<div></div>
|
||||
|
||||
<!-- <div></div>
|
||||
<el-button @click="wsActions.searchHost(device.udid, index)">搜主播</el-button>
|
||||
<div></div>
|
||||
<el-button @click="wsActions.toHost(device.udid, index)">主页</el-button>
|
||||
@@ -93,7 +97,7 @@
|
||||
</div>
|
||||
<div class="input-info" v-show="selectedDevice == index" :style="{ left: phone.width * 1.4 + 4 + '0px' }">
|
||||
<!-- <div class="input-info" v-show="false"> -->
|
||||
<el-button @click="showDialog = true; dialogTitle = '主播ID';">批量关注</el-button>
|
||||
<!-- <el-button @click="showDialog = true; dialogTitle = '主播ID';">批量关注</el-button> -->
|
||||
<div></div>
|
||||
<!-- <el-button @click="showDialog = true; dialogTitle = '评论';">导入评论</el-button> -->
|
||||
<div></div>
|
||||
@@ -102,8 +106,11 @@
|
||||
<!-- <el-button @click="showDialog = true; dialogTitle = '私信';">导入私信</el-button> -->
|
||||
<div></div>
|
||||
<el-button @click="getComArr(index, '私信')">查看私信</el-button>
|
||||
<el-button @click="wsActions.getmesNum(device.udid, index)">检测消息</el-button>
|
||||
<!-- <el-button @click="wsActions.search(device.udid, index)">搜索</el-button> -->
|
||||
<!-- <el-button @click="wsActions.getmesNum(device.udid, index)">检测消息</el-button> -->
|
||||
<!-- <el-button @click="wsActions.clickMesage(device.udid, index)">进入消息</el-button> -->
|
||||
<el-button @click="wsActions.clickSysMesage(device.udid, index)">进入消息</el-button>
|
||||
<el-button @click="resetApp(device.udid, index)">重置应用</el-button>
|
||||
<el-button
|
||||
@click="wsActions.clickCopyList(device.udid, index); openShowChat = true; istranslate = true">翻译本页对话</el-button>
|
||||
<!-- <el-button @click="wsActions.getSize(device.udid, index)">获取屏幕尺寸</el-button> -->
|
||||
@@ -111,8 +118,9 @@
|
||||
<el-input style="border: 1px solid #000;" v-model="textContent[index]" type="text"></el-input>
|
||||
<el-button @click="setComText(index)">发送</el-button>
|
||||
</div>
|
||||
<el-button @click="wsActions.test(device.udid, index)">截屏</el-button>
|
||||
<el-button @click="wsActions.killNow(device.udid, index)">关闭</el-button>
|
||||
<el-button @click="wsActions.test(device.udid, index)">打印ui节点树</el-button>
|
||||
<el-button @click="wsActions.test2(device.udid, index)">等待</el-button>
|
||||
<el-button @click="wsActions.killNow(device.udid, index)">关闭当前应用</el-button>
|
||||
<el-button @click="chooseFile(device.udid, index, 1, wsActions)">安装 APK 文件</el-button>
|
||||
<el-button @click="chooseFile(device.udid, index, 2, wsActions)">传送文件</el-button>
|
||||
<!-- <el-button @click="wsActions.isHost(device.udid, index)">一键养号</el-button> -->
|
||||
@@ -137,23 +145,26 @@
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted, onBeforeUnmount, watch, inject } from "vue";
|
||||
import VideoConverter from "h264-converter";
|
||||
import { Buffer } from 'buffer'; // 如果在浏览器环境需要引入buffer包
|
||||
import { useRouter } from 'vue-router';
|
||||
import { setphoneXYinfo, getphoneXYinfo } from '@/utils/storage'
|
||||
import { set } from "lodash";
|
||||
import { setphoneXYinfo, getphoneXYinfo, getUser, getHostList, setHostList, getContentpriList, setContentpriList, getContentList, setContentList } from '@/utils/storage'
|
||||
import { toBufferBtn, stringToUtf8ByteArray, getClipboard, setClipboard, bufferToString, startsWithHeader, trimLongArray, base64ToBinary, toBuffer } from '@/utils/bufferUtils';
|
||||
import { createWsActions } from '@/utils/wsActions';
|
||||
import { ElMessage, ElMessageBox, ElLoading } from 'element-plus'
|
||||
import { chat, translation } from "@/api/chat";
|
||||
import { chat, translationToChinese, translation } from "@/api/chat";
|
||||
import { update } from '@/api/account';
|
||||
import MultiLineInputDialog from '@/components/MultiLineInputDialog.vue'; // 根据实际路径修改
|
||||
import ChatDialog from '@/components/ChatDialog.vue'
|
||||
import { splitArray } from '@/utils/arrUtil'
|
||||
import { chooseFile } from '@/utils/fileUtil'
|
||||
import { connectSSE } from '@/utils/sseUtils'
|
||||
import { set } from "lodash";
|
||||
import { prologue, comment } from '@/api/account';
|
||||
|
||||
const router = useRouter();
|
||||
let wsActions = null;
|
||||
let userdata = getUser();
|
||||
// 引入刷新方法
|
||||
const reload = inject("reload")
|
||||
let refresh = ref(true);
|
||||
let phone = ref({ width: 207, height: 470 });
|
||||
const openStr = base64ToBinary("ZQBwAAAAAAA8CgLQAtAAAAAAAAAAAAD/AAAAAAAAAAAAAAAA"); //开启视频流的启动命令
|
||||
const eitwo = base64ToBinary("BAIAAABHVFJD"); //开启设备信息的命令
|
||||
@@ -168,19 +179,23 @@ let dialogTitle = ref('');
|
||||
let textContent = ref(['', '', '', '', '', '', '', '']);
|
||||
let textContentArr = ref([[], [], [], [], [], [], [], [], []]);
|
||||
//主播id内容
|
||||
let hostIdContent = ref(['', '', '', '', '', '', '', '']);
|
||||
let hostIdContentArr = ref([[], [], [], [], [], [], [], [], []]);
|
||||
let hostIdArr = ref([{}, {}, {}, {}, {}, {}, {}, {}]);
|
||||
// let hostIdContentArr = ref([[], [], [], [], [], [], [], [], []]);
|
||||
//私信文本内容
|
||||
let textContentpri = ref(['', '', '', '', '', '', '', '']);
|
||||
let textContentpriArr = ref([[], [], [], [], [], [], [], [], []]);
|
||||
//保存聊天内容
|
||||
let chatList = ref([]);
|
||||
//保存爬虫发送的主播信息 待存缓存
|
||||
let stroageHost = ref([]);
|
||||
//选中设备
|
||||
let selectedDevice = ref(999);
|
||||
//ws列表
|
||||
let wslist = [];
|
||||
// 是否停止点赞
|
||||
let isStopLike = ref([false, false, false, false, false, false, false, false]);
|
||||
// 是否停止
|
||||
let isStop = ref(false);
|
||||
//sse弹窗是否存在
|
||||
let isMsgPop = ref(false);
|
||||
//播放器列表
|
||||
let instanceList = ref([{}, {}, {}, {}, {}, {}, {}, {}]);
|
||||
//是否是在关注主播
|
||||
@@ -245,14 +260,14 @@ const initVideoStream = (udid, index) => {
|
||||
|
||||
wslist[index].onopen = () => {
|
||||
console.log("手机显示ws已开启");
|
||||
wsActions = createWsActions(wslist, isStopLike);
|
||||
wsActions = createWsActions(wslist);
|
||||
// 发送 开启 视频流数据
|
||||
setTimeout(() => {
|
||||
wslist[index].send(openStr);
|
||||
}, 300);
|
||||
playTimer.value[index] = setTimeout(() => {
|
||||
instanceList.value[index].converter.play();
|
||||
}, 3000);
|
||||
// playTimer.value[index] = setTimeout(() => {
|
||||
// instanceList.value[index].converter.play();
|
||||
// }, 3000);
|
||||
//``````````````````````````````````````````````````````````````````````````````````
|
||||
wsCache.set(udid, instanceList.value[index]);
|
||||
//``````````````````````````````````````````````````````````````````````````````````
|
||||
@@ -263,7 +278,7 @@ const initVideoStream = (udid, index) => {
|
||||
const data = new Uint8Array(event.data);
|
||||
//判断返回的如果是字符串为自定义返回
|
||||
if (typeof event.data == 'string') {
|
||||
if (isStopLike.value[index]) {
|
||||
if (isStop.value) {
|
||||
createTaskQueue(index).clear();//清除队伍中的任务
|
||||
return;
|
||||
}
|
||||
@@ -281,6 +296,11 @@ const initVideoStream = (udid, index) => {
|
||||
} else if (resData.type == 'getmesNum') {
|
||||
if (resData.message == 0) {
|
||||
console.log('没有消息')
|
||||
if (runType.value[index] == 'follow') {
|
||||
LikesToLikesToLikes(deviceInformation.value[index].udid, index)
|
||||
|
||||
}
|
||||
//如果检测到有新消息,会收到两条ws回复,一条message==1 一条message==成功
|
||||
} else if (resData.message == 1) {
|
||||
console.log('有消息')
|
||||
} else if (resData.message == '点击成功') {
|
||||
@@ -290,11 +310,16 @@ const initVideoStream = (udid, index) => {
|
||||
setTimeout(() => {
|
||||
clickxy(resData.x * iponeCoefficient.value[index].width, resData.y * iponeCoefficient.value[index].height, index) //index为9的时候长按
|
||||
}, 100)
|
||||
wsActions.clickMesage(deviceInformation.value[index].udid, index) //点击消息进入对话框
|
||||
wsActions.clickSysMesage(deviceInformation.value[index].udid, index) //点击消息进入对话框
|
||||
}, 1500)
|
||||
}
|
||||
} else if (resData.type == 'clickMesage') {
|
||||
//点击进入新消息页面以后,获取页面信息
|
||||
wsActions.clickCopyList(deviceInformation.value[index].udid, index)
|
||||
} else if (resData.type == 'clickSysMesage') {
|
||||
setTimeout(() => {
|
||||
Back('', index)
|
||||
}, 3000)
|
||||
} else if (resData.type == 'isVideoAndLive') {
|
||||
console.log(resData.message)
|
||||
} else if (resData.type == 'clickCopyList') { //获取到的消息列表
|
||||
@@ -307,10 +332,12 @@ const initVideoStream = (udid, index) => {
|
||||
console.log('最新消息', mesBox)
|
||||
console.log("翻译", istranslate.value)
|
||||
if (istranslate.value == false) {
|
||||
if (mesBox.position == 'right') return
|
||||
openShowChat.value = true
|
||||
console.log("执行ai")
|
||||
chat({ msg: mesBox.text }).then(res => {
|
||||
console.log("ai返回", res)
|
||||
textContentpri.value[index] = res
|
||||
textContentpri.value[index] = res.result
|
||||
PrivatetexToPrivatePush(deviceInformation.value[index].udid, index)
|
||||
})
|
||||
} else {
|
||||
@@ -334,6 +361,9 @@ const initVideoStream = (udid, index) => {
|
||||
}
|
||||
} else if (resData.type == 'Comment') {//打开评论
|
||||
phoneXYinfo.value[index].Comment = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
||||
} else if (resData.type == 'CommentText') {//复制评论
|
||||
phoneXYinfo.value[index].CommentText = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
||||
textContent.value[index] = resData.message
|
||||
} else if (resData.type == 'Comtext') {//评论输入
|
||||
phoneXYinfo.value[index].Comtext = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
||||
// setTimeout(() => {
|
||||
@@ -376,25 +406,42 @@ const initVideoStream = (udid, index) => {
|
||||
}, 1000);
|
||||
} else if (resData.type == 'Privatetex') {//私信评论
|
||||
phoneXYinfo.value[index].Privatetex = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
||||
} else if (resData.type == 'PrivatePush') {//私信发送
|
||||
} else if (resData.type == 'PrivatePush' || resData.type == 'PrivatePushFollow') {//私信发送
|
||||
phoneXYinfo.value[index].PrivatePush = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
||||
//如果是在关注主播的任务中
|
||||
if (runType.value[index] == 'follow') {
|
||||
runType.value[index] = ''
|
||||
}
|
||||
setTimeout(() => {
|
||||
Back('', index);
|
||||
setTimeout(() => {
|
||||
Back('', index);
|
||||
if (runType.value[index] == 'listen') {
|
||||
} else if (runType.value[index] == 'like' || runType.value[index] == 'follow') {
|
||||
LikesToLikesToLikes(deviceInformation.value[index].udid, index, 2)
|
||||
}
|
||||
setTimeout(() => {
|
||||
Back('', index);
|
||||
setTimeout(() => {
|
||||
if (resData.type == 'PrivatePush') {
|
||||
Back('', index);
|
||||
setTimeout(() => {
|
||||
Back('', index);
|
||||
setTimeout(() => {
|
||||
Back('', index);
|
||||
//正常没有消息,发送完私信以后,返回六次,然后继续下一个任务
|
||||
wsActions.getmesNum(deviceInformation.value[index].udid, index)
|
||||
// LikesToLikesToLikes(deviceInformation.value[index].udid, index)
|
||||
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
} else if (resData.type == 'PrivatePushFollow') {
|
||||
//如果有新消息,回复完私信以后,返回三次,然后继续下一个任务
|
||||
wsActions.getmesNum(deviceInformation.value[index].udid, index)
|
||||
// LikesToLikesToLikes(deviceInformation.value[index].udid, index)
|
||||
|
||||
}
|
||||
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
|
||||
} else if (resData.type == 'clickCopy') {//点击复制
|
||||
phoneXYinfo.value[index].clickCopy = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
||||
} else if (resData.type == 'hostVideo') {//点击复制
|
||||
} else if (resData.type == 'hostVideo') {//观看主播视频
|
||||
phoneXYinfo.value[index].hostVideo = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
||||
} else if (resData.type == 'isHost') {//视频关注主播
|
||||
phoneXYinfo.value[index].isHost = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
||||
@@ -408,18 +455,17 @@ const initVideoStream = (udid, index) => {
|
||||
} else if (resData.message == 1) {
|
||||
console.log('有关注', index)
|
||||
const randomNum = Math.random(); // 生成一个0到1之间的随机数
|
||||
if (randomNum < 0.5) {
|
||||
if (randomNum < 0.6) {
|
||||
console.log('进行点赞评论', index)
|
||||
LikesToCommentToComPush(deviceInformation.value[index].udid, index)
|
||||
} else {
|
||||
console.log('下一个', index)
|
||||
wsActions.slideDown(deviceInformation.value[index].udid, index)//是否继续下一个视频
|
||||
setTimeout(() => {
|
||||
console.log('观看视频中', index)
|
||||
randomSeeVideo(deviceInformation.value[index].udid, index) //30-50秒后继续循环任务
|
||||
}, 1000);
|
||||
randomSeeVideo(deviceInformation.value[index].udid, index) //30-50秒后继续循环任务
|
||||
}
|
||||
}
|
||||
} else if (resData.type == 'openDY') {//视频关注主播
|
||||
createTaskQueue(index).clear();//清除队伍中的任务
|
||||
}
|
||||
setphoneXYinfo(phoneXYinfo.value)
|
||||
if (resData.type != 'isHost') {
|
||||
@@ -427,56 +473,68 @@ const initVideoStream = (udid, index) => {
|
||||
setTimeout(() => {
|
||||
createTaskQueue(index).next(); // 继续队列中下一个任务
|
||||
}, 5000)
|
||||
} else if (resData.type == 'getmesNum') {
|
||||
|
||||
} else {
|
||||
createTaskQueue(index).next(); // 继续队列中下一个任务
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// --------------------------------------------------------------------------报错处理
|
||||
// console.error(resData.type, resData)
|
||||
// ----------------------------------------------------------------------------------------------------报错处理
|
||||
//如果该视频无法被评论,返回刷下一条视频
|
||||
if (resData.type == 'Comtext') {
|
||||
if (resData.type == 'Comtext' || resData.type == 'CommentText') {
|
||||
if (runType.value[index] == 'follow') {
|
||||
createTaskQueue(index).clear();//清除队伍中的任务
|
||||
|
||||
Back('', index)
|
||||
setTimeout(() => {
|
||||
Back('', index)
|
||||
setTimeout(() => {
|
||||
Back('', index)
|
||||
LikesToLikesToLikes(deviceInformation.value[index].udid, index, 2)
|
||||
}, 1000)
|
||||
createTaskQueue(index).next(); // 继续队列中下一个任务
|
||||
createTaskQueue(index).next(); // 继续队列中下一个任务
|
||||
}, 1000)
|
||||
} else {
|
||||
createTaskQueue(index).clear();//清除队伍中的任务
|
||||
Back('', index)
|
||||
resetApp(udid, index)
|
||||
setTimeout(() => {
|
||||
Back('', index)
|
||||
setTimeout(() => {
|
||||
wsActions.isHost(deviceInformation.value[index].udid, index)
|
||||
}, 1000)
|
||||
wsActions.isHost(deviceInformation.value[index].udid, index)
|
||||
}, 1000)
|
||||
}
|
||||
//如果该视频无法被私信,返回刷下一条视频
|
||||
} else if (resData.type == 'Privatetex') {
|
||||
createTaskQueue(index).clear();//清除队伍中的任务
|
||||
//如果该视频无法被搜索到,返回刷下一条视频
|
||||
} else if (resData.type == 'toHost') {
|
||||
Back('', index)
|
||||
setTimeout(() => {
|
||||
Back('', index)
|
||||
LikesToLikesToLikes(deviceInformation.value[index].udid, index, 2)
|
||||
createTaskQueue(index).clear();//清除队伍中的任务
|
||||
setTimeout(() => {
|
||||
Back('', index)
|
||||
LikesToLikesToLikes(deviceInformation.value[index].udid, index)
|
||||
}, 1000)
|
||||
}, 1000)
|
||||
} else if (resData.type == 'hostVideo') {
|
||||
createTaskQueue(index).clear();//清除队伍中的任务
|
||||
Back('', index)
|
||||
setTimeout(() => {
|
||||
LikesToLikesToLikes(deviceInformation.value[index].udid, index, 2)
|
||||
}, 1000)
|
||||
} else if (resData.type == 'getmesNum' || resData.type == 'clickMesage') {
|
||||
} else if (resData.type == 'Privatetex' || resData.type == 'hostVideo' || resData.type == 'search') {
|
||||
if (runType.value[index] == 'follow') {
|
||||
//关注的时候出现无法私信和没有视频的情况 错误重置
|
||||
resetApp(udid, index)
|
||||
setTimeout(() => {
|
||||
wsActions.getmesNum(deviceInformation.value[index].udid, index)
|
||||
// LikesToLikesToLikes(deviceInformation.value[index].udid, index)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
} else if (resData.type == 'getmesNum') {
|
||||
if (runType.value[index] == 'follow') {
|
||||
LikesToLikesToLikes(deviceInformation.value[index].udid, index)
|
||||
}
|
||||
//getmesNum出现没有消息的情况
|
||||
} else if (resData.type == 'clickMesage' || resData.type == 'ComPush') {
|
||||
//ComPush关注主播的时候出现无法评论的视频 会跳过评论发送,不处理评论发送的返回错误
|
||||
} else if (resData.type == 'clickCopyList') {
|
||||
//如果无法获取到聊天记录,返回继续检测
|
||||
console.error('未找到聊天,返回')
|
||||
Back('', index)
|
||||
|
||||
} else if (resData.type == 'clickSysMesage') {
|
||||
//如果没有系统消息,则点击新消息
|
||||
wsActions.clickMesage(deviceInformation.value[index].udid, index) //点击消息进入对话框
|
||||
} else {
|
||||
console.error(resData.message); // 错误处理
|
||||
console.error(resData.message, resData.type); // 错误处理
|
||||
ElMessage.error(resData.message);
|
||||
createTaskQueue(index).clear();//清除队伍中的任务
|
||||
}
|
||||
@@ -624,13 +682,6 @@ const key = (index, state, keycode) => {
|
||||
|
||||
const handleVisibilityChange = () => {
|
||||
if (document.visibilityState === "hidden") {
|
||||
if (playTimer.value) {
|
||||
console.log("清除定时器");
|
||||
playTimer.value.forEach(Timer => {
|
||||
clearInterval(Timer);
|
||||
});
|
||||
playTimer.value = [{}, {}, {}, {}, {}, {}, {}, {}];
|
||||
}
|
||||
console.log("页面被隐藏");
|
||||
isshow.value = false;
|
||||
// 页面被隐藏时执行的逻辑
|
||||
@@ -669,8 +720,137 @@ onMounted(() => {
|
||||
setTimeout(() => {
|
||||
loading.close()
|
||||
}, 2000)
|
||||
|
||||
//sse接收爬虫发送的消息
|
||||
connectSSE(`https://datasave.api.yolozs.com/api/sse/connect/${userdata.tenantId}/${userdata.id}`, (data) => {
|
||||
// connectSSE(`http://192.168.1.155:19665/api/sse/connect/${userdata.tenantId}/${userdata.id}`, (data) => {
|
||||
// 处理服务端推送的数据
|
||||
console.log('来自服务端:', data)
|
||||
|
||||
//接收到start
|
||||
if (data === 'start') {
|
||||
if (!isMsgPop.value) {
|
||||
isMsgPop.value = true;
|
||||
ElMessageBox.confirm(
|
||||
'检测到YOLO助手正在爬取主播,是否进行操作?',
|
||||
'消息提醒',
|
||||
{
|
||||
confirmButtonText: '开始',
|
||||
cancelButtonText: '取消',
|
||||
type: 'success',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
//开启sse版follow任务
|
||||
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '任务开启成功',
|
||||
})
|
||||
setHostList(stroageHost.value)
|
||||
//重启tk
|
||||
resetTk()
|
||||
//获取评论
|
||||
comment().then((resA) => {
|
||||
console.log('resA:', resA);
|
||||
setContentList(resA)
|
||||
//评论
|
||||
textContentArr.value.forEach((item, indexA) => {
|
||||
textContent.value[indexA] = resA[getRandomNumber(resA.length - 1)];
|
||||
})
|
||||
prologue().then((resB) => {
|
||||
console.log('resB:', resB);
|
||||
setContentpriList(resB)
|
||||
//私信
|
||||
textContentpriArr.value.forEach((item, indexA) => {
|
||||
textContentpri.value[indexA] = resB[getRandomNumber(resB.length - 1)];
|
||||
runType.value[indexA] = 'follow'
|
||||
console.log('runType', runType.value[indexA])
|
||||
})
|
||||
deviceInformation.value.forEach((device, indexB) => {
|
||||
if (getHostList().length <= 0) return;
|
||||
|
||||
// LikesToLikesToLikes(device.udid, indexB)
|
||||
wsActions.getmesNum(device.udid, indexB)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
stroageHost.value = []
|
||||
isMsgPop.value = false;
|
||||
})
|
||||
}
|
||||
} else {
|
||||
stroageHost.value = getHostList()
|
||||
stroageHost.value.push(({ country: data.country, text: data.hostsId, state: false }))
|
||||
setHostList(stroageHost.value)
|
||||
}
|
||||
|
||||
|
||||
//更新状态
|
||||
// update(
|
||||
// {
|
||||
// id: data.id,
|
||||
// operationStatus: 1,
|
||||
// }
|
||||
// ).then(() => {
|
||||
|
||||
// })
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
function opentanchuan() {
|
||||
ElMessageBox.confirm(
|
||||
'接收到YOLO爬虫爬取到的主播,开始进行操作?',
|
||||
'消息提醒',
|
||||
{
|
||||
confirmButtonText: '开始',
|
||||
cancelButtonText: '取消',
|
||||
type: 'success',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '任务开启成功',
|
||||
})
|
||||
resetTk()
|
||||
comment().then((resA) => {
|
||||
console.log('resA:', resA);
|
||||
setContentList(resA)
|
||||
//评论
|
||||
textContentArr.value.forEach((item, indexA) => {
|
||||
textContent.value[indexA] = resA[getRandomNumber(resA.length - 1)];
|
||||
})
|
||||
|
||||
prologue().then((resB) => {
|
||||
|
||||
console.log('resB:', resB);
|
||||
setContentpriList(resB)
|
||||
//私信
|
||||
textContentpriArr.value.forEach((item, indexA) => {
|
||||
textContentpri.value[indexA] = resB[getRandomNumber(resB.length - 1)];
|
||||
runType.value[indexA] = 'follow'
|
||||
console.log('runType', runType.value[indexA])
|
||||
})
|
||||
|
||||
|
||||
deviceInformation.value.forEach((device, indexB) => {
|
||||
if (getHostList().length <= 0) return;
|
||||
|
||||
// LikesToLikesToLikes(device.udid, indexB)
|
||||
wsActions.getmesNum(device.udid, indexB)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
||||
});
|
||||
@@ -750,10 +930,6 @@ const ObtainDeviceInformation = () => {
|
||||
})
|
||||
if (!isrepeat) {
|
||||
deviceInformation.value.push(data.data.device);
|
||||
// setTimeout(() => {
|
||||
// initVideoStream(data.data.device.udid, deviceInformation.value.length - 1);
|
||||
// initCanvas(data.data.device.udid);
|
||||
// }, 300);
|
||||
new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
try {
|
||||
@@ -777,20 +953,18 @@ const ObtainDeviceInformation = () => {
|
||||
async function LikesToCommentToComPush(udid, index) {
|
||||
await sendWsTask(index, { udid, action: 'click', type: 'Likes', index, resourceId: 'com.zhiliaoapp.musically:id/dy6' });
|
||||
await sendWsTask(index, { udid, action: 'click', type: 'Comment', index, resourceId: 'com.zhiliaoapp.musically:id/cvd' });
|
||||
await sendWsTask(index, { udid, action: 'dump', type: 'CommentText', index, resourceId: 'com.zhiliaoapp.musically:id/d5q' });
|
||||
await sendWsTask(index, { udid, action: 'click', type: 'Comtext', index, resourceId: 'com.zhiliaoapp.musically:id/cs0' });
|
||||
await sendWsTask(index, { udid, action: 'click', type: 'ComPush', index, resourceId: 'com.zhiliaoapp.musically:id/bqg' });
|
||||
}
|
||||
|
||||
//点赞主页4个作品+评论最后一个作品并返回
|
||||
async function LikesToLikesToLikes(udid, index, type) {
|
||||
isStopLike.value[index] = false;
|
||||
async function LikesToLikesToLikes(udid, index) {
|
||||
isStop.value = false;
|
||||
runType.value[index] = 'follow';
|
||||
if (type == 2) {
|
||||
await sendWsTask(index, { udid, action: 'click', type: 'searchTxt', index, resourceId: 'com.zhiliaoapp.musically:id/f0l' });
|
||||
await sendWsTask(index, { udid, action: 'click', type: 'close', index, resourceId: 'com.zhiliaoapp.musically:id/blw' });
|
||||
} else if (type == 1) {
|
||||
await sendWsTask(index, { udid, action: 'click', type: 'search', index, resourceId: 'com.zhiliaoapp.musically:id/gtz' });
|
||||
}
|
||||
|
||||
// await sendWsTask(index, { udid, action: 'click', type: 'getmesNum', index, resourceId: 'com.zhiliaoapp.musically:id/jyv' });
|
||||
await sendWsTask(index, { udid, action: 'click', type: 'search', index, resourceId: 'com.zhiliaoapp.musically:id/gtz' });
|
||||
await sendWsTask(index, { udid, action: 'click', type: 'searchHost', index, resourceId: 'com.zhiliaoapp.musically:id/t6f' });
|
||||
await sendWsTask(index, { udid, action: 'click', type: 'toHost', index, resourceId: 'com.zhiliaoapp.musically:id/iso' });
|
||||
await sendWsTask(index, { udid, action: 'click', type: 'hostVideo', index, resourceId: 'com.zhiliaoapp.musically:id/u3o', num: 0 });
|
||||
@@ -811,9 +985,16 @@ async function LikesToLikesToLikes(udid, index, type) {
|
||||
//私信
|
||||
async function PrivatetexToPrivatePush(udid, index) {
|
||||
await sendWsTask(index, { udid, action: 'click', type: 'Privatetex', index, resourceId: 'com.zhiliaoapp.musically:id/hob' });
|
||||
await sendWsTask(index, { udid, action: 'click', type: 'PrivatePush', index, resourceId: 'com.zhiliaoapp.musically:id/hog' });
|
||||
await sendWsTask(index, { udid, action: 'click', type: 'PrivatePushFollow', index, resourceId: 'com.zhiliaoapp.musically:id/hog' });
|
||||
}
|
||||
|
||||
//重置当前应用
|
||||
async function resetApp(udid, index) {
|
||||
createTaskQueue(index).clear();//清除队伍中的任务
|
||||
|
||||
await sendWsTask(index, { udid, action: 'killNow' });
|
||||
await sendWsTask(index, { udid, action: 'openDY' });
|
||||
}
|
||||
//发送评论字符到手机方法
|
||||
function setComText(index) {
|
||||
isSend.value = true;
|
||||
@@ -822,7 +1003,9 @@ function setComText(index) {
|
||||
}, 300);
|
||||
console.log('发送评论内容', index, textContent.value[index])
|
||||
wslist[index].send(setClipboard(textContent.value[index]));
|
||||
textContent.value[index] = textContentArr.value[index][getRandomNumber(textContentArr.value[index].length - 1)];
|
||||
if (runType.value[index] === 'follow') {
|
||||
textContent.value[index] = getContentList()[index][getRandomNumber(getContentList()[index].length - 1)];
|
||||
}
|
||||
}
|
||||
|
||||
//发送主播ID字符到手机方法
|
||||
@@ -831,31 +1014,38 @@ function setHostId(index) {
|
||||
setTimeout(() => {
|
||||
isSend.value = false;
|
||||
}, 300);
|
||||
console.log('发送主播id内容', index, hostIdContent.value[index])
|
||||
wslist[index].send(setClipboard(hostIdContent.value[index])); //发送内容
|
||||
//获取当前主播ID的下标
|
||||
const indexBom = hostIdContentArr.value[index].indexOf(hostIdContent.value[index]) + 1;
|
||||
console.log(hostIdContentArr.value[index].indexOf(hostIdContent.value[index]) + 1, '当前主播下标');
|
||||
console.log(hostIdContentArr.value[index], '主播列表');
|
||||
//如果是最后一个ID 则重置
|
||||
if (indexBom == hostIdContentArr.value[index].length) {
|
||||
// isStopLike.value[index] = true;
|
||||
hostIdContent.value[index] = ''
|
||||
return
|
||||
const host = markFirstFalseAsTrue(getHostList())
|
||||
if (host == null) {
|
||||
createTaskQueue(index).clear();//清除队伍中的任务
|
||||
ElMessage.success('主播ID已全部发送完毕');
|
||||
return;
|
||||
}
|
||||
hostIdContent.value[index] = hostIdContentArr.value[index][indexBom];
|
||||
console.log(hostIdContent.value[index], '下次搜索')
|
||||
hostIdArr.value[index] = host;
|
||||
wslist[index].send(setClipboard(host.text)); //发送内容
|
||||
|
||||
}
|
||||
|
||||
|
||||
//发送私信字符到手机方法
|
||||
function setPrivateText(index) {
|
||||
function setPrivateText(index, datatype) {
|
||||
isSend.value = true;
|
||||
setTimeout(() => {
|
||||
isSend.value = false;
|
||||
}, 300);
|
||||
console.log('发送私信内容', index, textContentpri.value[index])
|
||||
wslist[index].send(setClipboard(textContentpri.value[index]));
|
||||
textContentpri.value[index] = textContentpriArr.value[index][getRandomNumber(textContentpriArr.value[index].length - 1)];
|
||||
//如果是在关注主播中,发送的开场白进行对应国家翻译
|
||||
if (runType.value[index] === 'follow' && datatype == 'PrivatePush') {
|
||||
translation({ msg: getContentpriList()[index][getRandomNumber(getContentpriList()[index].length - 1)], country: hostIdArr.value[index].country }).then(res => {
|
||||
console.log(res)
|
||||
textContentpri.value[index] = res;
|
||||
wslist[index].send(setClipboard(textContentpri.value[index]));
|
||||
})
|
||||
} else {
|
||||
wslist[index].send(setClipboard(textContentpri.value[index]));
|
||||
textContentpri.value[index] = getContentpriList()[index][getRandomNumber(getContentpriList()[index].length - 1)];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//获取手机粘贴板方法
|
||||
function getText(index) {
|
||||
@@ -864,11 +1054,11 @@ function getText(index) {
|
||||
|
||||
function getComArr(index, type) {
|
||||
if (type == '评论') {
|
||||
ElMessageBox.alert(textContentArr.value[index], `当前${type}内容`, {
|
||||
ElMessageBox.alert(getContentList()[index], `当前${type}内容`, {
|
||||
confirmButtonText: 'OK',
|
||||
})
|
||||
} else {
|
||||
ElMessageBox.alert(textContentpriArr.value[index], `当前${type}内容`, {
|
||||
ElMessageBox.alert(getContentpriList()[index], `当前${type}内容`, {
|
||||
confirmButtonText: 'OK',
|
||||
})
|
||||
}
|
||||
@@ -969,10 +1159,12 @@ function createTaskQueue(index) {
|
||||
enqueue(task) {
|
||||
taskQueues.get(index).push(task);
|
||||
if (taskQueues.get(index).length === 1) {
|
||||
console.log("执行任务第一个任务");
|
||||
task(); // 执行第一个任务
|
||||
}
|
||||
},
|
||||
next() {
|
||||
console.log('执行等待中任务')
|
||||
const queue = taskQueues.get(index);
|
||||
queue.shift(); // 移除已完成任务
|
||||
if (queue.length > 0) {
|
||||
@@ -981,76 +1173,72 @@ function createTaskQueue(index) {
|
||||
},
|
||||
clear() {
|
||||
taskQueues.set(index, []); // 清除所有任务
|
||||
},
|
||||
getNum() {
|
||||
return taskQueues.get(index)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//发送检查该手机的xy坐标任务
|
||||
function sendWsTask(index, data) {
|
||||
console.log('发送任务', data.type);
|
||||
console.log('任务等待中', data.type);
|
||||
return new Promise((resolve) => {
|
||||
const queue = createTaskQueue(index);
|
||||
const task = () => {
|
||||
//发送评论的文本粘贴事件
|
||||
if (data.type == 'Likes') {
|
||||
clickxy(160, 360, index)
|
||||
}
|
||||
if (data.type == 'isHost') {
|
||||
// clickxy(160, 360, index)
|
||||
}
|
||||
if (data.type == 'Comment') {
|
||||
if (runType.value[index] == 'follow') {
|
||||
try {
|
||||
const queue = createTaskQueue(index);
|
||||
// console.log("创建队列", queue.getNum());
|
||||
const task = () => {
|
||||
|
||||
//发送评论的文本粘贴事件
|
||||
if (data.type == 'Likes') {
|
||||
clickxy(160, 360, index)
|
||||
}
|
||||
}
|
||||
if (data.type == 'ComPush') {
|
||||
setTimeout(() => {
|
||||
setComText(index)//粘贴内容
|
||||
}, 500)
|
||||
}
|
||||
if (data.type == 'searchHost') {
|
||||
setTimeout(() => {
|
||||
setHostId(index)//粘贴内容
|
||||
}, 500)
|
||||
}
|
||||
//发送私信的文本粘贴事件
|
||||
if (data.type == 'PrivatePush') {
|
||||
setPrivateText(index)
|
||||
}
|
||||
//关注前的返回和右滑
|
||||
if (data.type == 'Attention') {
|
||||
// setTimeout(() => {
|
||||
// Back('', index)
|
||||
// setTimeout(() => {
|
||||
// wsActions.slideRight(data.udid, index)
|
||||
// }, 500);
|
||||
// }, 500);
|
||||
}
|
||||
//发送关注之前的返回
|
||||
if (data.type == 'addHost') {
|
||||
// setTimeout(() => {
|
||||
// Back('', index)
|
||||
// setTimeout(() => {
|
||||
// clickxy(160, 360, index)
|
||||
// wsActions.isHost(data.udid, index)
|
||||
// }, 1000);
|
||||
// }, 500);
|
||||
}
|
||||
//发送任务
|
||||
console.log('发送任务', data);
|
||||
if (data.type == 'Attention') {
|
||||
setTimeout(() => {
|
||||
if (data.type == 'isHost') {
|
||||
}
|
||||
if (data.type == 'Comment') {
|
||||
if (runType.value[index] == 'follow') {
|
||||
clickxy(160, 360, index)
|
||||
}
|
||||
}
|
||||
if (data.type == 'ComPush') {
|
||||
setTimeout(() => {
|
||||
setComText(index)//粘贴内容
|
||||
}, 500)
|
||||
}
|
||||
if (data.type == 'searchHost') {
|
||||
setTimeout(() => {
|
||||
setHostId(index)//粘贴内容
|
||||
}, 500)
|
||||
}
|
||||
//发送私信的文本粘贴事件
|
||||
if (data.type == 'PrivatePush' || data.type == 'PrivatePushFollow') {
|
||||
setPrivateText(index, data.type)
|
||||
}
|
||||
//关注前的返回和右滑
|
||||
if (data.type == 'Attention') {
|
||||
|
||||
}
|
||||
//发送关注之前的返回
|
||||
if (data.type == 'addHost') {
|
||||
}
|
||||
//发送任务
|
||||
if (data.type == 'Attention') {
|
||||
setTimeout(() => {
|
||||
wslist[index].send(JSON.stringify(data));
|
||||
resolve();
|
||||
}, 1000)
|
||||
} else {
|
||||
wslist[index].send(JSON.stringify(data));
|
||||
resolve();
|
||||
}, 1000)
|
||||
} else {
|
||||
wslist[index].send(JSON.stringify(data));
|
||||
resolve();
|
||||
}
|
||||
// 表示当前任务“已发出”,但不是“已完成”
|
||||
// 实际完成由 onmessage 中的 success 决定并继续执行队列
|
||||
};
|
||||
queue.enqueue(task);
|
||||
}
|
||||
// 表示当前任务“已发出”,但不是“已完成”
|
||||
// 实际完成由 onmessage 中的 success 决定并继续执行队列
|
||||
};
|
||||
queue.enqueue(task);
|
||||
} catch (e) {
|
||||
console.error('发送任务错误:', e);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1066,8 +1254,8 @@ function getRandomNumber(n) {
|
||||
|
||||
//延迟30-50秒后检测关注
|
||||
function randomSeeVideo(udid, index) {
|
||||
const delay = Math.floor(Math.random() * (50 - 30 + 1) + 30) * 1000;
|
||||
setTimeout(() => {
|
||||
const delay = Math.floor(Math.random() * (50 - 30) + 10) * 1000;
|
||||
playTimer.value[index] = setTimeout(() => {
|
||||
console.log('观看结束', index);
|
||||
wsActions.isHost(udid, index)//检测
|
||||
}, delay);
|
||||
@@ -1091,15 +1279,25 @@ function getVideoStyle(index) {
|
||||
};
|
||||
}
|
||||
|
||||
function stop(udid, index) {
|
||||
function stop() {
|
||||
// actions[index] = [];
|
||||
createTaskQueue(index).clear();//清除队伍中的任务
|
||||
cloesMonitor();
|
||||
isStopLike.value.forEach((item, i) => {
|
||||
isStopLike.value[i] = true;
|
||||
runType.value[index] = ''
|
||||
isStop.value = true; //停止所有任务
|
||||
isMsgPop.value = false;//关闭爬虫sse任务
|
||||
deviceInformation.value.forEach((item, i) => {
|
||||
console.log('停止', i);
|
||||
createTaskQueue(i).clear();//清除队伍中的任务
|
||||
console.log(createTaskQueue(i).getNum())
|
||||
//停止当前任务
|
||||
|
||||
//重置当前状态
|
||||
runType.value[i] = ''
|
||||
//清除观看视频定时器
|
||||
clearInterval(playTimer.value[i])
|
||||
playTimer.value[i] = null;//清除定时器
|
||||
|
||||
})
|
||||
console.log('停止', isStopLike.value);
|
||||
console.log('停止', isStop.value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1108,24 +1306,30 @@ function openTk() {
|
||||
wsActions.open(device.udid, index)
|
||||
})
|
||||
}
|
||||
|
||||
function resetTk() {
|
||||
isStop.value = false;
|
||||
deviceInformation.value.forEach((device, index) => {
|
||||
resetApp(device.udid, index)
|
||||
})
|
||||
}
|
||||
//监听所有手机是否有消息
|
||||
function openMonitor() {
|
||||
function openMonitor(type) {
|
||||
isStop.value = false;
|
||||
|
||||
deviceInformation.value.forEach((device, index) => {
|
||||
wsActions.getmesNum(device.udid, index)
|
||||
isStopLike.value[index] = false;
|
||||
runType.value[index] = 'listen'
|
||||
})
|
||||
isShowMes.value = setInterval(() => {
|
||||
deviceInformation.value.forEach((device, index) => {
|
||||
wsActions.getmesNum(device.udid, index)
|
||||
isStopLike.value[index] = false;
|
||||
})
|
||||
}, 10000)
|
||||
}
|
||||
|
||||
//关闭监听
|
||||
function cloesMonitor() {
|
||||
|
||||
deviceInformation.value.forEach((device, index) => {
|
||||
runType.value[index] = ''
|
||||
})
|
||||
@@ -1135,8 +1339,8 @@ function cloesMonitor() {
|
||||
|
||||
//一键养号
|
||||
function parentNum() {
|
||||
isStop.value = false;
|
||||
deviceInformation.value.forEach((device, index) => {
|
||||
isStopLike.value[index] = false;
|
||||
runType.value[index] = 'like'
|
||||
wsActions.isHost(device.udid, index)
|
||||
})
|
||||
@@ -1146,18 +1350,22 @@ function parentNum() {
|
||||
function onDialogConfirm(result, type, index) {
|
||||
console.log(result, type, index);
|
||||
if (type == '评论') {
|
||||
//index ==999 表示全部
|
||||
if (index == 999) {
|
||||
//index ==999 表示批量养号,输入完评论后 即可直接执行脚本
|
||||
// if (index == 999) {
|
||||
// getContentList().forEach((item, indexA) => {
|
||||
// // textContentArr.value[indexA] = result;
|
||||
// textContent.value[indexA] = result[getRandomNumber(result.length - 1)];
|
||||
// })
|
||||
// setContentList(result)
|
||||
// console.log(getContentList())
|
||||
// parentNum()
|
||||
// //index==998是批量关注主播 输入完评论后 还需要输入私信内容
|
||||
// } else
|
||||
if (index == 998) {
|
||||
textContentArr.value.forEach((item, indexA) => {
|
||||
textContentArr.value[indexA] = result;
|
||||
textContent.value[indexA] = result[getRandomNumber(result.length - 1)];
|
||||
})
|
||||
parentNum()
|
||||
} else if (index == 998) {
|
||||
textContentArr.value.forEach((item, indexA) => {
|
||||
textContentArr.value[indexA] = result;
|
||||
textContent.value[indexA] = result[getRandomNumber(result.length - 1)];
|
||||
})
|
||||
setContentList(result)
|
||||
//打开私信弹窗
|
||||
selectedDevice.value = 999;
|
||||
dialogTitle.value = '私信';
|
||||
@@ -1165,18 +1373,24 @@ function onDialogConfirm(result, type, index) {
|
||||
showDialog.value = true;
|
||||
}, 600)
|
||||
} else {
|
||||
textContentArr.value[index] = result;
|
||||
setContentList(result)
|
||||
|
||||
textContent.value[index] = result[getRandomNumber(result.length - 1)];
|
||||
}
|
||||
} else if (type == '私信') {
|
||||
//index ==999 表示全部
|
||||
if (index == 999) {
|
||||
textContentpriArr.value.forEach((item, indexA) => {
|
||||
textContentpriArr.value[indexA] = result;
|
||||
textContentpri.value[indexA] = result[getRandomNumber(result.length - 1)];
|
||||
runType.value[indexA] = 'follow'
|
||||
})
|
||||
|
||||
setContentpriList(result)
|
||||
deviceInformation.value.forEach((device, indexB) => {
|
||||
LikesToLikesToLikes(device.udid, indexB, 1)
|
||||
if (getHostList().length <= 0) return;
|
||||
|
||||
// LikesToLikesToLikes(device.udid, indexB)
|
||||
wsActions.getmesNum(device.udid, indexB)
|
||||
})
|
||||
} else {
|
||||
textContentpriArr.value[index] = result;
|
||||
@@ -1186,38 +1400,50 @@ function onDialogConfirm(result, type, index) {
|
||||
//index ==999 表示全部
|
||||
if (index == 999) {
|
||||
//分割数组 几台设备 分为几个数组
|
||||
const hostIdArrList = splitArray(result, deviceInformation.value.length)
|
||||
deviceInformation.value.forEach((device, indexA) => {
|
||||
hostIdContentArr.value[indexA] = hostIdArrList[indexA];
|
||||
hostIdContent.value[indexA] = hostIdContentArr.value[indexA][0];
|
||||
let hostListResult = [];
|
||||
result.forEach((item, indexA) => {
|
||||
hostListResult.push({ country: '', text: item, state: false })
|
||||
})
|
||||
setHostList(hostListResult)
|
||||
//打开评论弹窗
|
||||
selectedDevice.value = 998;
|
||||
dialogTitle.value = '评论';
|
||||
setTimeout(() => {
|
||||
showDialog.value = true;
|
||||
}, 600)
|
||||
} else {
|
||||
hostIdContentArr.value[index] = result;
|
||||
hostIdContent.value[index] = result[0];
|
||||
deviceInformation.value.forEach((device, indexA) => {
|
||||
if (index == indexA) {
|
||||
LikesToLikesToLikes(device.udid, index, 1)
|
||||
}
|
||||
})
|
||||
}
|
||||
// else {
|
||||
// hostIdContentArr.value[index] = result;
|
||||
// hostIdContent.value[index] = result[0];
|
||||
// deviceInformation.value.forEach((device, indexA) => {
|
||||
// if (index == indexA) {
|
||||
// LikesToLikesToLikes(device.udid, index)
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
function getTranslation(list) {
|
||||
list.forEach((item, index) => {
|
||||
translation({ msg: item.text }).then(res => {
|
||||
translationToChinese({ msg: item.text }).then(res => {
|
||||
console.log(res);
|
||||
chatList.value[index].text = res
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function markFirstFalseAsTrue(hostList) {
|
||||
const index = hostList.findIndex(item => item.state === false);
|
||||
if (index !== -1) {
|
||||
hostList[index].state = true;
|
||||
setHostList(hostList)
|
||||
return hostList[index]; // 可选:返回被修改的对象
|
||||
}
|
||||
return null; // 没有找到 false 的项
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
Reference in New Issue
Block a user