// pages/test2/test2.js Page({ /** * 页面的初始数据 */ data: { imgFiles: [ '/res/icons/ass_1.png', '/res/icons/ass_2.png', '/res/icons/ass_3.png', '/res/icons/ass_3.png', '/res/icons/ass_3.png', '/res/icons/ass_3.png', '/res/icons/ass_3.png', '/res/icons/ass_3.png', '/res/icons/ass_3.png', '/res/icons/ass_3.png', '/res/icons/ass_3.png', '/res/icons/ass_3.png', ], ledgerRemark: '台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注台账备注', previewImageUrls:[], previewCurrent: 0, showPreview: false, }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, previewImage(e) { const { index } = e.currentTarget.dataset; const previewImageUrls = this.data.imgFiles; this.setData({ previewImageUrls, previewCurrent: index, showPreview: true }); }, /** * 获取热门搜索内容 */ getHotTopic() { var that = this // 1. 热门法律法规 consultservice.getTopicLaw(app.globalData.accessToken.userId, { success(res) { res.forEach(r => { r.mfKeywordLv1 = r.mfKeywordLv1.split('、').slice(0, 5) r.mfReleaseDate = that.formatTime(r.mfReleaseDate) r.mfEffectiveDate = that.formatTime(r.mfEffectiveDate) r.mfClosingDate = that.formatTime(r.mfClosingDate) }); that.setData({ 'pageList[0]': res, 'pageList[4]': res }) } }) // 2. 热门法律法规条目 consultservice.getTopicItem(app.globalData.accessToken.userId, { success(res) { res.forEach(r => { r.miItemContent = r.miItemContent.replaceAll('\\n', '
') }); that.setData({ 'pageList[3]': res }) } }) // 3. 热门问答 consultservice.getTopicQA(app.globalData.accessToken.userId, { success(res) { res.forEach(r => { r.cqCreateTime = that.formatTime(r.cqCreateTime) }); that.setData({ 'pageList[1]': res }) } }) // 4. 热门案例 consultservice.getTopicCase(app.globalData.accessToken.userId, { success(res) { res.forEach(r => { r.ecSummary = r.ecSummary.replaceAll('\\n', '
') r.ecMeaning = r.ecMeaning.replaceAll('\\n', '
') r.ecExamined = r.ecExamined.replaceAll('\\n', '
') r.ecEnlightenment = r.ecEnlightenment.replaceAll('\\n', '
') r.ecOccurDate = that.formatTime(r.ecOccurDate) }); that.setData({ 'pageList[2]': res }) console.log(that.data.pageList); } }) }, })