export default class Track {
  constructor() {
    const userInfo = uni.getStorageSync("userInfo");
    console.log("用户信息用于埋点", userInfo);
    // console.error(Object.prototype.toString.call(userInfo))
    this.zwlog = new ZwLog({
      _user_id: userInfo.uuid,
      _user_nick: userInfo.username,
    });
    this.timing= window.performance.timing;
    this.initLog()
  }
  initLog() {
    const that=this;
    this.zwlog.onReady(() =>{
      console.log('zwlog 加载完成后的函数')
      //sendPV，上报一个日志，它接收一个⾃定义 PV 参数 key-value 键值对（只能是这种平铺的json，不能做多层嵌套）
      that.zwlog.sendPV({
        miniAppId: "2002273960",
        t2: that.timing.loadEventEnd - that.timing.navigationStart,// '页面启动到加载完成的时间',
        t0: that.timing.responseEnd- that.timing.navigationStart, // "页面启动到页面响应完成的时间",
        log_status: "02",
      });
    });
  }
}