merchant-app/pages/index.vue
2024-10-24 11:10:31 +08:00

48 lines
1.1 KiB
Vue

<template>
<merchantTask ref="child" v-if="roleType == 0" :titleTop="titleTop" :statusBarHeight="statusBarHeight" :nowTab1="nowTab"></merchantTask>
<employeeTask ref="child" v-else-if="roleType == 1" :titleTop="titleTop" :statusBarHeight="statusBarHeight" :nowTab1="nowTab"></employeeTask>
</template>
<script>
import merchantTask from "./components/merchantTask";
import employeeTask from "./components/employeeTask";
export default {
components: {
merchantTask,
employeeTask
},
data() {
return {
roleType: -1,
nowTab: 1,
titleTop: 1,
statusBarHeight: 1,
};
},
onLoad: function(options) {
this.roleType = this.$store.state.user.roleType;
const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
const { top, height } = menuButtonInfo;
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
// 计算标题需要偏移的位置
this.titleTop = top + (height - this.statusBarHeight) / 2;
if (options.self == 'true'){
this.nowTab = 2;
}
},
methods: {
reload(){
this.$refs.child.refresh();
},
}
}
</script>
<style scoped lang='scss'>
</style>