Files
property-manager-side/wuye-manager-uniapp/App.vue
2026-06-03 16:05:26 +08:00

160 lines
2.9 KiB
Vue

<script setup>
import { onLaunch } from '@dcloudio/uni-app'
// 应用启动时执行
onLaunch(() => {
console.log('App 启动')
// #ifdef APP-PLUS
// 只有 App 平台才获取 CID
getPushCID()
// #endif
})
// 获取 uniPush 2.0 CID
function getPushCID() {
uni.getPushClientId({
success: (res) => {
console.log('推送初始化成功')
console.log('CID =', res.cid)
// 存起来备用
uni.setStorageSync('push_cid', res.cid)
},
fail: (err) => {
console.error('获取推送 CID 失败', err)
}
})
}
</script>
<style>
/*每个页面公共css */
/* 全局清除默认样式 */
/* 通用flex布局 */
.flex {
display: flex;
}
.flex-center {
display: flex;
align-items: center;
justify-content: center;
}
.flex-between {
display: flex;
align-items: center;
justify-content: space-between;
}
.flex-around {
display: flex;
align-items: center;
justify-content: space-around;
}
.flex-col {
flex-direction: column;
}
.items-center {
align-items: center;
}
.justify-center {
justify-content: center;
}
.justify-around {
justify-content: space-around;
}
.justify-between {
justify-content: space-between;
}
.justify-evenly {
justify-content: space-evenly;
}
.flex-1 {
flex: 1;
}
.h-full {
height: 100%;
}
.w-full {
width: 100%;
}
.overflow-hidden {
overflow: hidden;
}
.overflow-auto {
overflow: auto;
}
.nodata {
color: #ccc;
text-align: center;
margin-top: 200rpx;
letter-spacing: 1rpx;
}
/* 自定义导航栏专用 */
.custom-header {
height: calc(var(--status-bar-height) + 88rpx);
padding-top: var(--status-bar-height);
}
/* 全局安全区样式 - 微信小程序完美支持 */
.safe-area-top {
padding-top: constant(safe-area-inset-top);
padding-top: env(safe-area-inset-top);
}
.safe-area-bottom {
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.page_container {
min-height: 100vh;
max-height: 100vh;
height: 100%;
background: repeating-linear-gradient(180deg, #e2f0ff, #f6faff);
overflow: hidden;
box-sizing: border-box;
padding: 0 40rpx;
/* 先写 constant() 兼容 iOS < 11.2,再写 env() */
padding-top: calc(constant(safe-area-inset-top) + 20rpx);
padding-top: calc(env(safe-area-inset-top) + 20rpx);
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.page_padding {
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
display: flex;
flex-direction: column;
width: 100%;
min-height: 100vh;
max-height: 100vh;
overflow: hidden;
box-sizing: border-box;
}
/* 单行省略 */
.ellipsis {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
/* 2行省略 */
.ellipsis-2 {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
/* 1 电表 2水表 */
</style>