Tiny Bunny
본문 바로가기
프로젝트/My

MY PROJECT(5) - 예매일정 수정

by 내이름효주 2024. 4. 30.
  • 일반회원에 대한 예매 정보가 없었기 때문에 일반회원 예매일정을 추가
    const gamelist = []; // game Date형 배열
    	const gamelist_gold = []; // game7일전 Date형 배열
    	const gamelist_silver = []; // game5일전 Date형 배열
    	const gamelist_normal = []; // game3일전 Date형 배열
    	
    	// 년도 포함한 경기 5일전 날짜 배열(2023-10-13)
    	const modifiedgameMinusDates = start_modifiedGameDates.map(date => {
    		const [yearStr, monthStr, dayStr] = date.split('-'); 
    	     
    		const year = parseInt(yearStr, 10); //parseInt(string, radix(진수)) 문자열 분석하고 정수로 변환
    	    const month = parseInt(monthStr, 10);
    	    const day = parseInt(dayStr, 10);
    
    		  for(let i = 0; i < start_modifiedGameDates.length; i++){
    			  
    	          const [yearStr, monthStr, dayStr] = start_modifiedGameDates[i].split('-');
    	          
    	          const year = parseInt(yearStr, 10);
    	          const month = parseInt(monthStr, 10);
    	          const day = parseInt(dayStr, 10);
    
    	          const gamelistDate = new Date(year, month - 1, day);
    	          gamelist.push(gamelistDate);
    	          
    	          const game1MinusDate = new Date(gamelistDate.getFullYear(), gamelistDate.getMonth(), (gamelistDate.getDate()-1));  
    	          const formattedDate1 = game1MinusDate.toISOString().split('T')[0]; //날짜 개체를 ISO 문자열로 변환한 다음 "YYYY-MM-DD 형식의 날짜 부분을 추출
    	          gamelist_normal.push(formattedDate1);
    	          
    	          const game3MinusDate = new Date(gamelistDate.getFullYear(), gamelistDate.getMonth(), (gamelistDate.getDate()-3));  
    	          const formattedDate3 = game3MinusDate.toISOString().split('T')[0]; //날짜 개체를 ISO 문자열로 변환한 다음 "YYYY-MM-DD 형식의 날짜 부분을 추출
    	          gamelist_silver.push(formattedDate3);
    	          
    	          const game5MinusDate = new Date(gamelistDate.getFullYear(), gamelistDate.getMonth(), (gamelistDate.getDate()-5));      
    	          const formattedDate5 = game5MinusDate.toISOString().split('T')[0]; //날짜 개체를 ISO 문자열로 변환한 다음 "YYYY-MM-DD 형식의 날짜 부분을 추출
    	          gamelist_gold.push(formattedDate5);
    		  }  
    	});​
  • 달력 헤더 와 body 사이에 등급을 표시해주고 싶은데 createElement나 직접 태그 추가하는 방식들이 안된다ㅠ

  • 경기 일정 클릭했을 때 회원정보도 알려주기 위해 일정 그릴때 comment를 남겨주고 그 comment를 불러서 넣어주는 방식으로 구현했다! 
    const member = {
          id: `event${i}`,
          title: start_modifiedGameDates[i].substring(5,start_modifiedGameDates[i].lengthS) + ' 경기 예매',
          start: gamelist_normal[i],
          end: end_modifiedGameDates[i],
          allDay: true,
          backgroundColor: "#d4d4d4",
          textColor: 'black',
          extendedProps: {
              comment: '일반회원'
          }
      };
      
    const memberLevel = eventInfo.event.extendedProps.comment;
    
    document.getElementById('memberlevel').textContent = memberLevel;​