diff --git a/app.json b/app.json index 6db189d..64631f3 100644 --- a/app.json +++ b/app.json @@ -56,6 +56,10 @@ "root": "pages/article", "name": "article", "pages": ["index"] + },{ + "root": "pages/articleList", + "name": "articleList", + "pages": ["index"] },{ "root": "pages/therapeuticRegimen", "name": "therapeuticRegimen", diff --git a/pages/AddTherapeuticRegimen/index.js b/pages/AddTherapeuticRegimen/index.js index 388c7e4..ffc0cb4 100644 --- a/pages/AddTherapeuticRegimen/index.js +++ b/pages/AddTherapeuticRegimen/index.js @@ -18,6 +18,7 @@ Page({ }, mode: '', dateVisible: false, + minuteVisible: false, date: new Date('2021-12-23').getTime(), // 支持时间戳传入 dateText: '', filter(type, options) { @@ -107,6 +108,11 @@ Page({ + }, + showPickertime(e){ + this.setData({ + minuteVisible: true, + }); }, handleSuccess(e) { diff --git a/pages/AddTherapeuticRegimen/index.json b/pages/AddTherapeuticRegimen/index.json index db6145a..d549868 100644 --- a/pages/AddTherapeuticRegimen/index.json +++ b/pages/AddTherapeuticRegimen/index.json @@ -8,7 +8,8 @@ "t-button": "tdesign-miniprogram/button/button", "t-upload": "tdesign-miniprogram/upload/upload", "t-radio": "tdesign-miniprogram/radio/radio", - "t-radio-group": "tdesign-miniprogram/radio-group/radio-group" + "t-radio-group": "tdesign-miniprogram/radio-group/radio-group", + "t-tag": "tdesign-miniprogram/tag/tag" }, "navigationBarTitleText": "用药方案" } \ No newline at end of file diff --git a/pages/AddTherapeuticRegimen/index.less b/pages/AddTherapeuticRegimen/index.less index 54ffe00..3a48210 100644 --- a/pages/AddTherapeuticRegimen/index.less +++ b/pages/AddTherapeuticRegimen/index.less @@ -28,6 +28,9 @@ line-height: 40rpx; margin: 0 8rpx 16rpx; } + .none{ + opacity: 0; + } .box{ display: flex; justify-content: space-between; @@ -37,4 +40,35 @@ .t-overlay{ top: 0!important; } + .yp-item{ + border: 2rpx solid #efefef; + border-radius: 12rpx; + overflow: hidden; + } + .administration-time{ + display: flex; + justify-content: space-between; + padding: 40rpx 0; + padding-left: 40rpx; + } + .radio-group{ + width: 300rpx; + } + .add-btn{ + margin-top: 40rpx; + } + .delete-btn{ + text-align: right; + margin-bottom: 10rpx; + } + .reminder-time{ + display: flex; + justify-content: space-between; + margin-bottom: 20rpx; + .label{ + flex: 1; + line-height: 130rpx; + } + } + } \ No newline at end of file diff --git a/pages/AddTherapeuticRegimen/index.wxml b/pages/AddTherapeuticRegimen/index.wxml index 3944c6e..f8aff9c 100644 --- a/pages/AddTherapeuticRegimen/index.wxml +++ b/pages/AddTherapeuticRegimen/index.wxml @@ -12,7 +12,7 @@ 用药周期 - + @@ -20,20 +20,63 @@ - 体重(kg) - + 体重(kg) + - + 药品信息 - - + + 删除 + + + + + + + 饭前/饭后 + + + + + + + + + +添加用药 - - + + 用药时间提醒 + + 早上 + + + + 中午 + + + + 晚上 + + + + 保存 + + + \ No newline at end of file diff --git a/pages/article/index.js b/pages/article/index.js index 1d5ba3c..40cae95 100644 --- a/pages/article/index.js +++ b/pages/article/index.js @@ -6,14 +6,17 @@ Page({ * 页面的初始数据 */ data: { - + article:{} }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - this.getList() + const data = JSON.parse(wx.getStorageSync('article')) + this.setData({ + article: data + }) }, diff --git a/pages/article/index.less b/pages/article/index.less index a8c285d..e703b6b 100644 --- a/pages/article/index.less +++ b/pages/article/index.less @@ -2,4 +2,11 @@ .rich{ padding: 28rpx; + background-color: #fff; + min-height: 100vh; + .title{ + font-size: 32rpx; + font-weight: bold; + margin-bottom: 40rpx; + } } \ No newline at end of file diff --git a/pages/article/index.wxml b/pages/article/index.wxml index 5cdc85d..21dbe65 100644 --- a/pages/article/index.wxml +++ b/pages/article/index.wxml @@ -1,5 +1,7 @@ - - + + {{article.title}} + + \ No newline at end of file diff --git a/pages/articleList/index.js b/pages/articleList/index.js new file mode 100644 index 0000000..e9c11e5 --- /dev/null +++ b/pages/articleList/index.js @@ -0,0 +1,92 @@ +// pages/articleList/index.js +import request from '~/api/request'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + articles:[] + }, + + // Helper function to strip HTML tags and convert to plain text + stripHtml(html) { + if (!html) return ''; + return html.replace(/<[^>]*>/g, ''); + }, + + async getList(){ + const res = await request('patient/articles', 'get', { title: '', page: 1, page_size: 10 }); + // Convert rich text content to plain text for each article + const articlesWithPlainText = res.list.map(article => ({ + ...article, + contentText: this.stripHtml(article.content) + })); + this.setData({ + articles: articlesWithPlainText + }) + }, + async preview(e){ + console.log(e.currentTarget.dataset.index) + const index = e.currentTarget.dataset.index + await wx.setStorageSync('article',JSON.stringify(this.data.articles[index])); + wx.navigateTo({ + url: '/pages/article/index', + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getList() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/articleList/index.json b/pages/articleList/index.json new file mode 100644 index 0000000..6683cdd --- /dev/null +++ b/pages/articleList/index.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "t-search": "tdesign-miniprogram/search/search" + }, + "navigationBarTitleText": "健康教育" +} \ No newline at end of file diff --git a/pages/articleList/index.less b/pages/articleList/index.less new file mode 100644 index 0000000..703f0e1 --- /dev/null +++ b/pages/articleList/index.less @@ -0,0 +1,39 @@ +/* pages/articleList/index.wxss */ + +.article-page { + height: 100vh; + padding: 28rpx; + background-color: #fff; + + .example-search { + background-color: #fff; + } + + .example-search:not(:last-child) { + margin-bottom: 32rpx; + } + + .article-item { + background-color: #f3f3f3; + padding: 20rpx; + border-radius: 12rpx; + max-height: 200rpx; + + .article-title { + font-weight: bold; + font-size: 32rpx; + margin-bottom: 20rpx; + } + + .article-content { + font-size: 28rpx; + font-size: 26rpx; + line-height: 36rpx; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 3; + overflow: hidden; + word-break: break-word; + } + } +} \ No newline at end of file diff --git a/pages/articleList/index.wxml b/pages/articleList/index.wxml new file mode 100644 index 0000000..2cd20b7 --- /dev/null +++ b/pages/articleList/index.wxml @@ -0,0 +1,14 @@ + + + + + + + + + {{item.title}} + + {{item.contentText}} + + + diff --git a/pages/home/index.js b/pages/home/index.js index a176de6..ca1be61 100644 --- a/pages/home/index.js +++ b/pages/home/index.js @@ -1,5 +1,5 @@ import * as echarts from '../../ec-canvas/echarts.min'; - +import request from '~/api/request'; const app = getApp(); function initChart(canvas, width, height, dpr) { @@ -146,8 +146,55 @@ Page({ ec2: { onInit: initChart2 }, - activeIndex: 0 + activeIndex: 0, + sfData:{}, + sfListLength: 0, + article:{}, + articlesLength: 0 }, + + // Helper function to strip HTML tags and convert to plain text + stripHtml(html) { + if (!html) return ''; + return html.replace(/<[^>]*>/g, ''); + }, + + async getSfList(){ + const res = await request('patient/follow_plans', 'get', { + page: 1, + page_size: 10, + type: 1 + }) + + // Calculate days between today and plan_date + const today = new Date() + const planDate = new Date(res.list[0].plan_date) + const diffTime = planDate - today + const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + + this.setData({ + sfListLength: res.total, + sfData: { + ...res.list[0], + daysUntilPlan: diffDays + } + }) + + const res2 = await request('patient/articles', 'get', { title: '', page: 1, page_size: 10 }); + // Convert rich text content to plain text + const plainTextContent = this.stripHtml(res2.list[0].content); + this.setData({ + articlesLength: res2.total, + article: { + ...res2.list[0], + contentText: plainTextContent + } + }) + }, + onLoad(){ + this.getSfList() + }, + changeChart(e) { const index = e.currentTarget.dataset.index; console.log(index); @@ -168,5 +215,16 @@ Page({ wx.navigateTo({ url: '/pages/emergency/index', }) - } + }, + toArticle(){ + wx.navigateTo({ + url: '/pages/articleList/index', + }) + }, + async toArticleDelit(){ + await wx.setStorageSync('article',JSON.stringify(this.data.article)); + wx.navigateTo({ + url: '/pages/article/index', + }) + }, }); \ No newline at end of file diff --git a/pages/home/index.less b/pages/home/index.less index 429fa6e..c3188fd 100644 --- a/pages/home/index.less +++ b/pages/home/index.less @@ -9,40 +9,48 @@ // height: calc(100% - @nav-bar-height); padding: 30rpx; padding-bottom: 160rpx; - .item-content{ + + .item-content { background-color: #fff; border-radius: 12rpx; padding: 30rpx; margin-bottom: 30rpx; - .item-title{ + + .item-title { font-size: 32rpx; font-weight: bold; color: #323030; } - .echarts-canvas-container{ + + .echarts-canvas-container { width: 100%; height: 600rpx; } - .echarts-canvas{ + + .echarts-canvas { width: 100%; height: 100%; } - .echarts-legend{ + + .echarts-legend { display: flex; margin-bottom: 20rpx; margin-top: 20rpx; - view{ + + view { margin-right: 20rpx; } - .active{ + + .active { color: #0091cc; text-decoration: underline; } } - .item-title{ + .item-title { position: relative; - .item-title-right-text{ + + .item-title-right-text { position: absolute; right: 0; top: 0; @@ -50,40 +58,48 @@ font-size: 24rpx; } } - .item-box{ + + .item-box { background-color: #f5f5f5; border-radius: 12rpx; padding: 26rpx; margin-top: 20rpx; position: relative; - .item-box-title{ + + .item-box-title { display: flex; justify-content: space-between; box-sizing: border-box; margin-bottom: 20rpx; - .item-box-title-left{ + + .item-box-title-left { font-size: 28rpx; color: #323030; } - .item-box-title-right{ + + .item-box-title-right { font-size: 24rpx; color: #949798; } } - .drug-name{ + + .drug-name { font-size: 30rpx; color: #323030; margin-bottom: 8rpx; } - .drug-usage{ + + .drug-usage { font-size: 26rpx; color: #323030; margin-bottom: 20rpx; } - .follow-up-itme{ + + .follow-up-itme { font-size: 24rpx; } - .follow-itme-ed{ + + .follow-itme-ed { color: #0091cc; font-size: 30rpx; position: absolute; @@ -91,16 +107,27 @@ top: 50%; transform: translateY(-50%); } - + + .article-content { + margin-top: 10rpx; + font-size: 26rpx; + line-height: 36rpx; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 3; + overflow: hidden; + word-break: break-word; + } + } - + } } - + } -.emergency-access{ +.emergency-access { position: fixed; right: 40rpx; bottom: 220rpx; @@ -113,5 +140,5 @@ display: flex; align-items: center; justify-content: center; - box-shadow: 0px 12px 32px 4px rgba(0, 0, 0, .04), 0px 8px 20px rgba(0, 0, 0, .08) ; + box-shadow: 0px 12px 32px 4px rgba(0, 0, 0, .04), 0px 8px 20px rgba(0, 0, 0, .08); } \ No newline at end of file diff --git a/pages/home/index.wxml b/pages/home/index.wxml index 6361d65..3fa54c3 100644 --- a/pages/home/index.wxml +++ b/pages/home/index.wxml @@ -44,38 +44,33 @@ 打卡 - + 随访提醒 - 术后一个月随访 + {{sfData.plan_name}} - + - + - + 健康推送 - + 更多 - + - - 关于配方奶粉的选择 + {{article.title}} - - diff --git a/pages/message/index.js b/pages/message/index.js index 82a90f1..9fb624d 100644 --- a/pages/message/index.js +++ b/pages/message/index.js @@ -1,31 +1,45 @@ // pages/clockIn/index.js +import request from '~/api/request'; Page({ /** * 页面的初始数据 */ data: { - - newTime: '' + dataList: [], }, + async getList(){ + const res = await request('patient/follow_plans', 'get', { + page: 1, + page_size: 100, + type: 2 + }) + + // Process the list to check dates + const processedList = res.list.map(item => { + const planDate = new Date(item.plan_date); + const today = new Date(); + const diffTime = planDate - today; + const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); + + // If within 7 days and status is 1, update to 2 + if (diffDays <= 7 && diffDays >= 0 && item.status === 1) { + return { ...item, status: 3 }; + } + return item; + }); + + this.setData({ + dataList: processedList + }) + }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - const now = new Date() - const year = now.getFullYear() - const month = now.getMonth() + 1 - const day = now.getDate() - const hours = now.getHours() - const minutes = now.getMinutes() - const seconds = now.getSeconds() + this.getList() - const formattedTime = `${year}年${month.toString().padStart(2, '0')}月${day.toString().padStart(2, '0')}日` - - this.setData({ - newTime: formattedTime - }) }, /** diff --git a/pages/message/index.wxml b/pages/message/index.wxml index 04b1d15..c433c07 100644 --- a/pages/message/index.wxml +++ b/pages/message/index.wxml @@ -1,14 +1,17 @@ - + - 术后1个月随访 - 已完成 + {{item.plan_name}} + 已完成 + 未开始 + 待开始 - 随访时间:2025年5月20日 - 填写随访问卷 + 随访时间:{{item.plan_date}} + 填写随访问卷 + 预约挂号 - + 添加随访 diff --git a/pages/my/index.js b/pages/my/index.js index 9a38fb7..049c6d1 100644 --- a/pages/my/index.js +++ b/pages/my/index.js @@ -39,7 +39,7 @@ Page({ settingList: [ { label: '用药方案', path: '/pages/therapeuticRegimen/index', icon: 'service', type: 'text' }, - { label: '健康教育', path: '/pages/article/index', icon: 'setting', type: 'text' }, + { label: '健康教育', path: '/pages/articleList/index', icon: 'setting', type: 'text' }, ], }, diff --git a/pages/my/info-edit/index.js b/pages/my/info-edit/index.js index 279a382..04ab3c6 100644 --- a/pages/my/info-edit/index.js +++ b/pages/my/info-edit/index.js @@ -3,8 +3,14 @@ import request from '~/api/request'; Page({ data: { personInfo: { - name: '', - gender: 0, + username: '', + sex: 0, + age: '', + id_number: '', + birthday: '', + operative_date: '', + + birth: '', address: [], introduction: '', diff --git a/project.private.config.json b/project.private.config.json index 53d6765..062e8df 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -3,12 +3,26 @@ "miniprogram": { "list": [ { - "name": "pages/AddTherapeuticRegimen/index", - "pathName": "pages/AddTherapeuticRegimen/index", + "name": "pages/articleList/index", + "pathName": "pages/articleList/index", "query": "", "scene": null, "launchMode": "default" }, + { + "name": "pages/AddTherapeuticRegimen/index", + "pathName": "pages/AddTherapeuticRegimen/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/AddTherapeuticRegimen/index", + "pathName": "pages/AddTherapeuticRegimen/index", + "query": "", + "launchMode": "default", + "scene": null + }, { "name": "pages/therapeuticRegimen/index", "pathName": "pages/therapeuticRegimen/index", @@ -107,6 +121,7 @@ }, "libVersion": "3.8.5", "setting": { - "urlCheck": false + "urlCheck": false, + "compileHotReLoad": false } } \ No newline at end of file