Compare commits
10 Commits
5e34aaf402
...
60be63e2d2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60be63e2d2 | ||
|
|
8cabf98bd9 | ||
|
|
51ce853bde | ||
|
|
a46cbf79f6 | ||
|
|
52415dee0b | ||
|
|
01e9c26821 | ||
| 560581f1a4 | |||
| 17d2251a70 | |||
| dcd677bbab | |||
| 60f6fc4873 |
BIN
YOLO工具箱.zip
Normal file
8
package-lock.json
generated
@@ -12,7 +12,7 @@
|
||||
"core-js": "^3.8.3",
|
||||
"echarts": "^5.6.0",
|
||||
"element-plus": "^2.9.7",
|
||||
"pinia": "^3.0.1",
|
||||
"pinia": "^3.0.3",
|
||||
"qwebchannel": "^6.2.0",
|
||||
"vue": "^3.2.13",
|
||||
"vue-router": "^4.0.3",
|
||||
@@ -9709,9 +9709,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/pinia": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pinia/-/pinia-3.0.1.tgz",
|
||||
"integrity": "sha512-WXglsDzztOTH6IfcJ99ltYZin2mY8XZCXujkYWVIJlBjqsP6ST7zw+Aarh63E1cDVYeyUcPCxPHzJpEOmzB6Wg==",
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/pinia/-/pinia-3.0.3.tgz",
|
||||
"integrity": "sha512-ttXO/InUULUXkMHpTdp9Fj4hLpD/2AoJdmAbAeW2yu1iy1k+pkFekQXw5VpC0/5p51IOR/jDaDRfRWRnMMsGOA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/devtools-api": "^7.7.2"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"core-js": "^3.8.3",
|
||||
"echarts": "^5.6.0",
|
||||
"element-plus": "^2.9.7",
|
||||
"pinia": "^3.0.1",
|
||||
"pinia": "^3.0.3",
|
||||
"qwebchannel": "^6.2.0",
|
||||
"vue": "^3.2.13",
|
||||
"vue-router": "^4.0.3",
|
||||
|
||||
@@ -24,4 +24,10 @@ window.ResizeObserver = class ResizeObserver extends _ResizeObserver {
|
||||
super(callback)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<!-- <style lang="less">
|
||||
/*每个页面公共css */
|
||||
|
||||
@import "@/static/css/app.less";
|
||||
</style> -->
|
||||
@@ -1,17 +1,42 @@
|
||||
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() {
|
||||
return getAxios({ url: '/cgi-bin/cart/latest' })
|
||||
}
|
||||
export function login(data) {
|
||||
return postAxios({ url: 'api/account/login', data })
|
||||
}
|
||||
// export function login(data) {
|
||||
// return postAxios({ url: 'api/account/login', data })
|
||||
// }
|
||||
export function cheekalive(data) {
|
||||
return postAxios({ url: 'api/account/cheekalive', data })
|
||||
}
|
||||
export function tkhostdata(data) {
|
||||
return postAxios({ url: 'api/tkinfo/tkhostdata', data })
|
||||
}
|
||||
|
||||
export function dicts(data) {
|
||||
return postAxios({ url: 'api/param/dicts', data })
|
||||
}
|
||||
@@ -25,10 +50,7 @@ export function exporthosts(data) {
|
||||
export function downList(url, data) {
|
||||
return downFile(url, data)
|
||||
}
|
||||
//查询tk账号查询次数
|
||||
export function tkaccountuseinfo(data) {
|
||||
return postAxios({ url: 'api/tkinfo/tkaccountuseinfo', data })
|
||||
}
|
||||
|
||||
//查询员工
|
||||
export function getStaffList(data) {
|
||||
return postAxios({ url: 'api/account/list', data })
|
||||
@@ -41,7 +63,9 @@ export function managerhosts(data) {
|
||||
export function 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 })
|
||||
}
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 88 KiB |
BIN
src/assets/logo1.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 2.1 MiB After Width: | Height: | Size: 1.3 MiB |
BIN
src/assets/logoBg1.png
Normal file
|
After Width: | Height: | Size: 2.1 MiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 106 KiB |
BIN
src/assets/logotext1.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
src/assets/logotext12.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
@@ -38,6 +38,8 @@ export default {
|
||||
|
||||
this.inputTime = this.time
|
||||
this.getTkhostdetail();
|
||||
console.log(this.time)
|
||||
|
||||
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]),
|
||||
]
|
||||
|
||||
// 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.num++
|
||||
console.log("返回数据", this.seriesData)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<div class="sidebar">
|
||||
<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">
|
||||
</div>
|
||||
<ul>
|
||||
<li @click="updateActiveIndex(1)" v-show="userInfo.userType == 3">
|
||||
<li @click="updateActiveIndex(1)">
|
||||
<div>
|
||||
<img v-show="activeIndex == 1" src="@/assets/navAction.png" autoplay loop muted class="background-img">
|
||||
<div style="display: flex;">
|
||||
@@ -45,11 +45,13 @@ import { ref, reactive, onMounted } from 'vue';
|
||||
import { getUser } from '@/utils/storage'
|
||||
import { defineEmits } from 'vue';
|
||||
|
||||
|
||||
|
||||
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) => {
|
||||
@@ -58,23 +60,23 @@ const updateActiveIndex = (index) => {
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
<style scoped lang="less">
|
||||
.sidebar {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
height: 900px;
|
||||
width: 280px;
|
||||
background-color: #338F6A;
|
||||
background-color: @bg-color;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
|
||||
.logo {
|
||||
border-bottom: 1px solid #fff;
|
||||
padding-bottom: 29px;
|
||||
padding-top: 20px;
|
||||
|
||||
img:nth-of-type(1) {
|
||||
height: 40px;
|
||||
height: 66px;
|
||||
}
|
||||
|
||||
img:nth-of-type(2) {
|
||||
|
||||
11
src/main.js
@@ -5,14 +5,15 @@ import store from './store'
|
||||
import { createPinia } from 'pinia';
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
|
||||
// createApp(App).use(store).use(router).mount('#app')
|
||||
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'; // 引入中文语言包
|
||||
|
||||
const app = createApp(App);
|
||||
app.use(ElementPlus, {
|
||||
locale: zhCn, // 配置中文
|
||||
});
|
||||
|
||||
app.use(ElementPlus) // 注册 ElementPlus
|
||||
app.use(createPinia()); // 注册 Pinia
|
||||
app.use(store); // 注册 store
|
||||
app.use(router); // 注册 router
|
||||
app.mount('#app');
|
||||
|
||||
app.mount('#app');
|
||||
@@ -19,11 +19,12 @@ const routes = [
|
||||
name: 'hostsList',
|
||||
component: () => import(/* webpackChunkName: "hostsList" */ '../views/hosts/hostsList.vue')
|
||||
},
|
||||
{
|
||||
path: 'workBenches',
|
||||
name: 'workBenches',
|
||||
component: () => import(/* webpackChunkName: "hostsList" */ '../views/hosts/workbenches.vue')
|
||||
},]
|
||||
// {
|
||||
// path: 'workBenches',
|
||||
// name: 'workBenches',
|
||||
// component: () => import(/* webpackChunkName: "hostsList" */ '../views/hosts/workbenches.vue')
|
||||
// },
|
||||
]
|
||||
}
|
||||
]
|
||||
const router = createRouter({
|
||||
|
||||
4
src/static/css/app.less
Normal file
@@ -0,0 +1,4 @@
|
||||
@bg-color: #022b4e; // 主色
|
||||
@bg-color-light: #022b4eaf; // 浅主色
|
||||
@bg-color-light-light: #022b4e1c; // 浅浅主色
|
||||
@btn-bg-color: #045dac; // 黄色按钮主色
|
||||
@@ -9,4 +9,29 @@ export const noticeStore = defineStore('noticeNum', {
|
||||
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
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -4,33 +4,53 @@
|
||||
*/
|
||||
import axios from 'axios'
|
||||
import { getToken, getUser } from '@/utils/storage'
|
||||
import { useRouter } from 'vue-router';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import router from '@/router'
|
||||
|
||||
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 = ''
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// 生产环境
|
||||
baseURL = "http://api.tkpage.vvtiktok.cn"
|
||||
// baseURL = "http://192.168.0.116:8085/"
|
||||
// baseURL = "https://api.tkpage.yolozs.com"
|
||||
baseURL = "http://47.79.98.113:8101"
|
||||
// baseURL = "http://192.168.0.103:8085/"
|
||||
// baseURL = "http://192.168.1.174:8101"
|
||||
} 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) => {
|
||||
// if (getToken()) {
|
||||
// config.headers['token'] = getToken();
|
||||
// }
|
||||
|
||||
const tokenCache = tokenStore()
|
||||
console.log("config", config)
|
||||
const url = sliceUrl(config.url)
|
||||
console.log("url", url)
|
||||
// 请求超时时间 - 毫秒
|
||||
config.timeout = 60000
|
||||
config.baseURL = baseURL
|
||||
// 自定义Content-type
|
||||
config.headers['Content-type'] = 'application/json'
|
||||
if (!(config.url == 'bigbrother-doLogin' || config.url == 'get-id-by-name')) {
|
||||
config.headers['vvtoken'] = tokenCache.token;
|
||||
}
|
||||
|
||||
return config;
|
||||
}, (error) => {
|
||||
return Promise.reject(error)
|
||||
@@ -38,7 +58,19 @@ axios.interceptors.request.use((config) => {
|
||||
|
||||
// 响应拦截器
|
||||
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) => {
|
||||
// 可添加请求失败后的处理逻辑
|
||||
return Promise.reject(error)
|
||||
@@ -54,10 +86,9 @@ export function getAxios({ url, params }) {
|
||||
params
|
||||
// 请求成功,将返回的数据传递给resolve函数
|
||||
}).then(res => {
|
||||
resolve(res.data)
|
||||
resolve(res)
|
||||
// 请求失败,将错误信息传递给reject函数
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
@@ -65,13 +96,6 @@ export function getAxios({ url, params }) {
|
||||
|
||||
// axios的post请求
|
||||
export function postAxios({ url, data }) {
|
||||
if (url != 'api/account/login') {
|
||||
|
||||
throttledCheekalive();
|
||||
|
||||
}
|
||||
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post(
|
||||
url,
|
||||
@@ -82,20 +106,9 @@ export function postAxios({ url, data }) {
|
||||
}
|
||||
}
|
||||
).then(res => {
|
||||
resolve(res.data)
|
||||
resolve(res)
|
||||
}).catch(err => {
|
||||
if (err.message == "Network Error") {
|
||||
// alert("网络错误,请检查网络连接")
|
||||
// ElMessage.error('网络连接错误');
|
||||
reject('网络连接错误')
|
||||
|
||||
} else {
|
||||
ElMessage.error(err.message);
|
||||
reject(err.message)
|
||||
|
||||
}
|
||||
// console.log(err)
|
||||
// reject(err)
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -132,9 +145,11 @@ export const downFile = async (urlstr, data) => {
|
||||
}
|
||||
//请求前验证
|
||||
function cheekalive() {
|
||||
const userCache = UserStore()
|
||||
const tokenCache = tokenStore()
|
||||
axios.post('api/account/cheekalive', {
|
||||
userId: getUser().userId,
|
||||
currcode: getToken(),
|
||||
userId: userCache.user.id,
|
||||
currcode: tokenCache.token,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
@@ -146,6 +161,7 @@ function cheekalive() {
|
||||
if (res.data) {
|
||||
|
||||
} else {
|
||||
stopScript();
|
||||
alert("账号在其他地方登录!")
|
||||
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
|
||||
@@ -1,11 +1,12 @@
|
||||
// pythonBridge.js
|
||||
import { ref, onMounted } from 'vue';
|
||||
const bridge = ref(null);
|
||||
import { ElMessage } from 'element-plus';
|
||||
const pyBridge = ref(null);
|
||||
// 初始化 QWebChannel
|
||||
const initBridge = () => {
|
||||
if (/localhost/.test(window.location.href)) return
|
||||
new QWebChannel(qt.webChannelTransport, (channel) => {
|
||||
bridge.value = channel.objects.bridge;
|
||||
pyBridge.value = channel.objects.bridge;
|
||||
});
|
||||
};
|
||||
export function usePythonBridge() {
|
||||
@@ -13,105 +14,185 @@ export function usePythonBridge() {
|
||||
|
||||
|
||||
|
||||
// 调用 Python 方法
|
||||
const fetchDataConfig = (data) => {
|
||||
// // 调用 Python 方法
|
||||
// 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) => {
|
||||
if (bridge.value) {
|
||||
bridge.value.fetchDataConfig(data, function (result) {
|
||||
if (pyBridge.value) {
|
||||
pyBridge.value.deleteAccountInfo(JSON.stringify(data),function (result) {
|
||||
resolve(result);
|
||||
});
|
||||
}else{
|
||||
console.log("pyBridge is null未连接上")
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
// 查询获取主播的数据
|
||||
const fetchDataCount = () => {
|
||||
//获取前端储存数据
|
||||
const getStorageData = (data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (bridge.value) {
|
||||
bridge.value.fetchDataCount(function (result) {
|
||||
if (pyBridge.value) {
|
||||
pyBridge.value.readAccountInfo(JSON.stringify(data),function (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后台
|
||||
const loginTikTok = () => {
|
||||
if (bridge.value) {
|
||||
bridge.value.loginTikTok(function (result) {
|
||||
|
||||
if (pyBridge.value) {
|
||||
pyBridge.value.loginTikTok(function (result) {
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// 登录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));
|
||||
}
|
||||
|
||||
}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));
|
||||
// }
|
||||
|
||||
// }
|
||||
// };
|
||||
|
||||
//跳转到主播页面
|
||||
const givePyAnchorId = (id) => {
|
||||
|
||||
if (bridge.value) {
|
||||
bridge.value.givePyAnchorId(id, function (result) {
|
||||
|
||||
console.log("id",id);
|
||||
if (pyBridge.value) {
|
||||
pyBridge.value.givePyAnchorId(id, function (result) {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//查询登录状态
|
||||
const backStageloginStatus = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (bridge.value) {
|
||||
bridge.value.backStageloginStatus(function (result) {
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
});
|
||||
// //查询登录状态
|
||||
// const backStageloginStatus = () => {
|
||||
// return new Promise((resolve, reject) => {
|
||||
// if (bridge.value) {
|
||||
// bridge.value.backStageloginStatus(function (result) {
|
||||
// resolve(result);
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
|
||||
};
|
||||
//查询登录状态
|
||||
const backStageloginStatusCopy = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (bridge.value) {
|
||||
bridge.value.backStageloginStatusCopy(function (result) {
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
});
|
||||
// };
|
||||
// //查询登录状态
|
||||
// const backStageloginStatusCopy = () => {
|
||||
// return new Promise((resolve, reject) => {
|
||||
// if (bridge.value) {
|
||||
// bridge.value.backStageloginStatusCopy(function (result) {
|
||||
// resolve(result);
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
|
||||
};
|
||||
// };
|
||||
|
||||
//导出表格
|
||||
const exportToExcel = (data) => {
|
||||
if (bridge.value) {
|
||||
bridge.value.exportToExcel(JSON.stringify(data));
|
||||
if (pyBridge .value) {
|
||||
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);
|
||||
|
||||
return {
|
||||
fetchDataConfig,
|
||||
fetchDataCount,
|
||||
loginBackStage,
|
||||
loginTikTok,
|
||||
exportToExcel,
|
||||
stopScript,
|
||||
controlTask,
|
||||
getBrotherInfo,
|
||||
getVersion,
|
||||
givePyAnchorId,
|
||||
backStageloginStatus,
|
||||
backStageloginStatusCopy,
|
||||
exportToExcel
|
||||
getStorageData,
|
||||
setStorageData,
|
||||
deleteStorageData,
|
||||
};
|
||||
}
|
||||
@@ -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() {
|
||||
return localStorage.getItem('token');
|
||||
export async function getToken() {
|
||||
const res = await getStorageData({ key: 'token' });
|
||||
return JSON.parse(res);
|
||||
}
|
||||
|
||||
export function removeToken() {
|
||||
localStorage.removeItem('token');
|
||||
export async function removeToken() {
|
||||
const res = deleteStorageData({key: 'token'});
|
||||
}
|
||||
|
||||
export function setUser(user) {
|
||||
|
||||
localStorage.setItem('user', JSON.stringify(user));
|
||||
export async function setUser(user) {
|
||||
const res = await setStorageData({key: 'user',data: user}).then(res => {
|
||||
});
|
||||
}
|
||||
|
||||
export function getUser() {
|
||||
return JSON.parse(localStorage.getItem('user'));
|
||||
export async function getUser() {
|
||||
const res = await getStorageData({ key: 'user' });
|
||||
return JSON.parse(res);
|
||||
}
|
||||
|
||||
export function setNumData(numData) {
|
||||
localStorage.setItem('num', JSON.stringify(numData));
|
||||
export async function setNumData(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) {
|
||||
localStorage.setItem('userPass', JSON.stringify(userdata));
|
||||
export async function setUserPass(userdata) {
|
||||
const res = await setStorageData({key: 'userPass',data:userdata})
|
||||
}
|
||||
// 导出一个函数,用于获取用户密码
|
||||
export function getUserPass() {
|
||||
return JSON.parse(localStorage.getItem('userPass'));
|
||||
export async function getUserPass() {
|
||||
const res = await getStorageData({ key: 'userPass' });
|
||||
return JSON.parse(res);
|
||||
}
|
||||
|
||||
// 用于设置tk账户密码
|
||||
export function setTkUser(userdata) {
|
||||
localStorage.setItem('tkuser', JSON.stringify(userdata));
|
||||
export async function setTkUser(userdata) {
|
||||
const res = await setStorageData({key: 'tkuser',data: userdata})
|
||||
}
|
||||
// 用于获取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);
|
||||
}
|
||||
|
||||
@@ -1,295 +1,351 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<div class="container">
|
||||
<div class="right">
|
||||
<img src="../assets/logoBg.png" class="background-video" alt="">
|
||||
<!-- 设置 -->
|
||||
<div class="center-align">
|
||||
<div></div>
|
||||
<div class="setup">
|
||||
<div class="setup-item center-justify">
|
||||
<div></div>
|
||||
<span>
|
||||
网络设置
|
||||
</span>
|
||||
</div>
|
||||
<div class="setup-item center-justify">
|
||||
<div></div>
|
||||
<span>
|
||||
简体中文
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="center-line" style="margin-top: 40px;">
|
||||
<!-- logo -->
|
||||
<div class="logo">
|
||||
<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>
|
||||
<div class="main">
|
||||
<div class="container">
|
||||
<div class="right">
|
||||
<img src="../assets/logoBg.png" class="background-video" alt="" />
|
||||
<!-- 设置 -->
|
||||
<div class="center-align">
|
||||
<div></div>
|
||||
<div class="setup">
|
||||
<div class="setup-item center-justify">
|
||||
<div></div>
|
||||
<span> 网络设置 </span>
|
||||
</div>
|
||||
<div class="setup-item center-justify">
|
||||
<div></div>
|
||||
<span> 简体中文 </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="center-line" style="margin-top: 40px">
|
||||
<!-- logo -->
|
||||
<div class="logo">
|
||||
<!-- <div class="center-justify" style="height: 80px; width: 300px;">
|
||||
<img style="height: 100%;" src="@/assets/logotext.png">
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<!-- From -->
|
||||
<div class="from">
|
||||
<div class="from-title center-justify">
|
||||
<div>账号登陆</div>
|
||||
</div>
|
||||
<!-- From -->
|
||||
<div class="from">
|
||||
<div class="from-title center-justify">
|
||||
<div>账号登陆</div>
|
||||
</div>
|
||||
|
||||
<div class="from-input">
|
||||
<el-form label-position="left" label-width="100px" :model="formData">
|
||||
<div class="from-input">
|
||||
<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">
|
||||
<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-item">
|
||||
<el-button class="loginButton" color="#8f7ee7" type="primary"
|
||||
@click="onSubmit">登录</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="from-input-item">
|
||||
<el-button
|
||||
class="loginButton"
|
||||
color="#8f7ee7"
|
||||
type="primary"
|
||||
@click="onSubmit"
|
||||
>登录</el-button
|
||||
>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="version center-justify">版本号:{{ version }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { login } from '@/api/account';
|
||||
import { getToken, setToken, setUser, setUserPass, getUserPass } from '@/utils/storage';
|
||||
import { ElLoading } from 'element-plus';
|
||||
import { ref, reactive, onMounted } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { login, rentgetloginID } from "@/api/account";
|
||||
import { getToken, setToken, setUser, setUserPass, getUserPass } from "@/utils/storage";
|
||||
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 formData = ref({
|
||||
userId: getUserPass() == null ? '' : getUserPass().userId,
|
||||
password: getUserPass() == null ? '' : getUserPass().password,
|
||||
});
|
||||
|
||||
const formData = ref({});
|
||||
|
||||
const onSubmit = () => {
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: 'Loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)',
|
||||
});
|
||||
setUserPass(formData.value);
|
||||
login({
|
||||
userId: formData.value.userId,
|
||||
password: formData.value.password,
|
||||
}).then((res) => {
|
||||
loading.close();
|
||||
console.log(res)
|
||||
if (res) {
|
||||
if (res.activeYn == 'Y') {
|
||||
setToken(res.currcode);
|
||||
setUser(res);
|
||||
router.push('/nav');
|
||||
} else {
|
||||
alert('账号未启用');
|
||||
}
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: "Loading",
|
||||
background: "rgba(0, 0, 0, 0.7)",
|
||||
});
|
||||
rentgetloginID({
|
||||
name: formData.value.tenantName,
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
|
||||
} else {
|
||||
alert('账号或密码错误');
|
||||
}
|
||||
|
||||
}).catch((err) => {
|
||||
loading.close();
|
||||
});
|
||||
login({
|
||||
username: formData.value.userId,
|
||||
tenantId: res,
|
||||
password: formData.value.password,
|
||||
})
|
||||
.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>
|
||||
|
||||
<style lang="less">
|
||||
.main {
|
||||
width: 1600px;
|
||||
height: 900px;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
width: 1600px;
|
||||
height: 900px;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
|
||||
/* 页面无法选中 */
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
/* 页面无法选中 */
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
width: 1600px;
|
||||
height: 900px;
|
||||
.container {
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
width: 1600px;
|
||||
height: 900px;
|
||||
|
||||
.right {
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
width: 1600px;
|
||||
height: 900px;
|
||||
padding: 20px 40px 20px 50px;
|
||||
border-left: 3px solid #23516e;
|
||||
position: relative;
|
||||
/* 添加 position: relative */
|
||||
overflow: hidden;
|
||||
/* 防止内容溢出 */
|
||||
.right {
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
width: 1600px;
|
||||
height: 900px;
|
||||
padding: 20px 40px 20px 50px;
|
||||
border-left: 3px solid #23516e;
|
||||
position: relative;
|
||||
/* 添加 position: relative */
|
||||
overflow: hidden;
|
||||
/* 防止内容溢出 */
|
||||
|
||||
.background-video {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: -1;
|
||||
/* 确保视频在内容之下 */
|
||||
}
|
||||
.version {
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
font-size: 20px;
|
||||
bottom: 20px;
|
||||
left: calc(50% - 50px);
|
||||
// box-sizing: border-box;
|
||||
// width: 1600px;
|
||||
}
|
||||
|
||||
.setup {
|
||||
display: flex;
|
||||
color: #fff;
|
||||
.background-video {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: -1;
|
||||
/* 确保视频在内容之下 */
|
||||
}
|
||||
|
||||
.setup-item {
|
||||
padding: 10px 6px;
|
||||
display: flex;
|
||||
.setup {
|
||||
display: flex;
|
||||
color: #fff;
|
||||
|
||||
div {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
background-color: rgb(255, 255, 255);
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.setup-item {
|
||||
padding: 10px 6px;
|
||||
display: flex;
|
||||
|
||||
.logo {
|
||||
padding: 20px 0;
|
||||
}
|
||||
div {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
background-color: rgb(255, 255, 255);
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.from {
|
||||
width: 420px;
|
||||
height: 320px;
|
||||
color: #107A4E;
|
||||
background-color: #ffffff44;
|
||||
border-radius: 20px;
|
||||
border: 1px solid #fff;
|
||||
padding: 32px;
|
||||
box-sizing: border-box;
|
||||
.logo {
|
||||
padding: 20px 0;
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
.from-title {
|
||||
font-family: Source Han Sans SC;
|
||||
font-weight: 500;
|
||||
font-size: 24px;
|
||||
color: #107A4E;
|
||||
line-height: 37px;
|
||||
.from {
|
||||
width: 420px;
|
||||
// height: 320px;
|
||||
color: @bg-color;
|
||||
background-color: #ffffff44;
|
||||
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 {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
// border-bottom: 4px solid #1db97d;
|
||||
}
|
||||
}
|
||||
div {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
// border-bottom: 4px solid #1db97d;
|
||||
}
|
||||
}
|
||||
|
||||
.from-input {
|
||||
width: 100%;
|
||||
padding: 15px 0;
|
||||
.from-input {
|
||||
width: 100%;
|
||||
padding: 15px 0;
|
||||
|
||||
.from-input-item {
|
||||
display: flex;
|
||||
padding: 8px 0;
|
||||
.from-input-item {
|
||||
display: flex;
|
||||
padding: 8px 0;
|
||||
|
||||
.from-input-item-title {
|
||||
color: #107A4E;
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
width: 80px;
|
||||
height: 50px;
|
||||
}
|
||||
.from-input-item-title {
|
||||
color: @bg-color;
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
width: 80px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.loginButton {
|
||||
width: 359px;
|
||||
height: 50px;
|
||||
background: #FFFFFF;
|
||||
border-radius: 24px;
|
||||
border: 1px solid #FFFFFF;
|
||||
.loginButton {
|
||||
width: 359px;
|
||||
height: 50px;
|
||||
background: #ffffff;
|
||||
border-radius: 24px;
|
||||
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;
|
||||
font-weight: 500;
|
||||
font-size: 18px;
|
||||
color: #107A4E;
|
||||
line-height: 37px;
|
||||
}
|
||||
}
|
||||
|
||||
.from-input-item1 {
|
||||
display: flex;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.from-input-item1 {
|
||||
display: flex;
|
||||
width: 359px;
|
||||
height: 50px;
|
||||
background: @bg-color-light-light;
|
||||
border-radius: 24px;
|
||||
border: 1px solid #ffffff;
|
||||
padding: 12px 25px 13px 25px;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.center-line {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.center-justify {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.center-align {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.center-flex {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.el-input__wrapper {
|
||||
--el-input-focus-border-color: rgba(255, 255, 0, 0);
|
||||
--el-menu-hover-bg-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);
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
<style scoped lang="less">
|
||||
::v-deep(.el-input__wrapper) {
|
||||
background-color: rgba(255, 0, 0, 0);
|
||||
box-shadow: none;
|
||||
|
||||
background-color: rgba(255, 0, 0, 0);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
::v-deep(.el-input__inner) {
|
||||
color: #107A4E;
|
||||
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
::v-deep(.el-input__inner::placeholder) {
|
||||
color: #107A4E;
|
||||
color: @bg-color;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -3,13 +3,15 @@
|
||||
<div class="center-align" style="width: 100%; margin: 0 20px;">
|
||||
<div class="box-card-num1 center-line">
|
||||
<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.canInvitationCount }}</span></div>
|
||||
<div>运行时间: <span>{{ formattedTime }}</span></div>
|
||||
|
||||
</div>
|
||||
<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="startTimer">计时开始</el-button> -->
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -55,7 +57,7 @@
|
||||
<!-- <el-button class="reset-button" @click="reset">重置数据</el-button> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>n
|
||||
</template>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<div class="input-group">
|
||||
@@ -86,14 +88,14 @@
|
||||
<el-col :span="8">
|
||||
<div class="input-group">
|
||||
<label>后台查询频率</label>
|
||||
<el-input type='number' v-model="pyData.frequency.hour" :min="0"
|
||||
:max="pyData.frequency.day - 1" placeholder="次/小时" style="width: 100%"
|
||||
:disabled="!pyData.isStart">
|
||||
<!-- <el-input type='number' v-model="pyData.frequency.hour" @input="handleInputHour" -->
|
||||
<el-input type='number' v-model="pyData.frequency.hour" placeholder="次/小时"
|
||||
style="width: 100%" :disabled="!pyData.isStart">
|
||||
<template #append>次/小时</template>
|
||||
</el-input>
|
||||
<el-input type='number' v-model="pyData.frequency.day" :min="pyData.frequency.hour + 1"
|
||||
:max="100" placeholder="次/24小时" style="width: 100%; margin-top: 10px"
|
||||
:disabled="!pyData.isStart">
|
||||
<!-- <el-input type='number' v-model="pyData.frequency.day" @input="handleInputDay" -->
|
||||
<el-input type='number' v-model="pyData.frequency.day" placeholder="次/24小时"
|
||||
style="width: 100%; margin-top: 10px" :disabled="!pyData.isStart">
|
||||
<template #append>次/24小时</template>
|
||||
</el-input>
|
||||
</div>
|
||||
@@ -113,12 +115,13 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { ref, onMounted, computed } from 'vue';
|
||||
import { usePythonBridge, } from '@/utils/pythonBridge'
|
||||
import { setNumData, getNumData, getUser, setTkUser, getTkUser } from '@/utils/storage'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { getCountryName } from '@/utils/countryUtil'
|
||||
import { tkaccountuseinfo } from '@/api/account'
|
||||
|
||||
//导入python交互方法
|
||||
const { fetchDataConfig, fetchDataCount, loginBackStage, loginTikTok, backStageloginStatus, backStageloginStatusCopy } = usePythonBridge();
|
||||
|
||||
@@ -132,16 +135,27 @@ let hostData = ref({
|
||||
validAnchorsCount: 0,
|
||||
canInvitationCount: 0,
|
||||
checkedDataCount: 0,
|
||||
|
||||
});
|
||||
//是否开启tk
|
||||
// let isTk = ref(true);
|
||||
|
||||
//账号是否登陆中
|
||||
let isLogin = ref([false, false]);
|
||||
//设置状态轮询定时器
|
||||
let statusTimer = ref(null);
|
||||
let statusTimerCopy = ref(null);
|
||||
|
||||
//设置次数最大值
|
||||
let maxCount = ref([
|
||||
{
|
||||
hourMax: 50,
|
||||
dayMax: 300,
|
||||
},
|
||||
{
|
||||
hourMax: 100,
|
||||
dayMax: 600,
|
||||
},
|
||||
]);
|
||||
|
||||
//tk账号信息
|
||||
let tkData = ref([
|
||||
@@ -158,9 +172,7 @@ let tkData = ref([
|
||||
index: 2,
|
||||
code: 0,
|
||||
num: 0
|
||||
|
||||
},
|
||||
|
||||
]);
|
||||
|
||||
//python需要的数据
|
||||
@@ -179,6 +191,7 @@ let pyData = ref({
|
||||
//按钮提交状态
|
||||
let submitting = ref(true);
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
//从缓存获取数据
|
||||
if (getNumData()) {
|
||||
@@ -194,7 +207,6 @@ onMounted(() => {
|
||||
tkaccountuse(tkData.value[1].account, 1)
|
||||
|
||||
getIpInfo()
|
||||
//查询次数查询
|
||||
|
||||
|
||||
})
|
||||
@@ -211,6 +223,22 @@ const getIpInfo = async () => {
|
||||
countryData.value = getCountryName(data.country);
|
||||
} catch (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('请输入正确的区间值');
|
||||
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('请输入正确的频率区间值');
|
||||
return;
|
||||
}
|
||||
@@ -265,14 +293,16 @@ const submit = () => {
|
||||
tenantId: getUser().tenantId,
|
||||
userId: getUser().userId,
|
||||
})).then((res) => {
|
||||
|
||||
//开始计时器
|
||||
startTimer();
|
||||
//开启查询次数
|
||||
getHostTimer.value = setInterval(() => {
|
||||
fetchDataCount().then((res) => {
|
||||
hostData.value = JSON.parse(res);
|
||||
tkaccountuse(tkData.value[0].account, 0)
|
||||
tkaccountuse(tkData.value[1].account, 1)
|
||||
})
|
||||
}, 1000);
|
||||
}, 5000);
|
||||
|
||||
|
||||
}).finally(() => {
|
||||
@@ -302,6 +332,7 @@ const unsubmit = () => {
|
||||
tenantId: getUser().tenantId,
|
||||
userId: getUser().userId,
|
||||
})).then((res) => {
|
||||
pauseTimer();
|
||||
pyData.value.isStart = true;
|
||||
clearInterval(getHostTimer.value);
|
||||
getHostTimer.value = null;
|
||||
@@ -378,13 +409,114 @@ function getloginStatusCopy() {
|
||||
|
||||
function tkaccountuse(id, index) {
|
||||
let num = 0;
|
||||
tkaccountuseinfo({ userId: id }).then((res) => {
|
||||
num = res
|
||||
tkData.value[index].num = num
|
||||
console.log('账号使用次数', tkData.value[index].num)
|
||||
tkaccountuseinfo(id).then((res) => {
|
||||
if (res) {
|
||||
num = res
|
||||
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>
|
||||
|
||||
<style scoped lang="less">
|
||||
@@ -419,7 +551,7 @@ function tkaccountuse(id, index) {
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0px 0px 21px 0px rgba(183, 183, 183, 0.33);
|
||||
border-radius: 24px;
|
||||
padding-top: 60px;
|
||||
// padding-top: 60px;
|
||||
box-sizing: border-box;
|
||||
|
||||
div {
|
||||
@@ -519,7 +651,7 @@ label {
|
||||
.open-login {
|
||||
width: 100px;
|
||||
height: 47px;
|
||||
background: #E7CA92;
|
||||
background: @btn-bg-color;
|
||||
border-radius: 10px;
|
||||
border: none;
|
||||
}
|
||||
@@ -527,7 +659,7 @@ label {
|
||||
.reset-button {
|
||||
width: 132px;
|
||||
height: 47px;
|
||||
background: #E7CA92;
|
||||
background: @btn-bg-color;
|
||||
border-radius: 10px;
|
||||
|
||||
font-family: Source Han Sans SC;
|
||||
@@ -541,7 +673,7 @@ label {
|
||||
.submit-button {
|
||||
width: 160px;
|
||||
height: 47px;
|
||||
background: #338F6A;
|
||||
background: @bg-color;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
@@ -572,9 +704,9 @@ label {
|
||||
</style>
|
||||
|
||||
|
||||
<style scoped>
|
||||
<style scoped lang="less">
|
||||
::v-deep(.el-input-group__prepend) {
|
||||
background: #84CEB2;
|
||||
background: @bg-color-light;
|
||||
border-radius: 10px 0px 0px 10px;
|
||||
border: 1px solid #B7CEC5;
|
||||
font-family: Source Han Sans SC;
|
||||
@@ -585,7 +717,7 @@ label {
|
||||
}
|
||||
|
||||
::v-deep(.el-input-group__append) {
|
||||
background: #84CEB2;
|
||||
background: @bg-color-light;
|
||||
border-radius: 0px 10px 10px 0px;
|
||||
border: 1px solid #B7CEC5;
|
||||
font-family: Source Han Sans SC;
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<Sidebar class="noneText" @activeIndex="activeIndexFn" />
|
||||
<!-- <Sidebar class="noneText" @activeIndex="activeIndexFn" /> -->
|
||||
<div class="content ">
|
||||
<div v-show="activeIndex == 1">
|
||||
<workbenches v-if="openWerk" />
|
||||
</div>
|
||||
<div v-show="activeIndex == 2">
|
||||
<hostsList v-if="openList" />
|
||||
<!-- <div v-show="activeIndexA == 1">
|
||||
<workbenches />
|
||||
</div> -->
|
||||
<div>
|
||||
<hostsList />
|
||||
</div>
|
||||
<!-- <div style="position: absolute; bottom: 0; right: 0;">{{ version }}</div> -->
|
||||
|
||||
|
||||
</div>
|
||||
@@ -15,32 +16,30 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import Sidebar from '../components/Sidebar.vue';
|
||||
// import Sidebar from '../components/Sidebar.vue';
|
||||
import { RouterLink, RouterView } from 'vue-router'
|
||||
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 { getUser } from '@/utils/storage'
|
||||
|
||||
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)
|
||||
// import { usePythonBridge } from '@/utils/pythonBridge'
|
||||
|
||||
|
||||
|
||||
function activeIndexFn(data) {
|
||||
activeIndex.value = data
|
||||
openWerk.value = true
|
||||
openList.value = true
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// let activeIndexA = ref(1)
|
||||
|
||||
// function activeIndexFn(data) {
|
||||
// activeIndexA.value = data
|
||||
// console.log(data)
|
||||
// }
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style lang="less">
|
||||
body,
|
||||
html {
|
||||
margin: 0;
|
||||
@@ -52,7 +51,8 @@ html {
|
||||
display: flex;
|
||||
width: 1600px;
|
||||
height: 900px;
|
||||
background-color: #338F6A;
|
||||
background-color: @bg-color;
|
||||
position: relative;
|
||||
|
||||
|
||||
}
|
||||
@@ -67,14 +67,16 @@ html {
|
||||
|
||||
.sidebar {
|
||||
width: 200px;
|
||||
background-color: #338F6A;
|
||||
background-color: @bg-color;
|
||||
padding: 20px;
|
||||
/* box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1); */
|
||||
}
|
||||
|
||||
.content {
|
||||
margin-left: 280px;
|
||||
width: 1304px;
|
||||
// margin-left: 280px;
|
||||
margin-left: 25px;
|
||||
margin-right: 25px;
|
||||
width: 1540px;
|
||||
height: 868px;
|
||||
background: #FFFFFF;
|
||||
border-radius: 36px;
|
||||
|
||||
@@ -18,6 +18,9 @@ module.exports = defineConfig({
|
||||
})
|
||||
]
|
||||
}
|
||||
},
|
||||
less: {
|
||||
additionalData: `@import "@/static/css/app.less";` // 注入全局变量文件
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||