@@ -21,7 +21,12 @@ import { AiHelperButton } from '~/components/ai/ai-helper'
2121import { HeaderActionButton } from '~/components/button/rounded-button'
2222import { TextBaseDrawer } from '~/components/drawer/text-base-drawer'
2323import { Editor } from '~/components/editor/universal'
24- import { SlidersHIcon , TelegramPlaneIcon , EyeIcon , EyeOffIcon } from '~/components/icons'
24+ import {
25+ EyeIcon ,
26+ EyeOffIcon ,
27+ SlidersHIcon ,
28+ TelegramPlaneIcon ,
29+ } from '~/components/icons'
2530import { MaterialInput } from '~/components/input/material-input'
2631import { UnderlineInput } from '~/components/input/underline-input'
2732import { CopyTextButton } from '~/components/special-button/copy-text-button'
@@ -200,18 +205,20 @@ const PostWriteView = defineComponent(() => {
200205 < HeaderPreviewButton iframe data = { data } />
201206 < HeaderActionButton
202207 icon = { data . isPublished ? < EyeOffIcon /> : < EyeIcon /> }
203- variant = { data . isPublished ? " warning" : " success" }
208+ variant = { data . isPublished ? ' warning' : ' success' }
204209 onClick = { async ( ) => {
205210 if ( ! data . id ) {
206211 message . warning ( '请先保存文章' )
207212 return
208213 }
209-
214+
210215 const newStatus = ! data . isPublished
211216 try {
212- await RESTManager . api . posts ( data . id ) ( 'publish' ) . patch ( {
213- data : { isPublished : newStatus } ,
214- } )
217+ await RESTManager . api
218+ . posts ( data . id ) ( 'publish' )
219+ . patch ( {
220+ data : { isPublished : newStatus } ,
221+ } )
215222 data . isPublished = newStatus
216223 message . success ( newStatus ? '文章已发布' : '文章已设为草稿' )
217224 } catch ( _error ) {
@@ -291,7 +298,12 @@ const PostWriteView = defineComponent(() => {
291298 < NFormItem label = "分类" required path = "categoryId" >
292299 < NSelect
293300 placeholder = "请选择"
294- options = { categoryStore . data . value ?. map ( i => ( { label : i . name , value : i . id } ) ) || [ ] }
301+ options = {
302+ categoryStore . data . value ?. map ( ( i ) => ( {
303+ label : i . name ,
304+ value : i . id ,
305+ } ) ) || [ ]
306+ }
295307 value = { data . categoryId }
296308 onUpdateValue = { ( v ) => {
297309 data . categoryId = v
@@ -319,11 +331,12 @@ const PostWriteView = defineComponent(() => {
319331 if ( selectRef . value ) {
320332 selectRef . value . $el . querySelector ( 'input' ) . focus ( )
321333 }
322- const { data : tagData } = await RESTManager . api . categories . get < {
323- data : TagModel [ ]
324- } > ( {
325- params : { type : 'Tag' } ,
326- } )
334+ const { data : tagData } =
335+ await RESTManager . api . categories . get < {
336+ data : TagModel [ ]
337+ } > ( {
338+ params : { type : 'Tag' } ,
339+ } )
327340 tagsRef . value = tagData . map ( ( i ) => ( {
328341 label : `${ i . name } (${ i . count } )` ,
329342 value : i . name ,
@@ -368,7 +381,10 @@ const PostWriteView = defineComponent(() => {
368381 < NSelect
369382 maxTagCount = { 3 }
370383 multiple
371- options = { postListState . datalist . value . map ( i => ( { label : i . title , value : i . id } ) ) }
384+ options = { postListState . datalist . value . map ( ( i ) => ( {
385+ label : i . title ,
386+ value : i . id ,
387+ } ) ) }
372388 loading = { postListState . loading . value }
373389 filterable
374390 placeholder = "搜索标题"
@@ -424,7 +440,7 @@ const PostWriteView = defineComponent(() => {
424440 >
425441 { {
426442 checked : ( ) => '已发布' ,
427- unchecked : ( ) => '草稿'
443+ unchecked : ( ) => '草稿' ,
428444 } }
429445 </ NSwitch >
430446 </ NFormItem >
0 commit comments