Compare commits

...

10 Commits

Author SHA1 Message Date
pengxiaolong
60be63e2d2 创建仓库 2025-07-28 13:32:04 +08:00
pengxiaolong
8cabf98bd9 优化 2025-07-09 13:27:43 +08:00
pengxiaolong
51ce853bde 优化 2025-07-07 18:46:02 +08:00
pengxiaolong
a46cbf79f6 优化 2025-07-03 19:34:19 +08:00
pengxiaolong
52415dee0b 优化 2025-07-03 19:14:34 +08:00
pengxiaolong
01e9c26821 上传代码 2025-07-01 21:22:43 +08:00
560581f1a4 yolo 2025-06-24 13:35:33 +08:00
17d2251a70 添加 计时器功能 详细筛选功能 分配状态字段 2025-05-15 18:29:53 +08:00
dcd677bbab 近7日数据改为updata 2025-05-12 21:09:32 +08:00
60f6fc4873 版本号更新 2025-05-06 15:38:23 +08:00
27 changed files with 1488 additions and 851 deletions

BIN
YOLO工具箱.zip Normal file

Binary file not shown.

BIN
dist.rar

Binary file not shown.

8
package-lock.json generated
View File

@@ -12,7 +12,7 @@
"core-js": "^3.8.3", "core-js": "^3.8.3",
"echarts": "^5.6.0", "echarts": "^5.6.0",
"element-plus": "^2.9.7", "element-plus": "^2.9.7",
"pinia": "^3.0.1", "pinia": "^3.0.3",
"qwebchannel": "^6.2.0", "qwebchannel": "^6.2.0",
"vue": "^3.2.13", "vue": "^3.2.13",
"vue-router": "^4.0.3", "vue-router": "^4.0.3",
@@ -9709,9 +9709,9 @@
} }
}, },
"node_modules/pinia": { "node_modules/pinia": {
"version": "3.0.1", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/pinia/-/pinia-3.0.1.tgz", "resolved": "https://registry.npmjs.org/pinia/-/pinia-3.0.3.tgz",
"integrity": "sha512-WXglsDzztOTH6IfcJ99ltYZin2mY8XZCXujkYWVIJlBjqsP6ST7zw+Aarh63E1cDVYeyUcPCxPHzJpEOmzB6Wg==", "integrity": "sha512-ttXO/InUULUXkMHpTdp9Fj4hLpD/2AoJdmAbAeW2yu1iy1k+pkFekQXw5VpC0/5p51IOR/jDaDRfRWRnMMsGOA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vue/devtools-api": "^7.7.2" "@vue/devtools-api": "^7.7.2"

View File

@@ -11,7 +11,7 @@
"core-js": "^3.8.3", "core-js": "^3.8.3",
"echarts": "^5.6.0", "echarts": "^5.6.0",
"element-plus": "^2.9.7", "element-plus": "^2.9.7",
"pinia": "^3.0.1", "pinia": "^3.0.3",
"qwebchannel": "^6.2.0", "qwebchannel": "^6.2.0",
"vue": "^3.2.13", "vue": "^3.2.13",
"vue-router": "^4.0.3", "vue-router": "^4.0.3",

View File

@@ -24,4 +24,10 @@ window.ResizeObserver = class ResizeObserver extends _ResizeObserver {
super(callback) super(callback)
} }
} }
</script> </script>
<!-- <style lang="less">
/*每个页面公共css */
@import "@/static/css/app.less";
</style> -->

View File

