merchant-app/pages/index.vue

48 lines
1.1 KiB
Vue
Raw Normal View History

2024-09-12 14:10:05 +08:00
<template>
2024-10-24 11:10:31 +08:00
<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>
2024-09-12 14:10:05 +08:00
</template>
<script>
2024-10-24 11:10:31 +08:00
import merchantTask from "./components/merchantTask";
import employeeTask from "./components/employeeTask";
2024-09-12 14:10:05 +08:00
export default {
2024-10-24 11:10:31 +08:00
components: {
merchantTask,
employeeTask
},
2024-09-12 14:10:05 +08:00
data() {
return {
2024-10-24 11:10:31 +08:00
roleType: -1,
nowTab: 1,
titleTop: 1,
statusBarHeight: 1,
2024-09-12 14:10:05 +08:00
};
2024-10-24 11:10:31 +08:00
},
2024-09-12 14:10:05 +08:00
2024-10-24 11:10:31 +08:00
onLoad: function(options) {
this.roleType = this.$store.state.user.roleType;
2024-09-12 14:10:05 +08:00
const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
const { top, height } = menuButtonInfo;
2024-10-24 11:10:31 +08:00
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
2024-09-12 14:10:05 +08:00
// 计算标题需要偏移的位置
2024-10-24 11:10:31 +08:00
this.titleTop = top + (height - this.statusBarHeight) / 2;
2024-09-12 14:10:05 +08:00
2024-10-24 11:10:31 +08:00
if (options.self == 'true'){
this.nowTab = 2;
}
2024-09-12 14:10:05 +08:00
},
2024-10-24 11:10:31 +08:00
methods: {
2024-09-13 10:06:26 +08:00
reload(){
2024-10-24 11:10:31 +08:00
this.$refs.child.refresh();
2024-09-12 14:10:05 +08:00
},
}
}
</script>
2024-10-24 11:10:31 +08:00
<style scoped lang='scss'>
2024-09-12 14:10:05 +08:00
</style>