Skip to content
Snippets Groups Projects
Select Git revision
  • 88ccedd2c2c7af172cc1f6e7ff9d288dc0a24342
  • main default
  • xiemuqingxiao
  • YiboDevops
  • zhichengxu
  • sunhaoyu
  • afterTestgood
  • Xiemuqing-Xiao
  • 70-as-an-admin-i-want-to-through-a-table-to-update-new-user-so-that-admin-can-update-user
  • 73-as-a-user-i-want-ranking-can-be-update-by-match-so-that-i-can-see-the-ranking-for-real-time
  • 60-as-a-user-i-want-to-view-and-edit-my-personal-information-on-my-profile-page-so-that-i-can
  • 61-as-a-user-i-want-to-view-and-edit-my-personal-information-on-my-profile-page-so-that-i-can-2
  • 71-as-an-administrator-i-want-to-generate-the-matches-automatically-so-that-players-are-divided-by
  • 72-as-a-user-i-want-to-have-a-page-to-upload-and-share-photos-so-that-another-user-can-see-my
  • 64-as-an-admin-i-want-to-through-a-table-to-add-new-user-so-that-admin-can-give-user-a-new-account
  • 28-registration-feature
  • 71-user-management
  • 70-user-role
  • 71_Xiao
  • 64-as-an-admin-i-want-to-through-a-table-to-add-new-user-so-that-admin-can-give-user-a-new-account-2
  • revert-9d830250
21 results

matchDetail.js

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    matchDetail.js 1.29 KiB
        const urlParams = new URLSearchParams(window.location.search);
        const matchId = urlParams.get(`id`);
        // 获取比赛详情
        async function fetchMatchDetails(id) {
        try {
        const response = await fetch(`/match/${id}`);
        const matchData = await response.json();
    
        const matchInfo = document.getElementById('matchInfo');
        const matchScore = document.getElementById('matchScore');
        // btn give the id
        const updateBtn = document.getElementById("updateBtn");
            updateBtn.addEventListener('click', function (){
                window.location.href = `/html/matchDetailChangeScore.html?id=${id}`;
            })
        matchScore.innerHTML = `<p><strong></strong>${matchData.scoreA} - ${matchData.scoreB}</p>
    `
        matchInfo.innerHTML = `
                    <p><strong>Sport: </strong>${matchData.sport}</p>
                    <p><strong>Players: </strong>${matchData.playerAId} vs ${matchData.playerBId}</p>
                    <p><strong>Scheduled Time: </strong>${new Date(matchData.planTime).toLocaleString()}</p>
                    <p><strong>Status: </strong>${matchData.status}</p>
                    <p><strong>Winner: </strong>${matchData.winnerId ? matchData.winnerId : 'N/A'}</p>
                `;
    } catch (error) {
        console.error('Error fetching match details:', error);
    }
    }
        fetchMatchDetails(matchId);