<template>
	<view class="home">
		<!-- <uni-notice-bar show-icon scrollable
			text="uni-app 版正式发布，开发一次，同时发布iOS、Android、H5、微信小程序、支付宝小程序、百度小程序、头条小程序等7大平台。" /> -->
		<!-- <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> -->
		<uni-card>
			<view class="title">
				库存
			</view>
			<view class="menu-list-warp">
				<view class="menu-list-box" @click="toRouter('/submit/submit')">
					<image :src="'../static/smck.png'" mode=""></image>
					<view class="">
						异常上报
					</view>
				</view>
				<view class="menu-list-box" @click="toRouter('/usedTotal/usedTotal')" v-if="isRoom">
					<image :src="'../static/tj.png'" mode=""></image>
					<view class="">
						库存统计
					</view>
				</view>
			</view>
		</uni-card>
	</view>
</template>

<script>
	import {
		getInfo
	} from "@/util/api.js";
	import Vue from 'vue'
	export default {
		data() {
			return {
				userInfoData: [],
				notificationData:[],
				isRoom:false,
			}
		},
		onLoad() {
			const v = this
			if(
				Vue.prototype.$token.role_id == '1552548151620026370' || 
				Vue.prototype.$token.role_id == '1552550790307004417' || 
				Vue.prototype.$token.role_id == '1552550978346041346'){
				this.isRoom = true
			}
			// 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
				})
			},
		},
	}
</script>

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

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