|
- const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
- let config = require("../../config/config.js");
- let app = getApp();
- const Http = require("../../utils/HttpBasics");
- const util = require("../../utils/util");
- const imgurl = require("../../utils/imgurl");
- Page({
- data: {
- mouldType: 0,
- mouldConfig: {},
- navigationBarHeight,
- data: {
- bgColor: "#fff"
- },
- wmhome: imgurl.wmhome.url,
- couponId: null,
- orderId: "",
- day: "",
- hour: "",
- minute: "",
- nodes: '',
- id: '',
- goHomeUrl: "",
- winHeight: "100%"
- },
- onLoad(options) {
- this.setData({
- mouldType: app.globalData.mouldType,
- mouldConfig: app.globalData.mouldConfig,
- goHomeUrl: app.globalData.goHomeUrl,
- })
- console.log(options)
- if (options && options.id) {
- this.setData({
- id: options.id
- })
- this.topicShow(options.id)
- }
- },
- goback: function () {
- let this_ = this
- wx.switchTab({
- url: this_.data.goHomeUrl,
- })
- },
- topicShow(id) {
- let that = this;
- Http.get({
- url: config.api.topicFindById,
- data: {
- id: id
- }
- }).then(res => {
- console.log(res)
- if (res && res.data) {
- that.setData({
- data: res.data
- });
- /**
- * 获取屏幕的高度
- *
- */
- let query = wx.createSelectorQuery();
- query.select('.coupons').boundingClientRect();
- query.selectViewport().scrollOffset();
- query.exec((res) => {
- let listHeight = res[0].height; // 获取list高度
- let windowHeight = wx.getSystemInfoSync().windowHeight;
- if (windowHeight >= listHeight) {
- that.setData({
- winHeight: '100%'
- })
- }
- })
- }
- }).catch(err => {
- wx.showToast({
- title: err.errMsg,
- icon: 'none',
- duration: 2000,
- mask: false
- });
- })
- },
- gotoDetail: function (e) {
- if (e.currentTarget.dataset.type == 9) {
- console.log("平团")
- wx.navigateTo({
- url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${e.currentTarget.dataset.couponchannelid}`,
- })
- } else {
- console.log("优惠卷")
- wx.navigateTo({
- url: `/pages/coupon/detail/index?couponChannelId=${e.currentTarget.dataset.couponchannelid}&couponId=${e.currentTarget.dataset.couponid}`,
- })
- }
- },
- onShareAppMessage: function (options) {
- var that = this;
- var shareObj = {
- title: "专题活动",
- path: `/pages/main/index?id=${that.data.id}&type=td`,
- success: function (res) {
- if (res.errMsg == 'shareAppMessage:ok') { }
- },
- fail: function (error) {
- if (res.errMsg == 'shareAppMessage:fail cancel') { } else if (res.errMsg == 'shareAppMessage:fail') { }
- }
- };
- console.log(shareObj)
- // 返回shareObj
- return shareObj;
- }
-
- });
|