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

90 lines
2.1 KiB
Vue
Raw Normal View History

2023-01-30 14:57:39 +08:00
<template>
<div class="AppLegalLearning">
2023-02-17 14:42:58 +08:00
<u-navbar title="法治学习" :background="{background: '#f4f6fa'}" :is-back="false" title-bold></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>
2023-02-17 17:34:06 +08:00
<div>
2023-02-20 15:11:36 +08:00
<OnlineClass ref="OnlineClass" :height="height" @to-detail="toDetail" v-show="currIndex == 0"></OnlineClass>
<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',
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: '在线课堂',
},
{
name: '普法考试',
}
],
2023-02-17 14:12:38 +08:00
screenHeight: 0,
height: 0,
2023-01-30 14:57:39 +08:00
}
},
onShow() {
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) {
2023-02-17 14:38:07 +08:00
this.height = this.screenHeight - 250
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-01-31 09:49:26 +08:00
}
2023-01-30 14:57:39 +08:00
}
}
</script>
<style lang="scss" socped>
.AppGeneralLawExam {
.tabs_box {
height: 100px;
line-height: 100px;
}
}
</style>