Commit ebe10f9f authored by yun's avatar yun

修改bug

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