import common from '../../utils/util'; import main from '../../utils/main'; var app = getApp(); var backgroundAudioManager; Page({ data: { PanelShow: 0, IsShowPay:false, IsShowBtn:false, IsShowMore:false, IsPlay:false, ImagePath: app.globalData.uploadImageUrl, }, onLoad: function (options) { var that = this; backgroundAudioManager = wx.getBackgroundAudioManager(); wx.getSetting({ success(res) { if (res.authSetting['scope.userInfo'] || app.globalData.userInfo.IsShow == 0) { that.setData({ Containnerheight: main.getWindowHeight(), }); that.init(options.index); } else { wx.navigateTo({ url: '../index/accredit', }); } } }); }, init: function (index) { var that = this; if (!index) index=0; main.getData("GetMiaoguoNewUserImageList", function (data) { that.setData({ List: data[index].Images, PageIndex:index, }); wx.setNavigationBarTitle({ title: data[index].Name }); wx.setNavigationBarColor({ frontColor: "#000000", backgroundColor: data[index].BarColor, backgroundColorTop: data[index].BarColor, }); if (app.globalData.IsIPhoneX) { that.setData({ IsIPad: "_IPhoneX", }); } }); }, goto: function (e) { var url = e.currentTarget.dataset.url; wx.navigateTo({ url: url, }); }, showMore:function(){ this.setData({ IsShowMore:true, }) }, scroll:function(e){ var that=this; if (that.data.PanelShow==0 && that.data.PageIndex==0){ var query = wx.createSelectorQuery().in(that) query.select('#Image4').boundingClientRect(function(res){ console.log(res.top); if (res && res.top && res.top<0 && !that.data.IsShowBtn){ that.setData({ IsShowBtn:true, }); } else if (res && res.top && res.top>0 && that.data.IsShowBtn){ that.setData({ IsShowBtn:false, }); } }).exec(); } }, showPay:function(){ var that = this; main.getData("GetClassList?Flag=0", function (data) { if (data && data.length>0) { that.setData({ IsShowPay:true, StartDate: common.formatDateCHS(data[0].StartDate), }) } }); }, hidePay:function(){ this.setData({ IsShowPay:false, }); }, payMoney: function () { var that = this; var money = 1; var detail = {}; detail.UserID = app.globalData.userInfo.UserID; detail.Introducer = app.globalData.userInfo.Introducer; detail.PayType=9; detail = JSON.stringify(detail); //console.log(detail); //console.log(money); var remark = null; main.payMoney(9, remark, money, detail, function () { that.setData({ PanelShow:1, }); wx.setNavigationBarColor({ frontColor: "#000000", backgroundColorTop: "#ffffff", backgroundColor: "#ffffff", }); }); }, copyManager: function () { wx.setClipboardData({ data: "秒过学习法", success(res) { wx.showModal({ title: '已复制', showCancel: false, content: "请在微信添加公众号中长按粘贴。", confirmText: "知道了", }); } }); }, gotoIndex: function () { wx.reLaunch({ url: '../index/index', }) }, play:function(){ var that=this; var isPlay=!that.data.IsPlay; if (isPlay){ that.data.List[11].Image="bm_sy_12b"; backgroundAudioManager.title = "暖暖爸致辞"; backgroundAudioManager.src = app.globalData.uploadImageUrl+"web/_lesson/nuannuanbazhici.m4a"; } else{ that.data.List[11].Image="bm_sy_12a"; backgroundAudioManager.pause(); } that.setData({ List:that.data.List, IsPlay:isPlay, }); }, onShareAppMessage: function () { return { title: app.globalData.ShareTitle, path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID, imageUrl: app.globalData.ShareImage, } }, })