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', default: 'Default',
essential: 'Essential', essential: 'Essential',
full: 'Full', full: 'Full',
tagsHint: 'Hot Keywords', tagsHint: 'Hot Tags',
refresh: 'Refresh the page', refresh: 'Refresh the page',
help1: "The topic's title length should be between 1 and 40 characters.", 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.", 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.", help3: "The website's code is handwritten, and errors are inevitable.",
help4: 'If you encounter any errors, please', help4: 'If you encounter any errors, please',
contact: ' Contact Us.', contact: ' Contact Us.',
tags: 'Please input topic keywords', tags: 'Please input topic tags',
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.`, 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 Keywords (Click to Select) : ', hot: 'Popular Tags (Click to Select) : ',
categories: categories:
'Click to select topic categories (multiple selections allowed) : ', 'Click to select topic categories (multiple selections allowed) : ',
btnGalgame: 'Visual Novel', Galgame: 'Visual Novel',
btnTechnique: 'Technique', Technique: 'Technique',
btnOthers: 'Others', Others: 'Others',
publish: 'Confirm Publish', publish: 'Confirm Publish',
draft: 'Save Draft', draft: 'Save Draft',
}, },

View file

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

View file

@ -12,8 +12,6 @@ import { useKUNGalgamerStore } from '@/store/modules/kungalgamer'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
// //
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
//
import { getPlainText } from '@/utils/getPlainText'
// //
import { import {
EditCreateTopicRequestData, EditCreateTopicRequestData,
@ -22,7 +20,7 @@ import {
const router = useRouter() const router = useRouter()
const topicData = storeToRefs(useKUNGalgameEditStore()) const { content, isSave } = storeToRefs(useKUNGalgameEditStore())
const messageStore = useKUNGalgameMessageStore() const messageStore = useKUNGalgameMessageStore()
@ -31,10 +29,18 @@ const checkPublish = (topicData: EditCreateTopicRequestData) => {
// //
message('Title cannot be empty!', '标题不可为空!', 'warn') message('Title cannot be empty!', '标题不可为空!', 'warn')
return false return false
} else if (topicData.content.trim()) { } else if (!content.value.trim()) {
// TODO: //
console.log(getPlainText(topicData.content.trim()).length) message('Content cannot be empty!', '内容不可为空!', 'warn')
return true 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 { } else {
return true return true
} }
@ -85,7 +91,7 @@ const handlePublish = async () => {
const handleSave = () => { const handleSave = () => {
// true // true
topicData.isSave.value = true isSave.value = true
messageStore.info('AlertInfo.edit.draft') messageStore.info('AlertInfo.edit.draft')
} }
</script> </script>

View file

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