<template>
    <view class="ht-box">
        <view @tap.stop.prevent="godetails" class="ht-list" :data-id="item.e_id" v-for="(item, index) in getdata" :key="index">
            <view class="ht-list-year">{{ item.date }}</view>

            <view class="ht-list-event">{{ item.title }}</view>
        </view>
    </view>
</template>

<script>
export default {
    data() {
        return {
            getdata: [],
            show: false
        };
    },
    onLoad: function (t) {
        this.getData();
    },
    onShareAppMessage: function () {},
    methods: {
        getData: function () {
            uni.showLoading({
                title: '加载中'
            });
            var that = this;
            var e = new Date();
            var a = e.getMonth() + 1;
            var n = e.getDate();
            uni.request({
                url: 'https://v.juhe.cn/todayOnhistory/queryEvent.php?key=8525e2cd6ff71f07f54d3c7432f71685&date=' + a + '/' + n,
                data: {},
                header: {
                    'content-type': 'application/json'
                },
                success: function (e) {
                    uni.hideLoading();
                    if ('success' == e.data.reason) {
                       that.show=true;
                       that.getdata=e.data.result;
					
                    } else {
                        uni.showModal({
                            title: '提示',
                            content: '查询失败',
                            success: function (e) {
								that.show=false;
                            }
                        });
                    }
                }
            });
        },

        godetails: function (t) {
            console.log(t.currentTarget.dataset.id);
            uni.navigateTo({
                url: './details?id=' + t.currentTarget.dataset.id
            });
        }
    }
};
</script>
<style>
@import './historyToday.css';
</style>
