diff --git a/pages/buyer/index.js b/pages/buyer/index.js index 6608e8a..ca2c941 100644 --- a/pages/buyer/index.js +++ b/pages/buyer/index.js @@ -1211,6 +1211,19 @@ Page({ // 预览图片 previewImage(e) { + // 登录验证 + const userInfo = wx.getStorageSync('userInfo') || null + const userId = wx.getStorageSync('userId') || null + if (!userInfo || !userId) { + // 未登录,显示授权登录弹窗 + this.setData({ + showAuthModal: true, + pendingUserType: 'buyer' + }) + return + } + + // 已登录,执行图片预览 const { urls, index } = e.currentTarget.dataset this.setData({ showImagePreview: true, @@ -1221,6 +1234,19 @@ Page({ // 预览图片 previewImage(e) { + // 登录验证 + const userInfo = wx.getStorageSync('userInfo') || null + const userId = wx.getStorageSync('userId') || null + if (!userInfo || !userId) { + // 未登录,显示授权登录弹窗 + this.setData({ + showAuthModal: true, + pendingUserType: 'buyer' + }) + return + } + + // 已登录,执行图片预览 const { urls, index } = e.currentTarget.dataset this.setData({ showImagePreview: true,