Files
x-forend/src/App.vue
T
2025-01-13 08:21:31 +08:00

138 lines
2.3 KiB
Vue

<script setup lang="ts">
import { onLaunch, onHide } from '@dcloudio/uni-app'
import { useUserStore } from './store'
import { checkWithRedirectLogin, loginRoute } from './interceptors/route'
onLaunch((options) => {
if (checkWithRedirectLogin(options.path)) {
uni.reLaunch({
url: loginRoute,
// query: {
// redirect: options.path,
// },
})
} else {
if (userStore.isLogged) {
userStore.loadUserInfo()
}
}
})
onPageNotFound(() => {
console.log(1)
uni.reLaunch({
url: '/',
})
})
onHide(() => {
console.log('App Hide')
})
const userStore = useUserStore()
</script>
<style lang="scss">
/* 覆盖 uniapp 自带rpx效果 */
html {
font-family: 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 16px !important;
}
/* stylelint-disable-next-line selector-type-no-unknown */
#app {
max-width: 600px; /* apply-without-convert */
margin: 0 auto;
box-shadow: inherit;
}
/* stylelint-disable selector-type-no-unknown */
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;
}
image {
display: block;
}
view {
box-sizing: border-box;
}
uni-modal {
.uni-modal {
@apply max-w-345 rounded-16;
}
.uni-modal__hd {
@apply p-0;
}
.uni-modal__title {
@apply p-15 text-left text-16 font-600;
}
.uni-modal__bd {
@apply px-15 pt-0 text-left text-14 font-medium text-#666;
}
.uni-modal__btn {
@apply px-15 py-6 flex-none rounded-full shadow-none text-14;
&::after {
content: none;
}
&.uni-modal__btn_primary {
@apply ml-8 bg-gray-200 !text-black;
}
}
.uni-modal__ft {
@apply justify-end px-15 pb-10 leading-normal;
&::after {
content: none;
}
}
}
::-webkit-scrollbar {
display: none;
}
</style>