Skip to content

Commit

Permalink
Merge pull request #103 from leejaeseong11/feat-code
Browse files Browse the repository at this point in the history
fix: 랭크모드 경험치 증가, 정답 코드 첨부 삭제
  • Loading branch information
suemini authored Dec 21, 2023
2 parents 9a3d19b + 63960fd commit 47004bb
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 88 deletions.
18 changes: 12 additions & 6 deletions src/components/code/Normal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,11 @@ export default {
backOff() {
this.gameEnd = false
document.body.style.overflow = 'auto'
//우승한 memberNo, roomMemberList의 size 보내기(exp추가)
this.disconnect()
console.log(this.roomMemberList.length)
console.log(this.resultMemberNo)
const url = `${this.backURL}/member/exp?memberNo=${this.resultMemberNo}&roomSize=${this.roomMemberList.length}`
//우승한 memberNo, roomMemberList의 size 보내기(exp추가)
var roomMemberSize = this.roomMemberList.length * 5
const url = `${this.backURL}/member/exp?memberNo=${this.resultMemberNo}&roomSize=${roomMemberSize}`
if (this.resultMemberNo == this.memberNo) {
// apiClient 보내기
apiClient
Expand Down Expand Up @@ -319,6 +318,13 @@ export default {
this.reportModal = false
},
exitButtonClickHandler() {
var talkMessage = {
type: 'ROOM_TALK',
roomNo: this.roomNo,
sender: this.memberName,
message: this.memberNo
}
this.socket.send(JSON.stringify(talkMessage))
this.disconnect()
this.$router.push({ path: `/` })
},
Expand Down Expand Up @@ -684,7 +690,7 @@ body.flex-container {
border-radius: 10px;
width: 400px;
height: 540px;
margin-top: 250px;
margin-top: 100px;
margin-left: 10px;
z-index: 2;
overflow: hidden;
Expand Down
5 changes: 3 additions & 2 deletions src/components/code/NormalMonaco.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default defineComponent({
},
language: { type: String, default: 'java' },
theme: { type: String, default: 'vs-dark' }, //vs, vs-dark, hc-black
// fontSize: {defalut: 15px}
options: {
type: Object,
default() {
Expand All @@ -70,7 +71,8 @@ export default defineComponent({
height: fixedHeight,
'text-align': 'left',
'align-items': 'center',
'margin-left': '15px'
'margin-left': '15px',
'font-size' : '15px'
}
})
return {
Expand Down Expand Up @@ -244,7 +246,6 @@ export default defineComponent({
this.output = response.data.result
this.gameResult = response.data.gameResult
this.gameResult = '1'
if (this.gameResult == '1') {
this.$emit('monacoWinMemberNo', this.memberNo)
}
Expand Down
17 changes: 0 additions & 17 deletions src/components/code/RankMonaco.vue
Original file line number Diff line number Diff line change
Expand Up @@ -245,26 +245,9 @@ export default defineComponent({
this.output = response.data.result
this.gameResult = response.data.gameResult
this.gameResult = '1'
if (this.gameResult == '1') {
this.$emit('monacoWinMemberNo', this.memberNo)
}
//게임 결과 update
// const data = {
// gameResult: this.gameResult
// }
// const url2 = `${this.backURL}/rankgame/${this.rankNo}`
// apiClient
// .put(url2, JSON.stringify(data), {
// headers: {
// 'Content-Type': 'application/json'
// }
// })
// .catch(error => {
// console.log('Server Error:', error);
// alert('서버 에러 발생. 자세한 내용은 콘솔을 확인하세요.');
// });
})
//네트워크에 의한 요청 실패일 경우
.catch((error) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/home/MainHomeRoom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default {
}
)
.then(() => {
this.$router.push({
this.$router.replace({
path: `/room/${this.roomInfo.roomNo}`,
state: {
rightAccess: true
Expand Down
9 changes: 6 additions & 3 deletions src/components/profile/MyCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
>
<span class="opposing-name">{{ code.quizCorrect === 1 ? '성공' : '실패' }}</span>
<span class="opposing-name" :title="''+code.quizTitle">{{ code.quizTitle }}</span>
<span class="opposing-name">{{ code.quizDt }}</span>
<span class="regdate">{{ code.quizDt }}</span>
<button id="codeInfo" :data-quizno="code.quizNo" @click="codeClickHandler($event)">
조회
</button>
Expand Down Expand Up @@ -88,7 +88,6 @@ export default {
},
mounted() {
this.memberNo = this.$route.params.memberNo
console.log(this.memberNo)
const url = `${this.backURL}/mycode/${this.memberNo}`
apiClient
.get(url, {
Expand Down Expand Up @@ -195,7 +194,7 @@ export default {
);
}
.opposing-name {
.opposing-name, .regdate {
width: 20%;
line-height: 45px;
color: var(--main1-color);
Expand All @@ -206,6 +205,10 @@ export default {
text-overflow: ellipsis; /* 넘치는 텍스트에 "..." 추가 */
}
.regdate {
width: 40%;
}
.game-result {
color: var(--main1-color);
width: 50%;
Expand Down
4 changes: 2 additions & 2 deletions src/components/rank/RankMatching.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default {
},
setQuiz() {
apiClient.get(`${this.backURL}/rankroom/quiz/${this.rankRoom.roomNo}`).then((res) => {
this.$router.push({
this.$router.replace({
path: '/rank/' + res.data,
state: {
rightAccess: true
Expand Down Expand Up @@ -139,7 +139,7 @@ export default {
this.rankRoom.quizNo != ''
) {
this.stopMatching()
this.$router.push({
this.$router.replace({
path: '/rank/' + this.rankRoom.rankNo,
state: {
rightAccess: true
Expand Down
2 changes: 1 addition & 1 deletion src/components/room/AddRoom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export default {
}
})
.then(() => {
this.$router.push({
this.$router.replace({
path: `/room/${res.data}`,
state: {
rightAccess: true
Expand Down
9 changes: 6 additions & 3 deletions src/util/axios-interceptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ apiClient.interceptors.response.use(

async (error) => {
if (error.response?.status === 401) {
sweetAlert.warning('로그인이 필요합니다', '', '로그인창으로 가기').then(() => {
window.location.href = '/login'
})
sweetAlert.warning('로그인이 필요합니다', '', '로그인창으로 가기')
.then((result) => {
if (result.isConfirmed) {
window.location.href = '/login';
}
});
}
if (error.response?.status === 403) {
console.error('403 Forbidden 에러 발생 :', error.response)
Expand Down
Loading

0 comments on commit 47004bb

Please sign in to comment.