fix: category BUG

This commit is contained in:
KUN1007 2023-09-09 16:30:17 +08:00
parent 08ae3cfad8
commit 0f01c67467
4 changed files with 27 additions and 21 deletions

View file

@ -129,21 +129,21 @@ export default {
default: 'Default',
essential: 'Essential',
full: 'Full',
tagsHint: 'Hot Keywords',
tagsHint: 'Hot Tags',
refresh: 'Refresh the page',
help1: "The topic's title length should be between 1 and 40 characters.",
help2: "You can click on the left settings to adjust the editor's mode.",
help3: "The website's code is handwritten, and errors are inevitable.",
help4: 'If you encounter any errors, please',
contact: ' Contact Us.',
tags: 'Please input topic keywords',
hint: `Hint: (A single keyword should be within 14 characters, choose at least one and up to 7 keywords). You can enter text and press \`Enter\` to create a keyword.`,
hot: 'Popular Keywords (Click to Select) : ',
tags: 'Please input topic tags',
hint: `Hint: (A single tag should be within 14 characters, choose at least one and up to 7 tags). You can enter text and press \`Enter\` to create a tag.`,
hot: 'Popular Tags (Click to Select) : ',
categories:
'Click to select topic categories (multiple selections allowed) : ',
btnGalgame: 'Visual Novel',
btnTechnique: 'Technique',
btnOthers: 'Others',
Galgame: 'Visual Novel',
Technique: 'Technique',
Others: 'Others',
publish: 'Confirm Publish',
draft: 'Save Draft',
},

View file

@ -25,7 +25,7 @@ const plainText = getPlainText(props.data.content)
<div class="title">
<span>{{ props.data.title }}</span>
</div>
<!-- 话题发布日期 -->
<!-- 话题的状态点赞数等 -->
<div class="status">
<ul>
<li>
@ -43,7 +43,7 @@ const plainText = getPlainText(props.data.content)
</li>
</ul>
<!-- 话题的状态点赞数等 -->
<!-- 话题的发布日期 -->
<div class="time">
<span>{{
formatTimeDifference(
@ -115,7 +115,7 @@ const plainText = getPlainText(props.data.content)
}
/* 发帖日期 */
.time {
width: 60px;
width: 77px;
font-size: x-small;
color: var(--kungalgame-font-color-0);
/* 居中 */

View file

@ -12,8 +12,6 @@ import { useKUNGalgamerStore } from '@/store/modules/kungalgamer'
import { storeToRefs } from 'pinia'
//
import { useRouter } from 'vue-router'
//
import { getPlainText } from '@/utils/getPlainText'
//
import {
EditCreateTopicRequestData,
@ -22,7 +20,7 @@ import {
const router = useRouter()
const topicData = storeToRefs(useKUNGalgameEditStore())
const { content, isSave } = storeToRefs(useKUNGalgameEditStore())
const messageStore = useKUNGalgameMessageStore()
@ -31,10 +29,18 @@ const checkPublish = (topicData: EditCreateTopicRequestData) => {
//
message('Title cannot be empty!', '标题不可为空!', 'warn')
return false
} else if (topicData.content.trim()) {
// TODO:
console.log(getPlainText(topicData.content.trim()).length)
return true
} else if (!content.value.trim()) {
//
message('Content cannot be empty!', '内容不可为空!', 'warn')
return false
} else if (topicData.tags.length === 0) {
message('Please use at least one tag!', '请至少使用一个标签!', 'warn')
} else if (topicData.category.length === 0) {
message(
'Please select at least one category!',
'请至少选择一个分类!',
'warn'
)
} else {
return true
}
@ -85,7 +91,7 @@ const handlePublish = async () => {
const handleSave = () => {
// true
topicData.isSave.value = true
isSave.value = true
messageStore.info('AlertInfo.edit.draft')
}
</script>

View file

@ -8,14 +8,14 @@ export interface Category {
export const category: Category[] = [
{
index: 1,
name: 'btnGalgame',
name: 'Galgame',
},
{
index: 2,
name: 'btnTechnique',
name: 'Technique',
},
{
index: 3,
name: 'btnOthers',
name: 'Others',
},
]