123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- 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({
- // 更新属性和数据的方法与更新页面数据的方法类似
- });
- }
- }
- });
|