|
- const navigationBarHeight = (getApp().statusBarHeight + 50) + '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,
- navigationBarHeight,
- data: {
- bgColor:"#fff"
- },
- wmhome: imgurl.wmhome.url,
- couponId: null,
- orderId: "",
- day: "",
- hour: "",
- minute: "",
- nodes: '',
- id:'',
- },
- onLoad(options){
- this.setData({
- mouldType: app.globalData.mouldType
- })
- console.log(options)
- if(options&&options.id){
- this.setData({
- id:options.id
- })
- this.topicShow(options.id)
- }
- },
- goback: function () {
- tt.reLaunch({
- url: '/index/index',
- })
- },
- 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 = tt.createSelectorQuery();
- query.select('.coupons').boundingClientRect();
- query.selectViewport().scrollOffset();
- query.exec((res) => {
- let listHeight = res[0].height; // 获取list高度
- let windowHeight = tt.getSystemInfoSync().windowHeight;
- if (windowHeight >= listHeight){
- that.setData({
- winHeight:'100%'
- })
- }
- })
- }
- }).catch(err => {
- tt.showToast({
- title: err.errMsg,
- icon: 'none',
- duration: 2000,
- mask: false
- });
- })
- },
- gotoDetail:function(e){
- if (e.currentTarget.dataset.type == 9){
- console.log("平团")
- tt.navigateTo({
- url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${e.currentTarget.dataset.couponchannelid}`,
- })
- }else{
- console.log("优惠卷")
- tt.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;
- }
-
- });
|