/*
 * @Descripttion: zx
 * @Company: 思宏科技
 * @version: v1.0
 * @Author: zx
 * @Date: 2021-11-22 09:12:10
 * @LastEditors: zx
 * @LastEditTime: 2021-11-25 15:35:08
 */
import {
  fhGetRemoteVisitsDetail,
} from "../../../api/remote/index";
const app = getApp();
const pageOptions = {
  // 页面数据
  data: {
    isFirstOnShow: true, // 是否为首次执行onShow
    show: false,
    id:null, //房间号
    visitState:null
  },
   //远程探视详情
   async getRemoteVisitsDetail() {
    const id = app.globalData.id;
    try {
      const { results } = await fhGetRemoteVisitsDetail(
        id,
      );
      wx.$setGlobalData("patientInfo", results);
      this.setData({
        form: results,
      });
      console.log(this.data.form, "✔✔✔this.data.form");
    } catch (e) {
      console.log("debug axios", e);
    }
  },
  //出示二维码
  showCode() {
    this.setData({ show: true });
  },
  close() {
    this.setData({ show: false });
  },
  //复制文本
  copyBtn(e) {
    wx.setClipboardData({
      //准备复制的数据
      data: e.target.dataset.id,
      success(res) {
        wx.showToast({
          title: "复制成功",
        });
      },
    });
  },

  // 页面载入时
  onLoad(e) {
    this.init(e);
    this.setData({
      id:e.id
    })
    console.log(this.data.id);
    this.getRemoteVisitsDetail();
   
  },
  // 页面初始化
  init(e) {
    console.log(e,'😘😘😘😘e');
    this.setData({
      visitState:e.visitState
    })
  },
  // 页面准备好时
  onReady() {},
  // 页面显示时
  onShow() {
    const { isFirstOnShow } = this.data;

    if (isFirstOnShow) {
      // 首次执行时
      this.setData({
        isFirstOnShow: false,
        
      });
      return;
    }
  },
  // 页面隐藏时
  onHide() {},
  // 页面卸载时
  onUnload() {},
  // 下拉页面时
  onPullDownRefresh() {},
  // 到达页面底部时
  onReachBottom() {},
  // 页面滚动时
  onPageScroll() {},
  // 分享时，注：onShareAppMessage不能为async异步函数，会导致不能及时取得返回值，使得分享设置无效
  onShareAppMessage() {
    /* const title = ''
    const path = ''
    const imageUrl = ``

    return {
      title,
      path,
      imageUrl,
    } */
  },
};

Page(pageOptions);
