Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
corporateCulture-qd
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王立鹏
corporateCulture-qd
Commits
797a579b
Commit
797a579b
authored
Nov 25, 2025
by
lijiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【需求 17679】 feat: 完善首页、视频发布页、搜索页等相关内容
parent
53921419
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
346 additions
and
168 deletions
+346
-168
recommendList.vue
src/views/homePage/homeTab/components/recommendList.vue
+7
-0
videoList.vue
src/views/homePage/homeTab/components/videoList.vue
+0
-0
columnList.vue
src/views/homePage/yaTab/components/columnList.vue
+4
-4
practiceList.vue
src/views/homePage/yaTab/components/practiceList.vue
+18
-107
publishPractice.vue
src/views/homePage/yaTab/components/publishPractice.vue
+238
-0
selectTagsDialog.vue
src/views/homePage/yaTab/components/selectTagsDialog.vue
+46
-0
index.vue
src/views/publishCase/index.vue
+33
-57
index.vue
src/views/publishVideo/index.vue
+0
-0
index.vue
src/views/searchPage/index.vue
+0
-0
No files found.
src/views/homePage/homeTab/components/recommendList.vue
View file @
797a579b
...
...
@@ -9,6 +9,13 @@
@
click=
"handleClickItem(item)"
>
<div
class=
"flex gap-3 justify-between"
>
<!--
<div
v-if=
"item.isRecommend"
class=
"absolute top-0 left-0 w-15 h-7 z-1000 bg-#FFF9B9 flex items-center justify-center border-2px border-solid border-#f4f0eb rounded-tl-lg rounded-br-lg"
>
<img
class=
"w-6"
src=
"@/assets/img/culture/recommend.png"
alt=
""
/>
<div
class=
"text-12px text-#000 line-height-12px"
>
推荐
</div>
</div>
-->
<!-- 内容区域 -->
<div
class=
"flex-1 min-w-0 flex flex-col justify-between h-24"
>
<!-- 标题 -->
...
...
src/views/homePage/homeTab/components/videoList.vue
View file @
797a579b
This diff is collapsed.
Click to expand it.
src/views/homePage/yaTab/components/columnList.vue
View file @
797a579b
...
...
@@ -36,19 +36,19 @@
/>
<div
v-if=
"i.isRecommend"
class=
"absolute top-
0 left-0
w-15 h-7 z-1000 bg-#FFF9B9 flex items-center justify-center border-2px border-solid border-#f4f0eb rounded-tl-lg rounded-br-lg"
class=
"absolute top-
-1 left--1
w-15 h-7 z-1000 bg-#FFF9B9 flex items-center justify-center border-2px border-solid border-#f4f0eb rounded-tl-lg rounded-br-lg"
>
<img
class=
"w-6"
src=
"@/assets/img/culture/recommend.png"
alt=
""
/>
<div
class=
"text-12px text-#000 line-height-12px"
>
推荐
</div>
</div>
</div>
<h3
class=
"text
-sm
font-medium text-gray-800 mb-2 transition-colors"
>
<h3
class=
"text font-medium text-gray-800 mb-2 transition-colors"
>
{{
i
.
title
}}
</h3>
<p
class=
"text-
xs
text-gray-500 mb-3 line-clamp-2"
>
<p
class=
"text-
sm
text-gray-500 mb-3 line-clamp-2"
>
{{
i
.
content
}}
</p>
<div
class=
"flex items-center justify-between text-xs text-gray-
4
00"
>
<div
class=
"flex items-center justify-between text-xs text-gray-
5
00"
>
<div
class=
"flex items-center space-x-4"
>
<span
class=
"flex items-center"
>
<el-icon
class=
"mr-1"
><View
/></el-icon>
...
...
src/views/homePage/yaTab/components/practiceList.vue
View file @
797a579b
<
template
>
<div>
<!-- 发布区域 -->
<div
class=
"bg-white p-6 mb-6 rounded-lg shadow-sm"
>
<div
class=
"flex-1 bg-white rounded-lg border border-gray-200"
>
<!-- 主输入区域 -->
<div
class=
"flex gap-3 mb-4 items-center"
>
<!-- 用户头像 -->
<el-avatar
:size=
"48"
:src=
"userInfo.avatar"
class=
"flex-shrink-0"
>
<el-icon><User
/></el-icon>
</el-avatar>
<!-- 输入区域 -->
<div
class=
"flex-1"
>
<!-- 话题标签输入 -->
<div
class=
"mb-4"
>
<el-input
v-model=
"tagInput"
placeholder=
"话题描述...... (非必填)"
class=
"tag-input"
clearable
/>
</div>
<!-- 主要内容输入 -->
<div
class=
"relative mb-3"
>
<el-input
type=
"textarea"
placeholder=
"请输入你想发布的话题"
:rows=
"3"
:maxlength=
"500"
resize=
"none"
class=
"main-textarea"
/>
<!-- 字符计数 -->
<div
class=
"absolute bottom-3 right-3 text-xs text-gray-400"
>
1/30
</div>
</div>
</div>
</div>
<!-- 工具栏 -->
<div
class=
"flex items-center justify-between pl-15"
>
<!-- 左侧工具按钮 -->
<div
class=
"flex items-center gap-1"
>
<el-tooltip
content=
"添加标签"
placement=
"top"
>
<el-button
text
class=
"w-10 h-10 text-gray-500 hover:bg-gray-100 hover:text-gray-700 rounded-lg"
>
<el-icon
size=
"18"
><CollectionTag
/></el-icon>
</el-button>
</el-tooltip>
<el-tooltip
content=
"添加图片"
placement=
"top"
>
<el-button
text
class=
"w-10 h-10 text-gray-500 hover:bg-gray-100 hover:text-gray-700 rounded-lg"
>
<el-icon
size=
"18"
><Picture
/></el-icon>
</el-button>
</el-tooltip>
<el-tooltip
content=
"添加视频"
placement=
"top"
>
<el-button
text
class=
"w-10 h-10 text-gray-500 hover:bg-gray-100 hover:text-gray-700 rounded-lg"
>
<el-icon
size=
"18"
><VideoPlay
/></el-icon>
</el-button>
</el-tooltip>
<el-tooltip
content=
"添加附件"
placement=
"top"
>
<el-button
text
class=
"w-10 h-10 text-gray-500 hover:bg-gray-100 hover:text-gray-700 rounded-lg"
>
<el-icon
size=
"18"
><Paperclip
/></el-icon>
</el-button>
</el-tooltip>
</div>
<!-- 右侧操作按钮 -->
<div
class=
"flex items-center gap-3"
>
<el-button
class=
"px-4 py-2 text-gray-600 hover:text-gray-800 hover:bg-gray-50 rounded-lg border border-gray-200 text-sm"
>
存草稿
</el-button>
<el-button
type=
"primary"
:disabled=
"!tagInput"
class=
"px-6 py-2 bg-blue-500 hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed rounded-lg text-white text-sm font-medium shadow-sm hover:shadow-md transition-all duration-200"
>
发布话题
</el-button>
</div>
</div>
</div>
</div>
<PublishPractice
/>
<!-- 标签导航 -->
<div
class=
"bg-white p-4 mb-6 rounded-lg shadow-sm"
>
...
...
@@ -133,7 +38,7 @@
<div
class=
"flex items-center gap-2"
>
<div
class=
"w-1 h-6 bg-red-500 rounded"
></div>
<h2
class=
"text-lg font-medium"
>
{{
tagList
.
find
((
tag
)
=>
searchParams
.
tagIdList
?.
includes
(
tag
.
id
))?.
title
??
'最新'
}}
{{
filterText
}}
</h2>
</div>
<div
...
...
@@ -143,10 +48,9 @@
查看更多 >>
</div>
</div>
<el-divider
/>
<el-divider
class=
"my-1!"
/>
<!-- 动态列表 -->
<div
class=
"divide-y divide-gray-100"
>
<div
class=
"divide-y bg-#fff"
>
<div
@
click=
"router.push(`/postDetail/$
{item.id}`)"
v-for="item in list"
...
...
@@ -156,9 +60,9 @@
<div
class=
"flex gap-3 items-center"
>
<!-- 左侧内容 -->
<div
class=
"flex-1"
>
<h
3
class=
"text-base font-medium text-gray-900 mb-2 leading-relaxed
"
>
<h
2
class=
"font-medium text-gray-900 mb-2 leading-relaxed line-clamp-1
"
>
{{
item
.
title
}}
</h
3
>
</h
2
>
<!-- 带图片的内容 -->
<div
class=
"flex gap-3 mb-3"
>
...
...
@@ -169,7 +73,7 @@
class=
"w-20 h-20 object-cover rounded-lg flex-shrink-0"
/>
<div
class=
"flex-1"
>
<div
class=
"text-gray-600 text-sm leading-relaxed"
>
<div
class=
"text-gray-600 text-sm leading-relaxed
line-clamp-3
"
>
{{
item
.
content
}}
</div>
</div>
...
...
@@ -239,13 +143,13 @@
</
template
>
<
script
setup
lang=
"ts"
>
import
{
useUserStore
}
from
'@/stores/user'
import
{
storeToRefs
}
from
'pinia'
import
{
getPracticeList
}
from
'@/api/practice'
import
{
usePageSearch
,
useScrollTop
}
from
'@/hooks'
import
dayjs
from
'dayjs'
import
{
TABS_REF_KEY
}
from
'@/constants'
import
{
useTagsStore
}
from
'@/stores/tags'
import
PublishPractice
from
'./publishPractice.vue'
const
tagsStore
=
useTagsStore
()
const
{
tagList
}
=
storeToRefs
(
tagsStore
)
...
...
@@ -253,7 +157,6 @@ const { tagList } = storeToRefs(tagsStore)
const
router
=
useRouter
()
const
tabsRef
=
inject
(
TABS_REF_KEY
)
const
{
userInfo
}
=
storeToRefs
(
useUserStore
())
const
filterOptions
=
ref
([
{
title
:
'最热'
,
id
:
0
},
...
...
@@ -261,8 +164,6 @@ const filterOptions = ref([
{
title
:
'最多观看'
,
id
:
2
},
])
const
tagInput
=
ref
(
''
)
const
{
handleBackTop
,
ScrollTopComp
}
=
useScrollTop
(
tabsRef
!
)
const
{
list
,
total
,
searchParams
,
goToPage
,
changePageSize
,
refresh
}
=
usePageSearch
(
getPracticeList
,
...
...
@@ -273,6 +174,15 @@ const { list, total, searchParams, goToPage, changePageSize, refresh } = usePage
immediate
:
false
,
},
)
const
filterText
=
computed
(()
=>
{
return
(
filterOptions
.
value
.
find
((
item
)
=>
item
.
id
===
searchParams
.
value
.
sortLogic
)?.
title
+
(
searchParams
.
value
.
tagIdList
?.
length
?
'——'
:
''
)
+
(
searchParams
.
value
.
tagIdList
?.
length
?
tagList
.
value
.
find
((
item
)
=>
searchParams
.
value
.
tagIdList
?.
includes
(
item
.
id
))?.
title
:
''
)
)
})
const
toggleFilter
=
(
id
:
number
)
=>
{
searchParams
.
value
.
sortLogic
=
id
...
...
@@ -285,6 +195,7 @@ const toggleTag = (id: number) => {
refresh
()
handleBackTop
()
}
defineExpose
({
refresh
:
()
=>
{
refresh
()
...
...
src/views/homePage/yaTab/components/publishPractice.vue
0 → 100644
View file @
797a579b
<
template
>
<div
class=
"bg-white p-6 mb-6 rounded-lg shadow-sm"
>
<div
class=
"flex-1 bg-white rounded-lg border border-gray-200"
>
<!-- 主输入区域 -->
<div
class=
"flex gap-3 mb-4 items-start"
>
<!-- 用户头像 -->
<el-avatar
:size=
"48"
:src=
"userInfo.avatar"
class=
"flex-shrink-0"
>
<el-icon><User
/></el-icon>
</el-avatar>
<!-- 输入区域 -->
<div
class=
"flex-1"
>
<!-- 话题标签输入 -->
<div
class=
"mb-4"
>
<el-input
v-model=
"form.title"
placeholder=
"实践标题"
class=
"tag-input"
clearable
/>
</div>
<!-- 主要内容输入 -->
<div
class=
"relative mb-3"
>
<el-input
type=
"textarea"
placeholder=
"请输入实践内容"
:rows=
"3"
:maxlength=
"500"
resize=
"none"
class=
"main-textarea"
v-model=
"form.content"
/>
<!-- 字符计数 -->
<div
class=
"absolute bottom-3 right-3 text-xs text-gray-400"
>
1/30
</div>
</div>
<!-- 标签内容 -->
<div
class=
"mb-2"
>
<!-- 选择的标签内容 -->
<div
class=
"flex items-center gap-2"
>
<span
v-if=
"mainTagText"
class=
"text-sm text-gray-500"
>
主标签:
<el-tag>
{{
mainTagText
}}
</el-tag>
</span>
<span
v-if=
"subTagTextList.length > 0"
class=
"text-sm text-gray-500"
>
副标签:
<el-tag
class=
"mr-2"
v-for=
"tag in subTagTextList"
:key=
"tag"
>
{{
tag
}}
</el-tag>
</span>
</div>
</div>
<!-- 图片相关 -->
<div
v-if=
"form.imgUrl.length"
class=
"flex flex-wrap gap-2"
>
<!-- 删除图片 -->
<div
class=
"relative w-20 h-20 rounded-lg overflow-hidden group"
v-for=
"img in form.imgUrl"
:key=
"img"
>
<div
class=
"absolute top-1 right-1 z-10 w-5 h-5 flex items-center justify-center bg-black/60 rounded-full cursor-pointer opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-black/80 hover:scale-110"
@
click=
"handleDeleteImg(img)"
>
<el-icon
class=
"text-white text-xs"
>
<Close
/>
</el-icon>
</div>
<el-image
:src=
"img"
class=
"w-full h-full rounded-lg border border-gray-200"
fit=
"cover"
/>
</div>
</div>
</div>
</div>
<!-- 工具栏 -->
<div
class=
"flex items-center justify-between pl-15"
>
<!-- 左侧工具按钮 -->
<div
class=
"flex items-center gap-1"
>
<el-tooltip
content=
"添加标签"
placement=
"top"
>
<el-button
text
class=
"w-10 h-10 text-gray-500 hover:bg-gray-100 hover:text-gray-700 rounded-lg"
@
click=
"handleAddTag"
>
<el-icon
size=
"18"
><CollectionTag
/></el-icon>
</el-button>
</el-tooltip>
<!-- 隐藏上传文件的input -->
<input
type=
"file"
class=
"hidden"
ref=
"fileInputRef"
@
change=
"handleFileChange"
/>
<el-tooltip
content=
"添加图片"
placement=
"top"
>
<el-button
text
class=
"w-10 h-10 text-gray-500 hover:bg-gray-100 hover:text-gray-700 rounded-lg"
@
click=
"fileInputRef?.click()"
>
<el-icon
size=
"18"
><Picture
/></el-icon>
</el-button>
</el-tooltip>
<!--
<el-tooltip
content=
"添加视频"
placement=
"top"
>
<el-button
text
class=
"w-10 h-10 text-gray-500 hover:bg-gray-100 hover:text-gray-700 rounded-lg"
>
<el-icon
size=
"18"
><VideoPlay
/></el-icon>
</el-button>
</el-tooltip>
<el-tooltip
content=
"添加附件"
placement=
"top"
>
<el-button
text
class=
"w-10 h-10 text-gray-500 hover:bg-gray-100 hover:text-gray-700 rounded-lg"
>
<el-icon
size=
"18"
><Paperclip
/></el-icon>
</el-button>
</el-tooltip>
-->
</div>
<!-- 右侧操作按钮 -->
<div
class=
"flex items-center gap-3"
>
<el-button
class=
"px-4 py-2 text-gray-600 hover:text-gray-800 hover:bg-gray-50 rounded-lg border border-gray-200 text-sm"
@
click=
"handlePublish(ReleaseStatusTypeEnum.DRAFT)"
>
存草稿
</el-button>
<el-button
type=
"primary"
class=
"px-6 py-2 bg-blue-500 hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed rounded-lg text-white text-sm font-medium shadow-sm hover:shadow-md transition-all duration-200"
@
click=
"handlePublish(ReleaseStatusTypeEnum.PUBLISH)"
>
发布实践
</el-button>
</div>
</div>
</div>
<SelectTagsDialog
v-model:mainTagId=
"form.mainTagId"
v-model:tagList=
"form.tagList"
ref=
"selectTagsDialogRef"
/>
</div>
</
template
>
<
script
setup
lang=
"ts"
>
import
{
useUserStore
}
from
'@/stores'
import
{
storeToRefs
}
from
'pinia'
import
SelectTagsDialog
from
'./selectTagsDialog.vue'
import
{
useResetData
}
from
'@/hooks'
import
{
ReleaseStatusTypeEnum
,
SendTypeEnum
}
from
'@/constants'
import
{
useTagsStore
}
from
'@/stores'
import
{
uploadFile
}
from
'@/api'
import
{
Close
}
from
'@element-plus/icons-vue'
import
{
addOrUpdatePractice
}
from
'@/api'
import
type
{
AddOrUpdatePracticeDto
}
from
'@/api/practice/types'
const
tagsStore
=
useTagsStore
()
const
{
tagList
}
=
storeToRefs
(
tagsStore
)
const
userStore
=
useUserStore
()
const
{
userInfo
}
=
storeToRefs
(
userStore
)
const
selectTagsDialogRef
=
useTemplateRef
<
InstanceType
<
typeof
SelectTagsDialog
>>
(
'selectTagsDialogRef'
)
const
fileInputRef
=
useTemplateRef
<
HTMLInputElement
>
(
'fileInputRef'
)
const
[
form
,
resetForm
]
=
useResetData
({
title
:
''
,
content
:
''
,
imgUrl
:
[],
releaseStatus
:
ReleaseStatusTypeEnum
.
PUBLISH
,
mainTagId
:
''
,
tagList
:
[],
sendType
:
SendTypeEnum
.
IMMEDIATE
,
sendTime
:
''
,
})
const
mainTagText
=
computed
(()
=>
{
return
tagList
.
value
.
find
((
tag
)
=>
tag
.
id
===
Number
(
form
.
value
.
mainTagId
))?.
title
})
const
subTagTextList
=
computed
(()
=>
{
return
form
.
value
.
tagList
.
map
((
tag
)
=>
tagList
.
value
.
find
((
t
)
=>
t
.
id
===
tag
)?.
title
)
})
const
handleAddTag
=
()
=>
{
selectTagsDialogRef
.
value
?.
open
()
}
const
handleFileChange
=
async
(
e
:
Event
)
=>
{
const
file
=
(
e
.
target
as
HTMLInputElement
).
files
?.[
0
]
if
(
file
)
{
const
{
data
}
=
await
uploadFile
(
file
)
form
.
value
.
imgUrl
.
push
(
data
.
data
[
0
].
filePath
)
}
}
const
handleDeleteImg
=
(
img
:
string
)
=>
{
form
.
value
.
imgUrl
=
form
.
value
.
imgUrl
.
filter
((
item
)
=>
item
!==
img
)
}
const
validateForm
=
()
=>
{
if
(
!
form
.
value
.
title
)
{
ElMessage
.
error
(
'请输入实践标题'
)
return
false
}
if
(
!
form
.
value
.
content
)
{
ElMessage
.
error
(
'请输入实践内容'
)
return
false
}
if
(
!
form
.
value
.
mainTagId
)
{
ElMessage
.
error
(
'请选择主标签'
)
return
false
}
return
true
}
const
transformForm
=
(
releaseStatus
:
ReleaseStatusTypeEnum
):
AddOrUpdatePracticeDto
=>
{
return
{
...
form
.
value
,
releaseStatus
,
faceUrl
:
form
.
value
.
imgUrl
[
0
]
||
''
,
imgUrl
:
form
.
value
.
imgUrl
.
join
(
','
),
tagList
:
[
form
.
value
.
mainTagId
,
...
form
.
value
.
tagList
].
map
((
item
,
index
)
=>
({
sort
:
index
,
tagId
:
Number
(
item
),
})),
}
}
const
handlePublish
=
async
(
releaseStatus
:
ReleaseStatusTypeEnum
)
=>
{
if
(
!
validateForm
())
return
await
addOrUpdatePractice
(
transformForm
(
releaseStatus
))
ElMessage
.
success
(
releaseStatus
===
ReleaseStatusTypeEnum
.
PUBLISH
?
'发布成功'
:
'存草稿成功'
)
resetForm
()
}
</
script
>
<
style
scoped
></
style
>
src/views/homePage/yaTab/components/selectTagsDialog.vue
0 → 100644
View file @
797a579b
<
template
>
<el-dialog
v-model=
"dialogVisible"
title=
"选择标签"
width=
"500px"
:close-on-click-modal=
"false"
>
<div
class=
"space-y-6 px-2"
>
<div
class=
"flex items-start gap-4"
>
<div
class=
"text-sm text-gray-700 w-16 flex-shrink-0"
>
主标签
</div>
<div
class=
"flex-1"
>
<SelectTags
v-model=
"mainTagId"
/>
</div>
</div>
<div
class=
"flex items-start gap-4"
>
<div
class=
"text-sm text-gray-700 w-16 flex-shrink-0"
>
副标签
</div>
<div
class=
"flex-1"
>
<SelectTags
v-model=
"subTagIdList"
:max-selected-tags=
"3"
:filter-tags-fn=
"filterTagsFn"
/>
</div>
</div>
</div>
</el-dialog>
</
template
>
<
script
setup
lang=
"ts"
>
import
SelectTags
from
'@/components/common/SelectTags/index.vue'
import
type
{
TagItemDto
}
from
'@/api'
const
dialogVisible
=
ref
(
false
)
const
mainTagId
=
defineModel
<
string
>
(
'mainTagId'
,
{
required
:
true
})
const
subTagIdList
=
defineModel
<
number
[]
>
(
'tagList'
,
{
required
:
true
})
const
open
=
()
=>
{
dialogVisible
.
value
=
true
}
const
filterTagsFn
=
(
allTags
:
TagItemDto
[])
=>
{
return
allTags
.
filter
((
tag
)
=>
tag
.
id
!==
Number
(
mainTagId
.
value
))
}
defineExpose
({
open
,
})
</
script
>
<
style
scoped
></
style
>
src/views/publishCase/index.vue
View file @
797a579b
...
...
@@ -3,20 +3,9 @@
<div
class=
"max-w-4xl mx-auto"
>
<!-- 主表单卡片 -->
<div
class=
"bg-white rounded-lg shadow-lg p-8"
>
<el-form
ref=
"formRef"
:model=
"form"
label-position=
"top"
size=
"default"
>
<!-- 案例编号 -->
<div
class=
"mb-6 flex items-center gap-2"
>
<span
class=
"text-gray-700 font-medium"
>
案例编号:
</span>
<span
class=
"text-gray-900 font-semibold"
>
{{
form
.
number
}}
</span>
<el-tooltip
content=
"案例编号自动生成"
placement=
"top"
>
<el-icon
class=
"text-pink-500 cursor-pointer"
>
<QuestionFilled
/>
</el-icon>
</el-tooltip>
</div>
<el-form
ref=
"formRef"
:model=
"form"
label-position=
"top"
:rules=
"rules"
>
<!-- 标题输入 -->
<el-form-item
class=
"mb-6"
label=
"标题"
>
<el-form-item
class=
"mb-6"
label=
"标题"
prop=
"title"
>
<el-input
v-model=
"form.title"
placeholder=
"请输入【案例】标题"
...
...
@@ -27,7 +16,7 @@
</el-form-item>
<!-- 内容输入 -->
<el-form-item
class=
"mb-6 relative"
label=
"内容"
>
<el-form-item
class=
"mb-6 relative"
label=
"内容"
prop=
"content"
>
<el-input
v-model=
"form.content"
type=
"textarea"
...
...
@@ -38,7 +27,7 @@
/>
</el-form-item>
<!-- 关键词选择 -->
<el-form-item
label=
"文化关键词"
class=
"mb-6"
>
<el-form-item
label=
"文化关键词"
class=
"mb-6"
prop=
"mainTagId"
>
<div
class=
"flex flex-wrap gap-3"
>
主标签
<SelectTags
v-model=
"form.mainTagId"
/>
...
...
@@ -56,34 +45,19 @@
</el-form-item>
<!-- 是否同步发布 -->
<el-form-item
label=
"
*是否同步发布到实践"
class=
"mb-6
"
>
<el-radio-group
v-model=
"form.
publishToPractice
"
>
<el-radio
:label=
"
true
"
>
是
</el-radio>
<el-radio
:label=
"
false
"
>
否
</el-radio>
<el-form-item
label=
"
是否同步发布到实践"
class=
"mb-6"
prop=
"isSync
"
>
<el-radio-group
v-model=
"form.
isSync
"
>
<el-radio
:label=
"
1
"
>
是
</el-radio>
<el-radio
:label=
"
0
"
>
否
</el-radio>
</el-radio-group>
</el-form-item>
<!-- 发布时间 -->
<!--
<el-form-item
label=
"*发布时间"
class=
"mb-8"
>
<el-radio-group
v-model=
"form.publishTime"
>
<el-radio
label=
"now"
>
立即发布
</el-radio>
<el-radio
label=
"scheduled"
>
定时发布
</el-radio>
</el-radio-group>
<el-date-picker
v-if=
"form.publishTime === 'scheduled'"
v-model=
"form.scheduledTime"
type=
"datetime"
placeholder=
"选择发布时间"
class=
"ml-4"
/>
</el-form-item>
-->
<!-- 底部按钮组 -->
<div
class=
"flex items-center justify-between gap-4 pt-4"
>
<div
class=
"flex gap-4"
>
<el-button
@
click=
"handleCancel"
>
取消
</el-button>
<
el-button
@
click=
"handlePreview"
>
预览
</el-button
>
<el-button
type=
"info"
plain
@
click=
"handleS
aveDraf
t"
>
存草稿
</el-button>
<
!--
<el-button
@
click=
"handlePreview"
>
预览
</el-button>
--
>
<el-button
type=
"info"
plain
@
click=
"handleS
ubmi
t"
>
存草稿
</el-button>
</div>
<el-button
type=
"primary"
@
click=
"handleSubmit"
>
提交
</el-button>
</div>
...
...
@@ -94,14 +68,15 @@
</
template
>
<
script
setup
lang=
"tsx"
>
import
{
QuestionFilled
}
from
'@element-plus/icons-vue'
import
{
addOrUpdateCase
,
getMaxCaseNumber
}
from
'@/api'
import
{
addOrUpdateCase
}
from
'@/api'
import
{
useResetData
}
from
'@/hooks'
import
type
{
AddOrUpdateCaseDto
}
from
'@/api'
import
SelectTags
from
'@/components/common/SelectTags/index.vue'
import
type
{
FormInstance
}
from
'element-plus'
import
type
{
TagItemDto
}
from
'@/api'
import
{
TagTypeEnum
,
TagLevelEnum
}
from
'@/constants'
import
{
TagTypeEnum
,
TagLevelEnum
,
BooleanFlag
,
ReleaseStatusTypeEnum
}
from
'@/constants'
const
router
=
useRouter
()
const
formRef
=
useTemplateRef
<
FormInstance
>
(
'formRef'
)
...
...
@@ -110,31 +85,35 @@ type FormData = Omit<AddOrUpdateCaseDto, 'tagRelationDtoList'> & {
subTagIds
:
number
[]
}
const
[
form
]
=
useResetData
<
FormData
>
({
const
rules
=
{
title
:
[{
required
:
true
,
message
:
'请输入标题'
,
trigger
:
'blur'
}],
content
:
[{
required
:
true
,
message
:
'请输入内容'
,
trigger
:
'blur'
}],
mainTagId
:
[{
required
:
true
,
message
:
'请选择文化关键词'
,
trigger
:
'blur'
}],
isSync
:
[{
required
:
true
,
message
:
'请选择是否同步发布到实践'
,
trigger
:
'blur'
}],
}
const
[
form
,
resetForm
]
=
useResetData
({
title
:
''
,
content
:
''
,
number
:
''
,
mainTagId
:
''
,
subTagIds
:
[],
isSync
:
BooleanFlag
.
NO
,
releaseStatus
:
ReleaseStatusTypeEnum
.
DRAFT
,
})
// 取消
const
handleCancel
=
()
=>
{
ElMessage
.
warning
(
'确定要取消吗?'
)
// 可以添加确认对话框
resetForm
(
)
router
.
back
()
}
// 预览
const
handlePreview
=
()
=>
{
console
.
log
(
'预览'
,
form
)
ElMessage
.
success
(
'预览功能待实现'
)
}
//
const handlePreview = () => {
//
console.log('预览', form)
//
ElMessage.success('预览功能待实现')
//
}
// 保存草稿
const
handleSaveDraft
=
()
=>
{
console
.
log
(
'保存草稿'
,
form
)
ElMessage
.
success
(
'草稿保存成功'
)
}
const
transformData
=
(
formData
:
FormData
):
AddOrUpdateCaseDto
=>
{
const
{
mainTagId
,
subTagIds
,
...
rest
}
=
formData
...
...
@@ -142,6 +121,7 @@ const transformData = (formData: FormData): AddOrUpdateCaseDto => {
...
rest
,
tagRelationDtoList
:
[],
}
// 添加标签内容
obj
.
tagRelationDtoList
.
push
({
tagId
:
Number
(
mainTagId
),
type
:
TagTypeEnum
.
CULTURE_TAG
,
...
...
@@ -163,6 +143,8 @@ const handleSubmit = async () => {
const
res
=
await
addOrUpdateCase
(
transformData
(
form
.
value
))
if
(
res
)
{
ElMessage
.
success
(
'提交成功'
)
resetForm
()
router
.
back
()
}
}
...
...
@@ -230,14 +212,8 @@ const filterTagsFn = (allTags: TagItemDto[]) => {
return
allTags
.
filter
((
tag
)
=>
tag
.
id
!==
Number
(
form
.
value
.
mainTagId
))
}
const
fetchMaxCaseNumber
=
async
()
=>
{
const
{
data
}
=
await
getMaxCaseNumber
()
form
.
value
.
number
=
data
}
onActivated
(()
=>
{
showSubmissionGuide
()
fetchMaxCaseNumber
()
})
</
script
>
...
...
src/views/publishVideo/index.vue
View file @
797a579b
This diff is collapsed.
Click to expand it.
src/views/searchPage/index.vue
View file @
797a579b
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment