import Ajax from '../../util/ajax'
import api from '../../util/api'
import b1bg from '@/common/icon/b1-.jpg'
import r1bg from '@/common/icon/r1-.jpg'
import b1 from '@/common/icon/b1.jpg'
import b2bg from '@/common/icon/b2-.jpg'
import r2bg from '@/common/icon/r2-.jpg'
import b2 from '@/common/icon/b2.jpg'
import b3bg from '@/common/icon/b3-.jpg'
import r3bg from '@/common/icon/r3-.jpg'
import b3 from '@/common/icon/b3.jpg'
import b4bg from '@/common/icon/b4-.jpg'
import r4bg from '@/common/icon/r4-.jpg'
import b4 from '@/common/icon/b4.jpg'
import b5bg from '@/common/icon/b5-.jpg'
import r5bg from '@/common/icon/r5-.jpg'
import b5 from '@/common/icon/b5.jpg'
import b6bg from '@/common/icon/b6-.png'
import r6bg from '@/common/icon/r6-.jpg'
import b6 from '@/common/icon/b6.jpg'
import b7bg from '@/common/icon/b7-.jpg'
import r7bg from '@/common/icon/r7-.jpg'
import b7 from '@/common/icon/b7.jpg'
import b8bg from '@/common/icon/b8-.jpg'
import r8bg from '@/common/icon/r8-.jpg'
import b8 from '@/common/icon/b8.jpg'
import b9bg from '@/common/icon/b9-.jpg'
import r9bg from '@/common/icon/r9-.jpg'
import b9 from '@/common/icon/b9.jpg'
import b10bg from '@/common/icon/b10-.jpg'
import r10bg from '@/common/icon/r10-.jpg'
import b10 from '@/common/icon/b10.jpg'
import b11bg from '@/common/icon/b11-.jpg'
import r11bg from '@/common/icon/r11-.jpg'
import b11 from '@/common/icon/b11.jpg'
import b12bg from '@/common/icon/b12-.jpg'
import r12bg from '@/common/icon/r12-.jpg'
import b12 from '@/common/icon/b12.jpg'
import coverBlack from '@/common/icon/coverBlack.jpg'
import coverRed from '@/common/icon/coverRed.jpg'

