Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
safe-campus-bbs
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
万成波
safe-campus-bbs
Commits
28d41209
Commit
28d41209
authored
Nov 25, 2025
by
yuwenwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
移动端动态换行展示
parent
1eff28d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
16 deletions
+33
-16
safe-campus-bbs-uniapp/components/Dynamic-Item.vue
safe-campus-bbs-uniapp/components/Dynamic-Item.vue
+33
-16
No files found.
safe-campus-bbs-uniapp/components/Dynamic-Item.vue
View file @
28d41209
...
...
@@ -5,8 +5,8 @@
<image
class=
"avatar"
v-if=
"form.avatar"
:src=
"form.avatar"
></image>
<image
class=
"avatar"
v-else
src=
"/static/images/default-avatar.png"
></image>
<view
class=
"user-name"
>
{{
form
.
nickName
}}
</view>
<image
v-if=
"deleteable || userInfo.bbsAdmin || form.isSelf==1"
class=
"more-icon"
@
click.stop=
"handleDelDynamics"
src=
"/static/images/more-icon.png"
></image>
<image
v-if=
"deleteable || userInfo.bbsAdmin || form.isSelf==1"
class=
"more-icon"
@
click.stop=
"handleDelDynamics"
src=
"/static/images/more-icon.png"
></image>
<image
v-else
class=
"more-icon"
src=
"/static/images/more-icon.png"
></image>
<!-- 删除按钮 -->
<view
class=
"del-btn"
v-if=
"showDelBtn"
@
click.stop=
"handleDel"
...
...
@@ -18,7 +18,7 @@
<view
class=
"topic-box-common"
@
click.stop=
"toTopicDetailPage(name,index)"
>
#
{{
name
}}
</view>
</
template
>
</view>
<view
class=
"dynamic-content-box"
>
<view
class=
"dynamic-content-box"
>
<rich-text
v-if=
"preNodes.length > 0"
:nodes=
"preNodes"
class=
"text"
></rich-text>
<view
class=
"imgs"
v-if=
"form.type=='IMAGE'&&form.attachments && form.attachments.length > 0"
>
...
...
@@ -109,7 +109,8 @@
</view>
<view
class=
"operation-text"
>
<view
v-if=
"item.isFeatured==1"
style=
"color: #F2AC39;margin-right: 10rpx;"
>
精选
</view>
<view
style=
"color: #bbb;"
v-if=
"item.isSelf==1 || userInfo.bbsAdmin"
@
click.stop=
"handleDelete(item)"
>
删除
</view>
<view
style=
"color: #bbb;"
v-if=
"item.isSelf==1 || userInfo.bbsAdmin"
@
click.stop=
"handleDelete(item)"
>
删除
</view>
</view>
</view>
<view
class=
"content"
>
...
...
@@ -142,7 +143,9 @@
import
PublishComment
from
'
./PublishComment.vue
'
;
import
VideoPreview
from
'
./VideoPreview.vue
'
;
import
emotions
from
'
@/utils/emjo
'
;
import
{
getUserInfo
}
from
'
@/utils/auth
'
;
import
{
getUserInfo
}
from
'
@/utils/auth
'
;
export
default
{
name
:
"
Dynamic-Item
"
,
data
()
{
...
...
@@ -155,7 +158,7 @@
showDelBtn
:
false
,
preNodes
:
[],
emotions
,
userInfo
:{}
userInfo
:
{}
};
},
components
:
{
...
...
@@ -250,12 +253,26 @@
}
}
// 提取文本
// 提取文本
并按换行符分割
const
text
=
content
.
slice
(
0
,
nextEmotionIndex
);
nodes
.
push
({
type
:
'
text
'
,
text
:
text
});
if
(
text
)
{
const
textParts
=
text
.
split
(
'
\n
'
);
// 按换行符分割
textParts
.
forEach
((
part
,
idx
)
=>
{
if
(
part
)
{
// 添加普通文本节点
nodes
.
push
({
type
:
'
text
'
,
text
:
part
});
}
// 除了最后一部分,每个分割后都加
<
br
/>
if
(
idx
<
textParts
.
length
-
1
)
{
nodes
.
push
({
name
:
'
br
'
// 添加
<
br
/>
标签实现换行
});
}
});
}
content
=
content
.
slice
(
nextEmotionIndex
);
}
}
...
...
@@ -313,7 +330,7 @@
uni
.
showToast
({
title
:
'
投票成功
'
})
this
.
$emit
(
'
refreshCurrent
'
,
this
.
form
.
id
)
this
.
$emit
(
'
refreshCurrent
'
,
this
.
form
.
id
)
}
})
},
...
...
@@ -341,14 +358,14 @@
});
},
// 预览图片
preview
(
list
,
index
)
{
let
urls
=
list
.
map
((
item
)
=>
{
preview
(
list
,
index
)
{
let
urls
=
list
.
map
((
item
)
=>
{
return
item
.
url
;
})
if
(
urls
.
length
>
0
)
{
if
(
urls
.
length
>
0
)
{
uni
.
previewImage
({
urls
:
urls
,
current
:
index
current
:
index
});
}
},
...
...
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