<template>
	<view>
		<view class="uni-list">
			 <view class="uni-list-cell" hover-class="uni-list-cell-hover" v-for="(item,index) in list" :key="index">
				  <view class="uni-list-cell-navigate uni-navigate-right" @click="neivate(item.navUrl)">
					   {{item.name}}
				  </view>
			 </view>
		 </view>
		 <view class="goHome" @click='goMain()'>
		 	<img src="../../static/img/gohome.png">
		 </view>
	</view>
</template>

<script>
	export default {  
		data() {
			return {
				id:'',
				list:[
					{
						id:1,
						name:'劳动合同',
						navUrl:'laborContract'
					},
					{
						id:2,
						name:'培训合同',
						navUrl:'trainingContract'
					}
				]
			}
		},
		onLoad(options) {
			var _this = this;
			uni.getStorage({
				key: 'userInfo',
				success: function (res) {
					console.log(res.data)
					_this.id = res.data.userId
				}
			});
		},
		methods: {
			neivate(url) {
				if(url){
					uni.navigateTo({
					    url: url+'?id='+this.id
					});
				}	
			}
		},
		onBackPress(options) { //取消默认的返回事件.
			uni.switchTab({
				url: "../main/main"
			});
			return true;
		}
	}
</script>

<style>
	.uni-list-cell-navigate.uni-navigate-right:after{
		color: #333;
	}
</style>
