2024-09-02 07:40:26 +08:00
|
|
|
<script setup lang="js">
|
|
|
|
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
|
|
|
|
import { notificationService } from './service/notificationService'
|
|
|
|
|
|
|
|
// 在应用启动时注册轮询服务
|
|
|
|
onLaunch(() => {
|
2024-09-05 14:05:15 +08:00
|
|
|
console.log('应用正在运行...')
|
|
|
|
notificationService.startPollingUnreadMessages()
|
|
|
|
// 加载底部商城依赖
|
|
|
|
ShoproInit()
|
2024-09-02 07:40:26 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
// 当应用进入前台时继续轮询服务
|
|
|
|
onShow(() => {
|
2024-09-05 14:05:15 +08:00
|
|
|
console.log('应用显示出来了...')
|
|
|
|
notificationService.startPollingUnreadMessages()
|
|
|
|
|
|
|
|
// 下面是商城模块的初始化方法
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
// 获取urlSchemes参数
|
|
|
|
const args = plus.runtime.arguments
|
|
|
|
if (args) {
|
|
|
|
}
|
|
|
|
|
|
|
|
// 获取剪贴板
|
|
|
|
uni.getClipboardData({
|
|
|
|
success: (res) => {},
|
|
|
|
})
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
// 确认收货回调结果
|
|
|
|
console.log(options, 'options')
|
|
|
|
// #endif
|
2024-09-02 07:40:26 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
// 当应用进入后台时停止轮询服务
|
|
|
|
onHide(() => {
|
2024-09-05 14:05:15 +08:00
|
|
|
console.log('App Hide')
|
|
|
|
notificationService.stopPollingUnreadMessages()
|
2024-09-02 07:40:26 +08:00
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
2024-09-05 14:05:15 +08:00
|
|
|
@import '@/style/index.scss';
|
|
|
|
|
2024-09-02 07:40:26 +08:00
|
|
|
button::after {
|
|
|
|
border: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
swiper,
|
|
|
|
scroll-view {
|
|
|
|
flex: 1;
|
|
|
|
height: 100%;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
image {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
vertical-align: middle;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 单行省略,优先使用 unocss: text-ellipsis
|
|
|
|
.ellipsis {
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 两行省略
|
|
|
|
.ellipsis-2 {
|
|
|
|
display: -webkit-box;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
-webkit-line-clamp: 2;
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 三行省略
|
|
|
|
.ellipsis-3 {
|
|
|
|
display: -webkit-box;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
-webkit-line-clamp: 3;
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
}
|
|
|
|
</style>
|