<template>
	<view class="page">
		<view v-for="(item,index) in itemList" :key="index" class="example-box">
			<view class="item" style="margin-top: 22upx;">
				<view class="itemname">{{item.week||'星期'}} · {{changeTime(item.reportDate)}}</view>
			</view>
			<view class="item">
				<view class="itemname">必做事项</view>
				<view class="itemtext">{{item.mustContent||''}}</view>
			</view>
			<view class="item">
				<view class="itemname">待办事项</view>
				<view class="itemtext">{{item.waitContet||''}}</view>
			</view>
			<view class="item item_line">
				<view class="itemname">需求资源</view>
				<view class="itemtext">{{item.needSource||''}}</view>
			</view>
		</view>
		<view class="goHome" @click='goMain("weekInfo")'>
			<img src="../../static/img/gohome.png">
		</view>
	</view>
</template>

<script>
	import {
		config
	} from '../../request/js/config.js'
	export default{
		data(){
			return {
				config:config,
				itemList:[],
				id:''
			}
		},
		onLoad(option) {
			this.id=option.id;
			if(this.id==undefined){
				uni.reLaunch({
				    url: 'week'
				});
				return false;
			}
		    var _this = this;
		    this.$http.request({
				 url: '/apis/weekReport/detail',
				 method:'GET',
				 params: {
				   id:_this.id
				 },
		   }).then(res=>{
			if(res.data.code == 0){
				this.itemList = res.data.itemList;
			}else{
				uni.showToast({
					title: '获取信息失败',
					duration: 	1000,
					icon:"none"
				});
			}
		   }).catch(err=>{
			   console.log(err)
		   });
			
		},
		methods:{
			changeTime(info){
				var st = [];
				if(info){
					st = info.split(" ");
				}
				var time1 = st[0]||''
				return time1;
			}
		}
	}
</script>