提交 91f6334a 编写于 作者: guangjun.yang's avatar guangjun.yang

默认排序问题

上级 87c6996f
<template> <template>
<section> <section>
<GroupTitle :groupNum="groupNum" :showTitle="showTitle" :showOrder="showOrder" @order="orderAction"/> <GroupTitle ref="courseListGT" :groupNum="groupNum" :showTitle="showTitle" :showOrder="showOrder" @order="orderAction"/>
<div class="hot-teacher"> <div class="hot-teacher">
<!-- <div :class="index>1 && (index+1 == cParmData.length)?'teacher-item item-end' : 'teacher-item'" :key="index" --> <!-- <div :class="index>1 && (index+1 == cParmData.length)?'teacher-item item-end' : 'teacher-item'" :key="index" -->
<div :class="index>1 && (index+1 == cParmData.length)?'teacher-item item-end' : 'teacher-item'" :key="index" <div :class="index>1 && (index+1 == cParmData.length)?'teacher-item item-end' : 'teacher-item'" :key="index"
...@@ -30,8 +30,7 @@ ...@@ -30,8 +30,7 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex' import { mapActions, mapGetters } from 'vuex'
import { sortParmData } from '@/utils/index' import { sortParmData } from '@/utils/index'
import { import {
m_search_result_course_detail, m_search_result_course_detail,
...@@ -92,9 +91,15 @@ export default { ...@@ -92,9 +91,15 @@ export default {
}) })
}, },
...mapGetters({ ...mapGetters({
cSearchText: 'cSearchText' cSearchText: 'cSearchText',
orderNum: 'orderNum'
}) })
}, },
watch: {
orderNum(val) {
this.orderAction(1, true)
}
},
components: { components: {
GroupTitle GroupTitle
}, },
...@@ -172,12 +177,17 @@ export default { ...@@ -172,12 +177,17 @@ export default {
}) })
}, },
orderAction(orderIndex) { // resetGT() {
this.pageBurialPoin({ // this.$refs.courseListGT.resetShowOrderIndex()
...m_search_result_course_order, // },
labelValue: orderIndex, orderAction(orderIndex, notBP) {
createdTime: new Date().getTime(), if(!notBP) {
}) this.pageBurialPoin({
...m_search_result_course_order,
labelValue: orderIndex,
createdTime: new Date().getTime(),
})
}
this.searchForOrder('1', this.cSearchText, orderIndex, this.groupNum, this.parmData).then( param => { this.searchForOrder('1', this.cSearchText, orderIndex, this.groupNum, this.parmData).then( param => {
this.list = param this.list = param
}) })
......
...@@ -81,7 +81,8 @@ export default { ...@@ -81,7 +81,8 @@ export default {
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
cSearchText: 'cSearchText' cSearchText: 'cSearchText',
orderNum: 'orderNum'
}), }),
cParamData() { cParamData() {
if (this.list && this.list.length) { if (this.list && this.list.length) {
...@@ -96,6 +97,9 @@ export default { ...@@ -96,6 +97,9 @@ export default {
if (val > 100) { if (val > 100) {
this.searchForOrder this.searchForOrder
} }
},
orderNum(val) {
this.orderAction(1, true)
} }
}, },
created() { created() {
...@@ -237,12 +241,14 @@ export default { ...@@ -237,12 +241,14 @@ export default {
} }
return d; return d;
}, },
orderAction(orderIndex) { orderAction(orderIndex, notBP) {
this.pageBurialPoin({ if(!notBP) {
...m_search_result_five_minutes_order, this.pageBurialPoin({
labelValue: orderIndex, ...m_search_result_five_minutes_order,
createdTime: new Date().getTime(), labelValue: orderIndex,
}) createdTime: new Date().getTime(),
})
}
this.searchForOrder('2', this.cSearchText, orderIndex, this.groupNum, this.parmData).then( param => { this.searchForOrder('2', this.cSearchText, orderIndex, this.groupNum, this.parmData).then( param => {
this.list = param this.list = param
}) })
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
</section> </section>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'
export default { export default {
data() { data() {
return { return {
...@@ -44,6 +45,16 @@ export default { ...@@ -44,6 +45,16 @@ export default {
default: false default: false
} }
}, },
computed: {
...mapGetters({
orderNum: 'orderNum'
})
},
watch: {
orderNum(val) {
this.showOrderIndex = 1
}
},
methods: { methods: {
toggle() { toggle() {
this.showTitle = !showTitle this.showTitle = !showTitle
...@@ -52,7 +63,10 @@ export default { ...@@ -52,7 +63,10 @@ export default {
order(index) { order(index) {
this.showOrderIndex = index this.showOrderIndex = index
this.$emit('order', index) this.$emit('order', index)
} },
// resetShowOrderIndex(){
// this.showOrderIndex = 1
// }
} }
} }
</script> </script>
......
...@@ -72,7 +72,8 @@ export default { ...@@ -72,7 +72,8 @@ export default {
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
cSearchText: 'cSearchText' cSearchText: 'cSearchText',
orderNum: 'orderNum'
}), }),
cParamData() { cParamData() {
if (this.list && this.list.length) { if (this.list && this.list.length) {
...@@ -82,6 +83,11 @@ export default { ...@@ -82,6 +83,11 @@ export default {
} }
} }
}, },
watch: {
orderNum(val) {
this.orderAction(1, true)
}
},
mounted() { mounted() {
let _this = this let _this = this
this.token = this.$route.query.userToken || this.$route.query.token this.token = this.$route.query.userToken || this.$route.query.token
...@@ -154,12 +160,14 @@ export default { ...@@ -154,12 +160,14 @@ export default {
}) })
}, },
orderAction(orderIndex) { orderAction(orderIndex, notBP) {
this.pageBurialPoin({ if(!notBP) {
...m_search_result_health_cartoon_order, this.pageBurialPoin({
labelValue: orderIndex, ...m_search_result_health_cartoon_order,
createdTime: new Date().getTime(), labelValue: orderIndex,
}) createdTime: new Date().getTime(),
})
}
this.searchForOrder('4', this.cSearchText, orderIndex, this.groupNum, this.parmData).then( param => { this.searchForOrder('4', this.cSearchText, orderIndex, this.groupNum, this.parmData).then( param => {
this.list = param this.list = param
}) })
......
...@@ -80,7 +80,8 @@ export default { ...@@ -80,7 +80,8 @@ export default {
computed: { computed: {
...mapGetters({ ...mapGetters({
cSearchText: 'cSearchText', cSearchText: 'cSearchText',
userInfo: 'userInfo' userInfo: 'userInfo',
orderNum: 'orderNum'
}), }),
cParamData() { cParamData() {
if (this.list && this.list.length) { if (this.list && this.list.length) {
...@@ -90,6 +91,11 @@ export default { ...@@ -90,6 +91,11 @@ export default {
} }
} }
}, },
watch: {
orderNum(val) {
this.orderAction(1, true)
}
},
methods: { methods: {
//跳转 //跳转
goToPage(item){ goToPage(item){
...@@ -171,12 +177,14 @@ export default { ...@@ -171,12 +177,14 @@ export default {
return d return d
}, },
orderAction(orderIndex) { orderAction(orderIndex, notBP) {
this.pageBurialPoin({ if(!notBP) {
...m_search_result_lecturer_order, this.pageBurialPoin({
labelValue: orderIndex, ...m_search_result_lecturer_order,
createdTime: new Date().getTime(), labelValue: orderIndex,
}) createdTime: new Date().getTime(),
})
}
this.searchForOrder('3', this.cSearchText, orderIndex, this.groupNum, this.parmData).then( param => { this.searchForOrder('3', this.cSearchText, orderIndex, this.groupNum, this.parmData).then( param => {
this.list = param this.list = param
}) })
......
...@@ -2,6 +2,7 @@ const getters = { ...@@ -2,6 +2,7 @@ const getters = {
userInfo: state => state.sousuo.userInfo, userInfo: state => state.sousuo.userInfo,
statusBarHeight: state => state.sousuo.statusBarHeight, statusBarHeight: state => state.sousuo.statusBarHeight,
cSearchText: state => state.sousuo.cSearchText, cSearchText: state => state.sousuo.cSearchText,
refreshNum: state => state.sousuo.refreshNum refreshNum: state => state.sousuo.refreshNum,
orderNum: state => state.sousuo.orderNum
} }
export default getters export default getters
...@@ -3,7 +3,8 @@ const sousuo = { ...@@ -3,7 +3,8 @@ const sousuo = {
userInfo: {}, userInfo: {},
statusBarHeight: {}, statusBarHeight: {},
cSearchText: '', cSearchText: '',
refreshNum: 1 refreshNum: 1,
orderNum: 1
}, },
mutations: { mutations: {
SET_USER_INFO: (state, userInfo) => { SET_USER_INFO: (state, userInfo) => {
...@@ -17,7 +18,10 @@ const sousuo = { ...@@ -17,7 +18,10 @@ const sousuo = {
}, },
SET_REFRESH_NUM: (state, refreshNum) => { SET_REFRESH_NUM: (state, refreshNum) => {
state.refreshNum = refreshNum state.refreshNum = refreshNum
} },
SET_ORDER_NUM: (state, orderNum) => {
state.orderNum = orderNum
},
}, },
actions: { actions: {
setUserInfo({ commit }, userInfo) { setUserInfo({ commit }, userInfo) {
...@@ -32,6 +36,9 @@ const sousuo = { ...@@ -32,6 +36,9 @@ const sousuo = {
setRefreshNum({ commit }, refreshNum) { setRefreshNum({ commit }, refreshNum) {
commit('SET_REFRESH_NUM', refreshNum) commit('SET_REFRESH_NUM', refreshNum)
}, },
setOrderNum({ commit }, orderNum) {
commit('SET_ORDER_NUM', orderNum)
},
} }
} }
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<div class="list-container" v-show="navIndex === '0' && showTab0"> <div class="list-container" v-show="navIndex === '0' && showTab0">
<!-- 课程 --> <!-- 课程 -->
<div v-show="showTab1"> <div v-show="showTab1">
<CourseList :parmData="contentAppModels" :groupNum="contentAppModelCount"/> <CourseList ref="courseListRef" :parmData="contentAppModels" :groupNum="contentAppModelCount"/>
<ShowAllItem @showAllItem="showAllItem" itemIndex="1" /> <ShowAllItem @showAllItem="showAllItem" itemIndex="1" />
<SplitLine borderWidth="3px"/> <SplitLine borderWidth="3px"/>
</div> </div>
...@@ -159,9 +159,9 @@ export default { ...@@ -159,9 +159,9 @@ export default {
BackTop BackTop
}, },
computed: { computed: {
// ...mapGetters({ ...mapGetters({
// refreshNum: 'refreshNum' orderNum: 'orderNum'
// }) })
}, },
watch: { watch: {
searchText(val){ searchText(val){
...@@ -188,7 +188,8 @@ export default { ...@@ -188,7 +188,8 @@ export default {
}, },
methods: { methods: {
...mapActions({ ...mapActions({
setCSearchText: 'setCSearchText' setCSearchText: 'setCSearchText',
setOrderNum: 'setOrderNum'
}), }),
showAllItem(index) { showAllItem(index) {
console.log(typeof index) console.log(typeof index)
...@@ -244,29 +245,31 @@ export default { ...@@ -244,29 +245,31 @@ export default {
console.log('2222', param) console.log('2222', param)
}) })
} }
// _this.$refs.courseListRef.resetGT()
_this.setOrderNum((_this.orderNum + 1))
if(res.data.contentAppModelCount === 0){ if(res.data.contentAppModelCount === 0){
this.showTab1 = false _this.showTab1 = false
} }
// 五分钟医学 // 五分钟医学
_this.fiveMinutesMedicalContentList = this.spliceCertenNumData(res.data.fiveMinutesMedicalContentList, 4) _this.fiveMinutesMedicalContentList = _this.spliceCertenNumData(res.data.fiveMinutesMedicalContentList, 4)
_this.fiveMinutesMedicalContentListAll = this.handelFive(res.data.fiveMinutesMedicalContentList || []) _this.fiveMinutesMedicalContentListAll = _this.handelFive(res.data.fiveMinutesMedicalContentList || [])
_this.fiveMinutesMedicalContentListCount = res.data.fiveMinutesMedicalContentListCount + '' _this.fiveMinutesMedicalContentListCount = res.data.fiveMinutesMedicalContentListCount + ''
if(res.data.fiveMinutesMedicalContentListCount === 0){ if(res.data.fiveMinutesMedicalContentListCount === 0){
this.showTab2 = false _this.showTab2 = false
} }
// 讲师 // 讲师
_this.pCourseDoctorModels = this.spliceCertenNumData(res.data.pCourseDoctorModels, 4) _this.pCourseDoctorModels = _this.spliceCertenNumData(res.data.pCourseDoctorModels, 4)
_this.pCourseDoctorModelsAll = res.data.pCourseDoctorModels _this.pCourseDoctorModelsAll = res.data.pCourseDoctorModels
_this.pCourseDoctorModelCount = res.data.pCourseDoctorModelCount + '' _this.pCourseDoctorModelCount = res.data.pCourseDoctorModelCount + ''
if(res.data.pCourseDoctorModelCount === 0){ if(res.data.pCourseDoctorModelCount === 0){
this.showTab3 = false _this.showTab3 = false
} }
// 健康漫画 // 健康漫画
_this.educationContents = this.spliceCertenNumData(res.data.educationContents, 4) _this.educationContents = _this.spliceCertenNumData(res.data.educationContents, 4)
_this.educationContentsAll = res.data.educationContents _this.educationContentsAll = res.data.educationContents
_this.educationContentCount = res.data.educationContentCount + '' _this.educationContentCount = res.data.educationContentCount + ''
if(res.data.educationContentCount === 0){ if(res.data.educationContentCount === 0){
this.showTab4 = false _this.showTab4 = false
} }
} }
}) })
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册