提交 9f6f2643 authored 作者: 王鹏飞's avatar 王鹏飞

修改课程页面的loading效果

上级 0171bcd2
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<!-- <el-button class="rbtn" type="primary" size="medium" icon="el-icon-self-cc-book icon" @click="goCourseAll">{{ $t('pages.learn.course.changeCourse') }}</el-button> --> <!-- <el-button class="rbtn" type="primary" size="medium" icon="el-icon-self-cc-book icon" @click="goCourseAll">{{ $t('pages.learn.course.changeCourse') }}</el-button> -->
</div> </div>
<div class="con-box"> <div class="con-box" v-loading="loading">
<ul class="course-list"> <ul class="course-list">
<template v-for="(item, index) in homeList"> <template v-for="(item, index) in homeList">
<li v-bind:key="index" class="item"> <li v-bind:key="index" class="item">
...@@ -99,7 +99,8 @@ export default { ...@@ -99,7 +99,8 @@ export default {
homeList: [], // 从后台请求 homeList: [], // 从后台请求
param: {}, param: {},
timeInterval: null, timeInterval: null,
newLiveMsg: {} newLiveMsg: {},
loading: false
} }
}, },
mounted () { mounted () {
...@@ -112,11 +113,10 @@ export default { ...@@ -112,11 +113,10 @@ export default {
// 定时获取最新直播 // 定时获取最新直播
this.timeInterval = setInterval(this.getLatestLive, 10000) this.timeInterval = setInterval(this.getLatestLive, 10000)
const loading = this.$loading({ lock: true, text: '', spinner: '', background: 'rgba(255, 255, 255, 0.9)' })
cAction.Course.getLearnFind().then(data => { cAction.Course.getLearnFind().then(data => {
this.find[0].arrItem = data this.find[0].arrItem = data
this.getAjaxList(true, this.$t('pages.learn.course.goCourseAllStr')) this.getAjaxList(true, this.$t('pages.learn.course.goCourseAllStr'))
}).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() }) }).catch(e => { this.$message.error(e.message) }).finally(() => { })
}, },
destroyed () { destroyed () {
if (this.timeInterval) { if (this.timeInterval) {
...@@ -134,12 +134,15 @@ export default { ...@@ -134,12 +134,15 @@ export default {
this.$router.push({ path: `/app/learn/course-detail/${sid}/${cid}` }) this.$router.push({ path: `/app/learn/course-detail/${sid}/${cid}` })
}, },
getAjaxList (bool, str) { getAjaxList (bool, str) {
this.loading = true
cAction.Course.getCourseList(bool, this.param).then(json => { cAction.Course.getCourseList(bool, this.param).then(json => {
this.homeList = json this.homeList = json
if (!json.length) { if (!json.length) {
this.$message(str) this.$message(str)
} }
}).catch(e => { this.$message.error(e.message) }).finally(() => {}) }).catch(e => { this.$message.error(e.message) }).finally(() => {
this.loading = false
})
}, },
/** /**
* 分类选择 - 选中某一项 * 分类选择 - 选中某一项
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论