123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <script setup>
- import { onHide, onLaunch, onShow } from '@dcloudio/uni-app'
- import { usePageAuth } from '@/hooks/usePageAuth'
- import { useUserStore } from '@/store'
- import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'
- const mtpushModule = uni.requireNativePlugin('EL-MTPush')
- usePageAuth()
- const userStore = useUserStore()
- const isLoggedIn = computed(() => !!userStore.token)
- onLaunch(() => {
- console.log('App Launch')
- if (isLoggedIn.value) {
- userStore.getUserInfo()
- }
- if (uni.getSystemInfoSync().platform === 'ios') {
- mtpushModule.requestNotificationAuthorization((result) => {
- const status = result.status
- if (status < 2) {
- uni.showToast({
- icon: 'none',
- title: '您还没有打开通知权限',
- duration: 3000,
- })
- }
- })
- }
- // mtpushModule.setCountryCode("US");
- // mtpushModule.setTcpSSL(true)
- mtpushModule.setSiteName('Singapore')
- mtpushModule.setLoggerEnable(true)
- mtpushModule.initPushService()
- mtpushModule.addConnectEventListener((result) => {
- const connectEnable = result.connectEnable
- uni.$emit('connectStatusChange', connectEnable)
- })
- mtpushModule.addNotificationListener((result) => {
- const notificationEventType = result.notificationEventType
- const messageID = result.messageID
- const title = result.title
- const content = result.content
- const extras = result.extras
- uni.showToast({
- icon: 'none',
- title: JSON.stringify(result),
- duration: 3000,
- })
- })
- mtpushModule.addCustomMessageListener((result) => {
- const type = result.type
- const messageType = result.messageType
- const content = result.content
- uni.showToast({
- icon: 'none',
- title: JSON.stringify(result),
- duration: 3000,
- })
- })
- mtpushModule.addTagAliasListener((result) => {
- uni.showToast({
- icon: 'none',
- title: JSON.stringify(result),
- duration: 3000,
- })
- })
- if (uni.getSystemInfoSync().platform === 'ios') {
- mtpushModule.addLocalNotificationListener((result) => {
- const messageID = result.messageID
- const title = result.title
- const content = result.content
- const extras = result.extras
- uni.showToast({
- icon: 'none',
- title: JSON.stringify(result),
- duration: 3000,
- })
- })
- }
- // app更新
- })
- onShow(() => {
- console.log('App Show')
- })
- onHide(() => {
- console.log('App Hide')
- })
- </script>
- <style lang="scss">
- button::after {
- border: none;
- }
- swiper,
- scroll-view {
- flex: 1;
- height: 100%;
- overflow: hidden;
- }
- image {
- width: 100%;
- height: 100%;
- vertical-align: middle;
- }
- // ==================== 认证页面公共样式 ====================
- // 包含登录、注册、忘记密码等页面的通用样式
- // 背景图片区域样式
- .auth-bg-section {
- background-image: url('/static/login-bg.png');
- background-size: cover;
- background-position: top;
- background-repeat: no-repeat;
- min-height: 28vh; /* 占据上半部分屏幕 */
- }
- // 输入框样式 - 使用特殊化命名避免冲突
- :deep(.bandhu-auth-input-field) {
- box-sizing: border-box;
- height: 72rpx !important;
- background: #ffffff !important;
- border-radius: 8rpx !important;
- border: 2rpx solid rgba(166, 166, 166, 0.65) !important;
- padding: 0 24rpx !important;
- font-size: 28rpx !important;
- display: flex !important;
- align-items: center !important;
- &.is-disabled {
- background: #efefef !important;
- .wd-input__inner {
- color: #000000 !important;
- }
- }
- }
- // 主要按钮样式
- :deep(.bandhu-auth-primary-btn) {
- box-sizing: border-box;
- height: 88rpx !important;
- border-radius: 44rpx !important;
- font-size: 32rpx !important;
- font-weight: bold !important;
- }
- // 次要按钮样式(如获取验证码按钮)
- :deep(.bandhu-auth-secondary-btn) {
- box-sizing: border-box;
- width: 160rpx !important;
- height: 72rpx !important;
- border-radius: 12rpx !important;
- font-size: 24rpx !important;
- }
- </style>
|