<template>
	<view class="">
		<view class="listwarp">
			<view class="x_warp" v-for="(item,index) in list" :key="index" @click="toEdit(item)">
				<view class="x_left">
					<view class="x_p">星期 <text>{{item.week}}</text> </view>
					<view class="x_p">时段 <text>{{item.time}}</text> </view>
				</view>
				<view class="iconfont icon-arrows_right"></view>
			</view>
		</view>
		<view class="" style="height:200rpx" v-if="list.length == 0"></view>
		<u-empty v-if="list.length == 0" text="暂无更多"></u-empty>
		<!-- 新建 -->
		<view class="icon_creat" @click="addTime">
			<image :src="BASE_IMG_URL+'1.png'" mode="scaleToFill"></image>
		</view>
	</view>
</template>

<script>
	import { BASE_IMG_URL } from '@/util/api.js'
	import { netTimeSlotList } from '@/api/index.js'
	
	export default{
		data() {
			return{
				BASE_IMG_URL:BASE_IMG_URL,
				list:[]
			}
		},
		onShow() {
			this.getList()
		},
		methods:{
			getList() {
				netTimeSlotList().then(res=>{
					this.list = res.data
				})
			},
			//添加打卡时间
			addTime() {
				uni.navigateTo({
					url:'/pagesA/punchclock/clockrules/addClocktime'
				})
			},
			//编辑
			toEdit(item) {
				uni.navigateTo({
					url:'/pagesA/punchclock/clockrules/addClocktime?number='+item.number
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.listwarp{
		.x_warp{
			width:690rpx;
			background:#fff;
			border-radius: 10rpx;
			margin:24rpx auto 0;
			padding:30rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			.x_left{
				.x_p{
					display: flex;
					justify-content: flex-start;
					align-items: center;
					font-size:24rpx;
					color:#999;
					margin-bottom:15rpx;
					&:last-child{
						margin-bottom:0;
					}
					text{
						font-size:30rpx;
						color:#333;
						margin-left:24rpx;
					}
				}
			}
		}
	}
</style>