工作台页面

This commit is contained in:
2025-04-03 20:25:25 +08:00
parent 32cbc6404a
commit d7d08675c6
9 changed files with 250 additions and 81 deletions

View File

@@ -0,0 +1,164 @@
<template>
<div class="main">
<div>
<div style="display: flex;">
<el-select v-model="searchForm.country" placeholder="选择国家" size="large" style="width: 240px">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<div></div>
<el-date-picker v-model="searchForm.time" type="date" value-format="YYYYMMDD" placeholder="选择查询时间" size="large"
style="margin-left: 50px;" />
<el-button style="margin-left: 50px;" type="primary" @click="serch">查询</el-button>
</div>
<!-- <el-button type="primary" @click="getlist">查询列表</el-button>
<el-button type="primary" @click="getdictionary">查询字典</el-button> -->
</div>
<div class="hostTable center-justify">
<el-table :data="tableData" stripe>
<el-table-column prop="hostId" label="主播id" width="200" />
<el-table-column prop="hostName" label="主播名字" min-width="200" />
<el-table-column v-for="label in labelList" :prop="label.paramCode" :label="label.paramCodeMeaning"
width="150" />
</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" />
</div>
</div>
</template>
<script setup>
import { getToken, setToken, removeToken } from '@/utils/storage'
import { tkhostdata, dicts } from '@/api/account';
import { ref, reactive, onMounted } from 'vue';
let labelList = ref([])
const tableData = ref([])
//选择国家
const searchForm = ref({
country: '',
time: ''
})
//分页
let pageSize = ref(10)
let page = ref(1)
let total = ref(0)
const options = [
{
value: '日本',
label: '日本',
},
{
value: '美国',
label: '美国',
},
{
value: '荷兰',
label: '荷兰',
},
{
value: '澳大利亚',
label: '澳大利亚',
}
]
onMounted(() => {
getdictionary()
})
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)
getdictionary();
getlist();
}
//获取主播列表
const getlist = () => {
tkhostdata({
searchTime: searchForm.value.time,
region: searchForm.value.country,
pageSize: pageSize.value,
page: page.value
}).then(res => {
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)
})
}
//获取字典
const getdictionary = () => {
dicts({
paramType: "hostsdata",
// page: 1,
offset: 1,
pageSize: 100
}).then(res => {
// labelList.value = res.records
labelList.value = res
console.log(labelList.value)
})
}
</script>
<style lang="less">
.main {
box-sizing: border-box;
height: 100vh;
width: 100%;
padding: 40px;
.hostTable {
width: 100%;
padding: 40px 0;
}
}
.center-line {
display: flex;
flex-direction: column;
align-items: center;
// justify-content: center;
}
.center-justify {
display: flex;
justify-content: space-around;
align-items: center;
}
.center-align {
display: flex;
justify-content: space-between;
}
.center-flex {
display: flex;
justify-content: center;
align-items: center;
}
</style>

View File

@@ -0,0 +1,101 @@
<template>
<div class="container">
<el-card class="box-card">
<template #header>
<div class="card-header">
<span>工作台</span>
</div>
</template>
<el-row :gutter="20">
<el-col :span="8">
<div class="input-group">
<label>设置金币数量</label>
<el-input type='number' v-model="range1.min" :min="0" :max="range1.max - 1" placeholder="最小值"
style="width: 100%">
<template #prepend>最小金币数</template>
</el-input>
<el-input type='number' v-model="range1.max" :min="range1.min + 1" :max="100" placeholder="最大值"
style="width: 100%; margin-top: 10px"> <template #prepend>最大金币数</template>
</el-input>
</div>
</el-col>
<el-col :span="8">
<div class="input-group">
<label>设置粉丝数量</label>
<el-input type='number' v-model="range2.min" :min="0" :max="range2.max - 1" placeholder="最小值"
style="width: 100%">
<template #prepend>最小粉丝数</template>
</el-input>
<el-input type='number' v-model="range2.max" :min="range2.min + 1" :max="100" placeholder="最大值"
style="width: 100%; margin-top: 10px">
<template #prepend>最大粉丝数</template>
</el-input>
</div>
</el-col>
<el-col :span="8">
<div class="input-group">
<label>后台查询频率</label>
<el-input type='number' v-model="range3.min" :min="0" :max="range3.max - 1" placeholder="次/小时"
style="width: 100%">
<template #append>/小时</template>
</el-input>
<el-input type='number' v-model="range3.max" :min="range3.min + 1" :max="100"
placeholder="次/24小时" style="width: 100%; margin-top: 10px">
<template #append>/24小时</template>
</el-input>
</div>
</el-col>
</el-row>
<div style="margin-top: 20px; text-align: center">
<el-button type="primary" @click="submit">开始获取数据</el-button>
<el-button @click="reset">重置数据</el-button>
</div>
</el-card>
</div>
</template>
<script setup>
import { ref } from 'vue';
const range1 = ref({ min: 0, max: 0 });
const range2 = ref({ min: 0, max: 0 });
const range3 = ref({ min: 0, max: 0 });
const submit = () => {
console.log('提交的区间值:', range1.value, range2.value, range3.value);
};
const reset = () => {
range1.value = { min: 0, max: 0 };
range2.value = { min: 0, max: 0 };
range3.value = { min: 0, max: 0 };
};
</script>
<style scoped>
.container {
margin: 0 auto;
padding: 20px;
}
.box-card {
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.input-group {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 8px;
font-weight: bold;
color: #606266;
}
</style>