docs.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. ImagePath: app.globalData.uploadImageUrl,
  8. ArticleList:constant.arrArticleList,
  9. },
  10. onLoad: function (options) {
  11. var that = this;
  12. var id=options.ID;
  13. var arr=[];
  14. var title="";
  15. for(var i=0;i<that.data.ArticleList.length;i++){
  16. if (id==that.data.ArticleList[i].ID){
  17. arr=that.data.ArticleList[i].Content;
  18. title=that.data.ArticleList[i].TitleShort;
  19. break;
  20. }
  21. }
  22. that.setData({
  23. Containnerheight: main.getWindowHeight(),
  24. ImageArr:arr,
  25. ArticleID:options.ID,
  26. Title:title,
  27. });
  28. },
  29. showImage: function (e) {
  30. var image = e.currentTarget.dataset.url;
  31. image=this.data.ImagePath+"web/_ScoreLine/"+image;
  32. wx.previewImage({
  33. current: image,
  34. urls: [image]
  35. });
  36. },
  37. goto: function (e) {
  38. var url=e.currentTarget.dataset.url;
  39. wx.navigateTo({
  40. url: url,
  41. });
  42. },
  43. redirectTo: function (e) {
  44. var url=e.currentTarget.dataset.url;
  45. wx.redirectTo({
  46. url: url,
  47. });
  48. },
  49. reLaunch: function (e) {
  50. wx.reLaunch({
  51. url: 'default',
  52. })
  53. },
  54. onShareTimeline: function () {
  55. return this.onShareAppMessage();
  56. },
  57. onShareAppMessage: function () {
  58. return {
  59. title: this.data.Title,
  60. path: app.globalData.SharePath + '?type=docs&ID='+this.data.ArticleID+'&UserID=' + app.globalData.userInfo.UserID,
  61. }
  62. },
  63. })