- 旅游卡页面(qrcode/index): 卡面背景图、持卡人信息直接显示、 头像点击查看大图、绑定入口、入园码二维码、卡号复制按钮 - App.vue: getSystemInfoSync → getDeviceInfo, try/catch兜底 - uni-app 升级到 3.0.0-alpha-5010320260611001 (5.13) - Sass: @import → @use 迁移(main.scss, _mixins.scss, _utilities.scss) - pnpm-workspace.yaml 配置更新 Co-Authored-By: Claude <noreply@anthropic.com>
44 lines
1.1 KiB
Vue
44 lines
1.1 KiB
Vue
<script setup lang="ts">
|
|
import { onLaunch } from '@dcloudio/uni-app'
|
|
import { useUserStore } from './store/user'
|
|
|
|
onLaunch(() => {
|
|
// #ifdef MP-WEIXIN
|
|
// 仅真机检查隐私协议,模拟器中跳过(getPrivacySetting 在模拟器会触发框架级 timeout)
|
|
try {
|
|
const deviceInfo = wx.getDeviceInfo()
|
|
if (deviceInfo.platform !== 'devtools' && typeof wx.getPrivacySetting === 'function') {
|
|
wx.getPrivacySetting({
|
|
success: (res: any) => {
|
|
if (res.needAuthorization) {
|
|
uni.setStorageSync('needPrivacy', true)
|
|
} else {
|
|
uni.removeStorageSync('needPrivacy')
|
|
}
|
|
},
|
|
fail: () => {},
|
|
})
|
|
}
|
|
} catch (_e) {
|
|
// wx.getDeviceInfo 或 wx.getPrivacySetting 不支持时静默跳过
|
|
}
|
|
// #endif
|
|
|
|
const userStore = useUserStore()
|
|
// 如果有 token,尝试获取用户信息
|
|
if (userStore.isLogin) {
|
|
userStore.fetchUserInfo().catch(() => {
|
|
// 获取用户信息失败不影响使用
|
|
})
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
@use './styles/main.scss' as *;
|
|
|
|
page {
|
|
min-height: 100vh;
|
|
}
|
|
</style>
|