<script setup lang='ts'>
import { mpUpdate, setCompanyId, setReferrerUserId, setRegisterStoreId } from '@/utils';

onLaunch((options) => {
  console.log('App Launch options ', options);
  // setRegisterStoreId('1144085996641443841');
  if(options?.query) {

    //保存登录邀请员工id
    if(options.query.referrerUserId) {
      setReferrerUserId(options.query.referrerUserId);
    }

    //保存注册门店id
    if(options.query.companyId) {
      setCompanyId(options.query.companyId);
    }

    //保存注册门店id
    if(options.query.storeId) {
      setRegisterStoreId(options.query.storeId);
    }

    if(options?.query.scene) {
      //保存注册门店id
      const params = decodeURIComponent(options?.query.scene);
      if(params.split('=')[0] === 'storeId') {
        setRegisterStoreId(params.split('=')[1]);
      }
    }
  }

  // #ifdef MP
  mpUpdate();
  // #endif
});
onShow(() => {
  console.log('App Show');
});
onHide(() => {
  console.log('App Hide');
});

// globalData : {
//   test: '';
// }
</script>

<style lang='scss'>
/* 每个页面公共css */
@import 'uview-plus/index.scss';
@import '@/static/styles/common.scss';
</style>