@@ -1,17 +1,42 @@
import { getAxios, postAxios, downFile } from '@/utils/axios.js' import { getAxios, postAxios, downFile } from '@/utils/axios.js'
import { ElMessage } from 'element-plus';
//租户获取登录id
export function rentgetloginID(data) {
return getAxios({ url: `/api/tenant/get-id-by-name?name=${data.name}`})
}
//登录
export function login(data) {
return postAxios({ url: '/api/user/bigbrother-doLogin', data })
}
//获取国家
export function getCountryinfo(data) {
return postAxios({ url: '/api/common/country_info', data })
}
//查询tk账号查询次数
export function tkaccountuseinfo(accountName) {
return getAxios({ url: `/api/common/accountCount?accountName=${accountName}` })
}
export function tkhostdata(data) {
return postAxios({ url: '/api/big-brother/page', data })
}
export function apiGetCart() { export function apiGetCart() {
return getAxios({ url: '/cgi-bin/cart/latest' }) return getAxios({ url: '/cgi-bin/cart/latest' })
} }
export function login(data) { // export function login(data) {
return postAxios({ url: 'api/account/login', data }) // return postAxios({ url: 'api/account/login', data })
} // }
export function cheekalive(data) { export function cheekalive(data) {
return postAxios({ url: 'api/account/cheekalive', data }) return postAxios({ url: 'api/account/cheekalive', data })
} }
export function tkhostdata(data) {
return postAxios({ url: 'api/tkinfo/tkhostdata', data })
}
export function dicts(data) { export function dicts(data) {
return postAxios({ url: 'api/param/dicts', data }) return postAxios({ url: 'api/param/dicts', data })
} }
@@ -25,10 +50,7 @@ export function exporthosts(data) {
export function downList(url, data) { export function downList(url, data) {
return downFile(url, data) return downFile(url, data)
} }
//查询tk账号查询次数
export function tkaccountuseinfo(data) {
return postAxios({ url: 'api/tkinfo/tkaccountuseinfo', data })
}
//查询员工 //查询员工
export function getStaffList(data) { export function getStaffList(data) {
return postAxios({ url: 'api/account/list', data }) return postAxios({ url: 'api/account/list', data })
@@ -41,7 +63,9 @@ export function managerhosts(data) {
export function upholdinfo(data) { export function upholdinfo(data) {
return postAxios({ url: 'api/tkinfo/upholdinfo', data }) return postAxios({ url: 'api/tkinfo/upholdinfo', data })
} }
//获取
export function getCountryinfo(data) { //查看名字
return postAxios({ url: 'api/tkinfo/countryinfo', data }) export function accountName(str) {
return postAxios({ url: 'api/account/accountName?accounts=' + str })
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 88 KiB

BIN
src/assets/logo1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
src/assets/logoBg1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 106 KiB

BIN
src/assets/logotext1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
src/assets/logotext12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -38,6 +38,8 @@ export default {
this.inputTime = this.time this.inputTime = this.time
this.getTkhostdetail(); this.getTkhostdetail();
console.log(this.time)
console.log(this.getPrevious7Days(this.inputTime)) console.log(this.getPrevious7Days(this.inputTime))
}, },
@@ -93,16 +95,6 @@ export default {
res[0][this.getPrevious7Days(this.inputTime)[6]] == null ? 0 : Number(res[0][this.getPrevious7Days(this.inputTime)[6]][this.dataType]), res[0][this.getPrevious7Days(this.inputTime)[6]] == null ? 0 : Number(res[0][this.getPrevious7Days(this.inputTime)[6]][this.dataType]),
] ]
// this.seriesData = {
// [this.getPrevious7Days(this.inputTime)[0]]: res[0][this.getPrevious7Days(this.inputTime)[0]] == null ? 0 : res[0][this.getPrevious7Days(this.inputTime)[0]][this.dataType],
// [this.getPrevious7Days(this.inputTime)[1]]: res[0][this.getPrevious7Days(this.inputTime)[1]] == null ? 0 : res[0][this.getPrevious7Days(this.inputTime)[1]][this.dataType],
// [this.getPrevious7Days(this.inputTime)[2]]: res[0][this.getPrevious7Days(this.inputTime)[2]] == null ? 0 : res[0][this.getPrevious7Days(this.inputTime)[2]][this.dataType],
// [this.getPrevious7Days(this.inputTime)[3]]: res[0][this.getPrevious7Days(this.inputTime)[3]] == null ? 0 : res[0][this.getPrevious7Days(this.inputTime)[3]][this.dataType],
// [this.getPrevious7Days(this.inputTime)[4]]: res[0][this.getPrevious7Days(this.inputTime)[4]] == null ? 0 : res[0][this.getPrevious7Days(this.inputTime)[4]][this.dataType],
// [this.getPrevious7Days(this.inputTime)[5]]: res[0][this.getPrevious7Days(this.inputTime)[5]] == null ? 0 : res[0][this.getPrevious7Days(this.inputTime)[5]][this.dataType],
// [this.getPrevious7Days(this.inputTime)[6]]: res[0][this.getPrevious7Days(this.inputTime)[6]] == null ? 0 : res[0][this.getPrevious7Days(this.inputTime)[6]][this.dataType],
// }
this.initChart(); this.initChart();
this.num++ this.num++
console.log("返回数据", this.seriesData) console.log("返回数据", this.seriesData)

View File

@@ -1,11 +1,11 @@
<template> <template>
<div class="sidebar"> <div class="sidebar">
<div class="logo"> <div class="logo">
<img style="margin-right: 10px;" src="@/assets/logo.png"> <!-- <img style="margin-right: 10px;" src="@/assets/logo.png"> -->
<img src="@/assets/logotext.png"> <img src="@/assets/logotext.png">
</div> </div>
<ul> <ul>
<li @click="updateActiveIndex(1)" v-show="userInfo.userType == 3"> <li @click="updateActiveIndex(1)">
<div> <div>
<img v-show="activeIndex == 1" src="@/assets/navAction.png" autoplay loop muted class="background-img"> <img v-show="activeIndex == 1" src="@/assets/navAction.png" autoplay loop muted class="background-img">
<div style="display: flex;"> <div style="display: flex;">
@@ -45,11 +45,13 @@ import { ref, reactive, onMounted } from 'vue';
import { getUser } from '@/utils/storage' import { getUser } from '@/utils/storage'
import { defineEmits } from 'vue'; import { defineEmits } from 'vue';
const userInfo = ref(getUser()) const userInfo = ref(getUser())
let activeIndex = ref(userInfo.value.userType == 3 ? 1 : 2); let activeIndex = ref(1);
const emit = defineEmits(['update:activeIndex']); const emit = defineEmits(['activeIndex']);
const updateActiveIndex = (index) => { const updateActiveIndex = (index) => {
@@ -58,23 +60,23 @@ const updateActiveIndex = (index) => {
}; };
</script> </script>
<style scoped> <style scoped lang="less">
.sidebar { .sidebar {
position: fixed; position: fixed;
left: 0; left: 0;
top: 0; top: 0;
height: 900px; height: 900px;
width: 280px; width: 280px;
background-color: #338F6A; background-color: @bg-color;
padding: 20px; padding: 20px;
box-sizing: border-box; box-sizing: border-box;
.logo { .logo {
border-bottom: 1px solid #fff; border-bottom: 1px solid #fff;
padding-bottom: 29px; padding-top: 20px;
img:nth-of-type(1) { img:nth-of-type(1) {
height: 40px; height: 66px;
} }
img:nth-of-type(2) { img:nth-of-type(2) {

View File

@@ -5,14 +5,15 @@ import store from './store'
import { createPinia } from 'pinia'; import { createPinia } from 'pinia';
import ElementPlus from 'element-plus' import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css' import 'element-plus/dist/index.css'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'; // 引入中文语言包
// createApp(App).use(store).use(router).mount('#app')
const app = createApp(App); const app = createApp(App);
app.use(ElementPlus, {
locale: zhCn, // 配置中文
});
app.use(ElementPlus) // 注册 ElementPlus app.use(ElementPlus) // 注册 ElementPlus
app.use(createPinia()); // 注册 Pinia app.use(createPinia()); // 注册 Pinia
app.use(store); // 注册 store app.use(store); // 注册 store
app.use(router); // 注册 router app.use(router); // 注册 router
app.mount('#app'); app.mount('#app');

View File

@@ -19,11 +19,12 @@ const routes = [
name: 'hostsList', name: 'hostsList',
component: () => import(/* webpackChunkName: "hostsList" */ '../views/hosts/hostsList.vue') component: () => import(/* webpackChunkName: "hostsList" */ '../views/hosts/hostsList.vue')
}, },
{ // {
path: 'workBenches', // path: 'workBenches',
name: 'workBenches', // name: 'workBenches',
component: () => import(/* webpackChunkName: "hostsList" */ '../views/hosts/workbenches.vue') // component: () => import(/* webpackChunkName: "hostsList" */ '../views/hosts/workbenches.vue')
},] // },
]
} }
] ]
const router = createRouter({ const router = createRouter({

4
src/static/css/app.less Normal file
View File

@@ -0,0 +1,4 @@
@bg-color: #022b4e; // 主色
@bg-color-light: #022b4eaf; // 浅主色
@bg-color-light-light: #022b4e1c; // 浅浅主色
@btn-bg-color: #045dac; // 黄色按钮主色

View File

@@ -9,4 +9,29 @@ export const noticeStore = defineStore('noticeNum', {
this.data.num++; this.data.num++;
}, },
}, },
}); });
export const tokenStore = defineStore('token', {
state: () => {
return { token: '' }
},
// 也可以这样定义
// state: () => ({ count: 0 })
actions: {
setToken(token){
this.token = token
}
},
})
export const UserStore = defineStore('User', {
state: () => {
return { user: {} }
},
// 也可以这样定义
// state: () => ({ count: 0 })
actions: {
setUser(user){
this.user = user
}
},
})

View File

@@ -4,33 +4,53 @@
*/ */
import axios from 'axios' import axios from 'axios'
import { getToken, getUser } from '@/utils/storage' import { getToken, getUser } from '@/utils/storage'
import { useRouter } from 'vue-router'; import router from '@/router'
import { ElMessage } from 'element-plus';
import { ElMessage } from 'element-plus';
import { usePythonBridge, } from '@/utils/pythonBridge'
import { ref } from 'vue';
import { defineStore } from 'pinia'
import { tokenStore,UserStore } from '@/stores/notice'
const { stopScript } = usePythonBridge();
const router = useRouter();
// 请求地址前缀 // 请求地址前缀
let baseURL = '' let baseURL = ''
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// 生产环境 // 生产环境
baseURL = "http://api.tkpage.vvtiktok.cn" // baseURL = "https://api.tkpage.yolozs.com"
// baseURL = "http://192.168.0.116:8085/" baseURL = "http://47.79.98.113:8101"
// baseURL = "http://192.168.0.103:8085/"
// baseURL = "http://192.168.1.174:8101"
} else { } else {
// 测试环境
// baseURL = "http://120.26.251.180:8085/"
// 开发环境 // 开发环境
baseURL = "http://api.tkpage.vvtiktok.cn" // baseURL = "https://api.tkpage.yolozs.com"
baseURL = "http://47.79.98.113:8101"
// baseURL = "http://192.168.1.174:8101"
// baseURL = "http://api.tkpage.vvtiktok.cn"
} }
// 请求拦截器 // 请求拦截器
axios.interceptors.request.use((config) => { axios.interceptors.request.use((config) => {
// if (getToken()) { const tokenCache = tokenStore()
// config.headers['token'] = getToken(); console.log("config", config)
// } const url = sliceUrl(config.url)
console.log("url", url)
// 请求超时时间 - 毫秒 // 请求超时时间 - 毫秒
config.timeout = 60000 config.timeout = 60000
config.baseURL = baseURL config.baseURL = baseURL
// 自定义Content-type // 自定义Content-type
config.headers['Content-type'] = 'application/json' config.headers['Content-type'] = 'application/json'
if (!(config.url == 'bigbrother-doLogin' || config.url == 'get-id-by-name')) {
config.headers['vvtoken'] = tokenCache.token;
}
return config; return config;
}, (error) => { }, (error) => {
return Promise.reject(error) return Promise.reject(error)
@@ -38,7 +58,19 @@ axios.interceptors.request.use((config) => {
// 响应拦截器 // 响应拦截器
axios.interceptors.response.use((response) => { axios.interceptors.response.use((response) => {
return response console.log("response", response.data)
if (response.data.code == 0) {
console.log("response", response.data.data)
return response.data.data
} else if (response.data.code == 40400) {
router.push('/')
ElMessage.error(response.data.code + '' + response.data.message);
}else{
ElMessage.error(response.data.code + '' + response.data.message);
}
}, (error) => { }, (error) => {
// 可添加请求失败后的处理逻辑 // 可添加请求失败后的处理逻辑
return Promise.reject(error) return Promise.reject(error)
@@ -54,10 +86,9 @@ export function getAxios({ url, params }) {
params params
// 请求成功将返回的数据传递给resolve函数 // 请求成功将返回的数据传递给resolve函数
}).then(res => { }).then(res => {
resolve(res.data) resolve(res)
// 请求失败将错误信息传递给reject函数 // 请求失败将错误信息传递给reject函数
}).catch(err => { }).catch(err => {
console.log(err)
reject(err) reject(err)
}) })
}) })
@@ -65,13 +96,6 @@ export function getAxios({ url, params }) {
// axios的post请求 // axios的post请求
export function postAxios({ url, data }) { export function postAxios({ url, data }) {
if (url != 'api/account/login') {
throttledCheekalive();
}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios.post( axios.post(
url, url,
@@ -82,20 +106,9 @@ export function postAxios({ url, data }) {
} }
} }
).then(res => { ).then(res => {
resolve(res.data) resolve(res)
}).catch(err => { }).catch(err => {
if (err.message == "Network Error") { reject(err)
// alert("网络错误,请检查网络连接")
// ElMessage.error('网络连接错误');
reject('网络连接错误')
} else {
ElMessage.error(err.message);
reject(err.message)
}
// console.log(err)
// reject(err)
}) })
}) })
} }
@@ -132,9 +145,11 @@ export const downFile = async (urlstr, data) => {
} }
//请求前验证 //请求前验证
function cheekalive() { function cheekalive() {
const userCache = UserStore()
const tokenCache = tokenStore()
axios.post('api/account/cheekalive', { axios.post('api/account/cheekalive', {
userId: getUser().userId, userId: userCache.user.id,
currcode: getToken(), currcode: tokenCache.token,
}, },
{ {
headers: { headers: {
@@ -146,6 +161,7 @@ function cheekalive() {
if (res.data) { if (res.data) {
} else { } else {
stopScript();
alert("账号在其他地方登录!") alert("账号在其他地方登录!")
window.location.href = '/'; window.location.href = '/';
} }
@@ -167,6 +183,18 @@ function throttle(func, limit) {
} }
} }
const throttledCheekalive = throttle(cheekalive, 5000); function sliceUrl(url) {
const lastSlash = url.lastIndexOf('/');
const questionMark = url.indexOf('?');
if (questionMark == -1) {
const result = url.slice(lastSlash + 1, url.length);
return result;
} else {
const result = url.slice(lastSlash + 1, questionMark);
return result;
}
}
export default axios export default axios

View File

@@ -1,11 +1,12 @@
// pythonBridge.js // pythonBridge.js
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
const bridge = ref(null); import { ElMessage } from 'element-plus';
const pyBridge = ref(null);
// 初始化 QWebChannel // 初始化 QWebChannel
const initBridge = () => { const initBridge = () => {
if (/localhost/.test(window.location.href)) return if (/localhost/.test(window.location.href)) return
new QWebChannel(qt.webChannelTransport, (channel) => { new QWebChannel(qt.webChannelTransport, (channel) => {
bridge.value = channel.objects.bridge; pyBridge.value = channel.objects.bridge;
}); });
}; };
export function usePythonBridge() { export function usePythonBridge() {
@@ -13,105 +14,185 @@ export function usePythonBridge() {
// 调用 Python 方法 // // 调用 Python 方法
const fetchDataConfig = (data) => { // const fetchDataConfig = (data) => {
// return new Promise((resolve, reject) => {
// if (bridge.value) {
// bridge.value.fetchDataConfig(data, function (result) {
// resolve(result);
// });
// }
// });
// };
// // 查询获取主播的数据
// const fetchDataCount = () => {
// return new Promise((resolve, reject) => {
// if (bridge.value) {
// bridge.value.fetchDataCount(function (result) {
// resolve(result);
// });
// }
// });
// };
//删除前端储存数据
const deleteStorageData = (data) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (bridge.value) { if (pyBridge.value) {
bridge.value.fetchDataConfig(data, function (result) { pyBridge.value.deleteAccountInfo(JSON.stringify(data),function (result) {
resolve(result); resolve(result);
}); });
}else{
console.log("pyBridge is null未连接上")
} }
}); });
}; };
// 查询获取主播的数据 //获取前端储存数据
const fetchDataCount = () => { const getStorageData = (data) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (bridge.value) { if (pyBridge.value) {
bridge.value.fetchDataCount(function (result) { pyBridge.value.readAccountInfo(JSON.stringify(data),function (result) {
resolve(result); resolve(result);
}); });
}else{
console.log("pyBridge is null未连接上")
}
});
};
//设置前端储存数据
const setStorageData = (data) => {
return new Promise((resolve, reject) => {
if (pyBridge.value) {
pyBridge.value.storageAccountInfo(JSON.stringify(data),function (result) {
resolve(result);
});
}else{
console.log("pyBridge is null未连接上")
}
});
};
// 查询获取大哥的数据
const controlTask = (data) => {
return new Promise((resolve, reject) => {
if (pyBridge.value) {
pyBridge.value.control_task(data,function (result) {
resolve(result);
});
}else{
console.log("pyBridge is null未连接上")
}
});
};
//总数有效数
const getBrotherInfo = () => {
return new Promise((resolve, reject) => {
if (pyBridge.value) {
pyBridge.value.getBrotherInfo(function (result) {
resolve(JSON.parse(result));
});
}else{
console.log("pyBridge is null未连接上")
} }
}); });
}; };
// 打开tk后台 // 打开tk后台
const loginTikTok = () => { const loginTikTok = () => {
if (bridge.value) { if (pyBridge.value) {
bridge.value.loginTikTok(function (result) { pyBridge.value.loginTikTok(function (result) {
}); });
} }else{
console.log("pyBridge is null未连接上")
};
// 登录tk后台
const loginBackStage = (data) => {
if (bridge.value) {
if (data.index == 0) {
bridge.value.loginBackStage(JSON.stringify(data));
} else if (data.index == 1) {
bridge.value.loginBackStageCopy(JSON.stringify(data));
}
} }
}; };
// // 登录tk后台
// const loginBackStage = (data) => {
// if (bridge.value) {
// if (data.index == 0) {
// bridge.value.loginBackStage(JSON.stringify(data));
// } else if (data.index == 1) {
// bridge.value.loginBackStageCopy(JSON.stringify(data));
// }
// }
// };
//跳转到主播页面 //跳转到主播页面
const givePyAnchorId = (id) => { const givePyAnchorId = (id) => {
console.log("id",id);
if (bridge.value) { if (pyBridge.value) {
bridge.value.givePyAnchorId(id, function (result) { pyBridge.value.givePyAnchorId(id, function (result) {
}); });
} }
}; };
//查询登录状态 // //查询登录状态
const backStageloginStatus = () => { // const backStageloginStatus = () => {
return new Promise((resolve, reject) => { // return new Promise((resolve, reject) => {
if (bridge.value) { // if (bridge.value) {
bridge.value.backStageloginStatus(function (result) { // bridge.value.backStageloginStatus(function (result) {
resolve(result); // resolve(result);
}); // });
} // }
}); // });
}; // };
//查询登录状态 // //查询登录状态
const backStageloginStatusCopy = () => { // const backStageloginStatusCopy = () => {
return new Promise((resolve, reject) => { // return new Promise((resolve, reject) => {
if (bridge.value) { // if (bridge.value) {
bridge.value.backStageloginStatusCopy(function (result) { // bridge.value.backStageloginStatusCopy(function (result) {
resolve(result); // resolve(result);
}); // });
} // }
}); // });
}; // };
//导出表格 //导出表格
const exportToExcel = (data) => { const exportToExcel = (data) => {
if (bridge.value) { if (pyBridge .value) {
bridge.value.exportToExcel(JSON.stringify(data)); pyBridge .value.exportToExcel(JSON.stringify(data));
}
};
const stopScript = () => {
if (pyBridge .value) {
pyBridge .value.stopScript();
} }
}; };
//获取版本号
const getVersion = () => {
return new Promise((resolve, reject) => {
if (pyBridge.value) {
pyBridge.value.currentVersion(function (result) {
resolve(result);
});
}
});
};
// 在组件挂载时初始化桥接 // 在组件挂载时初始化桥接
onMounted(initBridge); onMounted(initBridge);
return { return {
fetchDataConfig,
fetchDataCount,
loginBackStage,
loginTikTok, loginTikTok,
exportToExcel,
stopScript,
controlTask,
getBrotherInfo,
getVersion,
givePyAnchorId, givePyAnchorId,
backStageloginStatus, getStorageData,
backStageloginStatusCopy, setStorageData,
exportToExcel deleteStorageData,
}; };
} }

