help.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. var id=0;
  5. var idchild=0;
  6. Page({
  7. data: {
  8. List: [],
  9. ImagePath: app.globalData.uploadImageUrl,
  10. },
  11. onLoad: function (options) {
  12. var that = this;
  13. id=options.id;
  14. idchild=options.idchild;
  15. that.init(options,function(list){
  16. that.setData({
  17. Containnerheight: main.getWindowHeight(),
  18. Item: list[options.id].List[options.idchild],
  19. IsShare: options.IsShare,
  20. });
  21. wx.setNavigationBarColor({
  22. frontColor: "#000000",
  23. backgroundColor: "#ffffff",
  24. });
  25. });
  26. },
  27. init: function (options,callback) {
  28. var that = this;
  29. var list = wx.getStorageSync("MiaoguoTipsList");
  30. if (!list[options.id] || !list[options.id].List[options.idchild])
  31. list=undefined;
  32. if (!list){
  33. main.getData("GetMiaoguoTipsList", function (data) {
  34. callback(data);
  35. wx.setStorageSync("MiaoguoTipsList", data);
  36. });
  37. }
  38. else
  39. callback(list);
  40. },
  41. goto: function (e) {
  42. if (this.data.IsShare==1){
  43. var url = e.currentTarget.dataset.url;
  44. wx.redirectTo({
  45. url: url,
  46. });
  47. }
  48. else{
  49. wx.navigateBack({
  50. delta: 1,
  51. });
  52. }
  53. },
  54. onShareAppMessage: function () {
  55. return {
  56. title: "小贴士",
  57. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID + '&type=help&ID=' + id + '&IDChild=' + idchild,
  58. imageUrl: app.globalData.uploadImageUrl+'web/'+this.data.Item.Cover,
  59. }
  60. },
  61. })