<template>
	<view class="home">
		<commons-header></commons-header>
		<uni-card v-for="i in userInfoData.menus" :key="i.id">
			<view class="title">
				{{i.name}}
			</view>
			<view class="menu-list-warp">
				<view class="menu-list-box" v-for="j in i.children" :key="j.id" @click="toRouter(j)">
					<image :src="'../static/' + j.icon" mode=""></image>
					<view class="">
						{{j.name}}
					</view>
				</view>
			</view>
		</uni-card>
	</view>
</template>

<script>
	import {
		getInfo
	} from "@/util/api.js";
	import Vue from 'vue'
	import commonsHeader from '../components/commons-header/index.vue'
	export default {
		components:{
			commonsHeader
		},
		data() {
			return {
				userInfoData: [],
				notificationData:[],
			}
		},
		onLoad() {
			const v = this
			// v.$post('/wx/login/getUserInfo').then(res => {
			// 	v.userInfoData = res.data
			// 	Vue.prototype.$userInfo = res.data
			// 	uni.setStorage({
			// 		key: "userInfo",
			// 		data: res.data,
			// 		success(res) {

			// 		},
			// 		fail(res) {}
			// 	})
			// })
			// v.$post('/wx/message/notification',{}).then(res=>{
			// 	v.notificationData = res.data
			// })
		},
		methods: {
			toRouter(j) {
				console.log(j)
				uni.navigateTo({
					url: '/pages/' + j.menuKey + '/' + j.menuKey
				})
			},
		},
	}
</script>

<style lang="less">
	.home{
		background-color: #e9e9e9;
	}
	.menu-list-warp {
		.menu-list-box {
			width: 25%;
			text-align: center;
			float: left;
			padding: 20rpx;

			image {
				width: 100rpx;
				height: 100rpx;
			}
		}
	}
</style>
