|
|
@@ -14,26 +14,39 @@
|
|
|
</c-icon>
|
|
|
{{comment.title}}
|
|
|
</div>
|
|
|
- <div class="comment-content">{{comment.content}}</div>
|
|
|
+ <div class="comment-content">
|
|
|
+ <pre>{{comment.content}}</pre>
|
|
|
+ </div>
|
|
|
<div class="comment-author">{{ createTime }} | 作者:{{comment.userName}}
|
|
|
<c-tag :theme="comment.userRole === userType.teacher ? 'red' : 'blue'">{{userTypeNaming[comment.userRole]}}
|
|
|
</c-tag>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <icon-button :left="12" :size="40" @click="showActions = !showActions" class="more-button">
|
|
|
- {{showActions ? 'expand_less' : 'expand_more'}}
|
|
|
- </icon-button>
|
|
|
+ <div>
|
|
|
+ <icon-button :left="12" :size="40" @click="showActions = !showActions" class="more-button" theme="blue">
|
|
|
+ {{showActions ? 'expand_less' : 'expand_more'}}
|
|
|
+ </icon-button>
|
|
|
+ <router-link v-if="toPdfButton"
|
|
|
+ :to="{name: 'pdf-reader', params: { slideId: comment.slideId, page: comment.pageNumber }}"
|
|
|
+ >
|
|
|
+ <icon-button :left="4" :size="40" title="前往幻灯片对应的页面查看该评论" theme="green">
|
|
|
+ arrow_forward
|
|
|
+ </icon-button>
|
|
|
+ </router-link>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<show-transition-small>
|
|
|
<comment-tool-bar
|
|
|
v-if="showActions"
|
|
|
:top-number="comment.topNumber || ''"
|
|
|
- :user-id="comment.userId" :has-reply="comment.reply || ''"
|
|
|
+ :user-id="comment.userId" :reply="comment.reply || ''"
|
|
|
+ :personal="!comment.show"
|
|
|
@reply="handleReply"
|
|
|
@delete-reply="handleDeleteReply"
|
|
|
@delete-comment="handleDeleteComment"
|
|
|
@to-top="handleToTop"
|
|
|
@cancel-to-top="handleCancelToTop"
|
|
|
+ @change-show="handleChangeShow"
|
|
|
/>
|
|
|
</show-transition-small>
|
|
|
<div v-if="comment.reply" class="comment-reply">
|
|
|
@@ -47,7 +60,7 @@
|
|
|
<script>
|
|
|
import { mapState } from 'vuex'
|
|
|
import { createReply, removeReply } from '@/server/reply'
|
|
|
-import { removeComment, topComment, unTopComment } from '@/server/comment'
|
|
|
+import { modifyCommentShow, removeComment, topComment, unTopComment } from '@/server/comment'
|
|
|
import CommentToolBar from '@/components/Discussion/CommentToolBar'
|
|
|
import CIcon from '@/components/Basic/CIcon'
|
|
|
import momentFromNow from '@/utils/moment-from-now'
|
|
|
@@ -61,7 +74,8 @@ export default {
|
|
|
props: {
|
|
|
comment: Object,
|
|
|
isNew: Boolean,
|
|
|
- personal: Boolean
|
|
|
+ personal: Boolean,
|
|
|
+ toPdfButton: Boolean
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
@@ -129,6 +143,14 @@ export default {
|
|
|
}).catch(err => {
|
|
|
this.$setErrorMessage(err.response.data.msg)
|
|
|
})
|
|
|
+ },
|
|
|
+ handleChangeShow () {
|
|
|
+ modifyCommentShow({ commentId: this.comment.id.toString(), show: !this.comment.show })
|
|
|
+ .then(_ => {
|
|
|
+ this.$setSuccessMessage('修改成功!')
|
|
|
+ this.$emit('need-refresh')
|
|
|
+ })
|
|
|
+ .catch(err => this.$setErrorMessage(err.response.data.msg))
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -185,4 +207,10 @@ export default {
|
|
|
font-weight: normal;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+pre {
|
|
|
+ white-space: pre-wrap;
|
|
|
+ word-break: break-all;
|
|
|
+ margin: 0;
|
|
|
+}
|
|
|
</style>
|