articlefine.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. Version:app.globalData.Version,
  23. });
  24. that.getChoicenessArticle();
  25. main.checkGenerating();
  26. },
  27. goto: function (e) {
  28. let that=this;
  29. var url=e.currentTarget.dataset.url;
  30. if (url=="index" || url=="../../packageProduct/main/product"){
  31. wx.redirectTo({
  32. url: url,
  33. });
  34. }
  35. else if (url=="guide"){
  36. wx.setStorageSync('IsShowGuideContainer', true);
  37. wx.reLaunch({
  38. url: "index",
  39. });
  40. }
  41. else{
  42. wx.navigateTo({
  43. url: url,
  44. });
  45. }
  46. },
  47. //得到精选文章
  48. getChoicenessArticle:function(){
  49. let that=this;
  50. main.getData('GetYJBDCArticleList?IsFine=1', function (data) {
  51. if (data) {
  52. that.setData({
  53. ChoicenessList:data,
  54. });
  55. wx.setStorageSync('ChoicenessList', data);
  56. }
  57. });
  58. },
  59. onShareAppMessage: function () {
  60. return {
  61. title: app.globalData.ShareTitle,
  62. path: app.globalData.SharePath + '?goto=articlefine&UserID=' + app.globalData.userInfo.UserID,
  63. }
  64. },
  65. })