index.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. import animation from '../../utils/animation';
  4. const app = getApp();
  5. Page({
  6. data: {
  7. IsShowRemind:false,
  8. remindAnimation: "",
  9. },
  10. onLoad: function (options) {
  11. let that = this;
  12. that.setData({
  13. Containnerheight: main.getWindowHeight(),
  14. Version:app.globalData.Version,
  15. });
  16. },
  17. onShow:function(){
  18. app.globalData.OCRWords=[];
  19. this.getData();
  20. main.checkGenerating();
  21. if (wx.getStorageSync('IsShowGuideContainer')){
  22. this.initGuide();
  23. }
  24. else{
  25. this.setData({
  26. IsShowGuideContainer:false,
  27. })
  28. }
  29. },
  30. goto: function (e) {
  31. let that=this;
  32. var url=e.currentTarget.dataset.url;
  33. if (url=="wordsinput"){
  34. if (that.data.TodayCount>that.data.MaxCount){
  35. animation.toggleRemindWithAnimation(that);
  36. return ;
  37. }
  38. }
  39. wx.navigateTo({
  40. url: url,
  41. });
  42. that.setData({
  43. IsShowRemind:false,
  44. })
  45. },
  46. getData:function(){
  47. let that=this;
  48. main.getData('GetYJBDCArticleList?UserID=' + app.globalData.userInfo.UserID+'&IsTodayCount=1', function (data) {
  49. if (data) {
  50. that.setData({
  51. TodayCount:data.TodayCount,
  52. MaxCount:data.MaxCount,
  53. UnReadCount:data.UnReadCount,
  54. });
  55. }
  56. });
  57. },
  58. showRemind:function(){
  59. animation.toggleRemindWithAnimation(this);
  60. },
  61. initGuide:function(){
  62. let that=this;
  63. that.setData({
  64. IsShowGuideContainer:true,
  65. });
  66. main.showGuideContainer(that,"#txtWordsInput",0,110,"pic_ha01",396,248,-5);
  67. wx.setStorageSync('IsShowGuideContainer', true);
  68. },
  69. closeGuideContainer:function(){
  70. this.setData({
  71. IsShowGuideContainer:false,
  72. });
  73. wx.setStorageSync('IsShowGuideContainer', false);
  74. },
  75. // 阻止示例面板的触摸事件传递到底层
  76. catchTouchMove: function(e) {
  77. // 这个函数不需要做任何事情,只需要捕获事件防止冒泡
  78. return false;
  79. },
  80. onShareAppMessage: function () {
  81. return {
  82. title: app.globalData.ShareTitle,
  83. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  84. imageUrl: app.globalData.ShareImage,
  85. }
  86. },
  87. })