// 请求数据
export default {
  namespaced: true,
  state: {
    bannerBlack: [
      {
        bgImg: coverBlack,
        defaultBg: '',
        CalendarImg: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/coverBlack.jpg',
        CustomerImg: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/coverBlack.jpg',
        ImgName: '封面',
        Sort: 1,
        style: ''
      },
      {
        bgImg: b1bg,
        defaultBg: b1,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/96917dcd-ed9f-446b-b54d-d2160416cf1a-20181205094151.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b1.jpg',
        ImgName: '1月',
        Sort: 2,
        style: 'width:1.44rem;height:.94rem;position:absolute;top:.25rem;left:50%;transform:translateX(-50%);object-fit:cover;',
        styleCut: `width: 11.2cm;height: 7.3cm;position: absolute;top: 1.95cm;left: .9cm;`
      },
      {
        bgImg: b2bg,
        defaultBg: b2,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/dd3e0c2d-5ea4-47d5-84b7-c1259ddf9cf1-20181205094235.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b2.jpg',
        ImgName: '2月',
        Sort: 3,
        style: 'width:1.01rem;height:1.18rem;position:absolute;top:.23rem;left:0.15rem;object-fit:cover;',
        styleCut: `width: 7.83cm;height: 9.16cm;position: absolute;top: 1.8cm;left: 1.07cm;`
      },
      {
        bgImg: b3bg,
        defaultBg: b3,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/3a24c0c3-694f-4af2-aa09-0287eb0110fd-20181205094257.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b3.jpg',
        ImgName: '3月',
        Sort: 4,
        style: 'width:1.01rem;height:1.18rem;position:absolute;top:.23rem;right:0.16rem;object-fit:cover;',
        styleCut: `width: 7.83cm;height: 9.16cm;position: absolute;top: 1.8cm;right: 1.15cm;`
      },
      {
        bgImg: b4bg,
        defaultBg: b4,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/b387debc-dc6b-4864-8d26-ce41c2702f1a-20181205094322.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b4.jpg',
        ImgName: '4月',
        Sort: 5,
        style: 'width:1.44rem;height:.94rem;position:absolute;top:.24rem;left:50%;transform:translateX(-50.5%);object-fit:cover;',
        styleCut: `width: 11.1cm;height: 7.3cm;position: absolute;top: 1.9cm;left: .9cm;`
      },
      {
        bgImg: b5bg,
        defaultBg: b5,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/c5b51b42-078d-414b-8cb8-5b5daf6e5463-20181205094344.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b5.jpg',
        ImgName: '5月',
        Sort: 6,
        style: 'width:1.01rem;height:1.18rem;position:absolute;top:.23rem;left:0.15rem;object-fit:cover;',
        styleCut: `width: 7.83cm;height: 9.16cm;position: absolute;top: 1.8cm;left: 1.07cm;`
      },
      {
        bgImg: b6bg,
        defaultBg: b6,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/8b6a3cb2-23d2-4993-b84b-308e9b302cda-20181205094359.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b6.jpg',
        ImgName: '6月',
        Sort: 7,
        style: 'width:1.01rem;height:1.18rem;position:absolute;top:.24rem;right:0.16rem;object-fit:cover;',
        styleCut: `width: 7.83cm;height: 9.16cm;position: absolute;top: 1.87cm;right: 1.15cm;`
      },
      {
        bgImg: b7bg,
        defaultBg: b7,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/11a72196-3ca1-4759-88c3-6b4317928857-20181205094421.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b7.jpg',
        ImgName: '7月',
        Sort: 8,
        style: 'width:1.44rem;height:.94rem;position:absolute;top:.24rem;left:50%;transform:translateX(-50%);object-fit:cover;',
        styleCut: `width: 11.2cm;height: 7.3cm;position: absolute;top: 1.88cm;left: .9cm;`
      },
      {
        bgImg: b8bg,
        defaultBg: b8,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/0d563fa7-7a5c-46fe-bddc-dbb9cdfba160-20181205094436.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b8.jpg',
        ImgName: '8月',
        Sort: 9,
        style: 'width:1.01rem;height:1.18rem;position:absolute;top:.2rem;left:0.17rem;object-fit:cover;',
        styleCut: `width: 7.83cm;height: 9.16cm;position: absolute;top: 1.57cm;left: 1.23cm;`
      },
      {
        bgImg: b9bg,
        defaultBg: b9,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/44f83cc7-f57b-472d-b65b-84b5b10babc7-20181205094453.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b9.jpg',
        ImgName: '9月',
        Sort: 10,
        style: 'width:1.01rem;height:1.18rem;position:absolute;top:.2rem;right:0.16rem;object-fit:cover;',
        styleCut: `width: 7.83cm;height: 9.16cm;position: absolute;top: 1.58cm;right: 1.15cm;`
      },
      {
        bgImg: b10bg,
        defaultBg: b10,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/6cf9a507-87c2-47f9-ad15-990032ecdaac-20181205094510.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b10.jpg',
        ImgName: '10月',
        Sort: 11,
        style: 'width:1.44rem;height:.94rem;position:absolute;top:.24rem;left:50%;transform:translateX(-50%);object-fit:cover;',
        styleCut: `width: 11.2cm;height: 7.3cm;position: absolute;top: 1.88cm;left: .9cm;`
      },
      {
        bgImg: b11bg,
        defaultBg: b11,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/2e8d2090-c528-4f37-8964-201a638e17ed-20181205094529.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b11.jpg',
        ImgName: '11月',
        Sort: 12,
        style: 'width:1.01rem;height:1.18rem;position:absolute;top:.2rem;left:0.16rem;object-fit:cover;',
        styleCut: `width: 7.83cm;height: 9.16cm;position: absolute;top: 1.57cm;left: 1.15cm;`
      },
      {
        bgImg: b12bg,
        defaultBg: b12,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/e36c0bd2-5a48-42f0-86c6-99a56bb27210-20181205094545.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b12.jpg',
        ImgName: '12月',
        Sort: 13,
        style: 'width:1.01rem;height:1.18rem;position:absolute;top:.2rem;right:0.16rem;object-fit:cover;',
        styleCut: `width: 7.83cm;height: 9.16cm;position: absolute;top: 1.56cm;right: 1.15cm;`
      }
    ],
    bannerRed: [
      {
        bgImg: coverRed,
        defaultBg: '',
        CalendarImg: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/coverRed.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/coverRed.jpg',
        ImgName: '封面',
        Sort: 1,
        style: ''
      },
      {
        bgImg: r1bg,
        defaultBg: b1,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/de1214b4-2984-4d42-b224-66ea4f199b83-20181205094956.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b1.jpg',
        ImgName: '1月',
        Sort: 2,
        style: 'width:1.44rem;height:.94rem;position:absolute;top:.25rem;left:50%;transform:translateX(-50%);object-fit:cover;',
        styleCut: `width: 11.2cm;height: 7.3cm;position: absolute;top: 1.95cm;left: .9cm;`
      },
      {
        bgImg: r2bg,
        defaultBg: b2,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/c5d961ed-6a8e-401a-b371-19e3c7be070a-20181205095012.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b2.jpg',
        ImgName: '2月',
        Sort: 3,
        style: 'width:1.01rem;height:1.18rem;position:absolute;top:.23rem;left:0.15rem;object-fit:cover;',
        styleCut: `width: 7.83cm;height: 9.16cm;position: absolute;top: 1.8cm;left: 1.07cm;`
      },
      {
        bgImg: r3bg,
        defaultBg: b3,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/390afecc-e7f9-4643-beaf-e696de93f2bf-20181205095032.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b3.jpg',
        ImgName: '3月',
        Sort: 4,
        style: 'width:1.01rem;height:1.18rem;position:absolute;top:.23rem;right:0.16rem;object-fit:cover;',
        styleCut: `width: 7.83cm;height: 9.16cm;position: absolute;top: 1.8cm;right: 1.15cm;`
      },
      {
        bgImg: r4bg,
        defaultBg: b4,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/52015d95-f4a3-44bc-9650-79750c3a8a55-20181205095057.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b4.jpg',
        ImgName: '4月',
        Sort: 5,
        style: 'width:1.44rem;height:.94rem;position:absolute;top:.24rem;left:50%;transform:translateX(-50.5%);object-fit:cover;',
        styleCut: `width: 11.1cm;height: 7.3cm;position: absolute;top: 1.9cm;left: .9cm;`
      },
      {
        bgImg: r5bg,
        defaultBg: b5,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/2ea3e866-151b-4a38-8899-778113672e4b-20181205095118.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b5.jpg',
        ImgName: '5月',
        Sort: 6,
        style: 'width:1.01rem;height:1.18rem;position:absolute;top:.23rem;left:0.15rem;object-fit:cover;',
        styleCut: `width: 7.83cm;height: 9.16cm;position: absolute;top: 1.8cm;left: 1.07cm;`
      },
      {
        bgImg: r6bg,
        defaultBg: b6,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/23c4e345-addf-40cd-b383-658f2a998367-20181205095139.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b6.jpg',
        ImgName: '6月',
        Sort: 7,
        style: 'width:1.01rem;height:1.18rem;position:absolute;top:.24rem;right:0.16rem;object-fit:cover;',
        styleCut: `width: 7.83cm;height: 9.16cm;position: absolute;top: 1.87cm;right: 1.15cm;`
      },
      {
        bgImg: r7bg,
        defaultBg: b7,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/f686a7cd-b7d1-4501-aaad-177c10377618-20181205095200.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b7.jpg',
        ImgName: '7月',
        Sort: 8,
        style: 'width:1.44rem;height:.94rem;position:absolute;top:.24rem;left:50%;transform:translateX(-50%);object-fit:cover;',
        styleCut: `width: 11.2cm;height: 7.3cm;position: absolute;top: 1.88cm;left: .9cm;`
      },
      {
        bgImg: r8bg,
        defaultBg: b8,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/04d53ced-f552-4986-8f53-8ddc52f2ea9f-20181205095229.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b8.jpg',
        ImgName: '8月',
        Sort: 9,
        style: 'width:1.01rem;height:1.18rem;position:absolute;top:.2rem;left:0.17rem;object-fit:cover;',
        styleCut: `width: 7.83cm;height: 9.16cm;position: absolute;top: 1.57cm;left: 1.23cm;`
      },
      {
        bgImg: r9bg,
        defaultBg: b9,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/e8c6cf08-9036-4e50-9c2f-4ebc5d79f4d5-20181205095248.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b9.jpg',
        ImgName: '9月',
        Sort: 10,
        style: 'width:1.01rem;height:1.18rem;position:absolute;top:.2rem;right:0.16rem;object-fit:cover;',
        styleCut: `width: 7.83cm;height: 9.16cm;position: absolute;top: 1.6cm;right: 1.15cm;`
      },
      {
        bgImg: r10bg,
        defaultBg: b10,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/2c5cceb6-f418-4e49-bba6-bbd9f36eec2c-20181205095306.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b10.jpg',
        ImgName: '10月',
        Sort: 11,
        style: 'width:1.44rem;height:.94rem;position:absolute;top:.24rem;left:50%;transform:translateX(-50%);object-fit:cover;',
        styleCut: `width: 11.2cm;height: 7.3cm;position: absolute;top: 1.88cm;left: .9cm;`
      },
      {
        bgImg: r11bg,
        defaultBg: b11,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/e471c47e-2142-47e1-ad26-abe87af7b168-20181205095320.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b11.jpg',
        ImgName: '11月',
        Sort: 12,
        style: 'width:1.01rem;height:1.18rem;position:absolute;top:.2rem;left:0.16rem;object-fit:cover;',
        styleCut: `width: 7.83cm;height: 9.16cm;position: absolute;top: 1.57cm;left: 1.15cm;`
      },
      {
        bgImg: r12bg,
        defaultBg: b12,
        CalendarImg: 'http://spaceofcheng.oss-cn-beijing.aliyuncs.com/0592e7b4-f7c5-44dd-a557-e20b282e60ca-20181205095342.jpg',
        CustomerImg: '',
        CustomerImgShow: '',
        defaultNoUser: 'https://spaceofcheng.oss-cn-beijing.aliyuncs.com/calendar/b12.jpg',
        ImgName: '12月',
        Sort: 13,
        style: 'width:1.01rem;height:1.18rem;position:absolute;top:.2rem;right:0.16rem;object-fit:cover;',
        styleCut: `width: 7.83cm;height: 9.16cm;position: absolute;top: 1.56cm;right: 1.15cm;`
      }
    ],
    email: ''
  },
  mutations: {
    upDateBanner (state, { type, data }) {
      console.log(data)
      if (type == 1) {
        state.bannerBlack = data || []
      } else {
        state.bannerRed = data || []
      }
    },
    upDateWindowLoad (state, data) {
      state.windowLoad = data
    },
    upDateEmail (state, data) {
      state.email = data
    }
  },
  actions: {
    setBanner (context, { type, data }) {
      return new Promise((resolve) => {
        context.commit('upDateBanner', { type, data })
        resolve()
      })
    },
    setEmail (context, data) {
      return new Promise((resolve) => {
        console.log(data)
        context.commit('upDateEmail', data)
        resolve()
      })
    },
    calendar (context, data) {
      return new Promise((resolve, reject) => {
        Ajax({
          ...api.calendar.calendar,
          data: data
        }).then(res => {
          resolve(res)
        }).catch((err) => {
          reject(err)
        })
      })
    },
    getCalendarCustomer () {
      return new Promise((resolve, reject) => {
        Ajax({
          ...api.calendar.getCalendarCustomer
        }).then(res => {
          resolve(res)
        }).catch((err) => {
          reject(err)
        })
      })
    }
  }
}
