吉安感知网项目-前端
shuishen
2026-02-03 89380e6260a75d1d3b94de687ebcc2f50d50659d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<script setup>
import { onHide, onLaunch, onShow } from "@dcloudio/uni-app";
import { useAppStore, useUserStore, useLocationStore } from "@/store";
import { useGlobalWS } from "@/hooks/useGlobalWS.js";
 
const appStore = useAppStore();
const userStore = useUserStore();
const locationStore = useLocationStore();
 
useGlobalWS();
 
onShow(async () => {
  console.log("App Show");
  // 应用从后台返回前台时,重新初始化位置服务
  if (userStore.userInfo && locationStore) {
    try {
      await locationStore.initLocationService();
    } catch (error) {
      console.error('重新初始化位置服务失败:', error);
    }
  }
});
 
onHide(() => {
  console.log("App Hide");
  // 应用进入后台时,停止位置监听以节省资源
  if (locationStore) {
    locationStore.stopLocationWatch();
  }
});
 
onLaunch(() => {
  // 初始化系统信息
  appStore.initSystemInfo();
  if (!userStore.userInfo) {
    //不存在则跳转至登录页
    uni.reLaunch({
      url: "/pages/login/index",
    });
  }
});
</script>
 
<style lang="scss">
/* 每个页面公共css */
@import "uview-plus/index.scss";
@import "@/static/styles/common.scss";
 
.TUICallKit-mobile {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
}
 
page {
  background-image: url("https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_app_assets/images/user/bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  // min-height: 10vh;
}
 
.uni-tabbar-border {
  background-color: #f6f6f6 !important;
}
 
.uni-page-head__title {
  font-family: Source Han Sans CN, Source Han Sans CN !important;
  font-weight: 400 !important;
  font-size: 17px !important;
  color: #222324 !important;
}
 
.uni-page-head {
  background: transparent !important;
}
</style>