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