This commit is contained in:
2025-06-24 13:35:33 +08:00
parent 17d2251a70
commit 560581f1a4
20 changed files with 434 additions and 515 deletions

BIN
YOLO工具箱.zip Normal file

Binary file not shown.

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,43 @@
import { getAxios, postAxios, downFile } from '@/utils/axios.js' import { getAxios, postAxios, downFile } from '@/utils/axios.js'
export function getIdByName(name) {
return getAxios({ url: `/api/tenant/get-id-by-name?name=${name}` })
}
export function login(data) {
return postAxios({ url: '/api/user/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/save_data/hosts_info', 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 +51,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,11 +64,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) { export function accountName(str) {
return postAxios({ url: 'api/account/accountName?accounts=' + 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

@@ -95,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;">
@@ -49,9 +49,9 @@ 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) => {
@@ -60,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,11 +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') // 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

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

@@ -4,33 +4,37 @@
*/ */
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 { usePythonBridge, } from '@/utils/pythonBridge'
const { stopScript } = usePythonBridge(); 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://120.26.251.180:8085/" baseURL = "http://192.168.1.174:8101"
// baseURL = "http://192.168.0.103:8085/" // baseURL = "http://192.168.0.103:8085/"
} else { } else {
// 测试环境 // 测试环境
// baseURL = "http://120.26.251.180:8085/" // baseURL = "http://120.26.251.180:8085/"
// 开发环境 // 开发环境
baseURL = "http://api.tkpage.vvtiktok.cn" baseURL = "https://api.tkpage.yolozs.com"
// baseURL = "http://api.tkpage.vvtiktok.cn"
} }
// 请求拦截器 // 请求拦截器
axios.interceptors.request.use((config) => { axios.interceptors.request.use((config) => {
// if (getToken()) { console.log("config", config)
// config.headers['token'] = getToken(); const url = sliceUrl(config.url)
// } console.log("url", url)
if (!(config.url == 'doLogin' || config.url == 'get-id-by-name')) {
config.headers['vvtoken'] = getToken();
}
// 请求超时时间 - 毫秒 // 请求超时时间 - 毫秒
config.timeout = 60000 config.timeout = 60000
@@ -44,7 +48,15 @@ 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 {
router.push('/')
ElMessage.error(response.data.code + '' + response.data.message);
}
}, (error) => { }, (error) => {
// 可添加请求失败后的处理逻辑 // 可添加请求失败后的处理逻辑
return Promise.reject(error) return Promise.reject(error)
@@ -60,10 +72,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)
}) })
}) })
@@ -71,13 +82,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,
@@ -88,21 +92,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 {
console.log(err)
ElMessage.error('报错啦' + err.response.status);
// reject(err)
}
// console.log(err)
}) })
}) })
} }
@@ -175,6 +167,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

