var app=getApp() Component({ properties: { propName: { // 属性名 type: String, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型) value: 'val', // 属性初始值(必填) observer: function (newVal, oldVal) { // 属性被改变时执行的函数(可选) } } }, data: { isModalShow: false, firstAnimation: '', secondAnimation: '', thridAnimation: '' }, // 私有数据,可用于模版渲染 openModal(e) { const animation = swan.createAnimation() animation.translateY(-500).step(); this.setData({ isModalShow: true } , () => { //如果有参数的话,就不显示hotline组件的第一个弹框,直接显示第二个 console.log(e) if (e) { console.log(1) this.setData({ secondAnimation: animation.export() }) } else { console.log(2) this.setData({ firstAnimation: animation.export() }) } } ) swan.hideTabBar(); }, closeModal(e) { const animation = swan.createAnimation().translateY(0).step(); const animationClose = animation.export() this.setData({ firstAnimation: animationClose, secondAnimation: animationClose, thridAnimation: animationClose }) setTimeout(() => { this.setData({ isModalShow: false }) swan.showTabBar(); }, 400) }, showAni(e) { const animation = swan.createAnimation() //显示时的动画和消失的动画 const animationClose = animation.translateY(0).step().export(); const animationOpen = animation.translateY(-500).step().export(); this.setData({ firstAnimation: animationClose, secondAnimation: animationOpen }) }, makePhoneCall() { swan.makePhoneCall({ // 需要拨打的电话号码 phoneNumber: '4008819211', // 接口调用结束的回调函数(调用成功、失败都会执行) complete: res => { this.closeModal() } }); }, addPhone() { this.closeModal() setTimeout(() => { swan.addPhoneContact({ firstName: '我的社保', mobilePhoneNumber: '4008819211', }); }, 400) }, // goKefu(e){ // swan.navigateTo({ // url: '../../../public/pages/html/html?host=https://www.sobot.com/chat/h5/index.html&sysNum=a73ea222d7284f7c8801e60e6054e985&partnerId=2180427&tel='+ app.globalData.userInfo.phone+'&uname='+ app.globalData.userInfo.phone+'&remark=BDXCX_SHEBAO&titleFlag=3&powered=false&telShowFlag=true&telFlag=true' // }) // }, // 生命周期函数,可以为函数,或一个在methods段中定义的方法名 attached: function () { }, detached: function () { }, methods: { onTap: function () { this.setData({ // 更新属性和数据的方法与更新页面数据的方法类似 }); } } });