View File

@@ -1,45 +1,70 @@
export function setToken(token) {
localStorage.setItem('token', token); import { usePythonBridge} from "@/utils/pythonBridge";
const { getStorageData, setStorageData,deleteStorageData} = usePythonBridge();
import { ElMessage } from 'element-plus';
export async function setToken(token) {
const res = await setStorageData({key: 'token',data: token}).then(res => {
});
} }
export function getToken() { export async function getToken() {
return localStorage.getItem('token'); const res = await getStorageData({ key: 'token' });
return JSON.parse(res);
} }
export function removeToken() { export async function removeToken() {
localStorage.removeItem('token'); const res = deleteStorageData({key: 'token'});
} }
export function setUser(user) { export async function setUser(user) {
const res = await setStorageData({key: 'user',data: user}).then(res => {
localStorage.setItem('user', JSON.stringify(user)); });
} }
export function getUser() { export async function getUser() {
return JSON.parse(localStorage.getItem('user')); const res = await getStorageData({ key: 'user' });
return JSON.parse(res);
} }
export function setNumData(numData) { export async function setNumData(numData) {
localStorage.setItem('num', JSON.stringify(numData)); const res = await setStorageData({key: 'num',data: numData})
} }
export function getNumData() {
return JSON.parse(localStorage.getItem('num')); export async function getNumData() {
const res = await getStorageData({ key: 'num' });
return JSON.parse(res);
} }
// 导出一个函数,用于设置用户密码 // 导出一个函数,用于设置用户密码
export function setUserPass(userdata) { export async function setUserPass(userdata) {
localStorage.setItem('userPass', JSON.stringify(userdata)); const res = await setStorageData({key: 'userPass',data:userdata})
} }
// 导出一个函数,用于获取用户密码 // 导出一个函数,用于获取用户密码
export function getUserPass() { export async function getUserPass() {
return JSON.parse(localStorage.getItem('userPass')); const res = await getStorageData({ key: 'userPass' });
return JSON.parse(res);
} }
// 用于设置tk账户密码 // 用于设置tk账户密码
export function setTkUser(userdata) { export async function setTkUser(userdata) {
localStorage.setItem('tkuser', JSON.stringify(userdata)); const res = await setStorageData({key: 'tkuser',data: userdata})
} }
// 用于获取tk账户密码 // 用于获取tk账户密码
export function getTkUser() {
return JSON.parse(localStorage.getItem('tkuser')); export async function getTkUser() {
} const res = await getStorageData({ key: 'tkuser' });
return JSON.parse(res);
}
// 用于列表筛选条件
export async function setSerch(data) {
const res = await setStorageData({key: 'Serch',data: data})
}
// 用于获取列表筛选条件
export async function getSerch() {
const res = await getStorageData({ key: 'Serch' });
return JSON.parse(res);
}

