app.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // app.js
  2. App({
  3. globalData: {
  4. Version: "1.0.0",
  5. //IsProduction: true,
  6. ShareTitle: "语境背单词",
  7. SharePath: "pages/index/index",
  8. ShareImage: '../images/program_share-a01.png',
  9. ProgramID: 186,
  10. ProgramName: "语境背单词",
  11. AppID: "wx80059777521b897c",
  12. serverUrl: "https://scoreline.kylx365.com/apiData/",
  13. serverUrlServer: "https://scoreline.kylx365.com/apiData/",
  14. serverUrlLocalhost: "http://localhost:3000/apiData/",
  15. audioUrlBaidu: "https://tsn.baidu.com/text2audio?lan=zh&ctp=1&cuid=abcdxxx&tok=[token]&tex=[word]&vol=9&per=0&spd=3&pit=5",
  16. uploadImageUrl: "https://miaguo-1253256735.file.myqcloud.com/",
  17. officialAccounts:"https://mp.weixin.qq.com/s/gO9S4PrPl1Uu1iksyRuBgw",
  18. BaiduToken: "",//百度开发平台token
  19. IsIOS: true,
  20. IsAndroid: false,
  21. IsIPad: false,
  22. IsIPhoneX: false,
  23. IsOppo: false,
  24. systemInfo: null,
  25. userInfo: null,
  26. SourceID: 0,//来源ID
  27. shareTicket: null,
  28. userSource: null,//用户来源方式
  29. Key: "kylx365_chengjie",
  30. IV: "kylx365hongliren",
  31. TempStr:"",
  32. OCRWords:[],//OCR的单词
  33. SelectedWords:[],//选中的单词
  34. ocrReady: false
  35. },
  36. onLaunch: function (options) {
  37. var that=this;
  38. that.getSystemInfo();
  39. // wx.setEnableDebug({
  40. // enableDebug: true
  41. // });
  42. },
  43. getSystemInfo: function () {
  44. this.globalData.systemInfo = wx.getSystemInfoSync();
  45. if (this.globalData.systemInfo.system.indexOf("Android") >= 0) {
  46. this.globalData.IsIOS =false;
  47. this.globalData.IsAndroid=true;
  48. }
  49. else if (this.globalData.systemInfo.system.indexOf("iOS") >= 0) {
  50. this.globalData.IsIOS = true;
  51. this.globalData.IsAndroid=false;
  52. if (this.globalData.systemInfo.model.indexOf("X") >= 0
  53. || this.globalData.systemInfo.model.indexOf("11") >= 0
  54. || this.globalData.systemInfo.model.indexOf("12") >= 0
  55. || this.globalData.systemInfo.model.indexOf("13") >= 0
  56. || this.globalData.systemInfo.model.indexOf("14") >= 0)
  57. this.globalData.IsIPhoneX=true;
  58. }
  59. if (this.globalData.systemInfo.model.indexOf("iPad")>=0){
  60. this.globalData.IsIPad=true;
  61. }
  62. if (this.globalData.systemInfo.brand.indexOf("OPPO")>=0){
  63. this.globalData.IsOppo=true;
  64. }
  65. }
  66. })