Commit 16c9d521 by 李伟康

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

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