|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- let config = require("../../config/config.js");
- const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
- 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: {},
- couponId: null,
- orderId: "",
- day: "",
- hour: "",
- wmhome: imgurl.wmhome.url,
- minute: "",
- nodes: '',
- goHomeUrl: "",
- },
- onLoad(options) {
-
- if (app.globalData.token) {
- this.setData({
- mouldType: app.globalData.mouldType,
- mouldConfig: app.globalData.mouldConfig,
- goHomeUrl: app.globalData.goHomeUrl,
- })
- let that = this;
- if (options.id) {
- Http.get({
- url: config.api.bannerDetail,
- data: {
- id: options.id
- }
- }).then(res => {
- if (res.data.type == 2) {
- that.setData({
- nodes: res.data.html
- })
- }
- that.setData({
- data: res.data
- });
- }).catch(err => {
- wx.showToast({
- title: err.errMsg,
- icon: 'none',
- duration: 2000,
- mask: false
- });
- })
- }
- }else{
- app.tokenCallback = token =>{
- this.setData({
- mouldType: app.globalData.mouldType,
- mouldConfig: app.globalData.mouldConfig,
- goHomeUrl: app.globalData.goHomeUrl,
- })
- let that = this;
- if (options.id) {
- Http.get({
- url: config.api.bannerDetail,
- data: {
- id: options.id
- }
- }).then(res => {
- if (res.data.type == 2) {
- that.setData({
- nodes: res.data.html
- })
- }
- that.setData({
- data: res.data
- });
- }).catch(err => {
- wx.showToast({
- title: err.errMsg,
- icon: 'none',
- duration: 2000,
- mask: false
- });
- })
- }
- }
- }
-
- },
- goback: function () {
- let this_=this
- wx.switchTab({
- url: this_.data.goHomeUrl,
- })
- },
- onShareAppMessage: function (options) {
- var that = this;
- console.log(`/pages/bannerdetail/index?id=${that.data.data.id}`)
- var shareObj = {
- title: that.data.title,
- path: `/pages/bannerdetail/index?id=${that.data.data.id}`,
- 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)
-
- return shareObj;
- },
- });
|