library.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. Menu1:0,
  7. Menu2:0,
  8. Menu2Array:[{ID:0,Name:"全部",CSS:"Selected"},{ID:1,Name:"小学",CSS:""},{ID:2,Name:"初中",CSS:""},{ID:3,Name:"课外拓展",CSS:""}],
  9. },
  10. onPullDownRefresh: function () {
  11. wx.stopPullDownRefresh();
  12. },
  13. onLoad: function (options) {
  14. var that = this;
  15. that.setData({
  16. Containnerheight: main.getWindowHeight(),
  17. });
  18. },
  19. onShow:function(){
  20. var that = this;
  21. },
  22. setMenu1:function(e){
  23. var that=this;
  24. var index=e.currentTarget.dataset.index;
  25. that.setData({
  26. Menu1:index,
  27. });
  28. },
  29. setMenu2:function(e){
  30. var that=this;
  31. var index=e.currentTarget.dataset.index;
  32. var list=that.data.Menu2Array;
  33. for(var i=0;i<list.length;i++){
  34. list[i].CSS="";
  35. if (index==list[i].ID){
  36. list[i].CSS="Selected";
  37. }
  38. }
  39. that.setData({
  40. Menu2:index,
  41. Menu2Array:list,
  42. });
  43. },
  44. goto: function (e) {
  45. var url = e.currentTarget.dataset.url;
  46. wx.navigateTo({
  47. url: url,
  48. });
  49. },
  50. onShareAppMessage: function () {
  51. return {
  52. title: app.globalData.ShareTitle,
  53. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  54. imageUrl: app.globalData.ShareImage,
  55. }
  56. },
  57. })