diff --git a/config/config.js b/config/config.js index 0ec8864..81d718a 100755 --- a/config/config.js +++ b/config/config.js @@ -293,7 +293,11 @@ var config = { /** * 用户更新scene */ - updateScene:"/user/updateScene" + updateScene:"/user/updateScene", + /** + * 富文本详情 + */ + printHtmlById:"/wxCampaign/printHtmlById" }, weapp: { AppId: weappId diff --git a/pages/freeBannerDetail/index.js b/pages/freeBannerDetail/index.js index 4918821..ae1d1f7 100644 --- a/pages/freeBannerDetail/index.js +++ b/pages/freeBannerDetail/index.js @@ -1,6 +1,7 @@ -// pages/freeBannerDetail/index.js let app = getApp(); +var WxParse = require('../../wxParse/wxParse.js'); const config = require("../../config/config"); +const Http = require("../../utils/HttpBasics"); Page({ /** @@ -17,14 +18,59 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - console.log(config.url) - this.setData({ + const that = this; + that.setData({ url: config.url, id:options.id, token: app.globalData.token }) + + /*** WxParse.wxParse(bindName , type, data, target,imagePadding) + * 1.bindName绑定的数据名(必填) + * 2.type可以为html或者md(必填) + * 3.data为传入的具体数据(必填) + * 4.target为Page对象,一般为this(必填) + * 5.imagePadding为当图片自适应是左右的单一padding(默认为0,可选)*/ + // that.getWord(options.id) + + wx.request({ + url: 'https://ciformall.youlane.cn/C/api' + config.api.printHtmlById, + data: { + token: app.globalData.token, + id: options.id, + date: new Date() + }, + header: { + 'content-type': 'application/html' + }, + success: function (res) { + var temp = WxParse.wxParse('article', 'html',res.data, that, 5); + } + }) }, + /** + * 获得宣传页富文本详情 + */ + getWord(id){ + let that = this; + wx.request({ + url: 'https://ciformall.youlane.cn/C/api'+config.api.printHtmlById, + data: { + token: app.globalData.token, + id: id, + date: new Date() + }, + header: { + 'content-type': 'application/html' + }, + success:function(res){ + that.setData({ + wordHtml:res.data + }) + } + }) + }, /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/freeBannerDetail/index.wxml b/pages/freeBannerDetail/index.wxml index 5e873bb..fa77f36 100644 --- a/pages/freeBannerDetail/index.wxml +++ b/pages/freeBannerDetail/index.wxml @@ -1 +1,6 @@ - + + + + +