

export default defineNuxtRouteMiddleware((to, from) => {
  let url = defaultUrl.substring(0, apiUrl.length - 1);
  let specialPages = [
    '/goods/detail',//商品详情页
    '/store/goods',//店铺首页
  ];
  let statPvFlag = true;
  for (let i in specialPages) {
    if (specialPages[i].indexOf(to.path) > -1) {
      statPvFlag = false;
      break;
    }
  }

  console.log('执行中间件')
  if (!statPvFlag) {
    //不需要pv类型的统计
    updateStatCommonProperty({ pageUrl: url + to.path, referrerPageUrl: apiUrl });
  } else {
    setTimeout(() => {
      sldStatEvent({ behaviorType: 'pv', pageUrl: url + to.path, referrerPageUrl: apiUrl });
    }, 3000)
   
  }
})