// 修改 wxml 文件 日期:{{date}} 未找到相关数据

// 修改 js 文件 // 点击查找按钮 search: function () { const db = wx.cloud.database(); const yddata = db.collection('yddata');

yddata.where({ mailNumber: this.data.mailNumber }).get().then(res => { if (res.data.length > 0) { const data = res.data[0]; this.setData({ searchData: data, images: data.images, describe: data.describe, date: data.date }); } else { wx.showToast({ title: '未找到相关数据', icon: 'none' }); } }).catch(err => { console.error(err); }); },

// 文本框内容变化 describeChange: function (e) { this.setData({ describe: e.detail.value }); },

// 更新描述按钮点击事件 update: function () { const db = wx.cloud.database(); const yddata = db.collection('yddata');

yddata.doc(this.data.searchData._id).update({ data: { describe: this.data.describe } }).then(res => { wx.showToast({ title: '更新成功', }); }).catch(err => { console.error(err); }); },

// 修改 wxss 文件 .container { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; }

.search-box { display: flex; align-items: center; justify-content: center; margin-bottom: 20px; }

.input { width: 200rpx; height: 40rpx; border: 1rpx solid #ccc; padding: 0 10rpx; }

.button { width: 80rpx; height: 40rpx; background-color: #3498db; color: #fff; border: none; margin-left: 10rpx; }

.search-result { display: flex; flex-direction: column; align-items: center; }

.image { width: 200rpx; height: 200rpx; margin-bottom: 20px; }

.textarea { width: 200rpx; height: 100rpx; padding: 10rpx; border: 1rpx solid #ccc; margin-bottom: 20px; }

.date { margin-bottom: 20px; }

.empty { margin-bottom: 20px; }


原文地址: https://www.cveoy.top/t/topic/pxHj 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录