feat: 电子药箱小程序 - 4Tab药品管理
- 电子药箱: 药品库存管理 + 手动录入 + 今日用药打卡 - 药品百科: 搜索 + 分类筛选 + 20种药品静态数据 - 惠教中心: 4条药品使用指南课程 - 我的: 家庭成员信息管理 - 自定义TabBar + navigation-bar组件 - SVG药品分类插图
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/* components/empty/empty.wxss */
|
||||
@import "../../variables";
|
||||
|
||||
.empty {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
|
||||
.content {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
color: #333333;
|
||||
font-size: 32rpx;
|
||||
line-height: 44rpx;
|
||||
margin-top: 28rpx;
|
||||
}
|
||||
|
||||
.description {
|
||||
color: #999999;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
margin-top: 8rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.action {
|
||||
height: 54rpx;
|
||||
line-height: 54rpx;
|
||||
border-radius: 46rpx;
|
||||
min-width: 140rpx;
|
||||
padding: 0 24rpx;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
font-size: 28rpx;
|
||||
margin-top: 108rpx;
|
||||
background: linear-gradient(139deg, #ff9a33 0%, #ff7200 100%);
|
||||
}
|
||||
}
|
||||
|
||||
.empty-legacy {
|
||||
height: 60vh;
|
||||
color: $gray-color;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.empty-scene {
|
||||
min-height: 1220rpx;
|
||||
padding-top: 400rpx;
|
||||
overflow: hidden;
|
||||
background: #f5f5f5;
|
||||
|
||||
.scene-bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 982rpx;
|
||||
border-bottom-left-radius: 28rpx;
|
||||
border-bottom-right-radius: 28rpx;
|
||||
// background: linear-gradient(180deg, #ffd5af 0%, rgba(255, 255, 255, 0.2) 100%);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
// components/empty/empty.ts
|
||||
type SceneConfig = {
|
||||
title: string;
|
||||
description: string;
|
||||
icon: string;
|
||||
buttonText?: string;
|
||||
action?: string;
|
||||
imageStyle?: string;
|
||||
};
|
||||
|
||||
const SCENE_MAP: Record<string, SceneConfig> = {
|
||||
loadFail: {
|
||||
title: "加载失败",
|
||||
description: "请点击刷新重新加载试试~",
|
||||
icon: "./assets/load-failed.png",
|
||||
buttonText: "刷新",
|
||||
action: "refresh",
|
||||
imageStyle: "width: 328rpx; height: 392rpx;"
|
||||
},
|
||||
noDynamic: {
|
||||
title: "暂无动态",
|
||||
description: "这个地方空空如也~",
|
||||
icon: "./assets/no-dynamic.png",
|
||||
imageStyle: "width: 260rpx; height: 378rpx;"
|
||||
},
|
||||
noMessage: {
|
||||
title: "暂无消息",
|
||||
description: "暂无新的消息",
|
||||
icon: "./assets/no-message.png",
|
||||
imageStyle: "width: 344rpx; height: 376rpx;"
|
||||
},
|
||||
noAddress: {
|
||||
title: "暂无地址",
|
||||
description: "快去添加一个吧~",
|
||||
icon: "./assets/no-address.png",
|
||||
buttonText: "添加地址",
|
||||
action: "addAddress",
|
||||
imageStyle: "width: 264rpx; height: 392rpx;"
|
||||
},
|
||||
noArchive: {
|
||||
title: "暂无档案信息",
|
||||
description: "去添加宝贝的成长档案吧~",
|
||||
icon: "./assets/no-archive.png",
|
||||
imageStyle: "width: 388rpx; height: 408rpx;"
|
||||
}
|
||||
};
|
||||
|
||||
const DEFAULT_TITLE = "什么都没搜到";
|
||||
const DEFAULT_ICON = "../../assets/img/empty.svg";
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
scene: {
|
||||
type: String,
|
||||
value: "",
|
||||
observer: "syncScene"
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
value: DEFAULT_TITLE,
|
||||
observer: "syncScene"
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
value: "",
|
||||
observer: "syncScene"
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
value: DEFAULT_ICON,
|
||||
observer: "syncScene"
|
||||
},
|
||||
buttonText: {
|
||||
type: String,
|
||||
value: "",
|
||||
observer: "syncScene"
|
||||
},
|
||||
emptyStyle: {
|
||||
type: String,
|
||||
value: ""
|
||||
},
|
||||
imageStyle: {
|
||||
type: String,
|
||||
value: "",
|
||||
observer: "syncScene"
|
||||
}
|
||||
},
|
||||
|
||||
data: {
|
||||
sceneMode: false,
|
||||
resolvedTitle: "",
|
||||
resolvedDescription: "",
|
||||
resolvedIcon: "",
|
||||
resolvedButtonText: "",
|
||||
resolvedAction: "",
|
||||
resolvedImageStyle: ""
|
||||
},
|
||||
|
||||
lifetimes: {
|
||||
attached() {
|
||||
(this as any).syncScene();
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
syncScene() {
|
||||
const that = this as any;
|
||||
const scene = (that.data.scene || "").trim();
|
||||
const sceneConfig = scene ? SCENE_MAP[scene] : undefined;
|
||||
const title = that.data.title || "";
|
||||
const description = that.data.description || "";
|
||||
const icon = that.data.icon || "";
|
||||
const buttonText = that.data.buttonText || "";
|
||||
const imageStyle = that.data.imageStyle || "";
|
||||
|
||||
that.setData({
|
||||
sceneMode: !!sceneConfig,
|
||||
resolvedTitle: sceneConfig && title === DEFAULT_TITLE ? sceneConfig.title : (title || sceneConfig?.title || DEFAULT_TITLE),
|
||||
resolvedDescription: sceneConfig && !description ? sceneConfig.description : description,
|
||||
resolvedIcon: sceneConfig && icon === DEFAULT_ICON ? sceneConfig.icon : (icon || sceneConfig?.icon || DEFAULT_ICON),
|
||||
resolvedButtonText: sceneConfig && !buttonText ? (sceneConfig.buttonText || "") : buttonText,
|
||||
resolvedAction: sceneConfig?.action || "",
|
||||
resolvedImageStyle: sceneConfig && !imageStyle ? (sceneConfig.imageStyle || "") : imageStyle
|
||||
});
|
||||
},
|
||||
|
||||
handleAction() {
|
||||
const that = this as any;
|
||||
that.triggerEvent("action", {
|
||||
scene: that.data.scene,
|
||||
action: that.data.resolvedAction
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
<!--components/empty/empty.wxml-->
|
||||
<view class="empty {{sceneMode ? 'empty-scene' : 'empty-legacy'}}" style="{{emptyStyle}}">
|
||||
<view wx:if="{{sceneMode}}" class="scene-bg"></view>
|
||||
<view class="content">
|
||||
<view class="icon" style="{{resolvedImageStyle}}">
|
||||
<image src="{{resolvedIcon}}" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="title">{{resolvedTitle}}</view>
|
||||
<view class="description" wx:if="{{resolvedDescription}}">{{resolvedDescription}}</view>
|
||||
<view class="action" wx:if="{{resolvedButtonText}}" bind:tap="handleAction">{{resolvedButtonText}}</view>
|
||||
</view>
|
||||
</view>
|
||||
Reference in New Issue
Block a user