import { connect } from 'herculex';
import { setStorage, getStorage } from '../../utils';

const app = getApp();
Component(connect({
  mapStateToProps: {
    indexBanner: state => state.$global.indexBanner,
  },
})({
  data: {
    imgSrcPrefix: app.globalData.imgSrcPrefix,
  },
  didMount() {
  },
  props: {
    componentData: {},
  },
  methods: {
    async expo() {
      let adShowCount = +await getStorage('adShowCount') || 0;
      // eslint-disable-next-line no-plusplus
      setStorage('adShowCount', ++adShowCount);
      this.commitGlobal({ adShowed: true });
    },
    onTimeup() {
      console.log('时间到了');
      // const { indexBanner } = this.data;
      this.commit({
        isShowEnterAd: false,
      });
      // my.setNavigationBar({
      //   backgroundColor: indexBanner ? 'transparent' : '#fff',
      // });
    },
  },
}));
