refac: linter 관련 설정 변경 및 적용, map_theme 변수 제거
- eslint에 prettier 조합 - prettierrc에 width 120, tabWidth 2 - gameStor->map_theme 제거 - map_theme, mapTheme를 GameConst::$mapName으로 대체 - eslint에서 vue/vue3-essential 대신 vue3-recommended 적용 - vue/max-attributes-per-line 완화 - vue/v-on-event-hyphenation 해제 - vue/attribute-hyphenation 해제 - 일부 tsc import type warning 해결 - 일부 vue template type warning 해결 - 일부 vue SFC를 script setup으로 변경 - TipTap - TopBackBar - BottomBackBar - BoardArticle - ProcessCity
This commit is contained in:
@@ -1,27 +1,26 @@
|
||||
<template>
|
||||
<div class="articleFrame bg0">
|
||||
<div class="bg1 row gx-0">
|
||||
<div class="authorName center">{{ article.author }}</div>
|
||||
<div class="col articleTitle center">{{ article.title }}</div>
|
||||
<div class="col-2 col-md-1 date center">{{ article.date.slice(5, 16) }}</div>
|
||||
<div class="authorName center">
|
||||
{{ article.author }}
|
||||
</div>
|
||||
<div class="col articleTitle center">
|
||||
{{ article.title }}
|
||||
</div>
|
||||
<div class="col-2 col-md-1 date center">
|
||||
{{ article.date.slice(5, 16) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row gx-0 s-border-b">
|
||||
<div class="col-2 col-md-1 authorIcon center">
|
||||
<img
|
||||
class="generalIcon"
|
||||
width="64"
|
||||
height="64"
|
||||
:src="article.author_icon"
|
||||
/>
|
||||
<img class="generalIcon" width="64" height="64" :src="article.author_icon" />
|
||||
</div>
|
||||
<div class="col text">
|
||||
{{ article.text }}
|
||||
</div>
|
||||
<div class="col text">{{ article.text }}</div>
|
||||
</div>
|
||||
<div class="commentList">
|
||||
<board-comment
|
||||
v-for="comment in article.comment"
|
||||
:key="comment.no"
|
||||
:comment="comment"
|
||||
/>
|
||||
<board-comment v-for="comment in article.comment" :key="comment.no" :comment="comment" />
|
||||
</div>
|
||||
<div class="row gx-0">
|
||||
<div class="bg2 inputCommentHeader center d-grid">
|
||||
@@ -29,86 +28,78 @@
|
||||
</div>
|
||||
<div class="col d-grid">
|
||||
<input
|
||||
v-model.trim="newCommentText"
|
||||
class="commentText"
|
||||
type="text"
|
||||
maxlength="250"
|
||||
placeholder="새 댓글 내용"
|
||||
v-model.trim="newCommentText"
|
||||
@keyup.enter="submitComment"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-2 col-md-1 d-grid">
|
||||
<b-button class="submitComment" @click="submitComment" size="sm"
|
||||
>등록</b-button
|
||||
>
|
||||
<b-button class="submitComment" size="sm" @click="submitComment"> 등록 </b-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
<script lang="ts" setup>
|
||||
import type { BoardArticleItem } from "@/PageBoard.vue";
|
||||
import BoardComment from "@/components/BoardComment.vue";
|
||||
import { defineComponent, type PropType } from "vue";
|
||||
import { ref, type PropType } from "vue";
|
||||
import axios from "axios";
|
||||
import { convertFormData } from "@util/convertFormData";
|
||||
import type { InvalidResponse } from "@/defs";
|
||||
export default defineComponent({
|
||||
name: "BoardArticle",
|
||||
components: {
|
||||
BoardComment,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
newCommentText: "",
|
||||
};
|
||||
},
|
||||
props: {
|
||||
article: {
|
||||
type: Object as PropType<BoardArticleItem>,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
emits: ["submit-comment"],
|
||||
methods: {
|
||||
async submitComment() {
|
||||
const comment = this.newCommentText;
|
||||
if (!comment) {
|
||||
return;
|
||||
}
|
||||
const articleNo = this.article.no;
|
||||
|
||||
let result: InvalidResponse;
|
||||
const newCommentText = ref("");
|
||||
|
||||
try {
|
||||
const response = await axios({
|
||||
url: "j_board_comment_add.php",
|
||||
method: "post",
|
||||
responseType: "json",
|
||||
data: convertFormData({
|
||||
articleNo: articleNo,
|
||||
text: comment,
|
||||
}),
|
||||
});
|
||||
result = response.data;
|
||||
if (!result.result) {
|
||||
throw result.reason;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
alert(`실패했습니다: ${e}`);
|
||||
return;
|
||||
}
|
||||
|
||||
this.newCommentText = "";
|
||||
|
||||
this.$emit("submit-comment");
|
||||
},
|
||||
const props = defineProps({
|
||||
article: {
|
||||
type: Object as PropType<BoardArticleItem>,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(event: "submit-comment"): void;
|
||||
}>();
|
||||
|
||||
async function submitComment() {
|
||||
const comment = newCommentText.value;
|
||||
if (!comment) {
|
||||
return;
|
||||
}
|
||||
const articleNo = props.article.no;
|
||||
|
||||
let result: InvalidResponse;
|
||||
|
||||
try {
|
||||
const response = await axios({
|
||||
url: "j_board_comment_add.php",
|
||||
method: "post",
|
||||
responseType: "json",
|
||||
data: convertFormData({
|
||||
articleNo: articleNo,
|
||||
text: comment,
|
||||
}),
|
||||
});
|
||||
result = response.data;
|
||||
if (!result.result) {
|
||||
throw result.reason;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
alert(`실패했습니다: ${e}`);
|
||||
return;
|
||||
}
|
||||
|
||||
newCommentText.value = "";
|
||||
|
||||
emit("submit-comment");
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
td.text {
|
||||
white-space: pre;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user