| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <template>
- <view>
- <home v-show="current == 0" ref="home"></home>
- <my v-show="current == 1" ref="refMy"></my>
- <u-tabbar v-model="current" :list="list" active-color="#2F4379" :before-switch="beforeSwitch"></u-tabbar>
- </view>
- </template>
- <script>
- import home from '@/components/home.vue';
- import my from '@/components/my.vue';
- import {mapGetters} from 'vuex';
- export default {
- components: {
- home,
- my
- },
- data() {
- return {
- list: [
- {
- iconPath: '/static/nav1.png',
- selectedIconPath: '/static/nav1_on.png',
- text: '学习中心',
- customIcon: false
- },
- {
- iconPath: '/static/nav4.png',
- selectedIconPath: '/static/nav4_on.png',
- text: '我的',
- customIcon: false
- }
- ],
- current: 0
- };
- },
- onLoad(option) {},
- onShow() {
- this.$refs.home.init();
- },
- onShareAppMessage(res) {
- var self = this;
- return {
- title: '中正',
- path: `/pages/index/index?inviteCode=`+userInfo==null?'':userInfo.userAccount,
- };
- },
- methods: {
- beforeSwitch(index) {
- let that = this;
- if (index == this.current) {
- return false;
- }
- if (!this.$method.isLogin()) {
- this.$navTo.togo('/pages/login/login');
- return false;
- } else {
- if (index == 1) {
- this.$refs.refMy.init();
- }
- return true;
- }
- }
- },
- onReachBottom() {},
- onPullDownRefresh() {},
- computed: {...mapGetters(['userInfo'])}
- };
- </script>
- <style scoped></style>
|