一键拨号,定位,长按二维码图片

var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    info: {
      mobile: '',
      telphone: '',
      address: '',
      latitude: "",
      longitude: "",

    },
    imgalist: ['https://www.njnrkj.com/MEIRONG/image/contact/code.jpg', 'https://www.njnrkj.com/MEIRONG/image/contact/code.jpg'],  
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  //  this.loadInfo();
    
    var that = this
    var scene_img = 'https://www.njnrkj.com/MEIRONG/image/contact/code.jpg' //这里添加图片的地址  
    that.setData({
      scene: scene_img
    })
  },
  previewImage: function (e) {
    wx.previewImage({
      current: this.data.imgalist, // 当前显示图片的http链接     
      urls: this.data.imgalist // 需要预览的图片http链接列表     
    })
    wx.getImageInfo({// 获取图片信息(此处可不要)  
      src: 'https://www.njnrkj.com/MEIRONG/image/contact/code.jpg',
      success: function (res) {
        console.log(res.width)
        console.log(res.height)
      }
    })
  },
  clickMobile: function () {
    wx.makePhoneCall({
      phoneNumber: this.data.info.telphone
    })
  },

  clickTelephone: function () {
    wx.makePhoneCall({
      phoneNumber: this.data.info.mobile
    })
  },

  loadInfo: function () {
    var that = this;
    var cacheInfo = wx.getStorageSync('info');
    if (cacheInfo) {
      that.setData({
        info: cacheInfo
      });
      return;
    }
    wx.request({
      url: 'https://www.njnrkj.com/app/public/index.php/index/contact/MrContact',
      dataType: 'json',
      success: function (res) {
        // console.log('res=' + res);
        if (res.statusCode == 200 && res.data.error != "error") {
          that.setData({
            info: res.data.info
          });
          wx.setStorage({
            key: 'info',
            data: res.data.info
          });
        } else {
          wx.showToast({
            icon: 'none',
            title: '没有访问权限或访问出错',
          });
        }
      },
      fail: function (err) {
        wx.showToast({
          icon: 'none',
          title: '访问出错',
        });
      }
    })
  },
  /**
   * 地址点击事件
   */
  clickAddress: function (e) {
    console.log('click address.....');
    wx.openLocation({
      latitude: 32.0902400000 || 0,
      longitude: 118.7813700000 || 0,
      name: this.data.info.storeName || '',
      address: this.data.info.address || ''
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.loadInfo();
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    wx.removeStorage({
      key: 'info',
      success: function (res) { },
    });
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    wx.removeStorageSync('info');
    this.loadInfo();
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})

<view class="container">

<view class="qrcode2"></view>
   

  <image class="codepic" bindtap='previewImage' src ='{{scene}}'></image> 
 
  <view class="input-compont">
    <view class="address-input">
      <view>
        <text class='mobile'>手机:{{info.telphone}} </text>
        <image bindtap='clickMobile' mode='widthFix' class='img1' src='https://www.njnrkj.com/MEIRONG//image/contact/mobile.png' />
      </view>
    </view>

    <view class="address-input">
      <view>
        <text>美丽热线:{{info.mobile}} </text>
        <image bindtap='clickTelephone' mode='widthFix' class='img2' src='https://www.njnrkj.com/MEIRONG//image/contact/call.png' />
      </view>
    </view>

    <view class="address-input last-input">
      <view>
        <view class='address_top'>
          <text>门店地址:{{info.address}}</text>
          <image catchtap='clickAddress' mode='widthFix' class='img3' src='https://www.njnrkj.com/MEIRONG//image/contact/direction.png' />
        </view>
      </view>
    </view>
  </view>
</view>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值