// app.js
App({
  globalData: {
    Version: "1.1.1",
    //IsProduction: true,
    ShareTitle: "阅读理解+答题",
    SharePath: "pages/index/index",
    ShareImage: '../images/pic_07.png',
    ProgramID: 186,
    ProgramName: "语境背单词",
    AppID: "wx80059777521b897c",
    serverUrl: "https://scoreline.kylx365.com/apiData/",
    serverUrlServer: "https://scoreline.kylx365.com/apiData/",
    serverUrlLocalhost: "http://localhost:3000/apiData/",
    audioUrlBaidu: "https://tsn.baidu.com/text2audio?lan=zh&ctp=1&cuid=abcdxxx&tok=[token]&tex=[word]&vol=9&per=0&spd=3&pit=5",
    uploadImageUrl: "https://miaguo-1253256735.file.myqcloud.com/",
    officialAccounts:"https://mp.weixin.qq.com/s/gO9S4PrPl1Uu1iksyRuBgw",
    BaiduToken: "",//百度开发平台token
    IsIOS: true,
    IsAndroid: false,
    IsIPad: false,
    IsIPhoneX: false,
    IsOppo: false,
    systemInfo: null,
    userInfo: null,
    SourceID: 0,//来源ID
    shareTicket: null,
    userSource: null,//用户来源方式
    Key: "kylx365_chengjie",
    IV: "kylx365hongliren",
    TempStr:"",
    OCRWords:[],//OCR的单词
    SelectedWords:[],//选中的单词
    ocrReady: false,//
    Generating:false,//生成文章中
    GeneratingStart:false,//生成文章中已经开始
    GenerateConfig:[],//生成文章的配置信息
  },
  onLaunch: function (options) {
    let that=this;
    that.getSystemInfo();
    // wx.setEnableDebug({
    //   enableDebug: true
    // });
  },
  getSystemInfo: function () {
    this.globalData.systemInfo = wx.getSystemInfoSync();
    
    if (this.globalData.systemInfo.system.indexOf("Android") >= 0) {
      this.globalData.IsIOS =false;
      this.globalData.IsAndroid=true;
    }
    else if (this.globalData.systemInfo.system.indexOf("iOS") >= 0) {
      this.globalData.IsIOS = true;
      this.globalData.IsAndroid=false;

      if (this.globalData.systemInfo.model.indexOf("X") >= 0
      || this.globalData.systemInfo.model.indexOf("11") >= 0
      || this.globalData.systemInfo.model.indexOf("12") >= 0
      || this.globalData.systemInfo.model.indexOf("13") >= 0 
      || this.globalData.systemInfo.model.indexOf("14") >= 0 
      || this.globalData.systemInfo.model.indexOf("15") >= 0 
      || this.globalData.systemInfo.model.indexOf("16") >= 0
      || this.globalData.systemInfo.model.indexOf("17") >= 0
      || this.globalData.systemInfo.model.indexOf("18") >= 0
      || this.globalData.systemInfo.model.indexOf("19") >= 0 
      || this.globalData.systemInfo.model.indexOf("20") >= 0)
        this.globalData.IsIPhoneX=true;
    }

    if (this.globalData.systemInfo.model.indexOf("iPad")>=0){
      this.globalData.IsIPad=true;
    }

    if (this.globalData.systemInfo.brand.indexOf("OPPO")>=0){
      this.globalData.IsOppo=true;
    }
  }
})