import common from '../../utils/util'; import main from '../../utils/main'; import animation from '../../utils/animation'; import commonBehavior from '../behaviors/commonBehavior'; const app = getApp(); let isFocus=true; Page({ behaviors: [commonBehavior], data: { Words:[], IsShowSetPanel:false, IsShowFirstOpen:false, IsShowExample:false, IsShowRemind:false, IsShowGuideContainer:false, IsShowGuideRemind:false, }, onLoad: function (options) { let that = this; const IsShowFirstOpen=wx.getStorageSync('IsShowFirstOpen'); const IsShowGuideContainer=wx.getStorageSync('IsShowGuideContainer'); if (!IsShowGuideContainer && !IsShowFirstOpen){ that.setData({ IsShowFirstOpen:1, }); } else{ const IsShowGuideRemind=wx.getStorageSync('IsShowGuideRemind'); if (!IsShowGuideRemind){ that.setData({ IsShowGuideRemind:1, }); } } that.setData({ Containnerheight: main.getWindowHeight(), KeyboardBtnName:"next", }); that.initMenu(); main.checkGenerating(); if (options.goto=="selectword"){ wx.navigateTo({ url: options.goto, }) } }, onShow:function(e){ let that = this; that.initWords(); that.isShowAlert(); that.initGuide(null); }, onHide:function(e){ this.getInputData(); }, initWords:function(){ let that = this; app.globalData.SelectedWords=common.removeDuplicateAndTrimStrings(app.globalData.SelectedWords); that.data.Words=[]; for(let i=0;i<10;i++){ let obj={}; obj.ID=i+1; if (app.globalData.SelectedWords[i]){ obj.Word=app.globalData.SelectedWords[i]; obj.CSS="txtWordFinished"; if (obj.Word && !that.isValidInput(obj.Word)){ obj.IsError=true; } else obj.IsError=false; } else{ obj.Word=""; obj.CSS=""; obj.IsError=false; } that.data.Words.push(obj); } //console.log(app.globalData.SelectedWords); that.setData({ Words:that.data.Words, }); }, initGuide:function(e){ let that=this; if (e && e.currentTarget.dataset.isstart){ wx.setStorageSync('IsShowGuideContainer', true); //wx.setStorageSync('IsShowGuideRemind', 2); wx.navigateBack({ delta: 1, }); } else if (wx.getStorageSync("IsShowGuideContainer")){ that.setData({ IsShowGuideContainer:true, IsShowGuideRemind:false, }); app.globalData.SelectedWords=["penguin","asia","mammal","panda","","fish","bird","dolphin","",""]; that.initWords(); main.showGuideContainer(that,"#txtWord5",134,-238,"pic_ha02",0,2); } }, initMenu:function(){ let that = this; let level=app.globalData.GenerateConfig.Level; level[0].CSS="Selected"; for(let i=1;i=10){ that.showRemind(); return; } if (app.globalData.OCRWords.length>0){ url="../main/selectword"; } else{ url="../main/ocr" } } wx.navigateTo({ url: url, }); }, getInputData:function(){ let that=this; app.globalData.SelectedWords=[]; for(let i=0;i