197 lines
4.1 KiB
Plaintext
Raw Normal View History

2021-01-12 18:04:14 +08:00
<style lang="less">
.header {
width: 100%;
height: 536rpx;
z-index: -10;
2021-01-15 12:00:20 +08:00
}
2021-01-12 18:04:14 +08:00
2021-01-15 12:00:20 +08:00
.tab-bar-icon {
width: 30px;
height: 20px;
}
2021-01-18 16:10:59 +08:00
2021-01-15 12:00:20 +08:00
page {
background-color: #F5F6F7;
2021-01-12 18:04:14 +08:00
}
</style>
<wxs module="m1" lang="babel">
const getTime = (time) => {
let date = getDate(time);
let hour = date.getHours();
let mins = date.getMinutes();
let sec = date.getSeconds();
let milli = date.getMilliseconds();
return `${hour}:${mins}:${sec}.${milli}`;
}
module.exports.getTime = getTime;
</wxs>
<template>
2021-01-21 19:04:31 +08:00
<van-tabbar v-if="hotSwitch" active="{{ pageIndex }}" bind:change="onChange" fixed active-color="#AC1630">
<van-tabbar-item>
2021-01-15 12:00:20 +08:00
<image
slot="icon"
:src="imageDefine.TAP_BAR_ICON1_OFF"
mode="aspectFit"
class="tab-bar-icon"
/>
<image
slot="icon-active"
:src="imageDefine.TAP_BAR_ICON1_ON"
mode="aspectFit"
class="tab-bar-icon"
/>
2021-01-15 23:31:44 +08:00
首页
2021-01-15 12:00:20 +08:00
</van-tabbar-item>
2021-01-21 19:04:31 +08:00
<van-tabbar-item>
2021-01-15 12:00:20 +08:00
<image
slot="icon"
:src="imageDefine.TAP_BAR_ICON2_OFF"
mode="aspectFit"
class="tab-bar-icon"
/>
<image
slot="icon-active"
:src="imageDefine.TAP_BAR_ICON2_ON"
mode="aspectFit"
class="tab-bar-icon"
/>
2021-01-15 23:31:44 +08:00
福利购
2021-01-15 12:00:20 +08:00
</van-tabbar-item>
2021-01-21 19:04:31 +08:00
<van-tabbar-item>
2021-01-15 12:00:20 +08:00
<image
slot="icon"
:src="imageDefine.TAP_BAR_ICON3_OFF"
mode="aspectFit"
class="tab-bar-icon"
/>
<image
slot="icon-active"
:src="imageDefine.TAP_BAR_ICON3_ON"
mode="aspectFit"
class="tab-bar-icon"
/>
2021-01-15 23:31:44 +08:00
紫环会
2021-01-15 12:00:20 +08:00
</van-tabbar-item>
2021-01-21 19:04:31 +08:00
<van-tabbar-item>
2021-01-15 12:00:20 +08:00
<image
slot="icon"
:src="imageDefine.TAP_BAR_ICON4_OFF"
mode="aspectFit"
class="tab-bar-icon"
/>
<image
slot="icon-active"
:src="imageDefine.TAP_BAR_ICON4_ON"
mode="aspectFit"
class="tab-bar-icon"
/>
2021-01-15 23:31:44 +08:00
我的
2021-01-15 12:00:20 +08:00
</van-tabbar-item>
2021-01-12 18:04:14 +08:00
</van-tabbar>
2021-01-20 17:25:41 +08:00
<mall-home v-if="pageIndex === 0" @changeTab="changeTab" />
2021-01-15 18:10:53 +08:00
<mall-shopping v-else-if="pageIndex === 1" />
2021-01-20 17:25:41 +08:00
<mall-bbs v-else-if="pageIndex === 2" @changeTab="changeTab" />
<mall-my v-else-if="pageIndex === 3" />
2021-01-12 18:04:14 +08:00
<dialog-registration />
2021-01-22 13:25:06 +08:00
<van-dialog id="van-dialog" />
2021-01-12 18:04:14 +08:00
</template>
<script>
import wepy from '@wepy/core'
import store from '@/store'
2021-01-15 12:00:20 +08:00
import { mapState, mapActions } from '@wepy/x'
2021-01-12 18:04:14 +08:00
import userApis from '../../apis/userApis'
2021-01-15 12:00:20 +08:00
import appManager from '../../appManager'
2021-01-12 18:04:14 +08:00
import eventHub from '../../common/eventHub'
2021-01-15 12:00:20 +08:00
import defaultMix from '../../mixins/defaultMix'
2021-01-21 19:04:31 +08:00
import mallApis from '../../apis/mallApis'
2021-01-12 18:04:14 +08:00
wepy.page({
store,
2021-01-15 12:00:20 +08:00
hooks: {},
2021-01-12 18:04:14 +08:00
2021-01-18 16:10:59 +08:00
mixins: [defaultMix],
2021-01-12 18:04:14 +08:00
data: {
pageIndex: 0
},
computed: {
2021-01-15 12:00:20 +08:00
...mapState({
'imageDefine': state => state.imageDefine,
2021-01-21 19:04:31 +08:00
'user': state => state.user,
'hotSwitch': state => state.hotSwitch
2021-01-15 12:00:20 +08:00
})
2021-01-12 18:04:14 +08:00
},
methods: {
...mapActions([
'setUserAction',
2021-01-15 12:00:20 +08:00
'setOpenidAction'
2021-01-12 18:04:14 +08:00
]),
handleViewTap() {
console.log('handleVieTap clicked')
},
tap() {
},
onChange(event) {
if (!this.user.token) {
2021-01-22 13:25:06 +08:00
eventHub.$emit('onShowDialogRegist')
return
}
2021-01-12 18:04:14 +08:00
this.pageIndex = event.$wx.detail
},
callAppLaunch() {
2021-01-20 17:25:41 +08:00
},
changeTab(index) {
this.pageIndex = index
2021-01-21 19:04:31 +08:00
},
2021-01-22 10:54:01 +08:00
async init() {
wx.showLoading({ title: '正在连接...', mask: true })
const r = await mallApis.getHotSwitch()
2021-01-21 19:04:31 +08:00
2021-01-22 10:54:01 +08:00
if (r && r.code === 200) {
store.state.hotSwitch = r.data
wx.hideLoading()
2021-01-21 19:04:31 +08:00
appManager.login()
2021-01-22 10:54:01 +08:00
return
}
await this.init()
2021-01-12 18:04:14 +08:00
}
2021-01-18 16:10:59 +08:00
2021-01-12 18:04:14 +08:00
},
ready() {
2021-01-22 19:47:58 +08:00
wx.getSystemInfo({
success (res) {
store.state.statusBarHeight = res.statusBarHeight
}
})
2021-01-21 19:04:31 +08:00
this.init()
2021-01-22 13:25:06 +08:00
// eventHub.$emit('onShowDialogRegist')
2021-01-21 19:04:31 +08:00
// appManager.login()
2021-01-12 18:04:14 +08:00
},
onShow() {
}
})
</script>
<config>
{
navigationBarTitleText: '',
usingComponents: {
2021-01-15 12:00:20 +08:00
'mall-home': '../../components/mall/tab/mall-home',
'mall-shopping': '../../components/mall/tab/mall-shopping',
'mall-bbs': '../../components/mall/tab/mall-bbs',
'mall-my': '../../components/mall/tab/mall-my',
2021-01-12 18:04:14 +08:00
'dialog-registration': '../../components/user/dialog-registration'
}
}
</config>