import {
  makeAutoObservable
} from 'mobx';

// import CryptoJS from 'crypto-js';
// // const CryptoJS = require('crypto-js');
// const hash = createHash('sha256');

// hash.update(bundle[fileName].source);
// const hashValue = hash.digest('hex').substring(0, 8);


// 首页
let _homePage = {
  bg_type1: './assets/homePage/bg_type1.png',
  bg_type2: './assets/homePage/bg_type2.png',
  tab1: './assets/homePage/tab1.png',
  tab2: './assets/homePage/tab2.png',
  arrow_left: './assets/homePage/arrow_left.png',
  btn_prize: './assets/homePage/btn_prize.png',
  mainbtn: './assets/homePage/mainbtn.png',
  btn_future: './assets/homePage/btn_future.png',
  mainbtn_popover: './assets/homePage/mainbtn_popover.png',
  btn_rule: './assets/homePage/btn_rule.png',
  title: './assets/homePage/title.png',
  btn_share: './assets/homePage/btn_share.png',
}


// 处理图片防止缓存
const dealImg = (obj) => {

  Object.keys(obj)?.map(item => {
    if (typeof obj[item] == 'string') {
      obj[item] = `${obj[item]}?v=${__BUILD_TIME__}`
    } else if (Array.isArray(obj[item])) {
      return dealImg(obj[item])
    }
  })

  return obj
}
let homePage = dealImg(_homePage)
const skinStore = makeAutoObservable({
  homePage,
})
export default skinStore;
