提交 5dd79037 authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 b1b50306
...@@ -17,6 +17,7 @@ export interface Post { ...@@ -17,6 +17,7 @@ export interface Post {
created_time: string created_time: string
updated_time: string updated_time: string
delete_time: string delete_time: string
collection_count: 0 | 1
} }
export interface PostItem extends Post { export interface PostItem extends Post {
......
...@@ -45,9 +45,9 @@ function toggleCollection() { ...@@ -45,9 +45,9 @@ function toggleCollection() {
chapter_id: detail.chapter_id, chapter_id: detail.chapter_id,
source_id: detail.id, source_id: detail.id,
type: 6, type: 6,
status: 1 status: detail.collection_count ? 0 : 1
}).then(() => { }).then(() => {
// data.collection_count = data.collection_count ? 0 : 1 detail.collection_count = detail.collection_count ? 0 : 1
}) })
} }
</script> </script>
...@@ -56,7 +56,9 @@ function toggleCollection() { ...@@ -56,7 +56,9 @@ function toggleCollection() {
<div class="bbs"> <div class="bbs">
<div class="bbs-hd" v-if="detail"> <div class="bbs-hd" v-if="detail">
<h1>{{ detail.title }}</h1> <h1>{{ detail.title }}</h1>
<el-button round auto-insert-space @click="toggleCollection">收藏</el-button> <el-button round auto-insert-space @click="toggleCollection">
{{ detail.collection_count ? '取消收藏' : '收藏' }}
</el-button>
<el-button round type="primary" auto-insert-space @click="discussFormVisible = true">回复</el-button> <el-button round type="primary" auto-insert-space @click="discussFormVisible = true">回复</el-button>
</div> </div>
<AppList v-bind="listOptions" ref="appList"> <AppList v-bind="listOptions" ref="appList">
......
...@@ -120,6 +120,8 @@ function genPreviewUrl(item: CollectionType) { ...@@ -120,6 +120,8 @@ function genPreviewUrl(item: CollectionType) {
function targetUrl(item: CollectionType) { function targetUrl(item: CollectionType) {
if (item.type === 5) { if (item.type === 5) {
return `/course/exam?course_id=${item.course_id}&semester_id=${item.semester_id}&paper_id=${item.info.id}&type=2&paper_title=${item.info.paper_title}` return `/course/exam?course_id=${item.course_id}&semester_id=${item.semester_id}&paper_id=${item.info.id}&type=2&paper_title=${item.info.paper_title}`
} else if (item.type === 6) {
return `/bbs/${item.info.id}`
} else if (item.type === 2) { } else if (item.type === 2) {
return genCoursePlayerUrl(item) return genCoursePlayerUrl(item)
} else { } else {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论