<template>
	<view class="page">
		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"   title="首页"  />
		<manager :height="height" v-if="isManager"></manager>
		<attach :height="height" v-else></attach>
	</view>
</template>

<script>
	import manager from "./manager/manager";
	import attach from "./attach/attach"
	export default {
		components:{
			manager,attach
		},
		data() {
			return {
				isManager:false,
				height:'',
				ruleList:[],
				roleList:[],
				roleBindRuleParam:{}
			}
		},
		onLoad() {
			let sysInfo = uni.getSystemInfoSync()
			this.height = sysInfo.windowHeight - 70 + 'px'
			// this.getRuleList()
			// this.getRoleList()
		},
		methods: {

			//查询规则
			getRuleList(){
				this.$api.service.getRuleList().then(res=>{
					console.log(res)
					this.ruleList = res.data.data
				})
			},
			//查询角色
			getRoleList(){
				this.$api.service.getRoleList().then(res=>{
					console.log(res)
					this.roleList = res.data.data
				})
			},
			//角色绑定规则
			roleBindRule(){
				this.$api.service.roleBindRule(this.roleBindRuleParam).then(res=>{
					this.getRuleList()
					this.getRoleList()
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	@import './index.rpx.css';
</style>
