zs 2 rokov pred
rodič
commit
545057dec0

+ 6 - 5
src/stores/match/course.ts

@@ -14,11 +14,7 @@ export const CourseStore = defineStore('course', () => {
   function increment() {
     count.value++;
   }
-  const query = async ({
-    skip = 0,
-    limit = undefined,
-    ...info
-  }: IQueryParams = {}): Promise<IQueryResult> => {
+  const query = async ({ skip = 0, limit = undefined, ...info }: IQueryParams = {}): Promise<IQueryResult> => {
     let cond: IQueryType = {};
     if (skip) cond.skip = skip;
     if (limit) cond.limit = limit;
@@ -26,6 +22,10 @@ export const CourseStore = defineStore('course', () => {
     const res = await axios.$get(`${api.url}`, cond);
     return res;
   };
+  const ranking = async ({ ...info }: IQueryParams = {}): Promise<IQueryResult> => {
+    const res = await axios.$get(`${api.url}/ranking`, info);
+    return res;
+  };
   const fetch = async (payload: any): Promise<IQueryResult> => {
     const res = await axios.$get(`${api.url}/${payload}`);
     return res;
@@ -48,6 +48,7 @@ export const CourseStore = defineStore('course', () => {
     doubleCount,
     increment,
     query,
+    ranking,
     fetch,
     create,
     update,

+ 11 - 1
src/views/match/course/index.vue

@@ -32,9 +32,11 @@ import { ElMessage } from 'element-plus';
 import { useRouter, useRoute } from 'vue-router';
 // 接口
 import { CourseStore } from '@/stores/match/course';
+import { ApplicationStore } from '@/stores/match/application';
 import { DictDataStore } from '@/stores/dict/dictData'; // 字典表
 import type { IQueryResult } from '@/util/types.util';
 const courseAxios = CourseStore();
+const applicationAxios = ApplicationStore();
 const dictAxios = DictDataStore();
 const { proxy } = getCurrentInstance() as any;
 // 路由
@@ -53,7 +55,7 @@ let fields: Ref<any[]> = ref([
   { label: '蓝方团队名称', model: 'blue_team_name' },
   { label: '蓝方分数', model: 'blue_score' },
   { label: '比赛时间', model: 'match_time' },
-  { label: '胜者', model: 'winner' },
+  { label: '胜者', model: 'winner', format: (i: any) => getDict(i, 'winner') },
   { label: '状态', model: 'status', type: 'select', isSearch: true, format: (i: any) => getDict(i, 'status') }
 ]);
 // 操作
@@ -65,6 +67,7 @@ let opera: Ref<any[]> = ref([
 let searchForm: Ref<any> = ref({});
 // 字典表
 const statusList: Ref<any> = ref([]);
+const applicationList: Ref<any> = ref([]);
 // 请求
 onMounted(async () => {
   loading.value = true;
@@ -89,6 +92,10 @@ const getDict = (e, model) => {
     let data: any = statusList.value.find((i: any) => i.value == e);
     if (data) return data.label;
     else return '暂无';
+  } else if (model == 'winner') {
+    let data: any = applicationList.value.find((i: any) => i.team_id == e);
+    if (data) return data.team_name;
+    else return '暂无';
   }
 };
 // 添加
@@ -113,6 +120,9 @@ const searchOther = async () => {
   // 状态
   res = await dictAxios.query({ type: 'course_status' });
   if (res.errcode == '0') statusList.value = res.data;
+  // 报名情况
+  res = await applicationAxios.query({ match_id: id.value, status: '1' });
+  if (res.errcode == '0') applicationList.value = res.data;
 };
 // 返回上一页
 const toBack = () => {

+ 27 - 16
src/views/match/ranking/index.vue

@@ -2,7 +2,12 @@
   <div id="index">
     <el-row>
       <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
-        <el-col :span="24" class="one">系统首页</el-col>
+        <el-col :span="24" class="one">
+          <cSearch :is_title="false" :is_back="true" @toBack="toBack"></cSearch>
+        </el-col>
+        <el-col :span="24" class="two">
+          <cTable :fields="fields" :opera="[]" :list="list" :usePage="false"> </cTable>
+        </el-col>
       </el-col>
     </el-row>
   </div>
@@ -11,28 +16,34 @@
 <script setup lang="ts">
 // 基础
 import type { Ref } from 'vue';
-// reactive,
-import { onMounted, ref, getCurrentInstance } from 'vue';
+import { ref, onMounted } from 'vue';
+import { useRoute } from 'vue-router';
 // 接口
-//import { TestStore } from '@common/src/stores/test';
-//import type { IQueryResult } from '@/util/types.util';
-//const testAxios = TestStore();
-const { proxy } = getCurrentInstance() as any;
+import { CourseStore } from '@/stores/match/course';
+const courseAxios = CourseStore();
+const route = useRoute();
 // 加载中
 const loading: Ref<any> = ref(false);
-// 分页数据
-//  const skip = 0;
-//  const limit = proxy.limit;;
+// 表单
+let list: Ref<any> = ref([]);
+let id: Ref<any> = ref(route.query.id);
+let fields: Ref<any[]> = ref([
+  { label: '团队名称', model: 'name' },
+  { label: '分数', model: 'score' }
+]);
 // 请求
 onMounted(async () => {
   loading.value = true;
-  //  await search({ skip, limit });
+  await search();
   loading.value = false;
 });
-//const search = async (e: { skip: number; limit: number }) => {
-//  const info = { skip: e.skip, limit: e.limit, ...searchInfo.value  };
-//  const res: IQueryResult = await testAxios.query(info);
-//  console.log(res);
-//};
+const search = async () => {
+  let res: any = await courseAxios.ranking({ match_id: id.value });
+  if (res.errcode == '0') list.value = res.data.scoreList;
+};
+// 返回上一页
+const toBack = () => {
+  window.history.go(-1);
+};
 </script>
 <style scoped lang="scss"></style>