<!--
 * @Author: aBin
 * @email: binbin0314@126.com
 * @Date: 2021-06-01 16:07:56
 * @LastEditors: aBin
 * @LastEditTime: 2021-06-10 14:23:36
-->
<template>
  <div class="d-flex flex-wrap flex-column">
    <a-card class="fill-width">
      <div class="d-flex flex-nowrap">
        <div class="flex-1">
          <a-date-picker
            :value="$moment(time)"
            :show-time="{ format: 'HH:mm' }"
            format="YYYY-MM-DD HH:mm"
            placeholder="选择时间"
            style="width: 100%"
            @change="onChange"
            @ok="onChange"
          />
        </div>
        <!-- <a-button v-if="isShow" style="width: 100px" type="primary" block @click="start"> 开始 </a-button> -->
      </div>
    </a-card>
    <Content :time="time" />
  </div>
</template>

<script>
import { mapActions, mapMutations } from 'vuex';
import Content from 'components/Content/Content.vue';
export default {
  name: 'Currency',
  components: { Content },
  data() {
    return { time: Date.parse(new Date()), isShow: false };
  },
  async created() {
    const start = await this.getStart();
    if (start) {
      this.time = +start;
    }
    this.setTitle('通用界面');
  },
  methods: {
    ...mapActions('home', ['getStart']),
    ...mapMutations('home', ['setTitle']),
    onChange(e) {
      let str = this.$moment(e._d).format('YYYY-MM-DD HH:mm');
      str += ':00';
      this.time = new Date(str).valueOf();
    },
  },
};
</script>

<style lang="stylus" scoped></style>
