contact.js 1.81 KB
import {
  getBindtapData
} from '../../utils/util';

let app = getApp();
Page({
  data: {
    authorizeVisible: false,
    contactInfo: {},
    // qrcodeUrl:"https://kd.cdn.xyiyang.com/weapp/zhiliang-light/qrcode/qrcode-focus.png",
    qrcodeUrlPublic: "https://kdcdn.oss-cn-shenzhen.aliyuncs.com/weapp/zhiliang-light/qrcode/qrcode-public.png",
    qrcodeUrlContact: "https://kdcdn.oss-cn-shenzhen.aliyuncs.com/weapp/zhiliang-light/qrcode/qrcode-contact.png",
  },
  onShareAppMessage() {},
  showAuth() {
    this.setData({
      authorizeVisible: true
    })
  },
  onLoad(options) {
    this.initData();
  },
  initData() {
    this.queryContact();
  },
  // 去联系我们表单页面
  onContactUserTableHandler() {
    app.router.push({
      path: "contactTable"
    })
  },
  // 打电话
  onMakePhoneCallHandler(evt) {
    let phoneNumber = getBindtapData(evt);
    wx.makePhoneCall({
      phoneNumber: phoneNumber
    })
  },

  /**
   * 图片查看
   */
  onPreviewImageHandler(evt) {
    let current = getBindtapData(evt);
    // let current = this.data.qrcodeUrl;
    let urls = [current];
    wx.previewImage({
      current: current,
      urls: urls
    })
  },

  // 联系我们
  queryContact() {
    return new Promise((resolve, reject) => {
      app.post({
        url: app.api.contact,
        sid: false
      }).then((result) => {
        this.setData({
          contactInfo: result
        })
        console.log("result:", result);
      })
      resolve();
    });
  },

  // 隐藏蒙层
  hideMask() {
    this.setData({
      authorizeVisible: false,
    })
  },
  // 子组件事件
  evtcomp(evt) {
    let {
      name,
      data
    } = evt.detail;
    switch (name) {

      // 隐藏弹窗
      case "_evt_hide_mask":
        this.hideMask();
        break;

      default:
        break;
    }
  },
})