View File

@@ -1,295 +1,351 @@
<template> <template>
<div class="main"> <div class="main">
<div class="container"> <div class="container">
<div class="right"> <div class="right">
<img src="../assets/logoBg.png" class="background-video" alt=""> <img src="../assets/logoBg.png" class="background-video" alt="" />
<!-- 设置 --> <!-- 设置 -->
<div class="center-align"> <div class="center-align">
<div></div> <div></div>
<div class="setup"> <div class="setup">
<div class="setup-item center-justify"> <div class="setup-item center-justify">
<div></div> <div></div>
<span> <span> 网络设置 </span>
网络设置 </div>
</span> <div class="setup-item center-justify">
</div> <div></div>
<div class="setup-item center-justify"> <span> 简体中文 </span>
<div></div> </div>
<span> </div>
简体中文 </div>
</span> <div class="center-line" style="margin-top: 40px">
</div> <!-- logo -->
</div> <div class="logo">
</div> <!-- <div class="center-justify" style="height: 80px; width: 300px;">
<div class="center-line" style="margin-top: 40px;"> <img style="height: 100%;" src="@/assets/logotext.png">
<!-- logo --> </div> -->
<div class="logo"> </div>
<div class="center-justify" style="height: 80px; width: 300px;">
<img style="margin-right: 20px;" src="@/assets/logo.png">
<img src="@/assets/logotext.png">
</div>
</div>
<!-- From --> <!-- From -->
<div class="from"> <div class="from">
<div class="from-title center-justify"> <div class="from-title center-justify">
<div>账号登陆</div> <div>账号登陆</div>
</div> </div>
<div class="from-input"> <div class="from-input">
<el-form label-position="left" label-width="100px" :model="formData"> <el-form label-position="left" label-width="100px" :model="formData">
<div class="from-input-item1">
<img src="@/assets/username.png" alt="" />
<el-input
style="height: 25px"
v-model="formData.tenantName"
placeholder="租户名称"
clearable
@keyup.enter="onSubmit"
/>
</div>
<div class="from-input-item1">
<img src="@/assets/username.png" alt="" />
<el-input
style="height: 25px"
v-model="formData.userId"
placeholder="账号"
clearable
@keyup.enter="onSubmit"
/>
</div>
<div class="from-input-item1">
<img src="@/assets/password.png" alt="" />
<el-input
style="height: 25px"
v-model="formData.password"
type="password"
placeholder="密码"
show-password
@keyup.enter="onSubmit"
/>
</div>
<div class="from-input-item1"> <div class="from-input-item">
<img src="@/assets/username.png" alt=""> <el-button
<el-input style="height: 25px;" v-model="formData.userId" placeholder="账号" clearable class="loginButton"
@keyup.enter="onSubmit" /> color="#8f7ee7"
</div> type="primary"
<div class="from-input-item1"> @click="onSubmit"
<img src="@/assets/password.png" alt=""> >登录</el-button
<el-input style="height: 25px; " v-model="formData.password" type="password" >
placeholder="密码" show-password @keyup.enter="onSubmit" /> </div>
</div> </el-form>
</div>
<div class="from-input-item"> </div>
<el-button class="loginButton" color="#8f7ee7" type="primary" </div>
@click="onSubmit">登录</el-button> <div class="version center-justify">版本号{{ version }}</div>
</div> </div>
</el-form> </div>
</div> </div>
</div>
</div>
</div>
</div>
</div>
</template> </template>
<script setup> <script setup>
import { ref, reactive, onMounted } from 'vue'; import { ref, reactive, onMounted } from "vue";
import { useRouter } from 'vue-router'; import { useRouter } from "vue-router";
import { login } from '@/api/account'; import { login, rentgetloginID } from "@/api/account";
import { getToken, setToken, setUser, setUserPass, getUserPass } from '@/utils/storage'; import { getToken, setToken, setUser, setUserPass, getUserPass } from "@/utils/storage";
import { ElLoading } from 'element-plus'; import { ElLoading } from "element-plus";
import { usePythonBridge } from "@/utils/pythonBridge";
import { ElMessage } from 'element-plus';
import { tokenStore,UserStore } from '@/stores/notice'
const tokenCache = tokenStore()
const userCache = UserStore()
const { getVersion } = usePythonBridge();
let version = ref("0.0.0");
onMounted(() => {
setTimeout(() => {
getVersion().then((res) => {
version.value = res;
});
getpassword();
}, 500);
});
async function getpassword(){
const res = await getUserPass();
formData.value = {
tenantName: res == null ? "" : res.tenantName,
userId: res == null ? "" : res.userId,
password: res == null ? "" : res.password,
};
}
const router = useRouter(); const router = useRouter();
const formData = ref({ const formData = ref({});
userId: getUserPass() == null ? '' : getUserPass().userId,
password: getUserPass() == null ? '' : getUserPass().password,
});
const onSubmit = () => { const onSubmit = () => {
const loading = ElLoading.service({ const loading = ElLoading.service({
lock: true, lock: true,
text: 'Loading', text: "Loading",
background: 'rgba(0, 0, 0, 0.7)', background: "rgba(0, 0, 0, 0.7)",
}); });
setUserPass(formData.value); rentgetloginID({
login({ name: formData.value.tenantName,
userId: formData.value.userId, })
password: formData.value.password, .then((res) => {
}).then((res) => { console.log(res);
loading.close();
console.log(res)
if (res) {
if (res.activeYn == 'Y') {
setToken(res.currcode);
setUser(res);
router.push('/nav');
} else {
alert('账号未启用');
}
} else { login({
alert('账号或密码错误'); username: formData.value.userId,
} tenantId: res,
password: formData.value.password,
}).catch((err) => { })
loading.close(); .then((res) => {
}); loading.close();
console.log(res);
setToken(res.tokenValue);
tokenCache.setToken(res.tokenValue)
userCache.setUser(res)
setUser(res);
setUserPass(formData.value);
router.push("/nav");
})
.catch((err) => {
loading.close();
});
})
.catch((err) => {
loading.close();
console.log(err);
});
}; };
</script> </script>
<style lang="less"> <style lang="less">
.main { .main {
width: 1600px; width: 1600px;
height: 900px; height: 900px;
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
/* 页面无法选中 */ /* 页面无法选中 */
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
.container { .container {
display: flex; display: flex;
box-sizing: border-box; box-sizing: border-box;
width: 1600px; width: 1600px;
height: 900px; height: 900px;
.right { .right {
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
width: 1600px; width: 1600px;
height: 900px; height: 900px;
padding: 20px 40px 20px 50px; padding: 20px 40px 20px 50px;
border-left: 3px solid #23516e; border-left: 3px solid #23516e;
position: relative; position: relative;
/* 添加 position: relative */ /* 添加 position: relative */
overflow: hidden; overflow: hidden;
/* 防止内容溢出 */ /* 防止内容溢出 */
.background-video { .version {
position: absolute; color: #fff;
top: 0; position: absolute;
left: 0; font-size: 20px;
width: 100%; bottom: 20px;
height: 100%; left: calc(50% - 50px);
z-index: -1; // box-sizing: border-box;
/* 确保视频在内容之下 */ // width: 1600px;
} }
.setup { .background-video {
display: flex; position: absolute;
color: #fff; top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
/* 确保视频在内容之下 */
}
.setup-item { .setup {
padding: 10px 6px; display: flex;
display: flex; color: #fff;
div { .setup-item {
width: 20px; padding: 10px 6px;
height: 20px; display: flex;
border-radius: 50%;
background-color: rgb(255, 255, 255);
margin-right: 5px;
}
}
}
.logo { div {
padding: 20px 0; width: 20px;
} height: 20px;
border-radius: 50%;
background-color: rgb(255, 255, 255);
margin-right: 5px;
}
}
}
.from { .logo {
width: 420px; padding: 20px 0;
height: 320px; height: 80px;
color: #107A4E; }
background-color: #ffffff44;
border-radius: 20px;
border: 1px solid #fff;
padding: 32px;
box-sizing: border-box;
.from-title { .from {
font-family: Source Han Sans SC; width: 420px;
font-weight: 500; // height: 320px;
font-size: 24px; color: @bg-color;
color: #107A4E; background-color: #ffffff44;
line-height: 37px; border-radius: 20px;
border: 1px solid #fff;
padding: 32px;
box-sizing: border-box;
.from-title {
font-family: Source Han Sans SC;
font-weight: 500;
font-size: 24px;
color: @bg-color;
line-height: 37px;
div { div {
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 600;
// border-bottom: 4px solid #1db97d; // border-bottom: 4px solid #1db97d;
} }
} }
.from-input { .from-input {
width: 100%; width: 100%;
padding: 15px 0; padding: 15px 0;
.from-input-item { .from-input-item {
display: flex; display: flex;
padding: 8px 0; padding: 8px 0;
.from-input-item-title { .from-input-item-title {
color: #107A4E; color: @bg-color;
font-size: 18px; font-size: 18px;
font-weight: 500; font-weight: 500;
width: 80px; width: 80px;
height: 50px; height: 50px;
} }
.loginButton { .loginButton {
width: 359px; width: 359px;
height: 50px; height: 50px;
background: #FFFFFF; background: #ffffff;
border-radius: 24px; border-radius: 24px;
border: 1px solid #FFFFFF; border: 1px solid #ffffff;
font-family: Source Han Sans SC;
font-weight: 500;
font-size: 18px;
color: @bg-color;
line-height: 37px;
}
}
font-family: Source Han Sans SC; .from-input-item1 {
font-weight: 500; display: flex;
font-size: 18px; width: 359px;
color: #107A4E; height: 50px;
line-height: 37px; background: @bg-color-light-light;
} border-radius: 24px;
} border: 1px solid #ffffff;
padding: 12px 25px 13px 25px;
.from-input-item1 { box-sizing: border-box;
display: flex; margin-bottom: 16px;
width: 359px; }
height: 50px; }
background: rgba(147, 174, 158, 0.37); }
border-radius: 24px; }
border: 1px solid #FFFFFF; }
padding: 12px 25px 13px 25px;
box-sizing: border-box;
margin-bottom: 16px;
}
}
}
}
}
} }
.center-line { .center-line {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
} }
.center-justify { .center-justify {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
align-items: center; align-items: center;
} }
.center-align { .center-align {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.center-flex { .center-flex {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.el-input__wrapper { .el-input__wrapper {
--el-input-focus-border-color: rgba(255, 255, 0, 0); --el-input-focus-border-color: rgba(255, 255, 0, 0);
--el-menu-hover-bg-color: rgba(255, 255, 0, 0); --el-menu-hover-bg-color: rgba(255, 255, 0, 0);
} }
</style> </style>
<style scoped> <style scoped lang="less">
::v-deep(.el-input__wrapper) { ::v-deep(.el-input__wrapper) {
background-color: rgba(255, 0, 0, 0); background-color: rgba(255, 0, 0, 0);
box-shadow: none; box-shadow: none;
} }
::v-deep(.el-input__inner) { ::v-deep(.el-input__inner) {
color: #107A4E; color: #fff;
} }
::v-deep(.el-input__inner::placeholder) { ::v-deep(.el-input__inner::placeholder) {
color: #107A4E; color: @bg-color;
} }
</style> </style>

File diff suppressed because it is too large Load Diff

View File

@@ -3,13 +3,15 @@
<div class="center-align" style="width: 100%; margin: 0 20px;"> <div class="center-align" style="width: 100%; margin: 0 20px;">
<div class="box-card-num1 center-line"> <div class="box-card-num1 center-line">
<div>总数量: <span>{{ hostData.totalCount }}</span></div> <div>总数量: <span>{{ hostData.totalCount }}</span></div>
<div>有效主播: <span>{{ hostData.validAnchorsCount }}</span></div> <div>新建主播: <span>{{ hostData.validAnchorsCount }}</span></div>
<div> 已查询: <span>{{ hostData.checkedDataCount }}</span></div> <div> 已查询: <span>{{ hostData.checkedDataCount }}</span></div>
<div>可邀请: <span>{{ hostData.canInvitationCount }}</span></div> <div>可邀请: <span>{{ hostData.canInvitationCount }}</span></div>
<div>运行时间: <span>{{ formattedTime }}</span></div>
</div> </div>
<div class="center-line" style="padding-top: 15vh;"> <div class="center-line" style="padding-top: 15vh;">
<el-button class="open-login" type="primary" @click="openTK">开启tk</el-button> <el-button class="open-login" type="primary" @click="openTK">开启tk</el-button>
<!-- <el-button class="open-login" type="primary" @click="startTimer">计时开始</el-button> -->
</div> </div>
<div> <div>
@@ -55,7 +57,7 @@
<!-- <el-button class="reset-button" @click="reset">重置数据</el-button> --> <!-- <el-button class="reset-button" @click="reset">重置数据</el-button> -->
</div> </div>
</div> </div>
</template>n </template>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<div class="input-group"> <div class="input-group">
@@ -86,14 +88,14 @@
<el-col :span="8"> <el-col :span="8">
<div class="input-group"> <div class="input-group">
<label>后台查询频率</label> <label>后台查询频率</label>
<el-input type='number' v-model="pyData.frequency.hour" :min="0" <!-- <el-input type='number' v-model="pyData.frequency.hour" @input="handleInputHour" -->
:max="pyData.frequency.day - 1" placeholder="次/小时" style="width: 100%" <el-input type='number' v-model="pyData.frequency.hour" placeholder="次/小时"
:disabled="!pyData.isStart"> style="width: 100%" :disabled="!pyData.isStart">
<template #append>/小时</template> <template #append>/小时</template>
</el-input> </el-input>
<el-input type='number' v-model="pyData.frequency.day" :min="pyData.frequency.hour + 1" <!-- <el-input type='number' v-model="pyData.frequency.day" @input="handleInputDay" -->
:max="100" placeholder="次/24小时" style="width: 100%; margin-top: 10px" <el-input type='number' v-model="pyData.frequency.day" placeholder="次/24小时"
:disabled="!pyData.isStart"> style="width: 100%; margin-top: 10px" :disabled="!pyData.isStart">
<template #append>/24小时</template> <template #append>/24小时</template>
</el-input> </el-input>
</div> </div>
@@ -113,12 +115,13 @@
</template> </template>
<script setup> <script setup>
import { ref, onMounted } from 'vue'; import { ref, onMounted, computed } from 'vue';
import { usePythonBridge, } from '@/utils/pythonBridge' import { usePythonBridge, } from '@/utils/pythonBridge'
import { setNumData, getNumData, getUser, setTkUser, getTkUser } from '@/utils/storage' import { setNumData, getNumData, getUser, setTkUser, getTkUser } from '@/utils/storage'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { getCountryName } from '@/utils/countryUtil' import { getCountryName } from '@/utils/countryUtil'
import { tkaccountuseinfo } from '@/api/account' import { tkaccountuseinfo } from '@/api/account'
//导入python交互方法 //导入python交互方法
const { fetchDataConfig, fetchDataCount, loginBackStage, loginTikTok, backStageloginStatus, backStageloginStatusCopy } = usePythonBridge(); const { fetchDataConfig, fetchDataCount, loginBackStage, loginTikTok, backStageloginStatus, backStageloginStatusCopy } = usePythonBridge();
@@ -132,16 +135,27 @@ let hostData = ref({
validAnchorsCount: 0, validAnchorsCount: 0,
canInvitationCount: 0, canInvitationCount: 0,
checkedDataCount: 0, checkedDataCount: 0,
}); });
//是否开启tk //是否开启tk
// let isTk = ref(true); // let isTk = ref(true);
//账号是否登陆中 //账号是否登陆中
let isLogin = ref([false, false]); let isLogin = ref([false, false]);
//设置状态轮询定时器 //设置状态轮询定时器
let statusTimer = ref(null); let statusTimer = ref(null);
let statusTimerCopy = ref(null); let statusTimerCopy = ref(null);
//设置次数最大值
let maxCount = ref([
{
hourMax: 50,
dayMax: 300,
},
{
hourMax: 100,
dayMax: 600,
},
]);
//tk账号信息 //tk账号信息
let tkData = ref([ let tkData = ref([
@@ -158,9 +172,7 @@ let tkData = ref([
index: 2, index: 2,
code: 0, code: 0,
num: 0 num: 0
}, },
]); ]);
//python需要的数据 //python需要的数据
@@ -179,6 +191,7 @@ let pyData = ref({
//按钮提交状态 //按钮提交状态
let submitting = ref(true); let submitting = ref(true);
onMounted(() => { onMounted(() => {
//从缓存获取数据 //从缓存获取数据
if (getNumData()) { if (getNumData()) {
@@ -194,7 +207,6 @@ onMounted(() => {
tkaccountuse(tkData.value[1].account, 1) tkaccountuse(tkData.value[1].account, 1)
getIpInfo() getIpInfo()
//查询次数查询
}) })
@@ -211,6 +223,22 @@ const getIpInfo = async () => {
countryData.value = getCountryName(data.country); countryData.value = getCountryName(data.country);
} catch (error) { } catch (error) {
console.error('请求出错:', error); console.error('请求出错:', error);
ElMessageBox.prompt('请输入将要获取国家的中文名', '获取国家失败', {
confirmButtonText: '确认',
cancelButtonText: '取消',
showClose: false,
closeOnClickModal: false,
showCancelButton: false,
})
.then(({ value }) => {
countryData.value = value
})
// .catch(() => {
// ElMessage({
// type: 'info',
// message: 'Input canceled',
// })
// })
} }
}; };
@@ -236,7 +264,7 @@ const submit = () => {
ElMessage.error('请输入正确的区间值'); ElMessage.error('请输入正确的区间值');
return; return;
} }
if (Number(pyData.value.frequency.hour) <= 0 || Number(pyData.value.frequency.day <= 0) || pyData.value.frequency.hour == '' || pyData.value.frequency.day == '') { if (Number(pyData.value.frequency.hour) <= 0 || Number(pyData.value.frequency.day) <= 0 || pyData.value.frequency.hour == '' || pyData.value.frequency.day == '') {
ElMessage.error('请输入正确的频率区间值'); ElMessage.error('请输入正确的频率区间值');
return; return;
} }
@@ -265,14 +293,16 @@ const submit = () => {
tenantId: getUser().tenantId, tenantId: getUser().tenantId,
userId: getUser().userId, userId: getUser().userId,
})).then((res) => { })).then((res) => {
//开始计时器
startTimer();
//开启查询次数
getHostTimer.value = setInterval(() => { getHostTimer.value = setInterval(() => {
fetchDataCount().then((res) => { fetchDataCount().then((res) => {
hostData.value = JSON.parse(res); hostData.value = JSON.parse(res);
tkaccountuse(tkData.value[0].account, 0) tkaccountuse(tkData.value[0].account, 0)
tkaccountuse(tkData.value[1].account, 1) tkaccountuse(tkData.value[1].account, 1)
}) })
}, 1000); }, 5000);
}).finally(() => { }).finally(() => {
@@ -302,6 +332,7 @@ const unsubmit = () => {
tenantId: getUser().tenantId, tenantId: getUser().tenantId,
userId: getUser().userId, userId: getUser().userId,
})).then((res) => { })).then((res) => {
pauseTimer();
pyData.value.isStart = true; pyData.value.isStart = true;
clearInterval(getHostTimer.value); clearInterval(getHostTimer.value);
getHostTimer.value = null; getHostTimer.value = null;
@@ -378,13 +409,114 @@ function getloginStatusCopy() {
function tkaccountuse(id, index) { function tkaccountuse(id, index) {
let num = 0; let num = 0;
tkaccountuseinfo({ userId: id }).then((res) => { tkaccountuseinfo(id).then((res) => {
num = res if (res) {
tkData.value[index].num = num num = res
console.log('账号使用次数', tkData.value[index].num) tkData.value[index].num = num
console.log('账号使用次数', tkData.value[index].num)
}
}).catch((err) => {
console.log('账号使用次数', err)
}) })
} }
const isRunning = ref(false);
const totalSeconds = ref(0);
//定时器
let timerCrawl = null;
const startTimedata = ref(null);
//清空时间 并开始运行
const startTimer = () => {
resetTimer();
if (isRunning.value) return;
isRunning.value = true;
startTimedata.value = Date.now();
timerCrawl = setInterval(() => {
totalSeconds.value = Math.floor((Date.now() - startTimedata.value) / 1000);
}, 1000);
};
//结束运行 暂停
const pauseTimer = () => {
isRunning.value = false;
clearInterval(timerCrawl);
};
//清空时间
const resetTimer = () => {
isRunning.value = false;
clearInterval(timerCrawl);
totalSeconds.value = 0;
};
// 格式化时间为 HH:MM:SS
const formattedTime = computed(() => {
const hours = Math.floor(totalSeconds.value / 3600);
const minutes = Math.floor((totalSeconds.value % 3600) / 60);
const seconds = totalSeconds.value % 60;
return [
hours.toString().padStart(2, '0'),
minutes.toString().padStart(2, '0'),
seconds.toString().padStart(2, '0')
].join(':');
});
function handleInputHour(value) {
console.log(value)
// 替换非数字字符为空字符串
let num = value.replace(/[^\d]/g, '');
// 如果值小于等于0则设置为0
if (Number(num) <= 0) {
num = 0;
}
if ((tkData.value[0].code == 1) && (tkData.value[1].code == 1)) {
if (Number(num) > maxCount.value[1].hourMax) {
num = maxCount.value[1].hourMax;
}
} else if ((tkData.value[0].code == 1) || (tkData.value[1].code == 1)) {
// 如果值大于最大值,则设置为最大值
if (Number(num) > maxCount.value[0].hourMax) {
num = maxCount.value[0].hourMax;
}
} else {
ElMessage.error('请先登录tk后台');
num = 0;
}
// 更新模型
pyData.value.frequency.hour = num;
}
function handleInputDay(value) {
console.log(value)
// 替换非数字字符为空字符串
let num = value.replace(/[^\d]/g, '');
// 如果值小于等于0则设置为0
if (Number(num) <= 0) {
num = 0;
}
if ((tkData.value[0].code == 1) && (tkData.value[1].code == 1)) {
if (Number(num) > maxCount.value[1].dayMax) {
num = maxCount.value[1].dayMax;
}
} else if ((tkData.value[0].code == 1) || (tkData.value[1].code == 1)) {
// 如果值大于最大值,则设置为最大值
if (Number(num) > maxCount.value[0].dayMax) {
num = maxCount.value[0].dayMax;
}
} else {
ElMessage.error('请先登录tk后台');
num = 0;
}
// 更新模型
pyData.value.frequency.day = num;
}
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
@@ -419,7 +551,7 @@ function tkaccountuse(id, index) {
background: #FFFFFF; background: #FFFFFF;
box-shadow: 0px 0px 21px 0px rgba(183, 183, 183, 0.33); box-shadow: 0px 0px 21px 0px rgba(183, 183, 183, 0.33);
border-radius: 24px; border-radius: 24px;
padding-top: 60px; // padding-top: 60px;
box-sizing: border-box; box-sizing: border-box;
div { div {
@@ -519,7 +651,7 @@ label {
.open-login { .open-login {
width: 100px; width: 100px;
height: 47px; height: 47px;
background: #E7CA92; background: @btn-bg-color;
border-radius: 10px; border-radius: 10px;
border: none; border: none;
} }
@@ -527,7 +659,7 @@ label {
.reset-button { .reset-button {
width: 132px; width: 132px;
height: 47px; height: 47px;
background: #E7CA92; background: @btn-bg-color;
border-radius: 10px; border-radius: 10px;
font-family: Source Han Sans SC; font-family: Source Han Sans SC;
@@ -541,7 +673,7 @@ label {
.submit-button { .submit-button {
width: 160px; width: 160px;
height: 47px; height: 47px;
background: #338F6A; background: @bg-color;
border-radius: 10px; border-radius: 10px;
} }
@@ -572,9 +704,9 @@ label {
</style> </style>
<style scoped> <style scoped lang="less">
::v-deep(.el-input-group__prepend) { ::v-deep(.el-input-group__prepend) {
background: #84CEB2; background: @bg-color-light;
border-radius: 10px 0px 0px 10px; border-radius: 10px 0px 0px 10px;
border: 1px solid #B7CEC5; border: 1px solid #B7CEC5;
font-family: Source Han Sans SC; font-family: Source Han Sans SC;
@@ -585,7 +717,7 @@ label {
} }
::v-deep(.el-input-group__append) { ::v-deep(.el-input-group__append) {
background: #84CEB2; background: @bg-color-light;
border-radius: 0px 10px 10px 0px; border-radius: 0px 10px 10px 0px;
border: 1px solid #B7CEC5; border: 1px solid #B7CEC5;
font-family: Source Han Sans SC; font-family: Source Han Sans SC;

View File

@@ -1,13 +1,14 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<Sidebar class="noneText" @activeIndex="activeIndexFn" /> <!-- <Sidebar class="noneText" @activeIndex="activeIndexFn" /> -->
<div class="content "> <div class="content ">
<div v-show="activeIndex == 1"> <!-- <div v-show="activeIndexA == 1">
<workbenches v-if="openWerk" /> <workbenches />
</div> </div> -->
<div v-show="activeIndex == 2"> <div>
<hostsList v-if="openList" /> <hostsList />
</div> </div>
<!-- <div style="position: absolute; bottom: 0; right: 0;">{{ version }}</div> -->
</div> </div>
@@ -15,32 +16,30 @@
</template> </template>
<script setup> <script setup>
import Sidebar from '../components/Sidebar.vue'; // import Sidebar from '../components/Sidebar.vue';
import { RouterLink, RouterView } from 'vue-router' import { RouterLink, RouterView } from 'vue-router'
import hostsList from '@/views/hosts/hostsList.vue' import hostsList from '@/views/hosts/hostsList.vue'
import workbenches from '@/views/hosts/workbenches.vue' // import workbenches from '@/views/hosts/workbenches.vue'
import { ref } from 'vue' import { ref } from 'vue'
import { getUser } from '@/utils/storage' import { getUser } from '@/utils/storage'
// import { usePythonBridge } from '@/utils/pythonBridge'
let userType = ref(getUser().userType)
let activeIndex = ref(userType.value == 3 ? 1 : 2)
let openWerk = ref(userType.value == 3 ? true : false)
let openList = ref(userType.value == 3 ? false : true)
console.log("用户等级", getUser().userType)
function activeIndexFn(data) {
activeIndex.value = data
openWerk.value = true
openList.value = true // let activeIndexA = ref(1)
console.log(data)
} // function activeIndexFn(data) {
// activeIndexA.value = data
// console.log(data)
// }
</script> </script>
<style> <style lang="less">
body, body,
html { html {
margin: 0; margin: 0;
@@ -52,7 +51,8 @@ html {
display: flex; display: flex;
width: 1600px; width: 1600px;
height: 900px; height: 900px;
background-color: #338F6A; background-color: @bg-color;
position: relative;
} }
@@ -67,14 +67,16 @@ html {
.sidebar { .sidebar {
width: 200px; width: 200px;
background-color: #338F6A; background-color: @bg-color;
padding: 20px; padding: 20px;
/* box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1); */ /* box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1); */
} }
.content { .content {
margin-left: 280px; // margin-left: 280px;
width: 1304px; margin-left: 25px;
margin-right: 25px;
width: 1540px;
height: 868px; height: 868px;
background: #FFFFFF; background: #FFFFFF;
border-radius: 36px; border-radius: 36px;

View File

@@ -18,6 +18,9 @@ module.exports = defineConfig({
}) })
] ]
} }
},
less: {
additionalData: `@import "@/static/css/app.less";` // 注入全局变量文件
} }
} }
} }