|
- const app = getApp()
- const config = require("../../config/config")
- const Http = require("../../utils/HttpBasics.js")
- const navigationBarHeight = (getApp().statusBarHeight + 44)+"px"
- var WxParse = require('../../wxParse/wxParse.js');
- const convert = require("../../utils/util.js")
- Page({
- data:{
- imgHttps:app.globalData.imgHttps,
- navigationBarHeight,
- allLsit:"",
- id:"",
- type:"",
- },
- getData(){
- Http.get({
- url:config.api.getPublicityDetail,
- data:{id:this.data.id}
- }).then(res=>{
- let temp = res.data
- if(temp.ttCoupons){
- temp.ttCoupons.map(item=>{
- item.popularity = convert.moodsText(item.popularity)
- })
- }
- this.setData({
- allLsit:temp
- })
- }).catch(err=>{
- tt.showToast({
- title: err.message, // 内容
- icon: "none"
- });
- })
- },
- getHtml(id ,that){
- tt.request({
- url: 'https://ttctest.malls.iformall.com/tt/api/wxCampaign/printHtmlById', // 目标服务器url
- data:{
- token: app.globalData.token,
- id:id,
- date: new Date()
- },
- header: {
- 'content-type': 'application/html'
- },
- success: (res) => {
- var temp = WxParse.wxParse('article', 'html', res.data, that, 5);
- }
- });
- },
- goXq(e){//跳转详情
- let id = e.currentTarget.dataset.id
- let title = e.currentTarget.dataset.title
- tt.navigateTo({
- url: `/pages/classDetails/classDetails?id=${id}&title=${title}` // 指定页面的url
-
- });
- },
- onLoad:function (params) {
- const that = this;
- console.log(params.id);
- if(params.id &¶ms.type==1){//宣传页
- that.setData({
- id:params.id,
- type:params.type
- })
- that.getData()
- }else if(params.id &¶ms.type==2){//图文
- that.setData({
- id:params.id,
- type:params.type
- })
- that.getHtml(params.id,that)
- }
- },
- })
|