| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <template>
- <view>
- <home v-show="current == 0"></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 { mapState, mapMutations } 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() {},
- onShareAppMessage: function(res) {
- var self = this;
- return {
- title: '中正',
- path: `/pages/index/index`,
- success(res) {
- if (self.$store.state.userInfo !== null) {
- console.log('已登录');
- var data = {
- taskType: 3
- };
- self.$api.taskShare(data).then(result => {});
- }
- },
- fail(res) {
- uni.showToast({
- title: '分享失败',
- icon: 'none'
- });
- }
- };
- },
- 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: { ...mapState(['login']) }
- };
- </script>
- <style scoped></style>
|