Skip to content

Commit

Permalink
fix: fix playground bug (#1822)
Browse files Browse the repository at this point in the history
* revise some bugs

* revise some bugs

* revise some bugs

* revise some bugs

* revise some bugs

* revise some bugs

* revise some bugs

* revise some bugs

---------

Co-authored-by: FranGuam <53105842+FranGuam@users.noreply.github.com>
  • Loading branch information
youyc22 and FranGuam committed May 18, 2024
1 parent cadfb43 commit b047b3b
Show file tree
Hide file tree
Showing 6 changed files with 2,231 additions and 551 deletions.
17 changes: 8 additions & 9 deletions src/app/ContestSite/MenuPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { lazy, Suspense, useEffect, useRef, useState } from "react";
import { Link, Route, Routes, useNavigate } from "react-router-dom";
import { Link, Route, Routes } from "react-router-dom";
import {
HomeOutlined,
TeamOutlined,
Expand Down Expand Up @@ -88,7 +88,6 @@ const MenuPage: React.FC<ContestProps> = (props) => {
const joinRef = useRef(null);
const codeRef = useRef(null);
const arenaRef = useRef(null);
const navigate = useNavigate();

const { data: getContestManagersData, error: getContestManagersError } =
graphql.useGetContestManagersSuspenseQuery({
Expand Down Expand Up @@ -302,12 +301,12 @@ const MenuPage: React.FC<ContestProps> = (props) => {
placement: "right",
target: () => arenaRef.current,
},
{
title: "游玩时刻",
description: "下面让我们跳转到试玩界面一探究竟吧!",
placement: "right",
target: () => playRef.current,
},
// {
// title: "游玩时刻",
// description: "下面让我们跳转到试玩界面一探究竟吧!",
// placement: "right",
// target: () => playRef.current,
// },
];

const TourGuide = () => {
Expand All @@ -321,7 +320,7 @@ const MenuPage: React.FC<ContestProps> = (props) => {
onClose={() => {
setOpen(false);
localStorage.setItem("tour_contest", "true");
navigate(url.link("playground"));
//navigate(url.link("playground"));
}}
steps={steps}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/app/ContestSite/PlaygroundPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const PlaygroundPage: React.FC<ContestProps> = ({ mode, user }) => {
max-width: calc((100vh - 72px) / 9 * 16);
max-height: calc(100vh - 72px);
aspect-ratio: 16 / 9;
padding: 0.9vw 1.6vw;
padding: 0 0;
`}
/>
</Row>
Expand Down
60 changes: 30 additions & 30 deletions src/app/ShareSite/CoursePage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, Layout, message } from "antd";
import { Button, Layout } from "antd";
import { useUrl } from "../../api/hooks/url";
import * as graphql from "@/generated/graphql";
import { ProColumns, ProTable } from "@ant-design/pro-components";
Expand All @@ -8,9 +8,9 @@ import { PageProps } from "..";

const CoursesPage: React.FC<PageProps> = ({ mode, user }) => {
const url = useUrl();
const { refetch: courseRefetch } = graphql.useGetCourseSuspenseQuery();
//const { refetch: courseRefetch } = graphql.useGetCourseSuspenseQuery();

const columns: ProColumns<graphql.Share_Course>[] = [
const columns: ProColumns<graphql.Course>[] = [
{
title: "课程号",
dataIndex: "code",
Expand Down Expand Up @@ -94,42 +94,42 @@ const CoursesPage: React.FC<PageProps> = ({ mode, user }) => {
},
];

const dataRequest = async (params: {
pageSize?: number;
current?: number;
}): Promise<{
data: graphql.Share_Course[];
success: boolean;
total?: number;
}> => {
console.log(params);
const { data, error } = await courseRefetch();
// const dataRequest = async (params: {
// pageSize?: number;
// current?: number;
// }): Promise<{
// data: graphql.Course[];
// success: boolean;
// total?: number;
// }> => {
// console.log(params);
// const { data, error } = await courseRefetch();

if (error) {
message.error("课程加载失败");
console.log(error.message);
return {
data: [],
success: false,
total: 0,
};
}
return {
data: data.share_course,
success: true,
total: data.share_course.length,
};
};
// if (error) {
// message.error("课程加载失败");
// console.log(error.message);
// return {
// data: [],
// success: false,
// total: 0,
// };
// }
// return {
// data: data.course,
// success: true,
// total: data.course.length,
// };
// };

return (
<Layout
css={`
margin: 30px;
`}
>
<ProTable<graphql.Share_Course>
<ProTable<graphql.Course>
columns={columns}
request={dataRequest}
//request={dataRequest}
rowKey="uuid"
pagination={{
showQuickJumper: true,
Expand Down

0 comments on commit b047b3b

Please sign in to comment.