|
|
@@ -0,0 +1,197 @@
|
|
|
+<template>
|
|
|
+ <div class="data-test-container">
|
|
|
+ <div class="page-header">
|
|
|
+ <h1>数据测试</h1>
|
|
|
+ <p>用于测试和验证比赛数据的页面</p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="content-area">
|
|
|
+ <div class="test-panel">
|
|
|
+ <h2>测试数据展示</h2>
|
|
|
+ <div class="data-display">
|
|
|
+ <div class="data-item">
|
|
|
+ <label>当前时间:</label>
|
|
|
+ <span>{{ currentTime }}</span>
|
|
|
+ </div>
|
|
|
+ <!-- <div class="data-item">
|
|
|
+ <label>测试状态:</label>
|
|
|
+ <span class="status-success">正常运行</span>
|
|
|
+ </div> -->
|
|
|
+ <div class="data-item">
|
|
|
+ <label>数据源:</label>
|
|
|
+ <span>比赛管理系统</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="action-buttons">
|
|
|
+ <button class="btn btn-primary" @click="refreshData">
|
|
|
+ 刷新数据
|
|
|
+ </button>
|
|
|
+ <button class="btn btn-secondary" @click="runTest">
|
|
|
+ 运行测试
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { ref, onMounted } from 'vue';
|
|
|
+import { requestClient } from '#/api/request';
|
|
|
+
|
|
|
+const currentTime = ref('');
|
|
|
+const gamesRelation = ref([]);
|
|
|
+const gamesSolution = ref({});
|
|
|
+
|
|
|
+const updateTime = () => {
|
|
|
+ currentTime.value = new Date().toLocaleString('zh-CN')
|
|
|
+}
|
|
|
+
|
|
|
+const refreshData = () => {
|
|
|
+ updateTime();
|
|
|
+ Promise.all([
|
|
|
+ requestClient.get('/pstery/get_games_relation', { params: { mk: 1 } }),
|
|
|
+ requestClient.get('/pstery/get_solutions')
|
|
|
+ ])
|
|
|
+ .then(([relations, solutions]) => {
|
|
|
+ gamesRelation.value = relations;
|
|
|
+ gamesSolution.value = solutions;
|
|
|
+ console.log('数据已刷新');
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+const runTest = async () => {
|
|
|
+ gamesSolution.value.solutions.forEach((solution) => {
|
|
|
+ const { info: { id }} = solution;
|
|
|
+ const relation = gamesRelation.value.find((relation) => relation.id === id);
|
|
|
+ if (!relation) {
|
|
|
+ console.log('relation not found', id);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (!relation.solutions) {
|
|
|
+ relation.solutions = [];
|
|
|
+ }
|
|
|
+ relation.solutions.push(solution);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ console.log('gamesRelation', gamesRelation);
|
|
|
+}
|
|
|
+
|
|
|
+// const currentTime = ref('')
|
|
|
+
|
|
|
+// const updateTime = () => {
|
|
|
+// currentTime.value = new Date().toLocaleString('zh-CN')
|
|
|
+// }
|
|
|
+
|
|
|
+// const refreshData = () => {
|
|
|
+// updateTime()
|
|
|
+// console.log('数据已刷新')
|
|
|
+// }
|
|
|
+
|
|
|
+// const runTest = () => {
|
|
|
+// console.log('开始运行测试...')
|
|
|
+// // 这里可以添加具体的测试逻辑
|
|
|
+// }
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ refreshData();
|
|
|
+})
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.data-test-container {
|
|
|
+ padding: 20px;
|
|
|
+
|
|
|
+ .page-header {
|
|
|
+ margin-bottom: 30px;
|
|
|
+
|
|
|
+ h1 {
|
|
|
+ font-size: 24px;
|
|
|
+ font-weight: bold;
|
|
|
+ margin-bottom: 8px;
|
|
|
+ color: #333;
|
|
|
+ }
|
|
|
+
|
|
|
+ p {
|
|
|
+ color: #666;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .content-area {
|
|
|
+ .test-panel {
|
|
|
+ background: #fff;
|
|
|
+ border-radius: 8px;
|
|
|
+ padding: 24px;
|
|
|
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
|
+
|
|
|
+ h2 {
|
|
|
+ font-size: 18px;
|
|
|
+ font-weight: 600;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ color: #333;
|
|
|
+ }
|
|
|
+
|
|
|
+ .data-display {
|
|
|
+ margin-bottom: 24px;
|
|
|
+
|
|
|
+ .data-item {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: 12px;
|
|
|
+
|
|
|
+ label {
|
|
|
+ font-weight: 500;
|
|
|
+ color: #555;
|
|
|
+ min-width: 100px;
|
|
|
+ }
|
|
|
+
|
|
|
+ span {
|
|
|
+ color: #333;
|
|
|
+
|
|
|
+ &.status-success {
|
|
|
+ color: #52c41a;
|
|
|
+ font-weight: 500;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .action-buttons {
|
|
|
+ display: flex;
|
|
|
+ gap: 12px;
|
|
|
+
|
|
|
+ .btn {
|
|
|
+ padding: 8px 16px;
|
|
|
+ border-radius: 6px;
|
|
|
+ border: none;
|
|
|
+ cursor: pointer;
|
|
|
+ font-size: 14px;
|
|
|
+ transition: all 0.2s;
|
|
|
+
|
|
|
+ &.btn-primary {
|
|
|
+ background: #1890ff;
|
|
|
+ color: white;
|
|
|
+
|
|
|
+ &:hover {
|
|
|
+ background: #40a9ff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ &.btn-secondary {
|
|
|
+ background: #f5f5f5;
|
|
|
+ color: #333;
|
|
|
+ border: 1px solid #d9d9d9;
|
|
|
+
|
|
|
+ &:hover {
|
|
|
+ background: #e6f7ff;
|
|
|
+ border-color: #1890ff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|