Files
chazhi/src/App.vue
2026-01-18 00:48:27 +08:00

98 lines
3.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script setup lang="ts">
import { onHide, onLaunch, onShow } from '@dcloudio/uni-app'
import { navigateToInterceptor } from '@/router/interceptor'
import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'
import { useUserStore } from '@/store'
import { strToParams } from '@/utils/tools'
onLaunch((options) => {
// if (options?.path === 'bundle/order/tea-room/order-detail') {
// uni.setStorageSync('transferOrder', {
// orderId: options?.query?.orderId || '',
// shareSource: options?.query?.shareSource || ''
// })
// console.log("🚀 ~ onLaunch sync:", uni.getStorageSync('transferOrder'))
// }
// 处理直接进入页面路由的情况如h5直接输入路由、微信小程序分享后进入等
// https://github.com/unibest-tech/unibest/issues/192
if (options?.path) {
navigateToInterceptor.invoke({ url: `/${options.path}` })
}
else {
navigateToInterceptor.invoke({ url: '/' })
}
// uni.setStorageSync(LOCATION_LAT_KEY, LOCATION_DEFAULT_LAT)
// uni.setStorageSync(LOCATION_LNG_KEY, LOCATION_DEFAULT_LNG)
// uni.setStorageSync(LOCATION_CITY_KEY, LOCATION_DEFAULT_CITY)
})
onShow((options) => {
if (options?.path === 'bundle/order/tea-room/order-detail') {
uni.setStorageSync('transferOrderParams', {
orderId: options?.query?.orderId || '',
shareSource: options?.query?.shareSource || ''
})
}
// 这里是设置用户场景类型的逻辑: 0 普通扫码进入 1 电梯扫码进入 2 充电宝扫码进入
if (options?.query?.scene) {
const scene = decodeURIComponent(options.query.scene)
const params = strToParams(scene)
if (params && params?.registerSource) {
const userStore = useUserStore()
userStore.setUserRegisterSource(Number(params.registerSource))
console.log("🚀 ~ onShow registerSource =", userStore.userRegisterSource)
}
}
console.log('App Show', options)
})
onHide(() => {
console.log('App Hide')
})
</script>
<style lang="scss">
swiper,
scroll-view {
flex: 1;
height: 100%;
overflow: hidden;
}
image {
width: 100%;
height: 100%;
vertical-align: middle;
}
/* 自定义全局样式 */
.absolute-center {position: absolute !important;left: 50%;top: 50%;transform: translate(-50%, -50%);}
.line-1 {white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}
.line-2 {display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;overflow: hidden;text-overflow: ellipsis;}
/* 自定义wot-ui的tab样式 */
.tabs {
:deep() {
.wd-tabs__line {
bottom: 0 !important;
width: 60rpx !important;
height: 16rpx !important;
background-color: transparent !important;
background-image: url(#{$OSS}images/reserve_room/reserve_room_image1.png) !important;
background-size: cover !important;
}
}
}
.booking-time {
:deep() {
.wd-tabs__line--inner,
.wd-tabs__line {
background-color: #4C9F44 !important;
}
}
}
</style>