优化代码
This commit is contained in:
@@ -3,31 +3,31 @@
|
||||
<u-navbar title="在线课堂" title-color="#000" :background="{background: '#f4f6fa'}"></u-navbar>
|
||||
|
||||
<div class="media">
|
||||
<img :src="data.pictureUrl" alt="" v-if="data.courseType == 0">
|
||||
<div class="videoPanel" v-if="data.courseType == 1">
|
||||
<qplayer v-if="!!data.videoId" :vid="data.videoId"/>
|
||||
<video v-else :src="data.videoUrl" controls/>
|
||||
<img :src="detail.pictureUrl" alt="" v-if="detail.courseType == 0">
|
||||
<div class="videoPanel" v-if="detail.courseType == 1">
|
||||
<qplayer v-if="!!detail.videoId" :vid="detail.videoId"/>
|
||||
<video v-else :src="detail.videoUrl" controls/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="title">{{ data.title }}</div>
|
||||
<p class="study_num">{{ data.learnerNumber || 0 }}人已学习</p>
|
||||
<div class="title">{{ detail.title }}</div>
|
||||
<p class="study_num">{{ detail.learnerNumber || 0 }}人已学习</p>
|
||||
|
||||
<u-parse class="content" :html="data.content"></u-parse>
|
||||
<u-parse class="content" :html="detail.content"></u-parse>
|
||||
|
||||
<div class="btn_box">
|
||||
<div class="input_btn" @click="showSend = true">我来说两句...</div>
|
||||
<div class="comment" @click="showComment = true;getComment()">
|
||||
<img src="https://cdn.cunwuyun.cn/qujing/message.png" alt="">
|
||||
<div class="comm_num">
|
||||
<span>{{ data.msgCount || 0 }}</span><span v-show="data.msgCount > 999">+</span>
|
||||
<span>{{ detail.msgCount || 0 }}</span><span v-show="detail.msgCount > 999">+</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<u-popup v-model="showComment" mode="bottom" border-radius="32">
|
||||
<h4 class="message_num">共{{ data.msgCount }}条评论</h4>
|
||||
<h4 class="message_num">共{{ detail.msgCount }}条评论</h4>
|
||||
<scroll-view scroll-y="true" @scrolltolower="scrollLower" class="comment_box" v-if="commentList.length">
|
||||
<div class="comment_card" v-for="item in commentList" :key="item.id">
|
||||
<div class="avatar">
|
||||
@@ -59,8 +59,7 @@
|
||||
v-model="content"
|
||||
:cursor-spacing="40"
|
||||
placeholder="我来说两句..."
|
||||
maxlength="100"
|
||||
@keyboardheightchange="keyboard">
|
||||
maxlength="100">
|
||||
</textarea>
|
||||
</div>
|
||||
<div class="send_btn" @click="sendComment">发送</div>
|
||||
@@ -78,7 +77,7 @@ export default {
|
||||
showSend: false,
|
||||
content: '',
|
||||
height: 0,
|
||||
data: {},
|
||||
detail: {},
|
||||
commentList: [],
|
||||
id: '',
|
||||
flag: false,
|
||||
@@ -93,7 +92,7 @@ export default {
|
||||
getDetail() {
|
||||
this.$instance.post(`/app/appcourseinfo/queryDetailById?id=${this.id}`).then(res => {
|
||||
if (res?.data) {
|
||||
this.data = res.data
|
||||
this.detail = res.data
|
||||
}
|
||||
}).catch(err => this.$u.toast(err.msg))
|
||||
},
|
||||
@@ -103,7 +102,7 @@ export default {
|
||||
params: {
|
||||
current: this.current,
|
||||
size: 10,
|
||||
courseId: this.data.id,
|
||||
courseId: this.detail.id,
|
||||
}
|
||||
}).then(res => {
|
||||
if (res?.data) {
|
||||
@@ -121,7 +120,7 @@ export default {
|
||||
|
||||
this.flag = true
|
||||
this.$instance.post(`/app/appcoursecomment/add`, {
|
||||
courseId: this.data.id,
|
||||
courseId: this.detail.id,
|
||||
content: this.content,
|
||||
type: '1'
|
||||
}).then(res => {
|
||||
@@ -141,8 +140,8 @@ export default {
|
||||
stop() {
|
||||
this.$instance.post(`/app/appcourseinfo/stopLearnById`, null, {
|
||||
params: {
|
||||
id: this.data.id,
|
||||
recordId: this.data.recordId
|
||||
id: this.detail.id,
|
||||
recordId: this.detail.recordId
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
@@ -150,9 +149,6 @@ export default {
|
||||
}
|
||||
}).catch(err => this.$u.toast(err.msg))
|
||||
},
|
||||
keyboard(e) {
|
||||
console.log(e.detail.height);
|
||||
},
|
||||
scrollLower() {
|
||||
this.current++
|
||||
this.getComment()
|
||||
|
||||
Reference in New Issue
Block a user