App.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <script setup>
  2. import {
  3. onLaunch,
  4. onShow,
  5. onError,
  6. onHide
  7. } from '@dcloudio/uni-app';
  8. import {
  9. ShoproInit
  10. } from './sheep';
  11. import {
  12. autoSign,
  13. cancelAutoSign,
  14. resetSignStatusIfNeeded
  15. } from './sheep/hooks/useModal';
  16. onShow((options) => {
  17. autoSign()
  18. // #ifdef APP-PLUS
  19. // 获取urlSchemes参数
  20. const args = plus.runtime.arguments;
  21. if (args) {}
  22. // 获取剪贴板
  23. uni.getClipboardData({
  24. success: (res) => {},
  25. });
  26. // #endif
  27. // #ifdef MP-WEIXIN
  28. // 确认收货回调结果
  29. // console.log(options, 'options');
  30. // #endif
  31. });
  32. onHide(() => {
  33. // console.log("页面隐藏了,取消自动签到");
  34. cancelAutoSign()
  35. });
  36. onLaunch(() => {
  37. // 检查标志位是否存在
  38. const cacheCleared = uni.getStorageSync('cacheCleared');
  39. if (!cacheCleared) {
  40. // 清除缓存
  41. uni.removeStorageSync('linkId');
  42. // 设置标志位,表示缓存已清除
  43. uni.setStorageSync('cacheCleared', true);
  44. }
  45. // 隐藏原生导航栏 使用自定义底部导航
  46. uni.hideTabBar();
  47. // 加载Shopro底层依赖
  48. ShoproInit();
  49. // 每天凌晨重置签到状态
  50. resetSignStatusIfNeeded();
  51. });
  52. onError((err) => {
  53. console.log('AppOnError:', err);
  54. });
  55. </script>
  56. <style lang="scss">
  57. @import '@/sheep/scss/index.scss';
  58. </style>