diff --git a/pages/seller/index.js b/pages/seller/index.js index 579dae6..f4ed25e 100644 --- a/pages/seller/index.js +++ b/pages/seller/index.js @@ -1211,10 +1211,12 @@ Page({ wx.switchTab({ url: '/pages/buyer/index' }) } else { // 卖家登录成功后,重新显示创建货源弹窗 + // 从本地存储加载保存的表单数据 + const savedSupply = wx.getStorageSync('newSupplyDraft') || { name: '', price: '', minOrder: '', yolk: '', spec: '', imageUrls: [] }; this.setData({ showImagePreview: false, showModal: true, - newSupply: { name: '', price: '', minOrder: '', yolk: '', spec: '', imageUrls: [] } + newSupply: savedSupply }); this.disablePageScroll(); } @@ -1401,6 +1403,8 @@ Page({ if (!userId || !openid || !userInfo) { console.log('用户未登录,显示登录提示'); + // 登录前保存当前表单数据到本地存储 + wx.setStorageSync('newSupplyDraft', this.data.newSupply); // 用户未登录,显示未授权提示弹窗 wx.showModal({ title: '登录提示',