import common from '../../utils/util'; import main from '../../utils/main'; import animation from '../../utils/animation'; const app = getApp(); Page({ data: { IsShowSelect:false, IsShowRemind:false, IsShowAlert:false, AlertClass:"", Sort1:"panel112", Sort2:"", RemindArr:[ { "Title":"取消收藏", "Content":"确定删除这条收藏记录吗?删除后无法恢复。", "BtnName":"删除", },{ "Title":"取消收藏", "Content":"确定删除这些收藏记录吗?删除后无法恢复。", "BtnName":"删除", },{ "Title":"生成文章", "Content":"要用这些单词生成新文章吗?", "BtnName":"继续", },{ "Title":"导出到秒过", "Content":"要把这些单词做成秒过题卡吗?\n\n该功能需要切换到「秒过 - 错题记忆卡」小程序中实现。", "BtnName":"继续", }, ], RemindIndex:0, }, onLoad: function (options) { let that = this; that.setData({ Containnerheight: main.getWindowHeight(), List:app.globalData.UserCollect, Count:0, }); }, sortWord:function(e){ let isSort=e.currentTarget.dataset.issort; let list=[]; let sort1="",sort2=""; if (isSort=="1"){ list=common.sort(this.data.List,"ASC","Word","String"); sort1=""; sort2="panel112"; } else{ list=common.sort(this.data.List,"DESC","ID","Number"); sort1="panel112"; sort2=""; } //debugger; this.setData({ List:list, Sort1:sort1, Sort2:sort2, }); }, selecItem:function(e){ let index=e.currentTarget.dataset.index; let list=this.data.List; for(let i=0;i10){ // 使用组件显示提示 this.selectComponent('#alertTip').showAlert("一篇文章最多可选10个单词"); return null; } } if (e.currentTarget.dataset.word) that.Word=e.currentTarget.dataset.word; animation.toggleRemindWithAnimation(this, { hideColor: 'rgba(0,0,0,0)', showColor: 'rgba(277,277,277,0.5)', panelAnimationKey: 'panelAnimation', // 控制内容面板的动画 animationKey: 'parentAnimation' // 控制父容器的动画(如果需要) }); }, showRemindEnd:function(e){ let that=this; const confirm=e.currentTarget.dataset.confirm; animation.toggleRemindWithAnimation(this, { hideColor: 'rgba(0,0,0,0)', showColor: 'rgba(277,277,277,0.5)' }); if (confirm=="1") { switch(Number(that.data.RemindIndex)){ case 0: that.deleteItem(that.Word); break; case 1: that.deleteMany(); break; case 2: that.setClipboard(); break; case 3: that.gotoMiaoguo(); break; } } }, deleteItem:function(word){ let that=this; main.getData('AddOrDeleteYJBDCUserCollect?UserID='+app.globalData.userInfo.UserID+'&Word='+word, function (data) { if (data){ app.globalData.UserCollect=data; that.setData({ List:app.globalData.UserCollect, }); wx.showToast({ title: '删除完成', }); } }); }, deleteMany:function(){ let that=this; let arr=that.getSelectedWord(); main.getData('DeleteYJBDCUserCollect?UserID='+app.globalData.userInfo.UserID+'&WordArr='+arr.join(","), function (data) { if (data){ app.globalData.UserCollect=data; that.setData({ List:app.globalData.UserCollect, }); wx.showToast({ title: '批量删除完成', }); } }); }, setClipboard:function(e){ let that=this; let arr=that.getSelectedWord(true); app.globalData.SelectedWords=arr; wx.redirectTo({ url: 'wordsinput', }); }, gotoMiaoguo:function(e){ let that=this; let arr=that.getSelectedWord(); var appid="wx84b3feac6069eec3"; var path="pages/index/index?SourceID="+app.globalData.ProgramID+"&goto=buildcard&Words="+arr.join(","); wx.navigateToMiniProgram({ appId: appid, path: path, }); }, getSelectedWord:function(selectTen){ let that=this; let list=that.data.List; let arr=[]; for(let i=0;i