Commit 16c9d521 by 李伟康

fix(home): 修复用户信息获取逻辑避免空对象访问

- 注释掉不必要的 userInfo 初始化赋值
- 移除未使用的 userInfo 数据绑定
- 修复 sceneType 计算属性中的空指针访问风险
- 为 checkStudyCenterPermission 方法添加安全的 userInfo 获取
- 在 dailyNewspaper 页面中初始化 reportStatus 状态
1 parent bcf36208
......@@ -360,7 +360,7 @@ export default {
footerBox: true,
showHome: true,
pointComponentName: 'Point',
userInfo: {},
// userInfo: {},
tabIndex: 0,
showBeisen: false,
tipsObject: {},
......@@ -403,8 +403,8 @@ export default {
uni.$logger.local.info('接收到学习弹窗事件', obj)
this.showExamPopup = true
})
const userInfo = uni.$storage.get('userInfo') || {}
this.userInfo = userInfo
// const userInfo = uni.$storage.get('userInfo') || {}
// this.userInfo = userInfo
FileUploadManager.init({
webviewRef: this.$refs.uploaderWebview,
vueContext: this
......@@ -440,8 +440,8 @@ export default {
return tabs ? tabs[this.tabIndex].name : ''
},
sceneType () {
const { sceneType } = uni.$storage.get('userInfo')
return sceneType
const userInfo = uni.$storage.get('userInfo')
return userInfo && userInfo.sceneType || ''
},
activityWindowPopStatus () {
return this.$store.getters.activityWindowPopStatus
......@@ -571,7 +571,7 @@ export default {
// 检查学习中心权限
async checkStudyCenterPermission () {
try {
const userInfo = uni.$storage.get('userInfo')
const userInfo = uni.$storage.get('userInfo') || {}
// 如果是渠道类型为9,没有权限
if (userInfo?.subLoginUser?.channelType == 9) {
......
......@@ -325,6 +325,7 @@ export default {
this.$refs.notice.open()
},
async getReportDetail() {
this.reportStatus = ''
uni.showLoading({ title: '加载中...', mask: true })
try {
const { uuid, shopMerchantId } = this.userInfo,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!