//index.js //获取应用实例 const app = getApp() Page({ data: { lastX: 0, //滑动开始x轴位置 lastY: 0, //滑动开始y轴位置 text: "没有滑动", currentGesture: 0, //标识手势 animationData: {}, loaddisplay: 'none', showCoverImg: true, headUrl: undefined, headBUrl: undefined, videoUrl: undefined, checkUrl: undefined, servicesUrl1: undefined, servicesUrl2: undefined, servicesUrl3: undefined, moonpackagesUrltl1: undefined, moonpackagesUrltr1: undefined, moonpackagesUrltr2: undefined, moonpackagesUrlbl: undefined, moonpackagesUrlbc: undefined, moonpackagesUrlbr: undefined, praise: [], navData: [{ name: "首页", //文本 current: 0, //是否是当前页,0不是 1是 style: 0, //样式 typea: "https://yuesuo.yueguanjia.com/MiniProgram/images/home.png", //不同图标 typec: "https://yuesuo.yueguanjia.com/MiniProgram/images/homec.png", fn: 'index' //对应处理函数 }, { name: "套餐", current: 0, style: 0, typea: "https://yuesuo.yueguanjia.com/MiniProgram/images/packages.png", //不同图标 typec: "https://yuesuo.yueguanjia.com/MiniProgram/images/packagesc.png", fn: 'packages' }, { name: "悦所", current: 1, style: 2, ico: '' }, { name: "活动", current: 0, style: 0, typea: "https://yuesuo.yueguanjia.com/MiniProgram/images/promotion.png", //不同图标 typec: "https://yuesuo.yueguanjia.com/MiniProgram/images/promotionc.png", fn: 'promotion' }, { name: "我的", current: 0, style: 0, typea: "https://yuesuo.yueguanjia.com/MiniProgram/images/mine.png", //不同图标 typec: "https://yuesuo.yueguanjia.com/MiniProgram/images/minec.png", fn: 'mine' }, ] }, index: function() { app.gopage("/pages/index/index"); }, promotion: function() { app.gopage("/pages/promotion/promotion"); }, yuesuo: function() { app.gopage("/pages/yuesuo/yuesuo"); }, packages: function() { app.gopage("/pages/packages/packages"); }, mine: function() { app.gopage("/pages/mine/mine"); }, onReady: function(res) { this.videoContext = wx.createVideoContext('myVideo') }, calling: function() { wx.makePhoneCall({ phoneNumber: '400-002-2699', success: function() { }, fail: function() { } }) }, finish: function() { this.setData({ loaddisplay: 'none' }) }, onLoad() { let _this = this; _this.setData({ navH: app.globalData.navHeight }) }, // onLoad: function () { // this.setData({ // loaddisplay: true // }) // var that = this // var praiselist = []; // wx.request({ // url: app.globalData.url + '/getYueSuo', // method: 'get', // success: function (res) { // for (var i = 0; i < res.data.length; i++) { // if (res.data[i].wy_type == 1) { // that.setData({ // headUrl: res.data[i].wy_url // }) // } // if (res.data[i].wy_type == 2) { // that.setData({ // videoUrl: res.data[i].wy_url // }) // } // if (res.data[i].wy_type == 3) { // that.setData({ // checkUrl: res.data[i].wy_url // }) // } // if (res.data[i].wy_type == 4) { // if (res.data[i].wy_seq ==1) { // that.setData({ // servicesUrl1: res.data[i].wy_url // }) // } // if (res.data[i].wy_seq == 2) { // that.setData({ // servicesUrl2: res.data[i].wy_url // }) // } // if (res.data[i].wy_seq == 3) { // that.setData({ // servicesUrl3: res.data[i].wy_url // }) // } // } // if (res.data[i].wy_type == 5) { // if (res.data[i].wy_position == 'tl1'){ // that.setData({ // moonpackagesUrltl1: res.data[i].wy_url // }) // } // if (res.data[i].wy_position == 'tr1') { // that.setData({ // moonpackagesUrltr1: res.data[i].wy_url // }) // } // if (res.data[i].wy_position == 'tr2') { // that.setData({ // moonpackagesUrltr2: res.data[i].wy_url // }) // } // if (res.data[i].wy_position == 'bl') { // that.setData({ // moonpackagesUrlbl: res.data[i].wy_url // }) // } // if (res.data[i].wy_position == 'bc') { // that.setData({ // moonpackagesUrlbc: res.data[i].wy_url // }) // } // if (res.data[i].wy_position == 'br') { // that.setData({ // moonpackagesUrlbr: res.data[i].wy_url // }) // } // } // if (res.data[i].wy_type == 7) { // that.setData({ // headBUrl: res.data[i].wy_url // }) // } // if (res.data[i].wy_type == 6) { // praiselist.push(res.data[i].wy_url) // } // } // that.setData({ // praise: praiselist // }) // } // }) // }, play: function() { this.setData({ showCoverImg: false }) }, playbutton: function() { this.videoContext = wx.createVideoContext('myVideo'); this.videoContext.play(); }, onShareAppMessage: function() { return { title: '悦所-您的私家月嫂服务', path: '/pages/index/index?skip=1&path=/pages/yuesuo/yuesuo' } }, handletouchmove: function(event) { var currentX = event.touches[0].pageX var currentY = event.touches[0].pageY var tx = currentX - this.data.lastX var ty = currentY - this.data.lastY var text = "" //左右方向滑动 if (Math.abs(tx) > Math.abs(ty)) {} //上下方向滑动 else { // 向上滑动 var animation = wx.createAnimation({ duration: 500, timingFunction: 'linear', }) this.animation = animation animation.opacity(0).step() this.setData({ animationData: animation.export() }) } //将当前坐标进行保存以进行下一次计算 this.data.lastX = currentX this.data.lastY = currentY }, handletouchtart: function(event) { this.data.lastX = event.touches[0].pageX this.data.lastY = event.touches[0].pageY }, //滑动结束事件 handletouchend: function(event) { this.data.currentGesture = 0; //滑动结束 var animation = wx.createAnimation({ delay: 500, duration: 500, timingFunction: 'linear', }) this.animation = animation animation.opacity(1).step() this.setData({ animationData: animation.export() }) } })