help.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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(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 (callback) {
  28. var that = this;
  29. var list = wx.getStorageSync("MiaoguoTipsList");
  30. if (!list){
  31. main.getData("GetMiaoguoTipsList", function (data) {
  32. callback(data);
  33. wx.setStorageSync("MiaoguoTipsList", data);
  34. });
  35. }
  36. else
  37. callback(list);
  38. },
  39. goto: function (e) {
  40. if (this.data.IsShare==1){
  41. var url = e.currentTarget.dataset.url;
  42. wx.redirectTo({
  43. url: url,
  44. });
  45. }
  46. else{
  47. wx.navigateBack({
  48. delta: 1,
  49. });
  50. }
  51. },
  52. onShareAppMessage: function () {
  53. return {
  54. title: "小贴士",
  55. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID + '&type=help&ID=' + id + '&IDChild=' + idchild,
  56. imageUrl: app.globalData.uploadImageUrl+'web/'+this.data.Item.Cover,
  57. }
  58. },
  59. })