feat: 电子药箱小程序 - 4Tab药品管理

- 电子药箱: 药品库存管理 + 手动录入 + 今日用药打卡
- 药品百科: 搜索 + 分类筛选 + 20种药品静态数据
- 惠教中心: 4条药品使用指南课程
- 我的: 家庭成员信息管理
- 自定义TabBar + navigation-bar组件
- SVG药品分类插图
This commit is contained in:
陈誉午
2026-07-29 11:20:52 +08:00
commit 994b267f5c
683 changed files with 43849 additions and 0 deletions
@@ -0,0 +1,6 @@
{
"disableScroll": true,
"usingComponents": {
"navigation-bar": "/components/navigation-bar/navigation-bar"
}
}
+384
View File
@@ -0,0 +1,384 @@
@import "../../../variables";
/* pages/live/report/report.scss */
page {
background: #f5f5f5;
}
.report-page {
display: flex;
flex-direction: column;
padding-bottom: 120rpx;
padding-top: 30rpx;
background: #f5f5f5;
box-sizing: border-box;
}
/* ===== Section Card ===== */
.section-card {
background: #fff;
margin: 0 24rpx 16rpx;
border-radius: $primary-border-radius;
padding: 0 32rpx;
overflow: hidden;
}
.section-title {
font-size: 28rpx;
color: #333;
font-weight: 500;
padding: 28rpx 0;
line-height: 1;
}
.section-header {
font-size: 32rpx;
color: #333;
font-weight: 600;
padding: 32rpx 32rpx 24rpx;
line-height: 1;
text-align: center;
}
/* ===== Step 1: Reason List ===== */
.reason-list-scroll {
height: 100vh;
overflow-y: scroll;
}
.reason-list {
padding: 0;
}
.reason-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 28rpx 0;
border-bottom: 1rpx solid #f5f5f5;
box-sizing: border-box;
}
.reason-item:last-child {
border-bottom: none;
}
.reason-item:active {
background: #fafafa;
margin: 0 -32rpx;
padding-left: 32rpx;
padding-right: 32rpx;
}
.reason-label {
font-size: 28rpx;
color: #333;
line-height: 1.4;
}
.reason-arrow {
width: 12rpx;
height: 12rpx;
border-top: 3rpx solid #b0b0b0;
border-right: 3rpx solid #b0b0b0;
transform: rotate(45deg);
flex-shrink: 0;
margin-left: 12rpx;
}
/* ===== Target Info ===== */
.target-row {
display: flex;
align-items: center;
padding: 24rpx 0;
}
.target-avatar {
width: 88rpx;
height: 88rpx;
border-radius: 50%;
margin-right: 24rpx;
flex-shrink: 0;
background: #f0f0f0;
border: 2rpx solid #f0f0f0;
}
.target-info {
display: flex;
flex-direction: column;
flex: 1;
min-width: 0;
}
.target-name {
font-size: 32rpx;
color: #333;
font-weight: 600;
line-height: 1.4;
}
.target-context {
font-size: 24rpx;
color: #999;
margin-top: 6rpx;
line-height: 1.4;
}
/* ===== Selected Reason Row ===== */
.selected-reason-row {
padding: 28rpx 0;
}
.selected-reason-text {
font-size: 28rpx;
line-height: 1.4;
font-weight: 500;
}
/* ===== Description ===== */
.desc-wrap {
padding-bottom: 16rpx;
}
.desc-textarea {
width: 100%;
min-height: 180rpx;
font-size: 28rpx;
color: #333;
line-height: 1.6;
border: none;
outline: none;
box-sizing: border-box;
padding: 16rpx 0 12rpx;
}
.desc-textarea::placeholder {
color: #c8c8c8;
}
.char-count {
font-size: 24rpx;
color: $gray-color;
text-align: right;
padding-bottom: 16rpx;
}
/* ===== Image Upload ===== */
.evidence-tip {
font-size: 24rpx;
color: $gray-color;
font-weight: normal;
}
.upload-grid {
display: flex;
flex-wrap: wrap;
padding-bottom: 28rpx;
}
.upload-cell {
width: 200rpx;
height: 200rpx;
margin-right: 12rpx;
margin-bottom: 12rpx;
position: relative;
overflow: hidden;
border-radius: 12rpx;
}
.upload-cell:nth-child(3n) {
margin-right: 0;
}
.upload-img {
width: 100%;
height: 100%;
display: block;
object-fit: cover;
}
.upload-close {
position: absolute;
top: 0;
right: 0;
width: 44rpx;
height: 44rpx;
display: flex;
align-items: center;
justify-content: center;
background: rgba(0, 0, 0, 0.45);
color: #fff;
font-size: 26rpx;
line-height: 1;
}
.upload-add {
border: 2rpx dashed #d0d0d0;
display: flex;
align-items: center;
justify-content: center;
font-size: 72rpx;
color: #d0d0d0;
line-height: 1;
background: #fafafa;
box-sizing: border-box;
}
.upload-add:active {
background: #f0f0f0;
}
/* ===== Unified Card (投诉原因+补充描述+图片证据) ===== */
.unified-card {
padding-bottom: 0;
}
.unified-divider {
height: 1rpx;
background: #f0f0f0;
margin: 0;
}
/* ===== Agreement ===== */
.agreement-section {
padding: 28rpx 32rpx;
background: transparent;
}
.agreement-row {
display: flex;
align-items: center;
}
.agreement-check-circle {
width: 36rpx;
height: 36rpx;
border-radius: 50%;
border: 2rpx solid #d0d0d0;
display: flex;
align-items: center;
justify-content: center;
margin-right: 14rpx;
flex-shrink: 0;
box-sizing: border-box;
}
.agreement-check-circle.checked {
background: #07c160;
border-color: #07c160;
}
.agreement-check-icon {
color: #fff;
font-size: 22rpx;
line-height: 1;
font-weight: bold;
}
.agreement-text {
font-size: 24rpx;
color: #999;
}
.agreement-link {
font-size: 24rpx;
color: $primary-color-blue;
}
/* ===== Bottom Submit Bar ===== */
.bottom-bar {
position: fixed;
left: 0;
right: 0;
bottom: 0;
padding: 20rpx 32rpx;
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
background: #fff;
box-sizing: border-box;
box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.04);
}
.submit-btn {
width: 100%;
height: 88rpx;
line-height: 88rpx;
background: #07c160;
color: #fff;
font-size: 32rpx;
font-weight: 500;
border-radius: 8rpx;
border: none;
text-align: center;
padding: 0;
}
.submit-btn[disabled] {
background: #e0e0e0;
color: #999;
}
.submit-btn:not([disabled]):active {
opacity: 0.85;
}
/* ===== Step 3: Success ===== */
.success-content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 200rpx 60rpx 60rpx;
box-sizing: border-box;
}
.success-icon-wrap {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
background: #07c160;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 40rpx;
}
.success-check {
color: #fff;
font-size: 60rpx;
line-height: 1;
font-weight: bold;
}
.success-title {
font-size: 36rpx;
font-weight: 600;
color: #333;
margin-bottom: 20rpx;
}
.success-desc {
font-size: 26rpx;
color: #999;
line-height: 1.6;
text-align: center;
margin-bottom: 72rpx;
}
.success-btn {
width: 400rpx;
height: 88rpx;
line-height: 88rpx;
background: #07c160;
color: #fff;
font-size: 30rpx;
border-radius: 8rpx;
border: none;
text-align: center;
padding: 0;
}
.success-btn:active {
opacity: 0.85;
}
+139
View File
@@ -0,0 +1,139 @@
import { appId } from "../../../env";
import { request } from "../../../utils/request";
Page({
data: {
pageStep: 1 as number,
targetAvatar: '',
targetName: '',
targetContext: '',
reasons: [
{ id: 1, label: '欺诈' },
{ id: 2, label: '色情低俗' },
{ id: 3, label: '诱导' },
{ id: 4, label: '传播不实信息' },
{ id: 5, label: '违法犯罪' },
{ id: 6, label: '骚扰' },
{ id: 7, label: '侵权(诽谤、抄袭)' },
{ id: 8, label: '混淆他人投诉' },
{ id: 9, label: '恶意营销' },
{ id: 10, label: '与服务类目不符' },
{ id: 11, label: '隐私信息收集' },
{ id: 12, label: '广告体验' },
{ id: 13, label: '其他' },
],
selectedReason: '',
description: '',
descriptionLen: 0 as number,
imageList: [] as string[],
isAgreed: true as boolean,
canSubmit: false as boolean,
},
onLoad(options: any) {
if (options?.targetName) {
this.setData({
targetName: decodeURIComponent(options.targetName),
targetContext: options.targetContext || '',
targetAvatar: options.targetAvatar || '',
});
}
},
onReasonTap(e: any) {
const { id } = e.currentTarget.dataset;
const reason = this.data.reasons.find((r: any) => r.id === Number(id));
if (reason) {
this.setData({
selectedReason: reason.label,
pageStep: 2,
isAgreed: true,
});
this.updateCanSubmit();
}
},
updateCanSubmit() {
const d = this.data;
this.setData({ canSubmit: !!d.selectedReason && !!d.description && d.isAgreed && d.imageList.length > 0 });
},
onDescriptionInput(e: any) {
this.setData({
description: e.detail.value,
descriptionLen: e.detail.value.length,
});
this.updateCanSubmit();
},
onChooseImage() {
wx.chooseMedia({
count: 9 - this.data.imageList.length,
mediaType: ['image'],
sourceType: ['album', 'camera'],
success: (res: any) => {
const tempFiles = res.tempFiles || [];
const newImages = tempFiles.map((f: any) => f.tempFilePath || f.path);
this.setData({
imageList: [...this.data.imageList, ...newImages],
}, () => {
this.updateCanSubmit();
});
},
});
},
onRemoveImage(e: any) {
const { index } = e.currentTarget.dataset;
const list = [...this.data.imageList];
list.splice(index, 1);
this.setData({ imageList: list }, () => {
this.updateCanSubmit();
});
},
toggleAgree() {
this.setData({ isAgreed: !this.data.isAgreed });
this.updateCanSubmit();
},
async handleSubmit() {
if (!this.data.canSubmit) {
return;
}
if (!this.data.selectedReason) {
wx.showToast({ title: '请选择投诉原因', icon: 'none' });
return;
}
wx.showLoading({ title: '提交中...' });
try {
await request({
options: {
url: '/app/video-watch/feedback',
method: 'POST',
data: {
seeId: wx.getStorageSync("seeId") || '',
code: wx.getStorageSync("code") || '',
openId: wx.getStorageSync("openId") || '',
appId,
type: this.data.selectedReason,
description: this.data.description,
},
},
});
wx.hideLoading();
this.setData({ pageStep: 3 });
} catch (err) {
wx.hideLoading();
wx.showToast({ title: '提交失败,请重试', icon: 'none' });
}
},
handleClose() {
wx.navigateBack();
},
});
+113
View File
@@ -0,0 +1,113 @@
<!-- pages/live/report/report.wxml -->
<navigation-bar title="反馈与投诉" back="{{true}}" bind:handleBack="handleBack" color="black" background="#ffffff" />
<block wx:if="{{pageStep === 1}}">
<scroll-view class="reason-list-scroll" scroll-y>
<view class="report-page">
<!-- 举报原因列表 -->
<view class="section-header">请选择投诉原因</view>
<view class="section-card">
<view class="reason-list">
<view
wx:for="{{reasons}}"
wx:key="id"
class="reason-item"
data-id="{{item.id}}"
bind:tap="onReasonTap"
>
<text class="reason-label">{{item.label}}</text>
<view class="reason-arrow"></view>
</view>
</view>
</view>
</view>
</scroll-view>
</block>
<block wx:elif="{{pageStep === 2}}">
<view class="report-page">
<!-- 举报对象 - 小程序头像和名称 -->
<view class="section-card">
<view class="target-row">
<image class="target-avatar" src="{{'/assets/img/wchat.svg'}}" mode="aspectFill" />
<view class="target-info">
<text class="target-name">小程序</text>
<text class="target-context" wx:if="{{targetContext}}">{{targetContext}}</text>
</view>
</view>
</view>
<!-- 投诉内容卡片(合并:投诉原因、补充描述、图片证据) -->
<view class="section-card unified-card">
<!-- 已选原因 - 直接展示,不可修改 -->
<view class="selected-reason-row">
<text class="selected-reason-text">{{selectedReason}}</text>
</view>
<!-- 分隔线 -->
<view class="unified-divider"></view>
<!-- 补充描述 -->
<view class="desc-wrap">
<textarea
class="desc-textarea"
placeholder="请详细描述投诉内容,包括时间、地点、涉及人员等信息..."
maxlength="500"
value="{{description}}"
bindinput="onDescriptionInput"
auto-height
/>
<view class="char-count">{{descriptionLen}}/500</view>
</view>
<!-- 分隔线 -->
<view class="unified-divider"></view>
<!-- 图片证据 -->
<view class="section-title">
<text>图片证据</text>
<text class="evidence-tip">(最多9张,选填)</text>
</view>
<view class="upload-grid">
<view
wx:for="{{imageList}}"
wx:key="index"
class="upload-cell"
>
<image class="upload-img" src="{{item}}" mode="aspectFill" />
<view class="upload-close" data-index="{{index}}" bind:tap="onRemoveImage">✕</view>
</view>
<view class="upload-cell upload-add" wx:if="{{imageList.length < 9}}" bind:tap="onChooseImage">+</view>
</view>
</view>
<!-- 投诉须知 - 无背景,圆形选中,默认选中 -->
<view class="agreement-section">
<view class="agreement-row" bind:tap="toggleAgree">
<view class="agreement-check-circle {{isAgreed ? 'checked' : ''}}">
<text wx:if="{{isAgreed}}" class="agreement-check-icon">✓</text>
</view>
<text class="agreement-text">我已阅读并同意</text>
<text class="agreement-link">《投诉须知》</text>
</view>
</view>
</view>
<!-- 底部提交按钮 -->
<view class="bottom-bar">
<button class="submit-btn" bind:tap="handleSubmit" disabled="{{!canSubmit}}">提交</button>
</view>
</block>
<block wx:else>
<view class="report-page">
<view class="success-content">
<view class="success-icon-wrap">
<text class="success-check">✓</text>
</view>
<text class="success-title">提交成功</text>
<text class="success-desc">我们将在24小时内处理您的投诉,请耐心等待</text>
<button class="success-btn" bind:tap="handleClose">我知道了</button>
</view>
</view>
</block>