articlefine.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. ImageUrl:app.globalData.uploadImageUrl,
  7. IsIPhoneX:app.globalData.IsIPhoneX,
  8. GradeArr:[
  9. {Image:"19",Name:"A1 A2",Name2:"小学",BColor:"#EDBF87"},
  10. {Image:"20",Name:"A2 B1",Name2:"初中",BColor:"#F2ED83"},
  11. {Image:"21",Name:"B1 B2",Name2:"高中",BColor:"#84D082"},
  12. {Image:"22",Name:"B2 C1",Name2:"大学",BColor:"#90C0E2"},
  13. ]
  14. },
  15. onLoad: function (options) {
  16. let that = this;
  17. let ArticleStyleArr=app.globalData.GenerateConfig.ArticleStyle;
  18. ArticleStyleArr=common.sort(ArticleStyleArr,"ASC","ID","Number");
  19. that.setData({
  20. Containnerheight: main.getWindowHeight(),
  21. ArticleStyleArr:ArticleStyleArr,
  22. });
  23. that.getChoicenessArticle();
  24. main.checkGenerating();
  25. },
  26. goto: function (e) {
  27. let that=this;
  28. var url=e.currentTarget.dataset.url;
  29. if (url=="index"){
  30. wx.reLaunch({
  31. url: url,
  32. });
  33. }
  34. else if (url=="guide"){
  35. wx.setStorageSync('IsShowGuideContainer', true);
  36. wx.reLaunch({
  37. url: "index",
  38. });
  39. }
  40. else{
  41. wx.navigateTo({
  42. url: url,
  43. });
  44. }
  45. },
  46. //得到精选文章
  47. getChoicenessArticle:function(){
  48. let that=this;
  49. main.getData('GetYJBDCArticleList?IsFine=1', function (data) {
  50. if (data) {
  51. that.setData({
  52. ChoicenessList:data,
  53. });
  54. wx.setStorageSync('ChoicenessList', data);
  55. }
  56. });
  57. },
  58. onShareAppMessage: function () {
  59. return {
  60. title: app.globalData.ShareTitle,
  61. path: app.globalData.SharePath + '?goto=articlefine&UserID=' + app.globalData.userInfo.UserID,
  62. }
  63. },
  64. })