完善功能
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { getAxios, postAxios } from '@/utils/axios.js'
|
||||
import { getAxios, postAxios, downFile } from '@/utils/axios.js'
|
||||
|
||||
export function apiGetCart() {
|
||||
return getAxios({ url: '/cgi-bin/cart/latest' })
|
||||
@@ -18,3 +18,14 @@ export function dicts(data) {
|
||||
export function tkhostdetail(data) {
|
||||
return postAxios({ url: 'tkinfo/tkhostdetail', data })
|
||||
}
|
||||
//导出表格
|
||||
export function exporthosts(data) {
|
||||
return postAxios({ url: 'export/hostsinfo', data })
|
||||
}
|
||||
export function downList(url, data) {
|
||||
return downFile(url, data)
|
||||
}
|
||||
//查询tk账号查询次数
|
||||
export function tkaccountuseinfo(data) {
|
||||
return postAxios({ url: 'tkinfo/tkaccountuseinfo', data })
|
||||
}
|
||||
|
||||
@@ -20,19 +20,25 @@ export default {
|
||||
dataType: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
time: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
seriesData: [],
|
||||
num: 0
|
||||
num: 0,
|
||||
inputTime: '',
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
|
||||
this.inputTime = this.time
|
||||
this.getTkhostdetail();
|
||||
console.log(this.getPrevious7Days(this.inputTime))
|
||||
|
||||
},
|
||||
methods: {
|
||||
@@ -51,7 +57,7 @@ export default {
|
||||
data: [this.title]
|
||||
},
|
||||
xAxis: {
|
||||
data: [this.getCurrentDate()[0].slice(4), this.getCurrentDate()[1].slice(4), this.getCurrentDate()[2].slice(4), this.getCurrentDate()[3].slice(4), this.getCurrentDate()[4].slice(4), this.getCurrentDate()[5].slice(4), this.getCurrentDate()[6].slice(4)]
|
||||
data: [this.getPrevious7Days(this.inputTime)[0].slice(4), this.getPrevious7Days(this.inputTime)[1].slice(4), this.getPrevious7Days(this.inputTime)[2].slice(4), this.getPrevious7Days(this.inputTime)[3].slice(4), this.getPrevious7Days(this.inputTime)[4].slice(4), this.getPrevious7Days(this.inputTime)[5].slice(4), this.getPrevious7Days(this.inputTime)[6].slice(4)]
|
||||
},
|
||||
yAxis: {},
|
||||
series: [
|
||||
@@ -65,34 +71,36 @@ export default {
|
||||
]
|
||||
};
|
||||
myChart.setOption(option);
|
||||
console.log(this.dataTime)
|
||||
|
||||
},
|
||||
getTkhostdetail() {
|
||||
tkhostdetail({
|
||||
hostId: this.id,
|
||||
dataType: this.dataType,
|
||||
searchTimeStart: this.getCurrentDate()[0],
|
||||
searchTimeEnd: this.getCurrentDate()[6]
|
||||
searchTimeStart: this.getPrevious7Days(this.inputTime)[0],
|
||||
searchTimeEnd: this.getPrevious7Days(this.inputTime)[6]
|
||||
}).then(res => {
|
||||
// console.log("返回数据", res[0][this.getCurrentDate()[2]])
|
||||
// console.log("返回数据", res[0][this.getPrevious7Days(this.inputTime)[2]])
|
||||
//echarts 数据初始化
|
||||
this.seriesData = [
|
||||
res[0][this.getCurrentDate()[0]] == null ? 0 : Number(res[0][this.getCurrentDate()[0]][this.dataType]),
|
||||
res[0][this.getCurrentDate()[1]] == null ? 0 : Number(res[0][this.getCurrentDate()[1]][this.dataType]),
|
||||
res[0][this.getCurrentDate()[2]] == null ? 0 : Number(res[0][this.getCurrentDate()[2]][this.dataType]),
|
||||
res[0][this.getCurrentDate()[3]] == null ? 0 : Number(res[0][this.getCurrentDate()[3]][this.dataType]),
|
||||
res[0][this.getCurrentDate()[4]] == null ? 0 : Number(res[0][this.getCurrentDate()[4]][this.dataType]),
|
||||
res[0][this.getCurrentDate()[5]] == null ? 0 : Number(res[0][this.getCurrentDate()[5]][this.dataType]),
|
||||
res[0][this.getCurrentDate()[6]] == null ? 0 : Number(res[0][this.getCurrentDate()[6]][this.dataType]),
|
||||
res[0][this.getPrevious7Days(this.inputTime)[0]] == null ? 0 : Number(res[0][this.getPrevious7Days(this.inputTime)[0]][this.dataType]),
|
||||
res[0][this.getPrevious7Days(this.inputTime)[1]] == null ? 0 : Number(res[0][this.getPrevious7Days(this.inputTime)[1]][this.dataType]),
|
||||
res[0][this.getPrevious7Days(this.inputTime)[2]] == null ? 0 : Number(res[0][this.getPrevious7Days(this.inputTime)[2]][this.dataType]),
|
||||
res[0][this.getPrevious7Days(this.inputTime)[3]] == null ? 0 : Number(res[0][this.getPrevious7Days(this.inputTime)[3]][this.dataType]),
|
||||
res[0][this.getPrevious7Days(this.inputTime)[4]] == null ? 0 : Number(res[0][this.getPrevious7Days(this.inputTime)[4]][this.dataType]),
|
||||
res[0][this.getPrevious7Days(this.inputTime)[5]] == null ? 0 : Number(res[0][this.getPrevious7Days(this.inputTime)[5]][this.dataType]),
|
||||
res[0][this.getPrevious7Days(this.inputTime)[6]] == null ? 0 : Number(res[0][this.getPrevious7Days(this.inputTime)[6]][this.dataType]),
|
||||
]
|
||||
|
||||
// this.seriesData = {
|
||||
// [this.getCurrentDate()[0]]: res[0][this.getCurrentDate()[0]] == null ? 0 : res[0][this.getCurrentDate()[0]][this.dataType],
|
||||
// [this.getCurrentDate()[1]]: res[0][this.getCurrentDate()[1]] == null ? 0 : res[0][this.getCurrentDate()[1]][this.dataType],
|
||||
// [this.getCurrentDate()[2]]: res[0][this.getCurrentDate()[2]] == null ? 0 : res[0][this.getCurrentDate()[2]][this.dataType],
|
||||
// [this.getCurrentDate()[3]]: res[0][this.getCurrentDate()[3]] == null ? 0 : res[0][this.getCurrentDate()[3]][this.dataType],
|
||||
// [this.getCurrentDate()[4]]: res[0][this.getCurrentDate()[4]] == null ? 0 : res[0][this.getCurrentDate()[4]][this.dataType],
|
||||
// [this.getCurrentDate()[5]]: res[0][this.getCurrentDate()[5]] == null ? 0 : res[0][this.getCurrentDate()[5]][this.dataType],
|
||||
// [this.getCurrentDate()[6]]: res[0][this.getCurrentDate()[6]] == null ? 0 : res[0][this.getCurrentDate()[6]][this.dataType],
|
||||
// [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();
|
||||
@@ -103,24 +111,58 @@ export default {
|
||||
|
||||
})
|
||||
},
|
||||
getCurrentDate() {
|
||||
const dates = [];
|
||||
const today = new Date();
|
||||
// getCurrentDate() {
|
||||
// const dates = [];
|
||||
// const today = new Date();
|
||||
|
||||
for (let i = 6; i >= 0; i--) {
|
||||
const date = new Date(today);
|
||||
date.setDate(today.getDate() - i);
|
||||
// for (let i = 6; i >= 0; i--) {
|
||||
// const date = new Date(today);
|
||||
// date.setDate(today.getDate() - i);
|
||||
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
// const year = date.getFullYear();
|
||||
// const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
// const day = String(date.getDate()).padStart(2, '0');
|
||||
|
||||
dates.push(`${year}${month}${day}`);
|
||||
// dates.push(`${year}${month}${day}`);
|
||||
// }
|
||||
|
||||
// return dates;
|
||||
// },
|
||||
getPrevious7Days(dateStr) {
|
||||
// 验证输入格式是否正确
|
||||
if (!/^\d{8}$/.test(dateStr)) {
|
||||
console.error('输入的格式不是YYYYMMDD.');
|
||||
return [];
|
||||
}
|
||||
|
||||
return dates;
|
||||
// 解析输入的日期字符串
|
||||
const year = parseInt(dateStr.substring(0, 4));
|
||||
const month = parseInt(dateStr.substring(4, 6)) - 1; // 月份从 0 开始
|
||||
const day = parseInt(dateStr.substring(6, 8));
|
||||
|
||||
// 创建日期对象
|
||||
const date = new Date(year, month, day);
|
||||
|
||||
// 存储结果的数组
|
||||
const result = [];
|
||||
|
||||
// 计算前 7 天的日期
|
||||
for (let i = 0; i <= 6; i++) {
|
||||
const currentDate = new Date(date);
|
||||
currentDate.setDate(date.getDate() - i); // 减去 i 天
|
||||
|
||||
// 格式化为 YYYYMMDD
|
||||
const formattedDate = `${currentDate.getFullYear()}${(currentDate.getMonth() + 1).toString().padStart(2, '0')}${currentDate.getDate().toString().padStart(2, '0')}`;
|
||||
result.push(formattedDate);
|
||||
}
|
||||
|
||||
// 按时间顺序排序(从最早到最晚)
|
||||
result.sort((a, b) => a.localeCompare(b));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -11,11 +11,10 @@ const router = useRouter();
|
||||
|
||||
// 请求地址前缀
|
||||
let baseURL = ''
|
||||
console.log(process.env.NODE_ENV)
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// 生产环境
|
||||
baseURL = "http://120.26.251.180:8085/api/"
|
||||
// baseURL = "http://192.168.0.100:8085/api/"
|
||||
// baseURL = "http://192.168.0.108:8085/api/"
|
||||
} else {
|
||||
// 开发环境
|
||||
baseURL = ""
|
||||
@@ -85,7 +84,6 @@ export function postAxios({ url, data }) {
|
||||
}
|
||||
}
|
||||
).then(res => {
|
||||
console.log(res)
|
||||
}).catch(err => {
|
||||
if (err.message == "Network Error") {
|
||||
// alert("网络错误,请检查网络连接")
|
||||
@@ -128,5 +126,38 @@ export function postAxios({ url, data }) {
|
||||
})
|
||||
})
|
||||
}
|
||||
export const downFile = async (urlstr, data) => {
|
||||
|
||||
// 发送请求,获取文件流
|
||||
const response = await axios.post(urlstr, data, { responseType: 'blob' });
|
||||
|
||||
// 获取文件名(如果后端设置了 Content-Disposition)
|
||||
const contentDisposition = response.headers['content-disposition'];
|
||||
let fileName = 'default-file-name'; // 默认文件名
|
||||
console.log(contentDisposition)
|
||||
console.log(response)
|
||||
if (contentDisposition) {
|
||||
// 从响应头中提取文件名
|
||||
const fileNameMatch = contentDisposition.match(/filename="(.+)"/);
|
||||
if (fileNameMatch && fileNameMatch.length > 1) {
|
||||
fileName = fileNameMatch[1];
|
||||
}
|
||||
}
|
||||
|
||||
// 创建一个临时的下载链接
|
||||
const blob = new Blob([response.data], { type: response.headers['content-type'] });
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = fileName; // 设置下载的文件名
|
||||
a.click();
|
||||
|
||||
// 释放 URL 对象
|
||||
window.URL.revokeObjectURL(url);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
export default axios
|
||||
@@ -47,18 +47,14 @@ export function usePythonBridge() {
|
||||
|
||||
// 登录tk后台
|
||||
const loginBackStage = (data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (bridge.value) {
|
||||
bridge.value.loginBackStage(data, function (result) {
|
||||
if (result) {
|
||||
resolve(result);
|
||||
} else {
|
||||
reject(result);
|
||||
}
|
||||
|
||||
});
|
||||
if (bridge.value) {
|
||||
if (data.index == 0) {
|
||||
bridge.value.loginBackStage(JSON.stringify(data));
|
||||
} else if (data.index == 1) {
|
||||
bridge.value.loginBackStageCopy(JSON.stringify(data));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
//跳转到主播页面
|
||||
@@ -70,6 +66,31 @@ export function usePythonBridge() {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//查询登录状态
|
||||
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);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
// 在组件挂载时初始化桥接
|
||||
onMounted(initBridge);
|
||||
|
||||
@@ -78,6 +99,8 @@ export function usePythonBridge() {
|
||||
fetchDataCount,
|
||||
loginBackStage,
|
||||
loginTikTok,
|
||||
givePyAnchorId
|
||||
givePyAnchorId,
|
||||
backStageloginStatus,
|
||||
backStageloginStatusCopy
|
||||
};
|
||||
}
|
||||
@@ -26,9 +26,20 @@ export function getNumData() {
|
||||
return JSON.parse(localStorage.getItem('num'));
|
||||
}
|
||||
|
||||
// 导出一个函数,用于设置用户密码
|
||||
export function setUserPass(userdata) {
|
||||
localStorage.setItem('userPass', JSON.stringify(userdata));
|
||||
}
|
||||
// 导出一个函数,用于获取用户密码
|
||||
export function getUserPass() {
|
||||
return JSON.parse(localStorage.getItem('userPass'));
|
||||
}
|
||||
|
||||
// 用于设置tk账户密码
|
||||
export function setTkUser(userdata) {
|
||||
localStorage.setItem('tkuser', JSON.stringify(userdata));
|
||||
}
|
||||
// 用于获取tk账户密码
|
||||
export function getTkUser() {
|
||||
return JSON.parse(localStorage.getItem('tkuser'));
|
||||
}
|
||||
@@ -45,7 +45,7 @@
|
||||
<el-form label-position="left" label-width="100px" :model="formData">
|
||||
|
||||
<div class="from-input-item1">
|
||||
<img src="@/assets/password.png" alt="">
|
||||
<img src="@/assets/username.png" alt="">
|
||||
<el-input style="height: 25px;" v-model="formData.userId" placeholder="账号" clearable
|
||||
@keyup.enter="onSubmit" />
|
||||
</div>
|
||||
|
||||
@@ -10,11 +10,13 @@
|
||||
style="margin-left: 50px;" />
|
||||
|
||||
<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"
|
||||
@click="exportList">导出Excel数据</el-button>
|
||||
</div>
|
||||
|
||||
<div class="hostTable center-justify">
|
||||
<el-table size="small" :data="tableData" stripe v-loading="loading">
|
||||
<el-table-column prop="hostId" label="主播id" width="200">
|
||||
<el-table :data="tableData" stripe v-loading="loading" height="500">
|
||||
<el-table-column fixed prop="hostId" label="主播id" width="200">
|
||||
<template #default="scope">
|
||||
<div class="hostIdText" @click="openHTML(scope.row.hostId)"> {{ scope.row.hostId }}</div>
|
||||
|
||||
@@ -25,7 +27,11 @@
|
||||
{{ scope.row.hostName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="hostlevel" label="等级" width="120">
|
||||
<template #default="scope">
|
||||
{{ scope.row.hostlevel }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-for="label in labelList" :key="label.paramCode" :prop="label.paramCode"
|
||||
:label="label.paramCodeMeaning" width="120">
|
||||
<template #default="scope">
|
||||
@@ -33,7 +39,8 @@
|
||||
placement="bottom" :width="600" 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"></component>
|
||||
:title="label.paramCodeMeaning" :id="scope.row.hostId" :dataType="label.paramCode"
|
||||
:time="searchForm.time"></component>
|
||||
</div>
|
||||
<template #reference>
|
||||
<span @mouseover="openPopover(scope.row.hostId, label.paramCode)"
|
||||
@@ -46,7 +53,9 @@
|
||||
<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"></component>
|
||||
:title="label.paramCodeMeaning" :id="scope.row.hostId" :dataType="label.paramCode"
|
||||
:time="searchForm.time">
|
||||
</component>
|
||||
</div>
|
||||
<template #reference>
|
||||
<!-- 鼠标移入时开启 -->
|
||||
@@ -69,8 +78,9 @@
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="center-justify" style="margin-top: 30px;">
|
||||
<el-pagination :default-current-page="4" v-model:current-page="page" background layout="prev, pager, next"
|
||||
:total="total" @change="serch" />
|
||||
<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]"
|
||||
@size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -78,8 +88,9 @@
|
||||
|
||||
<script setup>
|
||||
// import { getToken, setToken, removeToken } from '@/utils/storage'
|
||||
import { tkhostdata, dicts, tkhostdetail } from '@/api/account';
|
||||
import { tkhostdata, dicts, tkhostdetail, exporthosts, downList } from '@/api/account';
|
||||
import { usePythonBridge, } from '@/utils/pythonBridge'
|
||||
import { getUser } from '@/utils/storage'
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import EChartsComponent from '@/components/EChartsComponent.vue';
|
||||
|
||||
@@ -127,13 +138,50 @@ onMounted(() => {
|
||||
})
|
||||
|
||||
function serch() {
|
||||
console.log("pageSize.value", pageSize.value)
|
||||
console.log("page.value", page.value)
|
||||
console.log("searchForm.value.country", searchForm.value.country)
|
||||
console.log("time.value", searchForm.value.time)
|
||||
|
||||
getlist();
|
||||
}
|
||||
|
||||
function exportList() {
|
||||
downList('export/hostsinfo',
|
||||
{
|
||||
searchTime: searchForm.value.time,
|
||||
region: searchForm.value.country,
|
||||
pageSize: pageSize.value,
|
||||
page: page.value,
|
||||
userId: getUser().userId,
|
||||
userType: getUser().userType
|
||||
}
|
||||
);
|
||||
// exporthosts({
|
||||
// searchTime: searchForm.value.time,
|
||||
// region: searchForm.value.country,
|
||||
// pageSize: pageSize.value,
|
||||
// page: page.value,
|
||||
// userId: getUser().userId,
|
||||
// userType: getUser().userType
|
||||
// }).then(res => {
|
||||
// const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
||||
// const url = window.URL.createObjectURL(blob);
|
||||
// const a = document.createElement('a');
|
||||
// a.href = url;
|
||||
// a.download = 'table-data.xlsx'; // 下载的文件名
|
||||
// document.body.appendChild(a);
|
||||
// a.click();
|
||||
// a.remove();
|
||||
// window.URL.revokeObjectURL(url);
|
||||
// })
|
||||
}
|
||||
function handleSizeChange(val) {
|
||||
console.log(`${val} items per page`)
|
||||
getlist();
|
||||
|
||||
}
|
||||
function handleCurrentChange(val) {
|
||||
console.log(`current page: ${val}`)
|
||||
getlist();
|
||||
|
||||
}
|
||||
//获取主播列表
|
||||
const getlist = () => {
|
||||
loading.value = true
|
||||
@@ -141,17 +189,17 @@ const getlist = () => {
|
||||
searchTime: searchForm.value.time,
|
||||
region: searchForm.value.country,
|
||||
pageSize: pageSize.value,
|
||||
page: page.value
|
||||
page: page.value,
|
||||
userId: getUser().userId,
|
||||
userType: getUser().userType
|
||||
}).then(res => {
|
||||
loading.value = false
|
||||
total.value = res.total
|
||||
tableData.value = []
|
||||
res.records.forEach(item => {
|
||||
item = { ...item, ...item.infoMap }
|
||||
console.log(item)
|
||||
tableData.value.push(item)
|
||||
})
|
||||
console.log(tableData.value)
|
||||
})
|
||||
|
||||
}
|
||||
@@ -208,7 +256,7 @@ function openHTML(id) {
|
||||
<style lang="less">
|
||||
.main {
|
||||
box-sizing: border-box;
|
||||
height: 100vh;
|
||||
// height: 100vh;
|
||||
width: 100%;
|
||||
padding: 40px;
|
||||
|
||||
@@ -228,6 +276,16 @@ function openHTML(id) {
|
||||
height: 47px;
|
||||
background: #E7CA92;
|
||||
border-radius: 10px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.put-button {
|
||||
width: 132px;
|
||||
height: 47px;
|
||||
background: #E7CA92;
|
||||
border-radius: 10px;
|
||||
border: none;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
|
||||
<div>
|
||||
|
||||
<el-card class="box-card-num center-justify" v-for="(item, index) in 2" :key="index">
|
||||
<el-card class="box-card-num" v-for="(item, index) in 2" :key="index">
|
||||
<div class="center-justify">
|
||||
<div class="from-input-item">
|
||||
<div class="from-input-item-title center-justify">
|
||||
公会账号:
|
||||
</div>
|
||||
<el-input :disabled="!(isTk || tkData[index].code == 1)" v-model="tkData[index].account"
|
||||
<el-input :disabled="!(isTk && tkData[index].code == 0)" v-model="tkData[index].account"
|
||||
style="height: 50px;" placeholder="请输入登录账号" clearable />
|
||||
</div>
|
||||
|
||||
@@ -28,18 +28,18 @@
|
||||
<div class="from-input-item-title center-justify">
|
||||
公会密码:
|
||||
</div>
|
||||
<el-input :disabled="!(isTk || tkData[index].code == 1)" v-model="tkData[index].password"
|
||||
<el-input :disabled="!(isTk && tkData[index].code == 0)" v-model="tkData[index].password"
|
||||
style="height: 50px;" type="password" placeholder="请输入登录密码" show-password />
|
||||
</div>
|
||||
|
||||
<el-button class="open-login" style="margin-left: 60px;"
|
||||
:disabled="!(isTk || tkData[index].code == 1)" type="primary"
|
||||
:disabled="!(isTk && tkData[index].code == 0)" type="primary"
|
||||
@click="loginTK(index)">登录tk</el-button>
|
||||
<div v-if="tkData[index].code == 0" class="loginState" style="background-color: red;"></div>
|
||||
<div v-else class="loginState" style="background-color: green;"></div>
|
||||
<div v-if="tkData[index].code == 0" class="loginState"></div>
|
||||
<div v-if="tkData[index].code == 1" class="loginState" style="background-color: green;"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="todayCount">今日已查询次数:{{ tkData[index].num }}</div>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
@@ -51,7 +51,7 @@
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span class="center-justify"><img src="@/assets/worklogo.png">工作台 </span>
|
||||
<div>当前网络:{{ countryData }}
|
||||
<div style="margin-right: 120px;">当前网络:{{ countryData }}
|
||||
<!-- <el-button class="reset-button" @click="reset">重置数据</el-button> -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -116,11 +116,12 @@
|
||||
import { ref, onMounted } from 'vue';
|
||||
// import { useIPCountry } from '@/utils/useIPCountry';
|
||||
import { usePythonBridge, } from '@/utils/pythonBridge'
|
||||
import { setNumData, getNumData, getUser } from '@/utils/storage'
|
||||
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 } = usePythonBridge();
|
||||
const { fetchDataConfig, fetchDataCount, loginBackStage, loginTikTok, backStageloginStatus, backStageloginStatusCopy } = usePythonBridge();
|
||||
|
||||
//ip国家
|
||||
let countryData = ref('');
|
||||
@@ -137,6 +138,10 @@ let hostData = ref({
|
||||
//是否开启tk
|
||||
let isTk = ref(false);
|
||||
|
||||
//设置状态轮询定时器
|
||||
let statusTimer = ref(null);
|
||||
let statusTimerCopy = ref(null);
|
||||
|
||||
|
||||
//tk账号信息
|
||||
let tkData = ref([
|
||||
@@ -145,12 +150,15 @@ let tkData = ref([
|
||||
password: '',
|
||||
index: 1,
|
||||
code: 0,
|
||||
num: 0
|
||||
},
|
||||
{
|
||||
account: '',
|
||||
password: '',
|
||||
index: 2,
|
||||
code: 0,
|
||||
num: 0
|
||||
|
||||
},
|
||||
|
||||
]);
|
||||
@@ -176,7 +184,18 @@ onMounted(() => {
|
||||
if (getNumData()) {
|
||||
pyData.value = getNumData();
|
||||
}
|
||||
if (getTkUser()) {
|
||||
tkData.value = getTkUser();
|
||||
tkData.value[0].code = 0;
|
||||
tkData.value[1].code = 0;
|
||||
}
|
||||
|
||||
tkData.value[0].num = tkaccountuse(tkData.value[0].account)
|
||||
tkData.value[1].num = tkaccountuse(tkData.value[1].account)
|
||||
|
||||
getIpInfo()
|
||||
//查询次数查询
|
||||
|
||||
|
||||
})
|
||||
|
||||
@@ -277,18 +296,23 @@ const reset = () => {
|
||||
|
||||
|
||||
const loginTK = (index) => {
|
||||
loginBackStage(JSON.stringify({
|
||||
setTkUser(tkData.value)
|
||||
loginBackStage({
|
||||
account: tkData.value[index].account,
|
||||
password: tkData.value[index].password,
|
||||
index: index
|
||||
})).then((res) => {
|
||||
// let data = JSON.parse(res);
|
||||
// if (data.code == 1) {
|
||||
// tkData.value[data.index].code = 1;
|
||||
// }
|
||||
}).catch((err) => {
|
||||
|
||||
})
|
||||
if (index == 0) {
|
||||
statusTimer = setInterval(() => {
|
||||
getloginStatus();
|
||||
}, 2000)
|
||||
} else if (index == 1) {
|
||||
statusTimerCopy = setInterval(() => {
|
||||
getloginStatusCopy();
|
||||
}, 2000)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
const openTK = () => {
|
||||
@@ -297,9 +321,38 @@ const openTK = () => {
|
||||
loginTikTok();
|
||||
|
||||
}
|
||||
function jszhuru() {
|
||||
isTk.value = true;
|
||||
tkData[index].code = 1;
|
||||
|
||||
function getloginStatus() {
|
||||
backStageloginStatus().then((res) => {
|
||||
const data = JSON.parse(res);
|
||||
tkData.value[data.index].code = data.code
|
||||
|
||||
if (data.code == 1) {
|
||||
clearInterval(statusTimer);
|
||||
statusTimer = null;
|
||||
}
|
||||
})
|
||||
}
|
||||
function getloginStatusCopy() {
|
||||
backStageloginStatusCopy().then((res) => {
|
||||
const data = JSON.parse(res);
|
||||
tkData.value[data.index].code = data.code
|
||||
|
||||
if (data.code == 1) {
|
||||
clearInterval(statusTimer);
|
||||
statusTimer = null;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function tkaccountuse(id) {
|
||||
let num = 0;
|
||||
tkaccountuseinfo({ userId: id }).then((res) => {
|
||||
num = res
|
||||
console.log(num)
|
||||
})
|
||||
return num
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -346,15 +399,20 @@ function jszhuru() {
|
||||
}
|
||||
|
||||
.box-card-num {
|
||||
|
||||
|
||||
|
||||
width: 897px;
|
||||
height: 145px;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0px 0px 21px 0px rgba(183, 183, 183, 0.33);
|
||||
border-radius: 24px;
|
||||
margin-bottom: 30px;
|
||||
|
||||
padding-top: 18px;
|
||||
box-sizing: border-box;
|
||||
|
||||
.todayCount {
|
||||
padding: 15px 21px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.from-input-item {
|
||||
@@ -382,7 +440,7 @@ function jszhuru() {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
border-radius: 50%;
|
||||
background-color: red;
|
||||
background-color: #b90000;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
@@ -424,6 +482,7 @@ label {
|
||||
height: 47px;
|
||||
background: #E7CA92;
|
||||
border-radius: 10px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.reset-button {
|
||||
|
||||
Reference in New Issue
Block a user