diff --git a/.prettierrc b/.prettierrc index 67a42dd..170b4a2 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,7 +4,7 @@ "tabWidth": 2, "useTabs": false, "semi": true, - "singleQuote": false, + "singleQuote": true, "bracketSpacing": true, "trailingComma": "all", "arrowParens": "always", diff --git a/project.private.config.json b/project.private.config.json index cfd2f51..b7ae25a 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -9,6 +9,20 @@ "miniprogram": { "list": [ { + "name": "隐私协议", + "pathName": "pages/protocol/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "搜索", + "pathName": "pages/search/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { "name": "文章详情", "pathName": "pages/article/index", "query": "", diff --git a/src/app.json b/src/app.json index 48da4df..3c4d93e 100644 --- a/src/app.json +++ b/src/app.json @@ -7,7 +7,9 @@ "pages/topic/index", "pages/collection/index", "pages/classify/index", - "pages/article/index" + "pages/article/index", + "pages/search/index", + "pages/protocol/index" ], "preloadRule": {}, "window": { diff --git a/src/images/empty-1.png b/src/images/empty-1.png new file mode 100644 index 0000000..a8aa419 Binary files /dev/null and b/src/images/empty-1.png differ diff --git a/src/images/fold-up.png b/src/images/fold-up.png new file mode 100644 index 0000000..a64f696 Binary files /dev/null and b/src/images/fold-up.png differ diff --git a/src/images/icon-collection1.png b/src/images/icon-collection1.png new file mode 100644 index 0000000..6e5c7b1 Binary files /dev/null and b/src/images/icon-collection1.png differ diff --git a/src/images/icon-directory.png b/src/images/icon-directory.png new file mode 100644 index 0000000..b31527e Binary files /dev/null and b/src/images/icon-directory.png differ diff --git a/src/pages/article/index.json b/src/pages/article/index.json index 2d067ab..b37fe4a 100644 --- a/src/pages/article/index.json +++ b/src/pages/article/index.json @@ -2,6 +2,7 @@ "navigationStyle": "default", "navigationBarTitleText": "详情", "usingComponents": { - "van-slider": "@vant/weapp/slider/index" + "van-slider": "@vant/weapp/slider/index", + "van-popup": "@vant/weapp/popup/index" } } diff --git a/src/pages/article/index.scss b/src/pages/article/index.scss index 62785b0..45f83ab 100644 --- a/src/pages/article/index.scss +++ b/src/pages/article/index.scss @@ -1,14 +1,185 @@ .page { - padding: 48rpx 32rpx; + padding: 48rpx 32rpx 200rpx; + .page-title { font-size: 44rpx; color: #222222; font-weight: bold; line-height: 48rpx; } - .page-date{ + + .page-date { margin-top: 24rpx; font-size: 28rpx; color: #999999; } + + .audio-bar { + margin-top: 32rpx; + padding: 32rpx; + --slider-disabled-opacity: 1; + background-color: #f9fafb; + border-radius: 24rpx; + + .a-header { + display: flex; + align-items: center; + justify-content: space-between; + + .wrap { + line-height: 1; + + .name { + font-size: 32rpx; + color: #000000; + font-weight: bold; + } + + .date { + margin-top: 12rpx; + font-size: 24rpx; + color: #65686c; + } + } + + .icon { + width: 42rpx; + height: 42rpx; + } + } + + .progress { + display: block; + margin-top: 30rpx; + } + } + + .rich { + margin-top: 32rpx; + } + + .quick-article { + margin-top: 24rpx; + padding: 26rpx 32rpx; + background: #f9fafb; + line-height: 48rpx; + border-radius: 16rpx 16rpx 16rpx 16rpx; + + .label { + font-size: 32rpx; + color: #3795f7; + } + } + + .type { + margin-top: 48rpx; + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 24rpx; + + .label { + font-size: 32rpx; + color: #999999; + } + + .item { + padding: 6rpx 24rpx; + border-radius: 40rpx; + font-size: 32rpx; + color: #fff; + background-color: #3795f7; + } + } + + .footer { + position: fixed; + bottom: 0; + left: 0; + width: 100%; + padding: 30rpx 30rpx calc(30rpx + env(safe-area-inset-bottom)); + display: flex; + align-items: center; + justify-content: space-between; + box-shadow: 0 -6rpx 32.8rpx rgba(0, 0, 0, 0.1); + background: #ffffff; + + .item { + flex: 1; + display: flex; + align-items: center; + justify-content: center; + gap: 12rpx; + + .icon { + width: 56rpx; + height: 56rpx; + } + } + } +} + +.popup-directory { + .p-close-line { + padding: 36rpx 32rpx; + display: flex; + justify-content: flex-end; + .option { + font-size: 32rpx; + color: #999999; + .icon { + width: 24rpx; + height: 24rpx; + } + } + } + .p-title { + padding: 0 32rpx; + font-size: 44rpx; + color: #222222; + font-weight: bold; + } + .p-type { + padding: 32rpx; + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 24rpx; + + .label { + font-size: 32rpx; + color: #999999; + } + + .item { + padding: 6rpx 24rpx; + border-radius: 40rpx; + font-size: 32rpx; + color: #fff; + background-color: #3795f7; + } + } + .p-scroll { + max-height: 50vh; + padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); + .row { + padding: 32rpx; + position: relative; + &::after { + position: absolute; + bottom: 0; + left: 32rpx; + content: ''; + width: calc(100% - 64rpx); + height: 1px; + background-color: #f0f0f0; + } + &:last-of-type::after { + display: none; + } + &.current { + background: rgba(55, 149, 247, 0.06); + } + } + } } diff --git a/src/pages/article/index.ts b/src/pages/article/index.ts index 067b6bb..89a3fd7 100644 --- a/src/pages/article/index.ts +++ b/src/pages/article/index.ts @@ -1,8 +1,79 @@ const _app = getApp(); Page({ - data: {}, - onLoad() {}, + data: { + show: false, + + progress: 0, + url: 'http://m10.music.126.net/20241126110303/3f2481d2d6d50acd2009359539eadda0/ymusic/5353/0f0f/0358/d99739615f8e5153d77042092f07fd77.mp3', + play: false, + time: '00:01/00:00', + }, + innerAudioContext: null as WechatMiniprogram.InnerAudioContext | null, + onLoad() { + this.innerAudioContext = wx.createInnerAudioContext(); + }, + onUnload() { + if (this.innerAudioContext) { + this.innerAudioContext?.stop(); + this.innerAudioContext.destroy(); + } + }, + handlePlay() { + const { url, play } = this.data; + if (this.innerAudioContext) { + if (play) { + this.innerAudioContext.stop(); + return; + } + this.innerAudioContext.stop(); + this.innerAudioContext.src = url; + this.innerAudioContext.play(); + this.setData({ + play: true, + }); + const listener = () => { + if (this.innerAudioContext) { + const { currentTime, duration } = this.innerAudioContext; + const time = `${this.formatTime(currentTime)}/${this.formatTime(duration)}`; + const progress = (currentTime / duration) * 100; + this.setData({ + time, + progress, + }); + } + }; + this.innerAudioContext.onTimeUpdate(listener); + this.innerAudioContext.onEnded(() => { + this.setData({ + play: false, + }); + }); + this.innerAudioContext.onStop(() => { + this.setData({ + play: false, + }); + }); + } + }, + handlePause() { + if (this.innerAudioContext) { + this.innerAudioContext.pause(); + this.setData({ + play: false, + }); + } + }, + formatTime(time: number) { + const minutes = Math.floor(time / 60); + const seconds = Math.floor(time % 60); + return `${minutes < 10 ? `0${minutes}` : minutes}:${seconds < 10 ? `0${seconds}` : seconds}`; + }, + onClose() { + this.setData({ + show: false, + }); + }, }); -export {} +export {}; diff --git a/src/pages/article/index.wxml b/src/pages/article/index.wxml index 4dae00e..d0334b3 100644 --- a/src/pages/article/index.wxml +++ b/src/pages/article/index.wxml @@ -5,11 +5,69 @@ 概要解读 - 00:01/09:47 + {{time}} - - + + + + + + + + 上一篇: + 身体活动引用的政策与文献 + + + 下一篇: + 身体活动引用的政策与文献 + + + 分类 + 健康生活方式 + + + + + + 目录 + + + + 目录 - + + + + + + 收起 + + + + 身体活动引用的指南与专家共识 + + 分类 + 健康生活方式 + + + 1.身体活动引用的政策与文献 + 1.身体活动引用的政策与文献 + 1.身体活动引用的政策与文献 + 1.身体活动引用的政策与文献 + 1.身体活动引用的政策与文献 + 1.身体活动引用的政策与文献 + + + diff --git a/src/pages/home/index.wxml b/src/pages/home/index.wxml index 4d39d4b..8edd728 100644 --- a/src/pages/home/index.wxml +++ b/src/pages/home/index.wxml @@ -1,4 +1,7 @@ - + 人人都是家庭健康师,让生活更有质量 @@ -13,12 +16,7 @@ placeholder="请输入要搜索的内容" /> - + @@ -32,18 +30,14 @@ bind:tap="handleDetail" > 公司综合信息 - 健康政策三医政策健康政策三医政策健康政策三医政策健康政策三医政策健康政策三医政策健康政策三医政策健康政策三医政策健康政策三医政策健康政策三医政策健康政策三医政策健康政策三医政策 + + 健康政策三医政策健康政策三医政策健康政策三医政策健康政策三医政策健康政策三医政策健康政策三医政策健康政策三医政策健康政策三医政策健康政策三医政策健康政策三医政策健康政策三医政策 + - - 留言板 - - + 留言板 + 提交 diff --git a/src/pages/login/index.ts b/src/pages/login/index.ts index 88cde49..278a5dd 100644 --- a/src/pages/login/index.ts +++ b/src/pages/login/index.ts @@ -6,10 +6,10 @@ Page({ show: true, menuButtonInfo: {}, - mobile: "", - code: "", + mobile: '', + code: '', protool: false, - codeText: "发送验证码", + codeText: '发送验证码', }, onLoad() {}, getCode() { @@ -17,29 +17,29 @@ Page({ const mobile = this.data.mobile; if (!mobile) { wx.showToast({ - title: "手机号不能为空", - icon: "none", + title: '手机号不能为空', + icon: 'none', }); return; } // 验证手机号 if (!/^1[3-9,]\d{9}$/.test(mobile)) { wx.showToast({ - title: "手机号格式不正确", - icon: "none", + title: '手机号格式不正确', + icon: 'none', }); return; } wx.ajax({ - method: "POST", - url: "?r=takeda/login/send-verify-code", + method: 'POST', + url: '?r=takeda/login/send-verify-code', data: { mobile, }, }).then(() => { wx.showToast({ - icon: "none", - title: "验证码已发送~", + icon: 'none', + title: '验证码已发送~', }); let time = 60; timer = setInterval(() => { @@ -51,7 +51,7 @@ Page({ clearInterval(timer as number); timer = null; this.setData({ - codeText: "发送验证码", + codeText: '发送验证码', }); } }, 1000); @@ -60,26 +60,29 @@ Page({ handleSubmit() { const { mobile, code, protool } = this.data; if (!protool) { - this.handleNavProtool(); + wx.showToast({ + icon: 'none', + title: '请先同意用户隐私协议', + }); return; } if (!mobile) { wx.showToast({ - title: "请输入手机号", - icon: "none", + title: '请输入手机号', + icon: 'none', }); return; } if (!code) { wx.showToast({ - title: "请输入验证码", - icon: "none", + title: '请输入验证码', + icon: 'none', }); return; } wx.ajax({ - method: "POST", - url: "?r=takeda/login/reg-login", + method: 'POST', + url: '?r=takeda/login/reg-login', data: { mobile, code, @@ -92,12 +95,16 @@ Page({ const { protool } = this.data; const { iv, encryptedData } = e.detail; if (!protool) { + wx.showToast({ + icon: 'none', + title: '请先同意用户隐私协议', + }); return; } if (iv && encryptedData) { wx.ajax({ - method: "POST", - url: "?r=takeda/login/wx-reg-login", + method: 'POST', + url: '?r=takeda/login/wx-reg-login', data: { iv: encodeURIComponent(iv), encryptedData: encodeURIComponent(encryptedData), @@ -112,25 +119,17 @@ Page({ app.globalData.doctorId = res.doctorId; app.waitLogin().then(() => { wx.reLaunch({ - url: "/pages/home/index", + url: '/pages/home/index', }); }); }, handleProtool() { - if (this.data.protool) { - this.setData({ - protool: false, - }); - } else { - this.setData({ - protool: false, - }); - wx.navigateTo({ url: "/module1/pages/loginProtool/index" }); - } + this.setData({ + protool: !this.data.protool, + }); }, - handleNavProtool(e) { - const phone = e?.currentTarget?.dataset?.phone; - wx.navigateTo({ url: `/module1/pages/loginProtool/index?phone=${phone}` }); + handleNavProtool() { + wx.navigateTo({ url: `/pages/protocol/index` }); }, handleTopic() {}, diff --git a/src/pages/login/index.wxml b/src/pages/login/index.wxml index eec3e1c..ec787b4 100644 --- a/src/pages/login/index.wxml +++ b/src/pages/login/index.wxml @@ -29,11 +29,7 @@ 《用户隐私协议》 登录 - - @@ -44,7 +40,7 @@ - + diff --git a/src/pages/protocol/index.json b/src/pages/protocol/index.json new file mode 100644 index 0000000..94f3597 --- /dev/null +++ b/src/pages/protocol/index.json @@ -0,0 +1,5 @@ +{ + "navigationBarTitleText": "用户隐私协议", + "navigationStyle": "default", + "usingComponents": {} +} diff --git a/src/pages/protocol/index.scss b/src/pages/protocol/index.scss new file mode 100644 index 0000000..b9f0774 --- /dev/null +++ b/src/pages/protocol/index.scss @@ -0,0 +1,3 @@ +.page { + padding: 32rpx; +} diff --git a/src/pages/protocol/index.ts b/src/pages/protocol/index.ts new file mode 100644 index 0000000..067b6bb --- /dev/null +++ b/src/pages/protocol/index.ts @@ -0,0 +1,8 @@ +const _app = getApp(); + +Page({ + data: {}, + onLoad() {}, +}); + +export {} diff --git a/src/pages/protocol/index.wxml b/src/pages/protocol/index.wxml new file mode 100644 index 0000000..6908680 --- /dev/null +++ b/src/pages/protocol/index.wxml @@ -0,0 +1 @@ + diff --git a/src/pages/search/index.json b/src/pages/search/index.json new file mode 100644 index 0000000..9806cef --- /dev/null +++ b/src/pages/search/index.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "van-nav-bar": "@vant/weapp/nav-bar/index", + "van-icon": "@vant/weapp/icon/index", + "pagination":"/components/pagination/index" + } +} diff --git a/src/pages/search/index.scss b/src/pages/search/index.scss new file mode 100644 index 0000000..afd76ee --- /dev/null +++ b/src/pages/search/index.scss @@ -0,0 +1,99 @@ +page { + background-color: #f3f4f5; +} +.page { + padding-bottom: 80rpx; + .search { + margin: 34rpx 32rpx 0; + padding: 0 0 0 24rpx; + display: flex; + align-items: center; + background: linear-gradient(158deg, #ffffff 0%, #f2f9fe 100%); + border-radius: 106rpx 106rpx 106rpx 106rpx; + border: 1px solid #ffffff; + .icon { + width: 36rpx; + height: 36rpx; + } + .input { + flex: 1; + padding: 16rpx; + line-height: 40rpx; + font-size: 28rpx; + } + .place-input { + color: #c9cdd4; + } + } + .tip { + margin: 52rpx 32rpx 0; + font-size: 28rpx; + color: #222222; + font-weight: bold; + } + .card { + padding: 24rpx; + margin: 24rpx 32rpx 0; + display: flex; + gap: 24rpx; + background: linear-gradient(173deg, #ffffff 0%, #eff7ff 100%); + border-radius: 24rpx 24rpx 24rpx 24rpx; + border: 2rpx solid #ffffff; + .photo { + flex-shrink: 0; + width: 218rpx; + height: 218rpx; + border-radius: 16rpx; + } + .c-container { + flex: 1; + .title { + font-size: 32rpx; + color: #222222; + font-weight: bold; + line-height: 48rpx; + } + .type { + margin-top: 16rpx; + font-size: 28rpx; + color: #999999; + line-height: 28rpx; + } + .stat { + margin-top: 42rpx; + display: flex; + align-items: center; + gap: 40rpx; + .s-item { + display: flex; + align-items: center; + gap: 8rpx; + font-size: 28rpx; + color: #999999; + .icon { + width: 28rpx; + height: 28rpx; + } + &.active { + color: #3795f7; + } + } + } + } + } + .empty-search { + .e-icon { + margin: 186rpx auto 0; + display: block; + width: 217rpx; + height: 236rpx; + } + .content { + margin-top: 44rpx; + font-size: 32rpx; + line-height: 48rpx; + color: #999999; + text-align: center; + } + } +} diff --git a/src/pages/search/index.ts b/src/pages/search/index.ts new file mode 100644 index 0000000..1e18f4f --- /dev/null +++ b/src/pages/search/index.ts @@ -0,0 +1,45 @@ +const _app = getApp(); + +Page({ + data: { + background: "transparent", + + pagination: { + page: 1, + pages: 1, + count: 1, + }, + list: [], + }, + onLoad() {}, + getList(newPage = 1) { + // wx.ajax({ + // method: "GET", + // url: `?r=takeda/case/get-list`, + // data: { + // page: newPage, + // }, + // }).then((res) => { + // const list = res.page === 1 ? res.list : [...this.data.list, ...res.list]; + // this.setData({ + // list, + // pagination: { + // page: res.page, + // pages: res.pages, + // count: res.count, + // }, + // }); + // }); + }, + onReachBottom() { + const { page, pages } = this.data.pagination; + if (pages > page && this.data.list.length) { + this.getList(page + 1); + } + }, + handleBack() { + wx.navigateBack(); + }, +}); + +export {}; diff --git a/src/pages/search/index.wxml b/src/pages/search/index.wxml new file mode 100644 index 0000000..27ec7dd --- /dev/null +++ b/src/pages/search/index.wxml @@ -0,0 +1,54 @@ + + + + + + + + + + 以下为搜到的内容 + + + + 骨密度是骨健康的关键指标,我们检查对吗? + 健康管理/口腔 + + + + 123 + + + + 取消收藏 + + + + 收藏 + + + + + + + + 抱歉,未搜到相关内容 + + 换个词试试吧 + + + +