feat: 电子药箱小程序 - 4Tab药品管理
- 电子药箱: 药品库存管理 + 手动录入 + 今日用药打卡 - 药品百科: 搜索 + 分类筛选 + 20种药品静态数据 - 惠教中心: 4条药品使用指南课程 - 我的: 家庭成员信息管理 - 自定义TabBar + navigation-bar组件 - SVG药品分类插图
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"backgroundTextStyle": "light",
|
||||
"backgroundColor": "#ffffff",
|
||||
"navigationBarShareAppMessage": false,
|
||||
"navigationBarShareTimeline": false,
|
||||
"usingComponents": {
|
||||
"navigation-bar": "/components/navigation-bar/navigation-bar"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
@import "../../../variables";
|
||||
/* pages/live/registration.wxss */
|
||||
.page-result {
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
padding-top: 180rpx;
|
||||
.clock-icon,
|
||||
.success-container,
|
||||
.forbid-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
image {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
.success-icon {
|
||||
width: 240rpx;
|
||||
height: 240rpx;
|
||||
/* 使用滤镜改变颜色为 #0dc70d 绿色 */
|
||||
filter: brightness(0) saturate(100%) invert(48%) sepia(99%) saturate(748%) hue-rotate(90deg) brightness(90%) contrast(85%);
|
||||
}
|
||||
}
|
||||
|
||||
.text-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
text {
|
||||
margin-bottom: 20rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
}
|
||||
.info {
|
||||
margin-top: 80rpx;
|
||||
width: 90%;
|
||||
text-align: center;
|
||||
z-index: 9999;
|
||||
font-size: 20px;
|
||||
color: #c6c6c6;
|
||||
}
|
||||
.color-green {
|
||||
color: #0dc70d;
|
||||
}
|
||||
.userinfo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 15vh;
|
||||
border: 1px solid #ccc;
|
||||
padding: 30rpx ;
|
||||
border-radius: 25rpx;
|
||||
.choose-avatar {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
background: none;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
button::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 113rpx;
|
||||
height: 113rpx;
|
||||
border-radius: 50%;
|
||||
border: 2px solid $primary-color;
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
.nickname {
|
||||
width: 300rpx;
|
||||
margin-left: $primary-gap;
|
||||
font-size: $large-font-size;
|
||||
font-weight: 800;
|
||||
}
|
||||
.refresh {
|
||||
width: 150rpx;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
text-align: center;
|
||||
border-radius: 25rpx;
|
||||
border: 1px solid $primary-color;
|
||||
color: $primary-color;
|
||||
font-size: $large-font-size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
import UrlParamsHandler from "../../../utils/store";
|
||||
import { appversion, version } from "../../../env";
|
||||
import { request } from "../../../utils/request";
|
||||
const defaultAvatarUrl =
|
||||
"https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0";
|
||||
// pages/live/registration/registration.ts
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
userInfo: {
|
||||
avatarUrl: wx.getStorageSync("avatarUrl") || defaultAvatarUrl,
|
||||
nickName: wx.getStorageSync("userName") || "未登录用户",
|
||||
},
|
||||
state: -1,
|
||||
info: "",
|
||||
content: "",
|
||||
},
|
||||
|
||||
async register(state: string) {
|
||||
const app = getApp<IAppOption>();
|
||||
const bool = await app.login("register");
|
||||
if (!bool) return;
|
||||
const params = {
|
||||
openId: wx.getStorageSync("openId"),
|
||||
state,
|
||||
};
|
||||
|
||||
return await request({
|
||||
options: {
|
||||
url: "/app/watch/register?version=" + version.register,
|
||||
data: params,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
async registers(code: string) {
|
||||
const app = getApp<IAppOption>();
|
||||
const bool = await app.login("register");
|
||||
if (!bool) return;
|
||||
const params = {
|
||||
openId: wx.getStorageSync("openId"),
|
||||
code,
|
||||
};
|
||||
const data = await request({
|
||||
options: {
|
||||
url: `/app/video-watch/details?version=${version.details}&appVer=${appversion}`,
|
||||
method: "GET",
|
||||
data: params,
|
||||
},
|
||||
});
|
||||
|
||||
if (!data.watch.url) {
|
||||
this.setData({
|
||||
content: data.watch.content,
|
||||
state: -1,
|
||||
});
|
||||
} else {
|
||||
wx.redirectTo({
|
||||
url: `/pages/live/video/video?openId=${params.openId}&code=${params.code}&seeId=${data.watch.id}`,
|
||||
});
|
||||
}
|
||||
},
|
||||
async refresh() {
|
||||
const params = {
|
||||
openId: wx.getStorageSync("openId"),
|
||||
code: wx.getStorageSync("code"),
|
||||
};
|
||||
const res = await request({
|
||||
options: {
|
||||
url: "/app/video-watch/refresh",
|
||||
method: "GET",
|
||||
data: params,
|
||||
},
|
||||
});
|
||||
if (res.pass)
|
||||
wx.redirectTo({
|
||||
url: `/pages/live/video/video?openId=${params.openId}&code=${params.code}`,
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
async onLoad(options: any) {
|
||||
new UrlParamsHandler(options);
|
||||
wx.hideShareMenu({
|
||||
menus: ["shareAppMessage"], // 单独禁用好友分享
|
||||
});
|
||||
if (options.code && !options.content) {
|
||||
this.registers(options.code);
|
||||
}
|
||||
if (options.state && typeof options.state != "number" && !options.content) {
|
||||
const res = await this.register(options.state);
|
||||
if (res.code == 200) {
|
||||
this.setData({
|
||||
state: res.data.state,
|
||||
info: res.data.info,
|
||||
});
|
||||
}
|
||||
}
|
||||
if (options.content) {
|
||||
this.setData({
|
||||
content: options.content,
|
||||
state: options.state,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {},
|
||||
});
|
||||
@@ -0,0 +1,54 @@
|
||||
<!--pages/live/registration/registration.wxml-->
|
||||
<navigation-bar title="会员认证" back="{{false}}" color="black" background="#FFF" />
|
||||
|
||||
<view class="page-result">
|
||||
<block wx:if="{{!content && state === -1}}"></block>
|
||||
<block wx:elif="{{state === 1}}">
|
||||
<view class="clock-icon">
|
||||
<image src="/assets/img/clock.svg" mode="aspectFit" />
|
||||
</view>
|
||||
<view class="text-group">
|
||||
<text class="color-gray">审核中...</text>
|
||||
<text class="color-gray">恭喜您成功参与福利!</text>
|
||||
<text class="color-gray">请联系群主审核即可!</text>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<block wx:elif="{{state === 2}}">
|
||||
<view class="success-container">
|
||||
<image class="success-icon" src="/assets/img/success.svg" mode="aspectFit" />
|
||||
<text class="color-green">认证已通过</text>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<block wx:elif="{{state === 4}}">
|
||||
<image src="/assets/img/600.jpg" mode="widthFix" />
|
||||
</block>
|
||||
|
||||
<block wx:elif="{{content}}">
|
||||
<view class="forbid-container" wx:if="{{state > 0}}">
|
||||
<image src="/assets/img/forbid.svg" mode="aspectFit" />
|
||||
<view style="white-space:pre-wrap">{{content}}</view>
|
||||
</view>
|
||||
<block wx:if="{{state < 0}}">
|
||||
<view class="userinfo" >
|
||||
<button class="choose-avatar">
|
||||
<image class="avatar" src="{{userInfo.avatarUrl}}" />
|
||||
</button>
|
||||
<view class="nickname">{{userInfo.nickName}}</view>
|
||||
<view class="refresh" bind:tap="refresh">刷新</view>
|
||||
</view>
|
||||
<view style="white-space:pre-wrap">{{content}}</view>
|
||||
</block>
|
||||
</block>
|
||||
|
||||
<block wx:else>
|
||||
<view class="forbid-container">
|
||||
<image src="/assets/img/forbid.svg" mode="aspectFit" />
|
||||
<text>暂无法访问该功能,如有疑问请联系客服</text>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<view class="info" wx:if="{{info}}">{{info}}</view>
|
||||
|
||||
</view>
|
||||
Reference in New Issue
Block a user