Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

70 wiersze
2.0 KiB

  1. const app = getApp()
  2. const config = require("../../config/config")
  3. const Http = require("../../utils/HttpBasics.js")
  4. const navigationBarHeight = (getApp().statusBarHeight + 44)+"px"
  5. var WxParse = require('../../wxParse/wxParse.js');
  6. Page({
  7. data:{
  8. imgHttps:app.globalData.imgHttps,
  9. navigationBarHeight,
  10. allLsit:"",
  11. id:"",
  12. type:"",
  13. },
  14. getData(){
  15. Http.get({
  16. url:config.api.getPublicityDetail,
  17. data:{id:this.data.id}
  18. }).then(res=>{
  19. this.setData({
  20. allLsit:res.data
  21. })
  22. }).catch(err=>{
  23. tt.showToast({
  24. title: err.message, // 内容
  25. icon: "none"
  26. });
  27. })
  28. },
  29. getHtml(id ,that){
  30. tt.request({
  31. url: 'https://ttctest.malls.iformall.com/tt/api/wxCampaign/printHtmlById', // 目标服务器url
  32. data:{
  33. token: app.globalData.token,
  34. id:id,
  35. date: new Date()
  36. },
  37. header: {
  38. 'content-type': 'application/html'
  39. },
  40. success: (res) => {
  41. var temp = WxParse.wxParse('article', 'html', res.data, that, 5);
  42. }
  43. });
  44. },
  45. goXq(e){//跳转详情
  46. let id = e.currentTarget.dataset.id
  47. let title = e.currentTarget.dataset.title
  48. tt.navigateTo({
  49. url: `/pages/classDetails/classDetails?id=${id}&title=${title}` // 指定页面的url
  50. });
  51. },
  52. onLoad:function (params) {
  53. const that = this;
  54. console.log(params.id);
  55. if(params.id &&params.type==1){//宣传页
  56. that.setData({
  57. id:params.id,
  58. type:params.type
  59. })
  60. that.getData()
  61. }else if(params.id &&params.type==2){//图文
  62. that.setData({
  63. id:params.id,
  64. type:params.type
  65. })
  66. that.getHtml(params.id,that)
  67. }
  68. },
  69. })