Files
dvcp_v2_wechat_app/src/project/qujing/AppLegalLearning/AppLegalLearning.vue

101 lines
2.5 KiB
Vue
Raw Normal View History

2023-01-30 14:57:39 +08:00
<template>
<div class="AppLegalLearning" :style="{'height': screenHeight+'px'}">
2023-03-15 15:08:59 +08:00
<u-navbar title="普法学习" title-color="#000" title-size="32" :background="{background: '#f4f6fa'}" :is-back="false" :title-bold="true"></u-navbar>
2023-01-30 14:57:39 +08:00
<div class="tabs_box">
<u-tabs :list="tabs" font-size="32" bg-color="#f3f5f7" inactive-color="#999999"
:active-item-style="{color: '#222222'}" :is-scroll="true" :current="currIndex" @change="(i) => (currIndex = i)"> </u-tabs>
</div>
<div :style="{'height': (screenHeight-125)+'px'}">
2023-02-20 15:11:36 +08:00
<OnlineClass ref="OnlineClass" :height="height" @to-detail="toDetail" v-show="currIndex == 0"></OnlineClass>
2023-03-23 13:39:14 +08:00
<GeneralLawExam ref="GeneralLawExam" :height="height" @to-test="toTest" v-show="currIndex == 1"></GeneralLawExam>
2023-02-17 17:34:06 +08:00
</div>
2023-01-30 14:57:39 +08:00
</div>
</template>
<script>
2023-01-31 09:49:26 +08:00
import OnlineClass from './components/OnlineClass.vue'
import GeneralLawExam from './components/GeneralLawExam.vue'
2023-01-30 14:57:39 +08:00
export default {
name: 'AppLegalLearning',
2023-03-15 14:58:10 +08:00
appName: '普法学习',
2023-02-16 15:27:11 +08:00
customNavigation: true,
2023-01-30 14:57:39 +08:00
data() {
return {
2023-02-17 14:17:21 +08:00
currIndex: 0,
2023-01-30 14:57:39 +08:00
tabs: [
{
name: '在线课堂',
},
{
2023-03-15 14:58:10 +08:00
name: '普法考试',
2023-01-30 14:57:39 +08:00
}
],
2023-02-17 14:12:38 +08:00
screenHeight: 0,
height: 0,
2023-01-30 14:57:39 +08:00
}
},
onShow() {
2023-03-23 11:23:55 +08:00
uni.$on('update',(data)=> {
2023-03-15 17:28:36 +08:00
this.currIndex = data.inx
})
2023-02-13 16:13:27 +08:00
if(this.currIndex == 0) {
this.$refs.OnlineClass.getList();
} else {
this.$refs.GeneralLawExam.getList();
2023-02-16 08:54:41 +08:00
this.$refs.GeneralLawExam.getUserInfo()
2023-02-13 16:13:27 +08:00
}
2023-02-17 14:12:38 +08:00
uni.getSystemInfo({
success: (res)=> {
this.screenHeight = res.screenHeight
}
});
2023-01-30 14:57:39 +08:00
},
components: {
2023-01-31 09:49:26 +08:00
OnlineClass,
GeneralLawExam
2023-01-30 14:57:39 +08:00
},
watch: {
currIndex: {
handler(v) {
if(v == 0) {
this.$refs.OnlineClass.getList();
} else if(v == 1) {
this.$refs.GeneralLawExam.getList();
2023-02-16 08:54:41 +08:00
this.$refs.GeneralLawExam.getUserInfo()
2023-01-30 14:57:39 +08:00
}
}
2023-02-17 14:12:38 +08:00
},
screenHeight(v) {
if(v) {
this.height = this.screenHeight - 200
2023-02-17 14:12:38 +08:00
}
2023-01-30 14:57:39 +08:00
}
2023-01-31 09:49:26 +08:00
},
methods: {
2023-02-14 14:06:46 +08:00
toTest(id) {
uni.navigateTo({url: "./testForm?id=" + id})
2023-01-31 16:19:20 +08:00
},
2023-02-14 15:15:34 +08:00
toDetail(id) {
uni.navigateTo({url: "./classDetail?id=" + id})
2023-03-23 09:15:22 +08:00
},
},
onReachBottom() {
var refName = this.currIndex == 1 ? 'GeneralLawExam' : 'OnlineClass'
this.$refs[refName].nextList()
},
2023-01-30 14:57:39 +08:00
}
</script>
<style lang="scss" scoped>
2023-01-30 14:57:39 +08:00
.AppGeneralLawExam {
height: 100vh;
2023-01-30 14:57:39 +08:00
.tabs_box {
height: 100px;
line-height: 100px;
}
.component-content {
height: 100%;
}
2023-01-30 14:57:39 +08:00
}
</style>