<template name="times">
	<view>
		<view class="cu-timeline" v-for="(v,k) in fetch.times" :key="v.id">
			<view class="cu-time">{{v.name}}</view>
			<view class="cu-item" :class="v1.id == times ? 'text-blue' : ''" v-for="(v1,k1) in v.child" :key="v1.id" :style="{backgroundImage: v1.icon}">
				<view class="content" :style="{color:v1.color,backgroundColor:v1.bgcolor}" @click="go(v1)">
					<view class="cu-capsule radius">
						<view class="cu-tag bg-cyan">{{v1.name}}</view>
					</view>
					<view class="margin-top" v-if="v1.desc&& !v1.pic">{{v1.desc}}</view>
					<view class="margin-top" v-if="v1.pic && !v1.desc"><image :src="v1.pic" mode="widthFix" class="slide-image" style="height:auto"></image></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	name: "times",
	props: {
		info_id : {
			type : String,
			value : null
		},
		content_id : {
			type : String,
			value : null
		},
		page_id : {
			type : String,
			value : null
		},
		parent_page_id : {
			type : String,
			value : null
		},
		width : {
			type : String,
			default : '100%'
		},
		param : {},
		index : 0,
		times : 0,
	},
	data() {
		return {
			
		}
	},
	created() {
		this.fetch = this.param;
	},
	methods:{
		getData : function() {
			var info = {
				info_id : this.info_id,
				page_id : this.page_id,
				parent_page_id : this.parent_page_id,
			}
			this.$emit('getTimes', info);
		},
		go : function(times) {
			var self = this;
			this.Dever.alert('正在进入' + times.name);
			// 要拿到最新的page_id
			this.Dever.post('app/collection/?l=api.getPageId', {id:self.info_id,times:times.id}, function(t) {
				self.Dever.location('dream/view?id=' + self.info_id + '&page_id='+t.id+'&index=0&times=' + times.id);
			})
			
		},
	},
}
</script>

<style>
.slide-image {
	
}
</style>
