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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<script setup lang="uts">
    import { developmentLoginBypassEnabled } from './config/api.uts'
    import { initializeDevelopmentApiBaseUrl } from './config/development-server.uts'
    import { loginWithDevelopmentSession } from './services/auth.uts'
 
    // #ifdef APP-ANDROID || APP-HARMONY
    let firstBackTime = 0
    // #endif
 
    onLaunch(() => {
        console.log('App Launch')
        // 先把服务端地址解析好:开发环境探测本机局域网 IP,换网后不必改代码重新编译。
        initializeDevelopmentApiBaseUrl()
        if (developmentLoginBypassEnabled) {
            loginWithDevelopmentSession(() => {}, (error) => {
                console.warn('Development session initialization failed: ' + error.code)
            })
        }
    })
 
    onAppShow(() => {
        console.log('App Show')
    })
 
    onAppHide(() => {
        console.log('App Hide')
    })
 
    // #ifdef APP-ANDROID || APP-HARMONY
    onLastPageBackPress(() => {
        console.log('App LastPageBackPress')
        if (firstBackTime == 0) {
            uni.showToast({
                title: '再按一次退出应用',
                position: 'bottom',
            })
            firstBackTime = Date.now()
            setTimeout(() => {
                firstBackTime = 0
            }, 2000)
        } else if (Date.now() - firstBackTime < 2000) {
            firstBackTime = Date.now()
            uni.exit()
        }
    })
 
    onExit(() => {
        console.log('App Exit')
    })
    // #endif
</script>
 
<style>
    page {
        background-color: #F6F7FB;
        color: #1E293B;
        font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    }
 
    /* 每个页面公共布局 */
    .uni-row {
        flex-direction: row;
    }
 
    .uni-column {
        flex-direction: column;
    }
 
    /* 全局统一人才端自定义导航左上返回箭头,位置按登录页原型 */
    .nav-row .back-button,
    .nav-row .back {
        display: flex !important;
        width: 80rpx !important;
        height: 80rpx !important;
        margin-left: 0 !important;
        position: relative !important;
        left: auto !important;
        top: auto !important;
        border-radius: 10rpx !important;
        background-color: transparent !important;
        box-shadow: none !important;
        justify-content: center !important;
        align-items: center !important;
    }
 
    .custom-nav .nav-row,
    .page-header .nav-row {
        padding-left: 18rpx !important;
    }
 
    .nav-row .back-button image,
    .nav-row .back image {
        width: 44rpx !important;
        height: 44rpx !important;
    }
 
    .custom-nav.is-solid .back-button {
        background-color: transparent !important;
    }
 
    .nav-row .back-button-active {
        opacity: .55;
    }
</style>