Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-learn
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-learn
Commits
6925d777
提交
6925d777
authored
10月 26, 2022
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: update
上级
72ad147f
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
104 行增加
和
32 行删除
+104
-32
DiscussItem.vue
src/modules/bbs/components/DiscussItem.vue
+30
-21
DiscussItemCommentList.vue
src/modules/bbs/components/DiscussItemCommentList.vue
+5
-2
FileList.vue
src/modules/bbs/components/FileList.vue
+22
-2
PostForm.vue
src/modules/bbs/components/PostForm.vue
+11
-4
PostItem.vue
src/modules/bbs/components/PostItem.vue
+1
-1
types.ts
src/modules/bbs/types.ts
+1
-0
View.vue
src/modules/bbs/views/View.vue
+34
-2
没有找到文件。
src/modules/bbs/components/DiscussItem.vue
浏览文件 @
6925d777
...
@@ -68,26 +68,24 @@ function handleSubmit() {
...
@@ -68,26 +68,24 @@ function handleSubmit() {
<el-button
round
plain
size=
"small"
type=
"primary"
>
老师
</el-button>
<el-button
round
plain
size=
"small"
type=
"primary"
>
老师
</el-button>
</
template
>
</
template
>
<
template
v-else
>
<
template
v-else
>
<img
<div
class=
"discuss-item__level"
>
src=
"@/assets/images/icon_bbs_level_1.png"
<template
v-if=
"data.sso_user.discussion_level === 0"
>
width=
"40"
<img
src=
"@/assets/images/icon_bbs_level_1.png"
title=
"学徒"
/>
title=
"学徒"
<p>
学徒
</p>
v-if=
"data.sso_user.discussion_level === 0"
/>
</
template
>
<img
<
template
v-if=
"data.sso_user.discussion_level === 1"
>
src=
"@/assets/images/icon_bbs_level_2.png"
<img
src=
"@/assets/images/icon_bbs_level_2.png"
title=
"学者"
/>
width=
"40"
<p>
学者
</p>
title=
"学者"
</
template
>
v-if=
"data.sso_user.discussion_level === 1"
/>
<
template
v-if=
"data.sso_user.discussion_level === 2"
>
<img
<img
src=
"@/assets/images/icon_bbs_level_3.png"
title=
"大师"
/>
src=
"@/assets/images/icon_bbs_level_3.png"
<p>
大师
</p>
width=
"40"
</
template
>
title=
"大师"
<
template
v-if=
"data.sso_user.discussion_level === 3"
>
v-if=
"data.sso_user.discussion_level === 2"
/>
<img
src=
"@/assets/images/icon_bbs_level_4.png"
title=
"智者"
/>
<img
<p>
智者
</p>
src=
"@/assets/images/icon_bbs_level_4.png"
</
template
>
width=
"40"
</div>
title=
"智者"
v-if=
"data.sso_user.discussion_level === 3"
/>
</template>
</template>
</div>
</div>
<div
class=
"discuss-item__right"
>
<div
class=
"discuss-item__right"
>
...
@@ -95,7 +93,7 @@ function handleSubmit() {
...
@@ -95,7 +93,7 @@ function handleSubmit() {
<div
class=
"discuss-item__content"
v-html=
"content2Html(data.content)"
></div>
<div
class=
"discuss-item__content"
v-html=
"content2Html(data.content)"
></div>
<FileList
preview
:data=
"data.files"
v-if=
"data.files.length"
/>
<FileList
preview
:data=
"data.files"
v-if=
"data.files.length"
/>
</div>
</div>
<p
class=
"discuss-item__time"
>
{{ data.
upd
ated_time }}
</p>
<p
class=
"discuss-item__time"
>
{{ data.
cre
ated_time }}
</p>
<div
class=
"discuss-item__comment"
><p
@
click=
"handleReply"
>
回复
</p></div>
<div
class=
"discuss-item__comment"
><p
@
click=
"handleReply"
>
回复
</p></div>
<div
class=
"discuss-item-form"
v-if=
"formVisible"
>
<div
class=
"discuss-item-form"
v-if=
"formVisible"
>
<p
class=
"discuss-item-form__title"
>
回复本楼
</p>
<p
class=
"discuss-item-form__title"
>
回复本楼
</p>
...
@@ -165,6 +163,17 @@ function handleSubmit() {
...
@@ -165,6 +163,17 @@ function handleSubmit() {
font-size
:
16px
;
font-size
:
16px
;
color
:
#333
;
color
:
#333
;
}
}
.discuss-item__level
{
img
{
width
:
40px
;
}
p
{
font-size
:
10px
;
font-weight
:
400
;
line-height
:
17px
;
color
:
#666666
;
}
}
.discuss-item__right
{
.discuss-item__right
{
flex
:
1
;
flex
:
1
;
...
...
src/modules/bbs/components/DiscussItemCommentList.vue
浏览文件 @
6925d777
...
@@ -52,6 +52,9 @@ onMounted(() => {
...
@@ -52,6 +52,9 @@ onMounted(() => {
const
inputRef
=
$ref
<
InstanceType
<
typeof
ElInput
>
|
null
>
(
null
)
const
inputRef
=
$ref
<
InstanceType
<
typeof
ElInput
>
|
null
>
(
null
)
let
activeComment
=
$ref
<
DiscussCommentItem
>
()
let
activeComment
=
$ref
<
DiscussCommentItem
>
()
const
commentPlaceholder
=
$computed
(()
=>
{
return
activeComment
?
`回复@
${
getUsername
(
activeComment
.
sso_user
)}
:`
:
''
})
function
handleReply
(
data
:
DiscussCommentItem
)
{
function
handleReply
(
data
:
DiscussCommentItem
)
{
if
(
data
.
id
===
activeComment
?.
id
&&
formVisible
)
{
if
(
data
.
id
===
activeComment
?.
id
&&
formVisible
)
{
formVisible
=
false
formVisible
=
false
...
@@ -59,7 +62,6 @@ function handleReply(data: DiscussCommentItem) {
...
@@ -59,7 +62,6 @@ function handleReply(data: DiscussCommentItem) {
}
}
activeComment
=
data
activeComment
=
data
formVisible
=
true
formVisible
=
true
form
.
content
=
`回复@
${
getUsername
(
data
.
sso_user
)}
:`
nextTick
(()
=>
{
nextTick
(()
=>
{
inputRef
?.
focus
()
inputRef
?.
focus
()
})
})
...
@@ -82,7 +84,7 @@ function handleSubmit() {
...
@@ -82,7 +84,7 @@ function handleSubmit() {
reply_type
:
2
,
reply_type
:
2
,
floor_id
:
activeComment
.
floor_id
,
floor_id
:
activeComment
.
floor_id
,
reply_id
:
activeComment
.
id
,
reply_id
:
activeComment
.
id
,
content
:
form
.
content
.
replace
(
`回复@
${
getUsername
(
activeComment
.
sso_user
)}
:`
,
''
)
content
:
form
.
content
}).
then
(()
=>
{
}).
then
(()
=>
{
formVisible
=
false
formVisible
=
false
refresh
()
refresh
()
...
@@ -125,6 +127,7 @@ defineExpose({ refresh })
...
@@ -125,6 +127,7 @@ defineExpose({ refresh })
<el-input
<el-input
type=
"textarea"
type=
"textarea"
show-word-limit
show-word-limit
:placeholder=
"commentPlaceholder"
:autosize=
"
{ minRows: 6, maxRows: 6 }"
:autosize=
"
{ minRows: 6, maxRows: 6 }"
:maxlength="100"
:maxlength="100"
v-model="form.content"
v-model="form.content"
...
...
src/modules/bbs/components/FileList.vue
浏览文件 @
6925d777
...
@@ -29,13 +29,19 @@ const videos = $computed(() => {
...
@@ -29,13 +29,19 @@ const videos = $computed(() => {
<
template
>
<
template
>
<div
class=
"file-list"
>
<div
class=
"file-list"
>
<div
class=
"file-item"
v-for=
"(item, index) in currentImages"
:key=
"index"
>
<div
class=
"file-item"
v-for=
"(item, index) in currentImages"
:key=
"index"
>
<p
class=
"file-item__count"
v-if=
"images.length > 3 && index === 0"
>
共
{{
images
.
length
}}
张
</p>
<el-image
<el-image
style=
"width: 100%; height: 100%"
style=
"width: 100%; height: 100%"
:src=
"item.url + '?x-oss-process=image/resize,m_fill,h_90,w_160'"
:src=
"item.url + '?x-oss-process=image/resize,m_fill,h_90,w_160'"
:initial-index=
"index"
:initial-index=
"index"
:preview-src-list=
"imageSrcList"
:preview-src-list=
"imageSrcList"
fit=
"cover"
/>
fit=
"cover"
>
</el-image>
<template
v-if=
"preview"
>
<p
class=
"file-item__previewText"
>
查看大图
</p>
</
template
>
<
template
v-else
>
<p
class=
"file-item__count"
v-if=
"images.length > 3 && index === 0"
>
共
{{
images
.
length
}}
张
</p>
</
template
>
</div>
</div>
<
template
v-if=
"preview"
>
<
template
v-if=
"preview"
>
<div
class=
"video-item"
v-for=
"(item, index) in videos"
:key=
"index"
>
<div
class=
"video-item"
v-for=
"(item, index) in videos"
:key=
"index"
>
...
@@ -96,4 +102,18 @@ const videos = $computed(() => {
...
@@ -96,4 +102,18 @@ const videos = $computed(() => {
background
:
rgba
(
0
,
0
,
0
,
0
.8
);
background
:
rgba
(
0
,
0
,
0
,
0
.8
);
z-index
:
1000
;
z-index
:
1000
;
}
}
.file-item__previewText
{
position
:
absolute
;
right
:
0
;
bottom
:
0
;
padding
:
0
2px
;
height
:
18px
;
font-size
:
12px
;
color
:
#fff
;
line-height
:
18px
;
text-align
:
center
;
background
:
rgba
(
0
,
0
,
0
,
0
.5
);
border-radius
:
2px
0px
0px
0px
;
z-index
:
1000
;
}
</
style
>
</
style
>
src/modules/bbs/components/PostForm.vue
浏览文件 @
6925d777
...
@@ -35,6 +35,12 @@ const form = $(
...
@@ -35,6 +35,12 @@ const form = $(
files
:
[]
files
:
[]
})
})
)
)
if
(
props
.
courseId
)
{
form
.
course_id
=
props
.
courseId
}
if
(
props
.
semesterId
)
{
form
.
semester_id
=
props
.
semesterId
}
const
rules
=
ref
<
FormRules
>
({
const
rules
=
ref
<
FormRules
>
({
course_id
:
[{
required
:
true
,
message
:
'请选择课程'
,
trigger
:
'change'
}],
course_id
:
[{
required
:
true
,
message
:
'请选择课程'
,
trigger
:
'change'
}],
chapter_id
:
[{
required
:
true
,
message
:
'请选择章节'
,
trigger
:
'change'
}],
chapter_id
:
[{
required
:
true
,
message
:
'请选择章节'
,
trigger
:
'change'
}],
...
@@ -47,9 +53,10 @@ watchEffect(() => {
...
@@ -47,9 +53,10 @@ watchEffect(() => {
const
course
=
courses
.
value
.
find
(
item
=>
item
.
course_id
===
form
.
course_id
)
const
course
=
courses
.
value
.
find
(
item
=>
item
.
course_id
===
form
.
course_id
)
form
.
semester_id
=
course
?
course
.
semester
.
id
:
''
form
.
semester_id
=
course
?
course
.
semester
.
id
:
''
})
})
function
handleCourseChange
()
{
watch
(
chapters
,
()
=>
{
form
.
chapter_id
=
''
const
chapter
=
chapters
.
value
.
find
(
item
=>
item
.
id
===
form
.
chapter_id
)
}
if
(
!
chapter
)
form
.
chapter_id
=
''
})
// 提交
// 提交
function
handleSubmit
()
{
function
handleSubmit
()
{
formRef
?.
validate
().
then
(
create
)
formRef
?.
validate
().
then
(
create
)
...
@@ -94,7 +101,7 @@ function onChange(file: any, files: any, uploadRef: any) {
...
@@ -94,7 +101,7 @@ function onChange(file: any, files: any, uploadRef: any) {
<el-form
ref=
"formRef"
:model=
"form"
:rules=
"rules"
label-position=
"top"
>
<el-form
ref=
"formRef"
:model=
"form"
:rules=
"rules"
label-position=
"top"
>
<el-row
justify=
"space-between"
>
<el-row
justify=
"space-between"
>
<el-form-item
label=
"相关课程"
prop=
"course_id"
v-if=
"!courseId"
>
<el-form-item
label=
"相关课程"
prop=
"course_id"
v-if=
"!courseId"
>
<el-select
filterable
v-model=
"form.course_id"
@
change=
"handleCourseChange"
>
<el-select
filterable
v-model=
"form.course_id"
>
<el-option
v-for=
"item in courses"
:key=
"item.id"
:label=
"item.name"
:value=
"item.course_id"
></el-option>
<el-option
v-for=
"item in courses"
:key=
"item.id"
:label=
"item.name"
:value=
"item.course_id"
></el-option>
</el-select>
</el-select>
</el-form-item>
</el-form-item>
...
...
src/modules/bbs/components/PostItem.vue
浏览文件 @
6925d777
...
@@ -35,7 +35,7 @@ const username = $computed(() => {
...
@@ -35,7 +35,7 @@ const username = $computed(() => {
</div>
</div>
<div
class=
"post-item-ft"
>
<div
class=
"post-item-ft"
>
<p
class=
"post-item__username"
>
{{
username
}}
</p>
<p
class=
"post-item__username"
>
{{
username
}}
</p>
<p
class=
"post-item__time"
>
{{
data
.
updated
_time
}}
</p>
<p
class=
"post-item__time"
>
{{
data
.
last_post
_time
}}
</p>
</div>
</div>
</router-link>
</router-link>
</section>
</section>
...
...
src/modules/bbs/types.ts
浏览文件 @
6925d777
...
@@ -18,6 +18,7 @@ export interface Post {
...
@@ -18,6 +18,7 @@ export interface Post {
updated_time
:
string
updated_time
:
string
delete_time
:
string
delete_time
:
string
collection_count
:
0
|
1
collection_count
:
0
|
1
last_post_time
:
string
}
}
export
interface
PostItem
extends
Post
{
export
interface
PostItem
extends
Post
{
...
...
src/modules/bbs/views/View.vue
浏览文件 @
6925d777
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
type
{
Post
}
from
'../types'
import
type
{
Post
}
from
'../types'
import
{
ArrowUp
}
from
'@element-plus/icons-vue'
import
{
DArrowLeft
,
ArrowUp
}
from
'@element-plus/icons-vue'
import
AppList
from
'@/components/base/AppList.vue'
import
AppList
from
'@/components/base/AppList.vue'
import
DiscussItem
from
'../components/DiscussItem.vue'
import
DiscussItem
from
'../components/DiscussItem.vue'
...
@@ -13,6 +13,8 @@ interface Props {
...
@@ -13,6 +13,8 @@ interface Props {
id
:
string
id
:
string
}
}
const
props
=
defineProps
<
Props
>
()
const
props
=
defineProps
<
Props
>
()
const
router
=
useRouter
()
const
route
=
useRoute
()
let
detail
=
$ref
<
Post
>
()
let
detail
=
$ref
<
Post
>
()
...
@@ -50,9 +52,20 @@ function toggleCollection() {
...
@@ -50,9 +52,20 @@ function toggleCollection() {
detail
.
collection_count
=
detail
.
collection_count
?
0
:
1
detail
.
collection_count
=
detail
.
collection_count
?
0
:
1
})
})
}
}
// 返回列表
function
handleBack
()
{
router
.
replace
(
'/bbs'
)
}
</
script
>
</
script
>
<
template
>
<
template
>
<div
class=
"comeback"
>
<div
class=
"comeback__inner"
@
click=
"handleBack"
>
<el-icon><DArrowLeft
/></el-icon>
<p>
返回列表
</p>
</div>
</div>
<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>
...
@@ -75,6 +88,22 @@ function toggleCollection() {
...
@@ -75,6 +88,22 @@ function toggleCollection() {
</template>
</template>
<
style
lang=
"scss"
>
<
style
lang=
"scss"
>
.comeback
{
padding-bottom
:
20px
;
display
:
flex
;
justify-content
:
flex-start
;
}
.comeback__inner
{
display
:
flex
;
align-items
:
center
;
font-size
:
16px
;
line-height
:
1
;
color
:
#666666
;
cursor
:
pointer
;
p
{
padding
:
0
5px
;
}
}
.bbs
{
.bbs
{
background-color
:
#fff
;
background-color
:
#fff
;
border
:
1px
solid
#e5e5e5
;
border
:
1px
solid
#e5e5e5
;
...
@@ -85,7 +114,7 @@ function toggleCollection() {
...
@@ -85,7 +114,7 @@ function toggleCollection() {
}
}
.bbs-hd
{
.bbs-hd
{
position
:
relative
;
position
:
relative
;
padding
:
20px
;
padding
:
14px
20px
;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
border-bottom
:
1px
solid
#e4e4e4
;
border-bottom
:
1px
solid
#e4e4e4
;
...
@@ -93,6 +122,9 @@ function toggleCollection() {
...
@@ -93,6 +122,9 @@ function toggleCollection() {
z-index
:
10
;
z-index
:
10
;
h1
{
h1
{
flex
:
1
;
flex
:
1
;
font-size
:
20px
;
font-weight
:
400
;
color
:
#666666
;
}
}
}
}
.el-backtop
{
.el-backtop
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论