You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.1 KiB
Vue

2 years ago
<template>
<view class="container">
<swiper class="main" :autoplay="false" :current="currentPage" :duration="duration" easing-function="linear" @change="changeSwiper">
<swiper-item>
<manifest></manifest>
</swiper-item>
<swiper-item>
<moveTrace></moveTrace>
</swiper-item>
<swiper-item>
<index @changeTab="getChangeTab"></index>
</swiper-item>
<swiper-item>
<vgm></vgm>
</swiper-item>
<swiper-item>
<mine></mine>
</swiper-item>
</swiper>
2 years ago
<tabBar :current="currentPage" @change="changePage"></tabBar>
</view>
</template>
<script>
import tabBar from "@/components/tabBar/tabBar.vue"
import index from "@/pages/homePage/index/index.vue"
import mine from "@/pages/homePage/mine/mine.vue"
import manifest from "@/pages/homePage/manifest/manifest.vue" // 航运
import moveTrace from "@/pages/homePage/moveTrace/moveTrace.vue" // 运踪
import vgm from "@/pages/homePage/vgm/vgm.vue"
import {
getUserInfo
} from '@/common/js/api/homePage/login.js'
import {
mapState,
mapActions
} from 'vuex';
2 years ago
export default {
components: {
2 years ago
tabBar,
index,
mine,
manifest,
moveTrace,
vgm
},
data() {
return {
currentPage: 2,
duration: 200
2 years ago
}
},
computed: {
...mapState([
'userInfo'
]),
},
onLoad() {
if (!uni.getStorageSync('userToken')) {
2 years ago
getApp().globalData.isLogin = false;
console.log('== 当前登录状态 ==', getApp().globalData.isLogin)
} else {
2 years ago
this.getUserInfo();
}
},
methods: {
...mapActions([
'setUserInfo'
]),
changePage(index) {
2 years ago
this.currentPage = index;
},
getUserInfo() {
getUserInfo().then(res => {
2 years ago
if(res.code == 200){
console.log('== 获取到个人信息 ==', res.data);
this.setUserInfo(res.data);
}
2 years ago
})
},
getChangeTab(type) {
2 years ago
this.currentPage = type;
},
changeSwiper(e){
this.currentPage = e.detail.current;
2 years ago
}
2 years ago
}
}
</script>
<style lang="less">
.container {
height: 100vh;
padding-bottom: 140rpx;
display: flex;
flex-direction: column;
.main {
flex: 1;
}
2 years ago
}
</style>