diff --git a/src/api/account.js b/src/api/account.js index 22a04df..b476c78 100644 --- a/src/api/account.js +++ b/src/api/account.js @@ -6,6 +6,9 @@ export function apiGetCart() { export function login(data) { return postAxios({ url: '/api/user/aiChat-doLogin', data }) } +export function logout(data) { + return postAxios({ url: '/api/user/aiChat-logout', data }) +} export function getIdByName(name) { return getAxios({ url: `/api/tenant/get-id-by-name?name=${name}` }) diff --git a/src/components/ScheduleDialog.vue b/src/components/ScheduleDialog.vue new file mode 100644 index 0000000..052728b --- /dev/null +++ b/src/components/ScheduleDialog.vue @@ -0,0 +1,56 @@ + + + \ No newline at end of file diff --git a/src/composables/useDeviceDiscovery.js b/src/composables/useDeviceDiscovery.js index c46c478..ee62ea8 100644 --- a/src/composables/useDeviceDiscovery.js +++ b/src/composables/useDeviceDiscovery.js @@ -11,7 +11,8 @@ export function useDeviceDiscovery({ initCanvas, // (udid) => void initVideoStream, // (udid, index) => void wsActionsRef, // () => wsActions (可能一开始是 null) - td // 你的 useTeardown 实例,可选 + td, // 你的 useTeardown 实例,可选 + }) { const decoder = new TextDecoder('utf-8') diff --git a/src/composables/useSchedule.js b/src/composables/useSchedule.js new file mode 100644 index 0000000..5f077fd --- /dev/null +++ b/src/composables/useSchedule.js @@ -0,0 +1,45 @@ +import { ref } from "vue" +import { ElMessage } from "element-plus" +import { tryActivate } from "./useTaskControl" + +export function useSchedule(runTaskFn) { + const scheduleEnabled = ref(true) + let schedulePlan = [ + { key: "follow", duration: 40 * 60 * 1000 }, + { key: "like", duration: 20 * 60 * 1000 } + ] + let scheduleState = { index: 0, startTime: Date.now() } + let scheduleTimer = null + + function runTask(key) { + if (!scheduleEnabled.value) return + runTaskFn(key) // 交给外部实现 follow/like/brushLive 等 + } + + function startScheduleLoop() { + runTask(schedulePlan[scheduleState.index].key) + if (scheduleTimer) clearInterval(scheduleTimer) + scheduleTimer = setInterval(() => { + const now = Date.now() + const cur = schedulePlan[scheduleState.index] + if (now - scheduleState.startTime >= cur.duration) { + scheduleState.index = (scheduleState.index + 1) % schedulePlan.length + scheduleState.startTime = now + runTask(schedulePlan[scheduleState.index].key) + } + }, 30 * 1000) + } + + function stopSchedule() { + scheduleEnabled.value = false + if (scheduleTimer) clearInterval(scheduleTimer) + } + + return { + scheduleEnabled, + schedulePlan, + scheduleState, + startScheduleLoop, + stopSchedule + } +} diff --git a/src/composables/useTaskControl.js b/src/composables/useTaskControl.js new file mode 100644 index 0000000..dacd3dc --- /dev/null +++ b/src/composables/useTaskControl.js @@ -0,0 +1,23 @@ +import { ElMessage } from "element-plus" + +export function useTaskControl(runType, activeKey, stopAll) { + function stop() { + stopAll() + runType.value = "" + } + + function continueAfterReset(key, cb) { + if (runType.value === key) cb() + } + + function tryActivate(key, runner, force = false) { + if (!force && activeKey.value && activeKey.value !== key) { + ElMessage.warning("请先停止当前任务") + return + } + runType.value = key + runner && runner() + } + + return { stop, continueAfterReset, tryActivate } +} diff --git a/src/src.zip b/src/src.zip new file mode 100644 index 0000000..673293d Binary files /dev/null and b/src/src.zip differ diff --git a/src/utils/axios.js b/src/utils/axios.js index 3ad8402..a1eac58 100644 --- a/src/utils/axios.js +++ b/src/utils/axios.js @@ -18,7 +18,7 @@ let baseURL = '' if (process.env.NODE_ENV === 'development') { // 生产环境 // baseURL = "https://api.tkpage.yolozs.com" - // baseURL = "http://192.168.1.174:8101" + // baseURL = "http://192.168.1.7:8101" baseURL = "https://crawlclient.api.yolozs.com" } else { // 测试环境 diff --git a/src/utils/wsActions.js b/src/utils/wsActions.js index 1c2fa37..91bb68b 100644 --- a/src/utils/wsActions.js +++ b/src/utils/wsActions.js @@ -40,7 +40,7 @@ export function createWsActions(wslist) { slideUp: (udid, index) => send(index, { udid, action: 'slideUp' }),//上滑动视频 slideRight: (udid, index) => send(index, { udid, action: 'slideRight' }),//右滑动视频 getSize: (udid, index) => send(index, { udid, action: 'getSize', index }),//右滑动视频 - setClipboard: (udid, index, text, type) => send(index, { udid, action: 'setClipboard', type: type, index, resourceId: text }), //截屏测试 + // setClipboard: (udid, index, text, type) => send(index, { udid, action: 'setClipboard', type: type, index, resourceId: text }), //截屏测试 clickLikes: (udid, index) => send(index, { udid, action: 'click', type: 'Likes', index, resourceId: 'com.zhiliaoapp.musically:id/dy6' }),//点赞 clickComment: (udid, index) => send(index, { udid, action: 'click', type: 'Comment', index, resourceId: 'com.zhiliaoapp.musically:id/cvd' }),//打开评论 clickComtext: (udid, index) => send(index, { udid, action: 'click', type: 'Comtext', index, resourceId: 'com.zhiliaoapp.musically:id/cs0' }),//点开输入框 @@ -66,6 +66,7 @@ export function createWsActions(wslist) { isOneLive: (udid, index) => send(index, { udid, action: 'click', type: 'isOneLive', index, resourceId: 'com.zhiliaoapp.musically:id/s1w' }), //判断是否是单人直播 hostVideo: (udid, index, num) => send(index, { udid, action: 'click', type: 'hostVideo', index, resourceId: 'com.zhiliaoapp.musically:id/d3u', num: num }), //主播视频 test: (udid, index) => send(index, { udid, action: 'test', type: 'test', index, resourceId: 'com.zhiliaoapp.musically:id/TESTFFFXXX' }), //截屏测试 + openClose: (udid, index) => send(index, { udid, action: 'click', type: 'openClose', index, resourceId: 'android:id/button2' }), //关闭弹窗 // test2: (udid, index) => send(index, { udid, action: 'dump', type: 'test', index, resourceId: 'com.zhiliaoapp.musically:id/kg4' }), //截屏测试 diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 98f7f1c..bb1e09a 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -79,13 +79,11 @@ import { getToken, setToken, setUser, setUserPass, getUserPass } from '@/stores/ import { ElLoading, ElMessage } from 'element-plus'; -let version = ref('1.5.8(测试版)'); +let version = ref('1.6.0(测试版)'); onMounted(() => { - }) - const router = useRouter(); const formData = ref({ @@ -94,8 +92,6 @@ const formData = ref({ password: getUserPass() == null ? '' : getUserPass().password, }); - - const onSubmit = () => { const loading = ElLoading.service({ lock: true, diff --git a/src/views/VideoStream.vue b/src/views/VideoStream.vue index 9f3c2c1..7fec61a 100644 --- a/src/views/VideoStream.vue +++ b/src/views/VideoStream.vue @@ -47,11 +47,21 @@ @click="setComText(index)">发送 - - -
安装粘贴工具
-
mq
- + + + +
安装tk
@@ -64,6 +74,46 @@ @confirm="onDialogConfirm" @cancel="stop" /> + + + +
+
片段 A
+
+ + + + + + + + 分钟 +
+ +
片段 B
+
+ + + + + + + + 分钟 +
+ +
总时长
+
{{ schedAMin + schedBMin }} 分钟(必须等于 60)
+ +
启用调度
+
+
+ + +