Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

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