Commit ebe10f9f authored by yun's avatar yun

修改bug

parent 923d2cec
import axios from '@/utils/request'
import axiosIns from 'axios'
const api = {
test: '/wangxu',
......@@ -135,10 +136,15 @@ export const get = {
})
},
// 首页 tabs列表查询课程 请求
getHomeBLessons: (params) => {
getHomeBLessons: (params, that) => {
return axios({
url: api.HomeBLessons,
method: 'get',
cancelToken: new axiosIns.CancelToken(function executor(c) { // 设置 cancel token
if (that) {
that.sourceCnacle = c
}
}),
params: params
})
},
......
......@@ -96,15 +96,16 @@
<span>{{ item.menuName }}</span>
</div>
</a>
<a v-if="zcdshList.length == 0"
@click="goOutLink({url:'https://zhixin.zhiguaniot.com/eduread', title: '总裁读书会'})"
<a
v-if="zcdshList.length == 0"
@click="goOutLink({url:'https://zhixin.zhiguaniot.com/eduread', title: '总裁读书会'})"
>
<div class="menu-wrapper">
<img
class="bossSrc"
src="~@assets/images/index/01_03.png"
>
<span>{{'总裁读书会'}}</span>
<span>{{ '总裁读书会' }}</span>
</div>
</a>
</div>
......@@ -258,7 +259,10 @@
</div>
</div>
<!--tab切换-->
<div class="tabs-box" v-if="tabsList.length !== 1 || tabsContentList.length !== 0" >
<div
class="tabs-box"
v-if="tabsList.length !== 1 || tabsContentList.length !== 0"
>
<div :class="{'tabs-box-sizing': true,'tabs-position': tabsPosition}">
<tabs
class="v-tabs"
......@@ -311,7 +315,7 @@
class="default-img"
src="@assets/images/暂无数据.png"
>
<span>{{isLoadShow}}</span>
<span>{{ isLoadShow }}</span>
</div>
</div>
</div>
......@@ -323,7 +327,7 @@
class="default-img"
src="@assets/images/暂无数据.png"
>
<span>{{isLoadShowRecommend}}</span>
<span>{{ isLoadShowRecommend }}</span>
</div>
</pull-refresh>
<div
......@@ -336,7 +340,7 @@
</div>
<search-box
ref="searchBox"
:hackReset = 'hackReset'
:hack-reset="hackReset"
@onCancel="onCancel"
/>
</nav-bar-view>
......@@ -395,7 +399,8 @@ export default {
lineWidth: '60px',
zcdshList: [],
isProhibit: true,
isHiddenClose: false // 是否显示关闭及返回按钮
isHiddenClose: false, // 是否显示关闭及返回按钮
sourceCnacle: ''
}
},
filters: {
......@@ -597,33 +602,47 @@ export default {
* tabs 列表查询课程 请求
* courseLevelOne 一级课程分类 ID
*/
async HomeBLessons(courseLevelOne) {
this.isLoadShow = '加载中'
const res = await get.getHomeBLessons({
courseLevelOne: courseLevelOne,
requireId: '',
departs: [],
viewParam: '',
page: 1,
rows: this.pageNum
})
this.isLoadShow = '未筛选到相关数据'
// 遍历 学习人数和评论人数
res.data.data.rows.map((list) => {
list.personNumber !== '0' && list.personNumber !== '' ? (list.personNumber = list.personNumber + (list.lessonType === '1' ? '人报名' : '人学习')) : list.personNumber = ''
list.discussNumber === '0' || list.discussNumber === '' ? list.comment = '' : list.comment = list.discussNumber + '人评论'
})
this.tabsContentList = res.data.data.rows
this.tabsContentList.length > 0 ? this.isShow = false : this.isShow = true
// 加载状态结束
this.loading = false
// 数据全部加载完成
if (this.pageNum > res.data.data.total) {
this.finished = true
HomeBLessons(courseLevelOne) {
const that = this
if (that.sourceCnacle) {
that.sourceCnacle()
}
console.log(courseLevelOne)
console.log('___________________________________')
return new Promise(resolve => {
that.isLoadShow = '加载中'
get.getHomeBLessons({
courseLevelOne: courseLevelOne,
requireId: '',
departs: [],
viewParam: '',
page: 1,
rows: that.pageNum
}, that).then(res => {
console.log(courseLevelOne)
console.log('++++++++++++++++++++++++++++++')
that.isLoadShow = '未筛选到相关数据'
// 遍历 学习人数和评论人数
res.data.data.rows.map((list) => {
list.personNumber !== '0' && list.personNumber !== '' ? (list.personNumber = list.personNumber + (list.lessonType === '1' ? '人报名' : '人学习')) : list.personNumber = ''
list.discussNumber === '0' || list.discussNumber === '' ? list.comment = '' : list.comment = list.discussNumber + '人评论'
})
that.tabsContentList = res.data.data.rows
that.tabsContentList.length > 0 ? that.isShow = false : that.isShow = true
// 加载状态结束
that.loading = false
// 数据全部加载完成
if (that.pageNum > res.data.data.total) {
that.finished = true
}
resolve()
}).catch(err => {
console.log(err)
})
})
},
// tab标签切换事件
tabsClick(name, title) {
async tabsClick(name, title) {
if (title === '全部分类') {
name = ''
}
......@@ -632,15 +651,13 @@ export default {
this.tabsName = name
this.pageNum = 4
this.tabsContentList = []
this.$nextTick(() => {
this.HomeBLessons(name)
})
await this.HomeBLessons(name)
},
// 上拉触底 异步加载tabs内容
onLoad() {
async onLoad() {
this.pageNum = this.pageNum + 4
// // 异步更新数据
this.HomeBLessons(this.tabsName)
await this.HomeBLessons(this.tabsName)
},
// 点击更多 事件
moreClick(title) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment