collect.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. import constant from '../../utils/constant';
  4. const app = getApp();
  5. Page({
  6. data: {
  7. SchoolType1:constant.arrSchoolType1,
  8. ImagePath: app.globalData.uploadImageUrl,
  9. },
  10. onLoad: function (options) {
  11. var that = this;
  12. that.setData({
  13. Containnerheight: main.getWindowHeight(),
  14. SchoolType1Index:0,
  15. });
  16. },
  17. onShow:function(res){
  18. this.init();
  19. },
  20. init:function(){
  21. var that = this;
  22. main.getCollect(function(data){
  23. if (data){
  24. var arr=[data["收藏的高中"],data["收藏的初中"]];
  25. that.setData({
  26. SchoolCollect:arr,
  27. SchoolCurrent: arr[that.data.SchoolType1Index],
  28. });
  29. }
  30. });
  31. },
  32. onSelect:function(event){
  33. var that=this;
  34. main.onSelect(that,event,function(obj,e,result){
  35. if (e.currentTarget.dataset.object=="SchoolType1"){
  36. that.setData({
  37. SchoolType1Index:e.currentTarget.dataset.index,
  38. SchoolCurrent:that.data.SchoolCollect[e.currentTarget.dataset.index],
  39. });
  40. }
  41. });
  42. },
  43. goto: function (e) {
  44. main.goto(e);
  45. },
  46. gotoMap:function(e){
  47. if (this.data.SchoolCurrent.length>0){
  48. main.goto({currentTarget:{dataset:{url:"map?PageType=3"}}});
  49. }
  50. else
  51. main.goto(e);
  52. },
  53. onShareTimeline: function () {
  54. return this.onShareAppMessage();
  55. },
  56. onShareAppMessage: function () {
  57. return {
  58. title: app.globalData.ShareTitle,
  59. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  60. }
  61. },
  62. })