/*
 * @Author: wufan
 * @Date: 2021-03-26 15:40:49
 * @LastEditors: wufan
 * @LastEditTime: 2021-03-26 16:27:52
 * @Description: 阿里云埋点
 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
 */

window.WEBTRACING = (eventKey, eventName, content) => {
    if (!window.logger) { 
      return
    }

    const { xmState } = window.ctx;
    const {storeList = []} = xmState;
    const {id:storeId, storeUserId, storeName, storeType} = storeList[0] || {};
    
    logger.push("platform", "pc");
    logger.push("event", eventKey);
    logger.push("eventName", eventName);
    logger.push("device", navigator.userAgent);
    logger.push("storeId", storeId);
    logger.push("storeName", storeName);
    logger.push("storeType", storeType);
    logger.push("storeUserId", storeUserId);
    logger.push('env', process.env.DEPLOY_ENV || 'local');  // 哪个环境的埋点
    const _content = Object.assign({}, content, {
      学院名称: storeName,
      学院类型: storeType,
      storeId,
      storeUserId,
    });


    logger.push("content", JSON.stringify(_content));
    // 记录日志
    logger.logger();
  }