@@ -25,8 +25,8 @@
<!-- logo --> <!-- logo -->
<div class="logo"> <div class="logo">
<div class="center-justify" style="height: 80px; width: 300px;"> <div class="center-justify" style="height: 80px; width: 300px;">
<img style="margin-right: 20px;" src="@/assets/logo.png"> <!-- <img style="margin-right: 20px;height: 100%;" src="@/assets/logo.png"> -->
<img src="@/assets/logotext.png"> <img style="height: 100%;" src="@/assets/logotext.png">
</div> </div>
</div> </div>
@@ -38,7 +38,11 @@
<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"> <div class="from-input-item1">
<img src="@/assets/username.png" alt=""> <img src="@/assets/username.png" alt="">
<el-input style="height: 25px;" v-model="formData.userId" placeholder="账号" clearable <el-input style="height: 25px;" v-model="formData.userId" placeholder="账号" clearable
@@ -70,7 +74,7 @@
<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, getIdByName } 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 { usePythonBridge } from '@/utils/pythonBridge'
@@ -91,6 +95,7 @@ onMounted(() => {
const router = useRouter(); const router = useRouter();
const formData = ref({ const formData = ref({
tenantName: getUserPass() == null ? '' : getUserPass().tenantName,
userId: getUserPass() == null ? '' : getUserPass().userId, userId: getUserPass() == null ? '' : getUserPass().userId,
password: getUserPass() == null ? '' : getUserPass().password, password: getUserPass() == null ? '' : getUserPass().password,
}); });
@@ -104,29 +109,24 @@ const onSubmit = () => {
background: 'rgba(0, 0, 0, 0.7)', background: 'rgba(0, 0, 0, 0.7)',
}); });
setUserPass(formData.value); setUserPass(formData.value);
login({ getIdByName(formData.value.tenantName).then((tenantId) => {
userId: formData.value.userId, console.log(tenantId)
password: formData.value.password, login({
source: 'app' tenantId: Number(tenantId),
}).then((res) => { username: formData.value.userId,
loading.close(); password: formData.value.password,
console.log(res) }).then((res) => {
if (res.code == 200) { loading.close();
if (res.data.activeYn == 'Y') { console.log(res)
setToken(res.data.currcode); setToken(res.tokenValue);
setUser(res.data); setUser(res);
router.push('/nav'); router.push('/nav');
} else { }).catch((err) => {
alert('账号未启用'); loading.close();
} });
})
} else {
alert(res.mes);
}
}).catch((err) => {
loading.close();
});
}; };
</script> </script>
@@ -207,8 +207,8 @@ const onSubmit = () => {
.from { .from {
width: 420px; width: 420px;
height: 320px; // height: 320px;
color: #107A4E; color: @bg-color;
background-color: #ffffff44; background-color: #ffffff44;
border-radius: 20px; border-radius: 20px;
border: 1px solid #fff; border: 1px solid #fff;
@@ -219,7 +219,7 @@ const onSubmit = () => {
font-family: Source Han Sans SC; font-family: Source Han Sans SC;
font-weight: 500; font-weight: 500;
font-size: 24px; font-size: 24px;
color: #107A4E; color: @bg-color;
line-height: 37px; line-height: 37px;
@@ -239,7 +239,7 @@ const onSubmit = () => {
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;
@@ -257,7 +257,7 @@ const onSubmit = () => {
font-family: Source Han Sans SC; font-family: Source Han Sans SC;
font-weight: 500; font-weight: 500;
font-size: 18px; font-size: 18px;
color: #107A4E; color: @bg-color;
line-height: 37px; line-height: 37px;
} }
} }
@@ -266,7 +266,7 @@ const onSubmit = () => {
display: flex; display: flex;
width: 359px; width: 359px;
height: 50px; height: 50px;
background: rgba(147, 174, 158, 0.37); background: @bg-color-light-light;
border-radius: 24px; border-radius: 24px;
border: 1px solid #FFFFFF; border: 1px solid #FFFFFF;
padding: 12px 25px 13px 25px; padding: 12px 25px 13px 25px;
@@ -309,7 +309,7 @@ const onSubmit = () => {
} }
</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;
@@ -317,11 +317,11 @@ const onSubmit = () => {
} }
::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>

View File

@@ -7,24 +7,16 @@
</el-select> </el-select>
<div></div> <div></div>
<el-date-picker v-model="searchForm.time" type="date" value-format="YYYYMMDD" placeholder="选择查询时间" size="large" <el-date-picker v-model="searchForm.createTime" type="date" value-format="YYYY-MM-DD" placeholder="选择查询时间"
style="margin-left: 50px;width: 160px;" /> size="large" style="margin-left: 50px;width: 160px;" />
<el-input v-model="searchForm.hostId" placeholder="请输入主播id" size="large" <el-input v-model="searchForm.hostsId" placeholder="请输入主播id" size="large"
style="width: 160px; margin-left: 50px;" clearable /> style="width: 160px; margin-left: 50px;" clearable />
<el-select v-if="userInfo.userType == 3" v-model="searchForm.belongYn" filterable placeholder="分配情况"
style="width: 120px; margin-left: 50px;">
<el-option
v-for="item in [{ label: '全部', value: '' }, { label: '未分配', value: '0' }, { label: '已分配', value: '1' }]"
:key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-button class="serch-button" style="margin-left: 50px;" type="primary" @click="serch">查询</el-button> <el-button class="serch-button" style="margin-left: 50px;" type="primary" @click="serch">查询</el-button>
<el-button class="put-button" :disabled="tableData.length == 0" type="primary" <el-button class="put-button" :disabled="tableData.length == 0" type="primary"
@click="exportList">导出Excel数据</el-button> @click="exportList">导出Excel数据</el-button>
<el-button v-if="userInfo.userType == 3" class="put-button" type="primary" <!-- <el-button class="put-button" type="primary" @click="dialogFormVisible = true">分配给指定员工</el-button> -->
@click="dialogFormVisible = true">分配给指定员工</el-button>
<el-button @click="filterdialogVisible = true" style="width: 50px;" class="put-button" type="primary"><img <el-button @click="filterdialogVisible = true" style="width: 50px;" class="put-button" type="primary"><img
style="height: 30px;" src="@/assets/filter.png"></el-button> style="height: 30px;" src="@/assets/filter.png"></el-button>
</div> </div>
@@ -33,121 +25,29 @@
<el-table ref="multipleTableRef" :data="tableData" stripe v-loading="loading" height="500" <el-table ref="multipleTableRef" :data="tableData" stripe v-loading="loading" height="500"
@selection-change="handleSelectionChange"> @selection-change="handleSelectionChange">
<el-table-column type="selection" width="35" /> <el-table-column type="selection" width="35" />
<el-table-column fixed prop="hostId" label="主播id" width="160"> <el-table-column fixed prop="hostId" label="主播id" width="160">
<template #default="scope"> <template #default="scope">
<div class="hostIdText" :style="{ color: scope.row.useable == 'Y' ? 'green' : '#0f0092' }" <div class="hostIdText" @click="openHTML(scope.row.hostId)"> {{
@click="openHTML(scope.row.hostId)"> {{ scope.row.hostId }}</div>
scope.row.hostId }}</div>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column prop="hostName" label="主播名字" min-width="160">
<template #default="scope">
{{ scope.row.hostName }}
</template>
</el-table-column> -->
<el-table-column v-if="userInfo.userType == 3" prop="belongBy" label="分配情况" width="120">
<template #default="scope">
<el-popover v-if="scope.row.belongBy" placement="bottom" :width="200" trigger="hover"
@show="openAccountName(scope.row.belongBy)">
<template #reference>
<!-- <div @click="openAccountName(scope.row.belongBy)"> -->
<div style="color: green;">
{{ scope.row.belongBy == null || scope.row.belongBy == '' ? "未分配" : "已分配" }}
</div>
</template>
<div v-for="str in staffId" :key="str">
{{ str }}
</div>
<!-- <el-table :data="gridData">
<el-table-column width="150" property="date" label="date" />
<el-table-column width="100" property="name" label="name" />
</el-table> -->
</el-popover>
<div v-show="!scope.row.belongBy">未分配</div>
</template>
</el-table-column> <el-table-column prop="hostlevel" label="等级" width="80">
<el-table-column prop="hostlevel" label="等级" width="120">
<template #default="scope"> <template #default="scope">
{{ scope.row.hostlevel }} {{ scope.row.hostlevel }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-for="label in labelList" :key="label.paramCode" :prop="label.paramCode" <el-table-column v-for="label in labelList" :key="label.paramCode" :prop="label.paramCode"
:label="label.paramCodeMeaning" width="120"> :label="label.paramCodeMeaning" width="120">
<template v-if="label.paramCode != 'createDt'" #default="scope"> <template v-if="label.paramCode != 'createDt'" #default="scope">
<el-popover v-if="!(label.paramCode == 'hostcoins' || label.paramCode == 'ysthostcoins')"
placement="bottom" :width="600" trigger="hover">
<div style="height: 300px;">
<!-- createDt往前推7天 -->
<!-- <component :is="EChartsComponent" v-if="isPopoverVisible[`${scope.row.hostId}-${label.paramCode}`]"
:title="label.paramCodeMeaning" :id="scope.row.hostId" :dataType="label.paramCode"
:time="scope.row.createDt.split('T')[0].replace(/-/g, '').substring(0, 8)"></component> -->
<component :is="EChartsComponent" v-if="isPopoverVisible[`${scope.row.hostId}-${label.paramCode}`]"
:title="label.paramCodeMeaning" :id="scope.row.hostId" :dataType="label.paramCode"
:time="scope.row.updateDt"></component>
</div>
<template #reference>
<span @mouseover="openPopover(scope.row.hostId, label.paramCode)"
@mouseout="closePopover(scope.row.hostId, label.paramCode)">
{{ scope.row[label.paramCode] }}
</span>
</template>
</el-popover>
<el-popover v-else placement="bottom" :width="500" trigger="hover">
<div style="height: 300px;">
<!-- <component :is="EChartsComponent" v-if="isPopoverVisible[`${scope.row.hostId}-${label.paramCode}`]"
:title="label.paramCodeMeaning" :id="scope.row.hostId" :dataType="label.paramCode"
:time="scope.row.createDt.split('T')[0].replace(/-/g, '').substring(0, 8)">
</component> -->
<component :is="EChartsComponent" v-if="isPopoverVisible[`${scope.row.hostId}-${label.paramCode}`]"
:title="label.paramCodeMeaning" :id="scope.row.hostId" :dataType="label.paramCode"
:time="scope.row.updateDt">
</component>
</div>
<template #reference>
<!-- 鼠标移入时开启 -->
<span @mouseover="openPopover(scope.row.hostId, label.paramCode)"
@mouseout="closePopover(scope.row.hostId, label.paramCode)">
{{ scope.row[label.paramCode] }}
</span>
</template>
</el-popover>
</template>
</el-table-column>
<el-table-column v-if="userInfo.userType == 4" fixed="right" label="操作" width="120">
<template #default="scope">
<el-popover placement="top-start" :width="200" trigger="hover" :content="scope.row.comment">
<template #reference>
<el-button @click="openComment(scope.row)" link type="primary" size="small">维护情况</el-button>
</template>
</el-popover>
<select @change="handleSelectChange($event, scope.row)" v-model="scope.row.useable" class="m-2"
placeholder="Select" size="small" style="width: 70px">
<option label="未转化" value="N" />
<option label="已转化" value="Y" />
</select>
<el-dialog :modal="false" v-model="commentVisible" title="维护情况" align-center>
<el-input maxlength="80" v-model="commentInfo" placeholder="请输入维护情况" clearable show-word-limit />
<template #footer>
<span class="dialog-footer">
<el-button @click="commentVisible = false">取消</el-button>
<el-button type="primary" @click="uphostcomment()">
提交
</el-button>
</span>
</template>
</el-dialog>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="操作"> <!-- <el-table-column label="操作">
<template #default="scope"> <template #default="scope">
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center">
@@ -156,7 +56,9 @@
</template> </template>
</el-table-column> --> </el-table-column> -->
</el-table> </el-table>
</div> </div>
<!-- 分页 -->
<div class="center-justify" style="margin-top: 30px;"> <div class="center-justify" style="margin-top: 30px;">
<el-pagination v-model:current-page="page" v-model:page-size="pageSize" background <el-pagination v-model:current-page="page" v-model:page-size="pageSize" background
layout="sizes, prev, pager, next" :total="total" :page-sizes="[10, 20, 50, 100]" layout="sizes, prev, pager, next" :total="total" :page-sizes="[10, 20, 50, 100]"
@@ -165,63 +67,26 @@
</div> </div>
<el-dialog v-model="dialogFormVisible" title="分配主播" align-center>
<el-select v-model="staffValue" filterable placeholder="Select" style="width: 240px">
<el-option v-for="item in staffOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
<el-button type="primary" @click="allocation">
分配
</el-button>
</span>
</template>
</el-dialog>
<!-- <el-dialog v-model="hostNameVisible" title="分配情况" align-center>
{{ staffId }}
<template #footer>
<span class="dialog-footer">
<el-button type="primary" @click="hostNameVisible = false">
确定
</el-button>
</span>
</template>
</el-dialog> -->
<el-dialog v-model="filterdialogVisible" width="800px" :before-close="handleClose"> <el-dialog v-model="filterdialogVisible" width="800px" :before-close="handleClose">
<el-row :gutter="20" v-for="item in filterOptions" :key="item.type"> <el-row v-for="(field, index) in fields" :key="index" :gutter="20" style="margin-bottom: 10px">
<el-col :span="4"> <el-col :span="4">
<!-- <label>选择筛选条件</label> --> <div style="height: 100%; padding-top: 10px" class="center-justify">
<div style="height: 100%;padding-top: 10px;" class="center-justify"> {{ field.label }}
{{ item.label }}
</div> </div>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<div v-if="!(item.type == 'InvitationType')"><label>最小值</label></div> <div><label>最小值</label></div>
<div v-else><label>普票/金票</label></div> <el-input type="number" :oninput="'if(value.length>9)value=value.slice(0,9)'"
v-model.number="searchForm[field.minModel]" placeholder="请输入最小值" />
<el-input v-show="!(item.type == 'InvitationType')" oninput="if(value.length>10)value=value.slice(0,10)"
type="number" v-model.number="item.dataStart" placeholder="请输入最小值" />
<el-select v-show="(item.type == 'InvitationType')" v-model="item.dataStart" filterable placeholder="请选择"
style="width: 240px">
<el-option
v-for="item in [{ label: '全部', value: '' }, { label: '普票', value: '1' }, { label: '金票', value: '2' }]"
:key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<div v-show="!(item.type == 'InvitationType')"><label>最大值</label></div> <div><label>最大值</label></div>
<el-input type="number" :oninput="'if(value.length>9)value=value.slice(0,9)'"
<el-input v-show="!(item.type == 'InvitationType')" oninput="if(value.length>10)value=value.slice(0,10)" v-model.number="searchForm[field.maxModel]" placeholder="请输入最大值" />
type="number" v-model.number="item.dataEnd" placeholder="请输入最大值" />
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="4"> <el-col :span="4">
<!-- <label>选择筛选条件</label> --> <!-- <label>选择筛选条件</label> -->
@@ -235,7 +100,7 @@
<el-select v-model="sortData.sortType" filterable placeholder="请选择" style="width: 240px"> <el-select v-model="sortData.sortType" filterable placeholder="请选择" style="width: 240px">
<el-option v-for="item in filterOptions" :key="item.value" :label="item.label" :value="item.type" /> <el-option v-for="item in sortNameOptions" :key="item.type" :label="item.label" :value="item.type" />
</el-select> </el-select>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
@@ -250,7 +115,9 @@
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button type="primary" @click="reset">
重置
</el-button>
<!-- <el-button @click="filterdialogVisible = false">取消</el-button> --> <!-- <el-button @click="filterdialogVisible = false">取消</el-button> -->
<el-button type="primary" @click="handelClick"> <el-button type="primary" @click="handelClick">
确认 确认
@@ -284,25 +151,42 @@ const userInfo = ref(getUser())
//主播列表DOM //主播列表DOM
const multipleTableRef = ref(null) const multipleTableRef = ref(null)
let labelList = ref([]) let labelList = ref([
{ paramCode: 'country', paramCodeMeaning: '国家' },
{ paramCode: 'createTime', paramCodeMeaning: '创建时间' },
{ paramCode: 'hostsCoins', paramCodeMeaning: '主播金币' },
{ paramCode: 'yesterdayCoins', paramCodeMeaning: '昨日金币' },
{ paramCode: 'fans', paramCodeMeaning: '粉丝数' },
{ paramCode: 'fllowernum', paramCodeMeaning: '关注数' },
{ paramCode: 'onlineFans', paramCodeMeaning: '在线粉丝' },
{ paramCode: 'hostsKind', paramCodeMeaning: '主播类型' },
]);
const tableData = ref([]) const tableData = ref([])
//主播列表传参 //主播列表传参
const searchForm = ref({ const searchForm = ref({})
hostId: '', const fields = [
belongYn: '', { label: '粉丝数', minModel: 'fansMin', maxModel: 'fansMax' },
country: '', { label: '在线人数', minModel: 'onlineFansMin', maxModel: 'onlineFansMax' },
// time: new Date().toISOString().split('T')[0].replace(/-/g, ''), { label: '金币数', minModel: 'hostsCoinsMin', maxModel: 'hostsCoinsMax' },
time: '', { label: '关注数', minModel: 'fllowernumMin', maxModel: 'fllowernumMax' },
dataType: '', ]
dataStart: '',
dataEnd: '',
})
//排序 //排序
let sortData = ref({ sortForm: 'desc', sortType: 'hostcoins' }) let sortData = ref({ sortForm: 'desc', sortType: "createTime" })
//排序类型
let sortNameOptions = ref([
{ label: '创建时间', type: 'createTime' },
{ label: '主播金币', type: 'hostsCoins' },
{ label: '粉丝数', type: 'fans' },
{ label: '昨日金币', type: 'yesterdayCoins' },
{ label: '在线粉丝', type: 'onlineFans' },
{ label: '关注数', type: 'fllowernum' },
])
//员工选择列表 //员工选择列表
let staffOptions = ref([]) let staffOptions = ref([])
//筛选条件选择列表 //筛选条件选择列表
let filterOptions = ref([])
//选择的员工 //选择的员工
let staffValue = ref('') let staffValue = ref('')
//选择的主播列表 //选择的主播列表
@@ -336,19 +220,17 @@ let version = ref('0.0.0');
onMounted(() => { onMounted(() => {
getdictionary()//获取字典
getStaff(); //获取下级员工
getCountry(); //获取国家 getCountry(); //获取国家
getSerchStorage();//获取搜索条件 // getSerchStorage();//获取搜索条件
getlist();//获取主播列表 getlist();//获取主播列表
}) })
function serch() { function serch() {
page.value = 1
getlist(); getlist();
} }
@@ -356,28 +238,7 @@ function exportList() {
if (searchForm.value.dataType == 'InvitationType') { if (searchForm.value.dataType == 'InvitationType') {
searchForm.value.dataEnd = searchForm.value.dataStart searchForm.value.dataEnd = searchForm.value.dataStart
} }
exportToExcel({ exportToExcel({})
hostId: searchForm.value.hostId == '' ? null : searchForm.value.hostId,
belongYn: searchForm.value.belongYn == '' ? null : searchForm.value.belongYn,
searchTime: searchForm.value.time == '' ? null : searchForm.value.time,
region: searchForm.value.country == '' ? null : searchForm.value.country,
sortType: sortData.value.sortType,
sortForm: sortData.value.sortForm,
conditions: filterOptions.value.map(option => {
return {
...option,
dataEnd: option.dataEnd == '' ? null : option.dataEnd,
dataStart: option.dataStart == '' ? null : option.dataStart
};
}),
// dataType: searchForm.value.dataType == '' ? null : searchForm.value.dataType,
// dataStart: searchForm.value.dataStart == '' ? null : searchForm.value.dataStart,
// dataEnd: searchForm.value.dataEnd == '' ? null : searchForm.value.dataEnd,
pageSize: pageSize.value,
page: page.value,
userId: userInfo.value.userId,
userType: userInfo.value.userType
})
// //浏览器导出方法 // //浏览器导出方法
@@ -388,7 +249,6 @@ function exportList() {
// pageSize: pageSize.value, // pageSize: pageSize.value,
// page: page.value, // page: page.value,
// userId: userInfo.value.userId, // userId: userInfo.value.userId,
// userType: userInfo.value.userType
// } // }
// ); // );
@@ -418,68 +278,56 @@ function handleSelectionChange(data) {
} }
//获取主播列表 //获取主播列表
const getlist = () => { const getlist = () => {
if (searchForm.value.dataType == 'InvitationType') {
searchForm.value.dataEnd = searchForm.value.dataStart
}
loading.value = true loading.value = true
console.log(searchForm.value) console.log(searchForm.value)
tkhostdata({ tkhostdata({
hostId: searchForm.value.hostId == '' ? null : searchForm.value.hostId, tenantId: Number(userInfo.value.tenantId),
belongYn: searchForm.value.belongYn == '' ? null : searchForm.value.belongYn, sort: sortData.value.sortForm,//正序倒序
searchTime: searchForm.value.time == '' ? null : searchForm.value.time, sortName: sortData.value.sortType,//排序类型
region: searchForm.value.country == '' ? null : searchForm.value.country, "current": page.value,
sortType: sortData.value.sortType, "pageSize": pageSize.value,
sortForm: sortData.value.sortForm, ...searchForm.value,//筛选条件
conditions: filterOptions.value.map(option => {
return {
...option,
dataEnd: option.dataEnd == '' ? null : option.dataEnd,
dataStart: option.dataStart == '' ? null : option.dataStart
};
}),
// dataType: searchForm.value.dataType == '' ? null : searchForm.value.dataType,
// dataStart: searchForm.value.dataStart == '' ? null : searchForm.value.dataStart,
// dataEnd: searchForm.value.dataEnd == '' ? null : searchForm.value.dataEnd,
pageSize: pageSize.value,
page: page.value,
userId: userInfo.value.userId,
userType: userInfo.value.userType
}).then(res => { }).then(res => {
loading.value = false loading.value = false
total.value = res.total if (res) {
tableData.value = [] console.log('主播列表', res)
res.records.forEach(item => { total.value = Number(res.total)
if (item.infoMap.InvitationType == '1') { tableData.value = res.records.map(item => ({
item.infoMap.InvitationType = '普票' hostId: item.hostsId, // 注意:原字段是 hostId你的数据是 hostsId需手动映射
} else if (item.infoMap.InvitationType == '2') { hostlevel: item.hostsLevel, // 原字段 hostlevel 对应你的数据 hostsLevel
item.infoMap.InvitationType = '金票' country: item.country,
createTime: item.createTime,
fans: item.fans,
fllowernum: item.fllowernum,
hostsCoins: item.hostsCoins,
hostsKind: item.hostsKind,
onlineFans: item.onlineFans,
yesterdayCoins: item.yesterdayCoins,
// 保留原有字段(如 belongBy、useable 等)
belongBy: item.belongBy,
useable: item.useable
}));
}
}
console.log(item.infoMap)
item = { ...item, ...item.infoMap }
tableData.value.push(item)
})
}) })
} }
function handelClick() { function handelClick() {
filterOptions.value.forEach(item => {
if (item.type == 'InvitationType') {
item.dataEnd = item.dataStart
}
})
setSerch(filterOptions.value)
console.log(filterOptions.value)
filterdialogVisible.value = false filterdialogVisible.value = false
} }
function reset() {
searchForm.value.fansMin = null
searchForm.value.fansMax = null
searchForm.value.onlineFansMin = null
searchForm.value.onlineFansMax = null
searchForm.value.hostsCoinsMin = null
searchForm.value.hostsCoinsMax = null
searchForm.value.fllowernumMin = null
searchForm.value.fllowernumMax = null
}
function handleClose(done) { function handleClose(done) {
console.log('关闭') console.log('关闭')
// searchForm.value = { // searchForm.value = {
@@ -490,135 +338,106 @@ function handleClose(done) {
done() done()
} }
function getSerchStorage() {
if (getSerch()) {
// filterOptions.value = getSerch()
}
}
function openComment(data) {
console.log(data)
commentInfo.value = data.comment
commentHost.value = data.hostId
commentVisible.value = true
}
//修改主播维护状态 //修改主播维护状态
function handleSelectChange(event, data) { // function handleSelectChange(event, data) {
upholdinfo({ // upholdinfo({
"hostId": data.hostId, // "hostId": data.hostId,
"userId": userInfo.value.userId, // "userId": userInfo.value.userId,
"tenantId": userInfo.value.tenantId, // "tenantId": userInfo.value.tenantId,
// "comment": "我已经尽力维护,但是失败了", // // "comment": "我已经尽力维护,但是失败了",
"useable": event.target.value // "useable": event.target.value
}).then(res => { // }).then(res => {
console.log(res) // console.log(res)
}) // })
} // }
//更改主播维护备注 //更改主播维护备注
function uphostcomment() { // function uphostcomment() {
upholdinfo({ // upholdinfo({
"hostId": commentHost.value, // "hostId": commentHost.value,
"userId": userInfo.value.userId, // "userId": userInfo.value.userId,
"tenantId": userInfo.value.tenantId, // "tenantId": userInfo.value.tenantId,
"comment": commentInfo.value, // "comment": commentInfo.value,
}).then(res => { // }).then(res => {
console.log(res) // console.log(res)
serch() // serch()
commentVisible.value = false // commentVisible.value = false
}) // })
// }
function filterTag(value, row) {
console.log(row.useable, value)
return row.useable === value;
} }
//获取字典
const getdictionary = () => {
dicts({
paramType: "hostsdata",
// page: 1,
offset: 1,
pageSize: 100
}).then(res => {
// labelList.value = res.records
labelList.value = res
console.log(labelList.value)
labelList.value.forEach(item => {
if (item.paramCodeMeaning != '获取时间') {
filterOptions.value.push({
type: item.paramCode,
label: item.paramCodeMeaning,
dataStart: '',
dataEnd: ''
})
}
})
})
}
//获取国家 //获取国家
function getCountry() { function getCountry() {
getCountryinfo({}).then(res => { getCountryinfo({}).then(res => {
console.log(res) console.log(res)
res.forEach(item => { res.forEach(item => {
options.value.push({ value: item.countryGroupName, label: item.countryGroupName }) if (item.countryGroupName) {
options.value.push({ value: item.countryGroupName, label: item.countryGroupName })
}
}) })
console.log(options.value) console.log(options.value)
}).catch(err => {
console.log('getCountry', err)
}) })
} }
//获取下级员工 //获取下级员工
const getStaff = () => { // const getStaff = () => {
getStaffList({ // getStaffList({
userId: userInfo.value.userId, // userId: userInfo.value.userId,
userType: userInfo.value.userType, // activeYn: userInfo.value.activeYn,
activeYn: userInfo.value.activeYn, // tenantId: userInfo.value.tenantId,
tenantId: userInfo.value.tenantId, // }).then(res => {
}).then(res => { // console.log(res)
console.log(res) // res.forEach(item => {
res.forEach(item => { // staffOptions.value.push({
staffOptions.value.push({ // value: item.userId,
value: item.userId, // label: item.userName
label: item.userName // })
}) // })
}) // })
}) // }
}
//分配主播给员工
function allocation() {
managerhosts({
"manaId": userInfo.value.userId,
"userId": staffValue.value,
"tenantId": userInfo.value.tenantId,
"hostIds": selectHostList.value
}).then(res => {
if (res) {
dialogFormVisible.value = false
} // //分配主播给员工
}) // function allocation() {
} // managerhosts({
// "manaId": userInfo.value.userId,
// "userId": staffValue.value,
// "tenantId": userInfo.value.tenantId,
// "hostIds": selectHostList.value
// }).then(res => {
// if (res) {
// dialogFormVisible.value = false
// }
// })
// }
//获取主播信息 //获取主播信息
const getTkhostdetail = (id) => { // const getTkhostdetail = (id) => {
tkhostdetail({ // tkhostdetail({
hostId: id, // hostId: id,
// page: 1, // // page: 1,
searchTimeStart: '20250401', // searchTimeStart: '20250401',
searchTimeEnd: '20250403' // searchTimeEnd: '20250403'
}).then(res => { // }).then(res => {
console.log(labelList.value) // console.log(labelList.value)
}) // })
} // }
function openPopover(hostId, paramCode) { function openPopover(hostId, paramCode) {
@@ -637,30 +456,30 @@ function closePopover(hostId, paramCode) {
function openHTML(id) { function openHTML(id) {
givePyAnchorId(id) givePyAnchorId(id)
upholdinfo({ // upholdinfo({
"hostId": id, // "hostId": id,
"userId": userInfo.value.userId, // "userId": userInfo.value.userId,
"tenantId": userInfo.value.tenantId, // "tenantId": userInfo.value.tenantId,
// "comment": "我已经尽力维护,但是失败了", // // "comment": "我已经尽力维护,但是失败了",
"useable": "Y" // "useable": "Y"
}).then(res => { // }).then(res => {
getlist(); // getlist();
}) // })
} }
function openAccountName(idStr) { // function openAccountName(idStr) {
if (idStr) { // if (idStr) {
hostNameVisible.value = true // hostNameVisible.value = true
accountName(idStr).then(res => { // accountName(idStr).then(res => {
staffId.value = JSON.stringify(res).replace(/[{}"]/g, '') // 移除所有 {} 和 " // staffId.value = JSON.stringify(res).replace(/[{}"]/g, '') // 移除所有 {} 和 "
.split(',') // 按逗号分割成数组 // .split(',') // 按逗号分割成数组
console.log(res) // console.log(res)
}) // })
} // }
} // }
</script> </script>
<style lang="less"> <style lang="less">
@@ -688,7 +507,7 @@ function openAccountName(idStr) {
.serch-button { .serch-button {
width: 80px; width: 80px;
height: 47px; height: 47px;
background: #E7CA92; background: @btn-bg-color;
border-radius: 10px; border-radius: 10px;
border: none; border: none;
} }
@@ -696,7 +515,7 @@ function openAccountName(idStr) {
.put-button { .put-button {
width: 132px; width: 132px;
height: 47px; height: 47px;
background: #E7CA92; background: @btn-bg-color;
border-radius: 10px; border-radius: 10px;
border: none; border: none;
@@ -708,6 +527,8 @@ function openAccountName(idStr) {
--el-dialog-font-line-height: 50px; --el-dialog-font-line-height: 50px;
--el-dialog-width: 600px; --el-dialog-width: 600px;
--el-dialog-border-radius: 8px; --el-dialog-border-radius: 8px;
// border: 10px solid @bg-color-light;
} }
.center-line { .center-line {
@@ -736,20 +557,20 @@ function openAccountName(idStr) {
} }
</style> </style>
<style scoped> <style scoped lang="less">
::v-deep(.el-input__wrapper) { ::v-deep(.el-input__wrapper) {
background-color: #F2FAF9; background-color: #F2FAF9;
border: 1px solid #B7CEC5; border: 1px solid @bg-color;
height: 44px; height: 44px;
} }
::v-deep(.el-select__wrapper) { ::v-deep(.el-select__wrapper) {
background-color: #F2FAF9; background-color: #F2FAF9;
border: 1px solid #B7CEC5; border: 1px solid @bg-color;
height: 48px; height: 48px;
} }
::v-deep(.el-pagination.is-background .el-pager li.is-active) { ::v-deep(.el-pagination.is-background .el-pager li.is-active) {
background-color: #338F6A; background-color: @bg-color;
} }
</style> </style>

View File

@@ -3,7 +3,7 @@
<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>运行时间: <span>{{ formattedTime }}</span></div>
@@ -11,6 +11,7 @@
</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>
@@ -87,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>
@@ -136,12 +137,24 @@ let hostData = ref({
}); });
//是否开启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 +171,7 @@ let tkData = ref([
index: 2, index: 2,
code: 0, code: 0,
num: 0 num: 0
}, },
]); ]);
//python需要的数据 //python需要的数据
@@ -252,7 +263,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;
} }
@@ -290,7 +301,7 @@ const submit = () => {
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(() => {
@@ -397,10 +408,14 @@ 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)
}) })
} }
@@ -409,13 +424,16 @@ const isRunning = ref(false);
const totalSeconds = ref(0); const totalSeconds = ref(0);
//定时器 //定时器
let timerCrawl = null; let timerCrawl = null;
const startTimedata = ref(null);
//清空时间 并开始运行 //清空时间 并开始运行
const startTimer = () => { const startTimer = () => {
resetTimer(); resetTimer();
if (isRunning.value) return; if (isRunning.value) return;
isRunning.value = true; isRunning.value = true;
startTimedata.value = Date.now();
timerCrawl = setInterval(() => { timerCrawl = setInterval(() => {
totalSeconds.value++; totalSeconds.value = Math.floor((Date.now() - startTimedata.value) / 1000);
}, 1000); }, 1000);
}; };
@@ -442,6 +460,62 @@ const formattedTime = computed(() => {
seconds.toString().padStart(2, '0') seconds.toString().padStart(2, '0')
].join(':'); ].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">
@@ -576,7 +650,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;
} }
@@ -584,7 +658,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;
@@ -598,7 +672,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;
} }
@@ -629,9 +703,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;
@@ -642,7 +716,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

@@ -2,11 +2,11 @@
<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 v-show="activeIndexA == 2">
<hostsList v-if="openList" /> <hostsList />
</div> </div>
<div style="position: absolute; bottom: 0; right: 0;">{{ version }}</div> <div style="position: absolute; bottom: 0; right: 0;">{{ version }}</div>
@@ -29,25 +29,17 @@ import { getUser } from '@/utils/storage'
let userType = ref(getUser().userType) let activeIndexA = ref(1)
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) { function activeIndexFn(data) {
activeIndex.value = data activeIndexA.value = data
openWerk.value = true
openList.value = true
console.log(data) console.log(data)
} }
</script> </script>
<style> <style lang="less">
body, body,
html { html {
margin: 0; margin: 0;
@@ -59,7 +51,7 @@ html {
display: flex; display: flex;
width: 1600px; width: 1600px;
height: 900px; height: 900px;
background-color: #338F6A; background-color: @bg-color;
position: relative; position: relative;
@@ -75,7 +67,7 @@ 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); */
} }

View File

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