封装脸部护理跳转框

master
qsj 2 years ago
parent 21875f2c5e
commit c31d291cf6

@ -27,6 +27,8 @@ export default defineAppConfig({
"pages/webViewPage/webViewPage", "pages/webViewPage/webViewPage",
'pages/template/template', 'pages/template/template',
'pages/face_report/face_report', 'pages/face_report/face_report',
'pages/face_report_one/face_report_one',
'pages/face_report_AllDevice/face_report_AllDevice',
"pages/connection_help/connection_help", "pages/connection_help/connection_help",
"pages/errorpage/errorpage", "pages/errorpage/errorpage",
], ],

@ -2,7 +2,7 @@ import Taro from "@tarojs/taro";
import classnames from "classnames"; import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react"; import { Component, PropsWithChildren, useEffect, useState } from "react";
import { Progress } from "@antmjs/vantui"; import { Progress } from "@antmjs/vantui";
import { showModal } from "../../utils/traoAPI.js"; import { showModal } from "../../utils/traoAPI";
import { Tab, Tabs, Dialog, Popup } from "@antmjs/vantui"; import { Tab, Tabs, Dialog, Popup } from "@antmjs/vantui";
import { import {
Block, View, Text, Image, Input, Button, Textarea, Block, View, Text, Image, Input, Button, Textarea,
@ -65,6 +65,7 @@ export default class Index extends Component<any, any> {
data["instrumentId"] = id; data["instrumentId"] = id;
} }
let res = await InstrumentInfo.apiNursingLog.getStatistics(data); let res = await InstrumentInfo.apiNursingLog.getStatistics(data);
if (res.data.code === 200) { if (res.data.code === 200) {
this.setState({ statistics: res.data.data }); this.setState({ statistics: res.data.data });
} }
@ -252,8 +253,9 @@ delImg(i) {
} }
} }
async onLoad(options) { async onLoad(options) {
console.log(options,'查看传过来的参数');
let Bool = JSON.parse(options?.report) let Bool = JSON.parse(options?.report)
console.log('传过来的东西',options,Bool);
if(!Bool ){ if(!Bool ){
this.setState({ this.setState({
reportShow:Bool reportShow:Bool

@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: "模板页",
});

@ -0,0 +1,44 @@
import Taro from "@tarojs/taro";
import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import { Block, View, Text, Image, Input, Button } from "@tarojs/components";
import Navbar from "@/components/navbar/navbar";
import "./face_report_AllDevice.less";
export default class Index extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
name: "页面待开发",
};
}
async onLoad() {}
componentDidMount() {}
componentWillUnmount() {}
componentDidShow() {}
componentDidHide() {}
async initData() {}
customBack = () => {
Taro.navigateBack();
};
render() {
let { name } = this.state;
return (
<Block>
<Navbar
titleSlot="待开发页面"
isBack
isCustomBack
customBack={this.customBack}
/>
<View>{name}</View>
</Block>
);
}
}

@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: "模板页",
});

@ -0,0 +1,353 @@
page {
background: #f8f8f8;
}
.time {
font-size: 36rpx;
font-weight: 500;
color: #000000;
margin: 38rpx 0;
}
.m-x-30 {
margin-right: 30rpx;
margin-left: 30rpx;
background: #fff;
}
.statistic {
height: 200rpx;
background: #ffffff;
border-radius: 30rpx;
text-align: center;
margin-bottom: 20rpx;
margin-top: 32rpx;
}
.statistic_item {
flex: 1;
border-right: 1rpx solid #dddddd;
}
.statistic_title {
font-size: 48rpx;
font-weight: 600;
color: #000000;
margin-bottom: 26rpx;
height: 37rpx;
line-height: 1;
}
.num {
font-size: 26rpx;
font-weight: 500;
margin-left: 13rpx;
}
.statistic_desc {
font-size: 26rpx;
font-weight: 500;
color: #999999;
line-height: 36rpx;
}
.statistic_item:last-child {
border: none;
}
.bottom-title{
margin-right: 30rpx;
margin-left: 30rpx;
margin-top: 27rpx;
}
.text-title{
font-size: 18rpx;
color: #999999;
}
.main {
border-radius: 30rpx;
overflow: hidden;
// padding-bottom: calc(153rpx + env(safe-area-inset-bottom));
}
.main_title {
font-size: 32rpx;
font-weight: bold;
color: #000;
// margin: 48rpx 0 34rpx;
}
.eacharts{
background-color: red;
margin-top: 14px;
margin-bottom: 45rpx;
/* margin: 52rpx 0rpx; */
width: 100%;
height: 247rpx;
}
.van-popup {
border-radius: 30rpx;
.popBox {
box-sizing: border-box;
width: 670rpx;
height: 840rpx;
background: #ffffff;
border-radius: 30rpx;
position: relative;
padding: 42rpx 30rpx 0;
.close_icon {
position: absolute;
width: 50rpx;
height: 50rpx;
top: 34rpx;
right: 34rpx;
}
.popTitle {
font-size: 36rpx;
text-align: center;
font-family: PingFang SC;
font-weight: bold;
}
.popSubtitle {
display: flex;
justify-content: center;
align-items: flex-end;
font-size: 28rpx;
text-align: center;
margin-top: 50rpx;
.bold {
font-size: 38rpx;
font-weight: bold;
}
}
.img_box {
margin: 58rpx 0 37rpx 0;
display: flex;
flex-wrap: wrap;
.img {
position: relative;
margin-right: 35rpx;
width: 180rpx;
height: 180rpx;
.closeImg {
position: absolute;
top: 10rpx;
right: 10rpx;
width: 30rpx;
}
}
.img:last-child {
margin-right: 0;
}
.addBox {
width: 180rpx;
height: 180rpx;
background: #ffffff;
border: 1px solid #dddddd;
border-radius: 20rpx;
display: flex;
justify-content: center;
align-items: center;
Image {
width: 40rpx;
}
}
.showImg {
width: 100% !important;
height: 100% !important;
border-radius: 20rpx;
}
}
.info4 {
position: relative;
textarea {
padding: 28rpx 30rpx;
width: 610rpx;
height: 186rpx;
background: #ffffff;
border: 1px solid #dddddd;
border-radius: 3rpx;
box-sizing: border-box;
}
.tip {
position: absolute;
right: 20rpx;
bottom: 22rpx;
font-size: 22rpx;
font-family: PingFang SC;
font-weight: 500;
color: #cccccc;
}
}
.btn1 {
font-style: normal;
width: 270rpx;
height: 90rpx;
line-height: 90rpx;
background: #000000;
text-align: center;
border-radius: 45rpx;
font-size: 32rpx;
font-weight: bold;
margin-top: 55rpx;
color: #ffffff;
}
}
}
.footer {
position: fixed;
z-index: 99;
bottom: 0;
width: 100%;
height: 153rpx;
box-shadow: 0rpx -3rpx 7rpx 1rpx rgba(173, 191, 207, 0.21);
background: #ffffff;
}
.btn {
width: 540rpx;
height: 90rpx;
background: #000000;
border-radius: 45rpx;
color: #fff;
text-align: center;
line-height: 90rpx;
font-weight: bold;
font-size: 32rpx;
margin: 0 30rpx 0 49rpx;
}
.text {
flex: 1;
height: 31rpx;
font-size: 32rpx;
font-weight: bold;
color: #000000;
line-height: 31rpx;
}
.text image {
width: 10rpx;
height: 20rpx;
margin-left: 15rpx;
}
.products_item {
width: 690rpx;
height: 330rpx;
background: #fff;
padding: 30rpx 33rpx 38rpx;
border-radius: 30rpx;
box-sizing: border-box;
// margin-bottom: 20rpx;
}
.products_item:last-child {
border: none;
}
.products_top {
font-size: 28rpx;
font-weight: bold;
color: #000000;
margin-bottom: 36rpx;
}
.products_top .add_time {
padding-right: 23rpx;
}
.tag {
width: 90rpx;
height: 36rpx;
line-height: 36rpx;
background: #e5f9ee;
border-radius: 18rpx;
text-align: center;
font-size: 24rpx;
font-weight: 500;
color: #57bc81;
}
.tag_active {
background: #f8f8f8;
color: #999;
}
.face_type{
text-align: center;
margin-right: 37rpx;
// margin-top: 16rpx;
font-weight: 700;
}
.cover {
width: 170rpx;
height: 211rpx;
border-radius: 20rpx;
margin-right: 37rpx;
background-color: red;
}
.content {
display: flex;
flex-flow: column;
justify-content: space-between;
background-color: #f8f8f8;
border-radius: 30rpx;
padding: 21rpx;
border-radius: 20rpx;
width: 457rpx;
height: 195rpx;
}
.content_top{
height: 140rpx;
display: flex;
flex-flow: column;
justify-content: space-between;
}
.title {
font-size: 28rpx;
font-weight: bold;
color: #000000;
margin: 3rpx 0 25rpx;
}
.desc {
font-size: 24rpx;
font-weight: 500;
color: #999999;
margin: 12rpx 0rpx;
color: #181818;
font-weight: 700;
}
// .desc:last-child {
// margin-top: 10rpx;
// }
.progress {
display: flex;
margin-top: 10rpx;
font-size: 24rpx;
font-family: PingFang SC;
font-weight: 500;
color: #999999;
align-items: center;
.van-progress {
width: 213rpx;
.van-progress__portion {
background: linear-gradient(90deg, #ffe9c7, #eecda1);
border-radius: 6rpx;
height: 12rpx;
.van-progress__pivot {
display: none;
}
}
}
.percent {
margin-left: 52rpx;
}
}

@ -0,0 +1,424 @@
import Taro from "@tarojs/taro";
import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import { Progress } from "@antmjs/vantui";
import { showModal } from "../../utils/traoAPI";
import { Tab, Tabs, Dialog, Popup } from "@antmjs/vantui";
import {
Block, View, Text, Image, Input, Button, Textarea,
} from "@tarojs/components";
import { date, getdates, previewImage } from "../../utils/util";
/** 自定义组件 **/
import Navbar from "../../components/navbar/navbar";
import PopupAlert from "../../components/popup/popup-alert";
import { InstrumentInfo } from "../../utils/Interface";
/** 自定义组件 **/
import "./face_report_one.less";
export default class Index extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
face_Tyep: '基础脸部',
reportShow: true,
name: "template模板页",
statistics: {},
recordList: [],
recordData: {},
year: new Date().getFullYear(),
show: false,
clockStatistics: [],
punchInInfo: {
clockImageList: [],
clockContent: "",
},
monthTime: [
{ month: 1, time: 0 },
{ month: 2, time: 0 },
{ month: 3, time: 0 },
{ month: 4, time: 0 },
{ month: 5, time: 0 },
{ month: 6, time: 0 },
{ month: 7, time: 0 },
{ month: 8, time: 0 },
{ month: 9, time: 0 },
{ month: 10, time: 0 },
{ month: 11, time: 0 },
{ month: 12, time: 0 },
],
};
}
componentDidMount() { }
componentWillUnmount() { }
// 打开/关闭弹窗
setShow(show: boolean) {
this.setState({ show });
}
// 查询用户护理记录的当月统计信息
async getStatistics(id) {
let data = {};
if (id != null) {
data["instrumentId"] = id;
}
let res = await InstrumentInfo.apiNursingLog.getStatistics(data);
if (res.data.code === 200) {
this.setState({ statistics: res.data.data });
}
}
async getRecord(id, recordId) {
console.log("id, recordId", id, recordId);
let data = {};
if (id != null) {
data["instrumentId"] = id;
}
let res = await InstrumentInfo.apiNursingLog.getRecord(data);
if (res.data.code === 200) {
if (recordId) {
res.data.rows.map((item) => {
item.nursingTime = this.getTime(item.nursingTime);
item.createTime = getdates(item.createTime).replace(/-/g, ".");
if (item.id == recordId) {
this.setState({ recordData: item });
}
});
} else {
this.setState({ recordData: res.data.rows[0] });
}
this.setState({
recordList: res.data.rows.filter((item) => item.id != recordId),
});
}
}
// 文本框输入文字
handleTextareaInput = (e) => {
const punchInInfo = this.state.punchInInfo;
this.setState({ punchInInfo: { ...punchInInfo, clockContent: e.detail.value } });
};
async submit() {
let punchInInfo = this.state.punchInInfo || {};
if (!punchInInfo.clockImageList.length) {
Taro.showToast({
title: "请上传图片",
icon: "none",
});
return;
}
if (!punchInInfo.clockContent) {
Taro.showToast({
title: "请输入打卡心得",
icon: "none",
});
return;
}
InstrumentInfo.apiClock.postInsertClockLog(punchInInfo).then((res) => {
showModal({
t2: "您已完成今日打卡",
btn1show: false,
}).then(() => {
let data = new Date
Taro.setStorageSync('DayTime', data.toISOString())
this.setState({
clockShow: true
})
this.getClockStatistics();
this.setShow(false);
});
});
}
/**分页获取用户的打卡记录 page size*/
async getClockStatistics(year = this.state.year) {
let res = await InstrumentInfo.apiClock.getClockStatistics({ year });
console.log(res, '查看返回', year);
if (res.data.code === 200) {
res.data.data.reverse();
if (res.data.data.length > 0) {
res.data.data.map((item, index) => {
item.isMore = false;
item.detail = [];
if (index === 0) {
item.isMore = true;
this.getList(item.id, item.year, item.month);
}
this.state.monthTime.map((monthItem) => {
if (monthItem.month == item.month) {
monthItem.time = item.clockNum;
}
});
});
this.setState({ monthTime: this.state.monthTime });
} else {
let monthTime = [
{ month: 1, time: 0 },
{ month: 2, time: 0 },
{ month: 3, time: 0 },
{ month: 4, time: 0 },
{ month: 5, time: 0 },
{ month: 6, time: 0 },
{ month: 7, time: 0 },
{ month: 8, time: 0 },
{ month: 9, time: 0 },
{ month: 10, time: 0 },
{ month: 11, time: 0 },
{ month: 12, time: 0 },
];
this.setState({ monthTime });
}
this.setState({ clockStatistics: res.data.data });
}
}
// 获取当月打卡记录
async getList(id, year, month) {
let data = {
year,
month,
};
let res = await InstrumentInfo.apiClock.getList(data);
if (res.data.code === 200) {
console.log(this.state.clockStatistics, 88888);
this.state.clockStatistics.map((item) => {
if (item.id === id) {
item.detail = res.data.data;
item.detail.map((obj) => {
obj.updateTime = getdates(obj.updateTime).replace(/-/g, ".");
});
}
});
this.setState({ clockStatistics: this.state.clockStatistics });
}
}
// 上传图片
handleChooseImage() {
Taro.chooseMedia({
count: 1,
mediaType: ["image"],
sourceType: ["album", "camera"],
success: (res) => {
const tempFilePaths = res.tempFiles.map((item) => item.tempFilePath);
tempFilePaths?.forEach((item) => {
// eslint-disable-next-line @typescript-eslint/no-shadow
InstrumentInfo.apiClock
.clockFileUpload({ clockImg: item })
.then((res) => {
const currentImage = res.data.url;
const newImageList =
this.state.punchInInfo.clockImageList.length >= 3
? this.state.punchInInfo.clockImageList
: [...this.state.punchInInfo.clockImageList, currentImage];
const punchInInfo = this.state.punchInInfo;
punchInInfo.clockImageList = newImageList;
this.setState({ punchInInfo });
});
});
},
fail: (err) => {
console.info("err", err);
},
});
}
// 删除打卡图片
delImg(i) {
const punchInInfo = this.state.punchInInfo;
punchInInfo.clockImageList.splice(i, 1);
this.setState({ punchInInfo });
}
getRouteId() {
const searchParams = new URLSearchParams(window.location.search);
const id = searchParams.get("id");
const recordId = searchParams.get("recordId");
this.getStatistics(id);
this.getRecord(id, recordId);
console.log(recordId);
}
getTime(time) {
const hour = time.slice(0, 2);
const minute = time.slice(3, 5);
const second = time.slice(6, 8);
if (hour > 0) {
return hour + "时" + minute + "分" + second + "秒";
} else {
return minute + "分" + second + "秒";
}
}
async onLoad(options) {
console.log(options, '查看传过来的参数');
let Bool = JSON.parse(options?.report)
if (!Bool) {
this.setState({
reportShow: Bool
})
}
this.getRouteId();
this.getClockStatistics()
}
componentDidShow() { }
componentDidHide() { }
async initData() { }
GoIndex = () => {
Taro.switchTab({ url: "/pages/index/index" });
};
render() {
let { name, statistics, recordList, recordData, show, clockStatistics, punchInInfo, monthTime, reportShow, face_Tyep } = this.state;
return (
<Block>
<Navbar isBack titleSlot="护理报告"></Navbar>
<View className="statistic m-x-30 flex aitems">
<View className="statistic_item">
<View className="statistic_title">
<text>{statistics.nursingNum}</text>
<text className="num"></text>
</View>
<View className="statistic_desc"></View>
</View>
<View className="statistic_item">
<View className="statistic_title">{statistics.nursingTime}</View>
<View className="statistic_desc"></View>
</View>
{/* </block> */}
</View>
<View className="main m-x-30">
<View className="products_item" style="border: none">
<View className="products_middle flex">
<View className="left">
<Image
className="cover"
src={recordData.modeImage}
mode="aspectFill"
></Image>
<View className="face_type">{face_Tyep}</View>
</View>
<View className="content">
<View className="content_top">
<View className="desc_box">
<View className="desc">{recordData.modeName}</View>
<View className="desc">
{recordData.nursingTime}
</View>
<View className="desc">
{recordData.nursingTime}
</View>
<View className="desc">
{recordData.nursingTime}
</View>
</View>
</View>
</View>
</View>
</View>
<View className="main_title">-{face_Tyep}</View>
<View className="eacharts">echarts</View>
</View>
<View className="bottom-title">
<View className="text-title">[1] :1,使11
</View>
<View className="text-title">[2]: 使</View>
<View className="text-title">[3]:使<br /></View>
<View className="text-title">[4]:<br /></View>
<View className="text-title">
[5]:</View>
</View>
{reportShow ? (
<View className="footer flex aitems">
<View className="btn" onClick={this.setShow.bind(this, true)}></View>
<View className="text flex aitems">
<View onClick={this.GoIndex}></View>
<Image
src={require("../../img/right.png")}
mode="aspectFill"
></Image>
</View>
</View>
) : null}
<Popup show={show} onClose={() => this.setState({ show: false })}>
<View className="popBox">
<Image
className="close_icon"
src={require("../../img/close.png")}
mode="widthFix"
onClick={this.setShow.bind(this, false)}
></Image>
<View className="popTitle"></View>
<View className="popSubtitle">
<View className="bold">{clockStatistics[0]?.clockNum}</View>{" "}
<View className="bold">
{(clockStatistics[0]?.percentage * 100).toFixed(1)}%
</View>
</View>
<View className="img_box">
{punchInInfo.clockImageList.map((item, index) => (
<View key={item} className="img">
<Image className="showImg" src={item} mode="widthFix"></Image>
<Image
className="closeImg"
src={require("../../img/close1.png")}
mode="widthFix"
onClick={this.delImg.bind(this, index)}
></Image>
</View>
))}
{punchInInfo.clockImageList.length < 3 && (
<View
className="addBox"
onClick={this.handleChooseImage.bind(this)}
>
<Image
className="showImg"
src={require("../../img/clock_in_upload/add-image.png")}
mode="widthFix"
></Image>
</View>
)}
</View>
<View className="info4">
<View className="content">
<Textarea
placeholderStyle="color: #ccc; font-size: 26rpx;font-weight: 400;font-family: PingFang SC;"
placeholder="请记录一下今天的护理心得吧"
maxlength={120}
onInput={this.handleTextareaInput.bind(this)}
value={punchInInfo.clockContent}
></Textarea>
</View>
<View className="tip">
{"" + (punchInInfo.clockContent.length || 0) + "/120"}
</View>
</View>
<View className="popbtnbox flex aitems jcenter">
<View className="btn1" onClick={this.submit.bind(this)}>
</View>
</View>
</View>
</Popup>
</Block>
);
}
}

@ -32,7 +32,7 @@ export default class Recording extends Component<any, any> {
this.state = { this.state = {
name: "护理历程", name: "护理历程",
current: 0, current: 0,
ViewAddInstrument:false, //用来记录有没有添加设备 ViewAddInstrument: false, //用来记录有没有添加设备
array: [1, 2, 3, 4, 5], array: [1, 2, 3, 4, 5],
recordList: [], recordList: [],
bindingInstrumentList: [], bindingInstrumentList: [],
@ -94,6 +94,7 @@ export default class Recording extends Component<any, any> {
data["instrumentId"] = id; data["instrumentId"] = id;
} }
let res = await InstrumentInfo.apiNursingLog.getRecord(data); let res = await InstrumentInfo.apiNursingLog.getRecord(data);
console.log(res, '查看你获取护理历程');
if (res.data.code === 200) { if (res.data.code === 200) {
@ -102,7 +103,7 @@ export default class Recording extends Component<any, any> {
let createTime = getdates(item.createTime) let createTime = getdates(item.createTime)
item.createTime = createTime&& createTime.replace(/-/g, "."); item.createTime = createTime && createTime.replace(/-/g, ".");
}); });
this.setState({ recordList: res.data.rows }); this.setState({ recordList: res.data.rows });
} }
@ -216,14 +217,14 @@ export default class Recording extends Component<any, any> {
}; };
let res = await InstrumentInfo.apiClock.getList(data); let res = await InstrumentInfo.apiClock.getList(data);
if (res.data.code === 200) { if (res.data.code === 200) {
console.log(res, 88888,this.state.clockStatistics,id); console.log(res, 88888, this.state.clockStatistics, id);
this.state.clockStatistics.map((item) => { this.state.clockStatistics.map((item) => {
if (item.id === id) { if (item.id === id) {
item.detail = res.data.data; item.detail = res.data.data;
item.detail.map((obj) => { item.detail.map((obj) => {
let updateTime =getdates(obj.updateTime) let updateTime = getdates(obj.updateTime)
obj.updateTime = updateTime && updateTime.replace(/-/g, "."); obj.updateTime = updateTime && updateTime.replace(/-/g, ".");
}); });
@ -292,9 +293,46 @@ export default class Recording extends Component<any, any> {
} }
}; };
// 跳转到护理报告 // 跳转到护理报告
toReport(id, recordId) { toReport(id, recordId, item) {
console.log(item, '查看类型', item.jumpType );
item.jumpType =1
switch (item.jumpType ) {
case 1:
this.One(item);
break;
case 2:
this.two(item); break;
case 3:
this.three(item); break;
default:
this.AllDevice(item);
}
// let report =false
// go("/pages/face_report/face_report?id=" + id + "&recordId=" + recordId+ "&report=" + report );
}
// 打开第一种类型
One = async (item) => {
console.log('打开第一种类型', item);
let report =false let report =false
go("/pages/face_report/face_report?id=" + id + "&recordId=" + recordId+ "&report=" + report ); go("/pages/face_report_one/face_report_one?id=" + item.id + "&recordId=" + item.recordId+ "&report=" + report );
}
// 打开第二种类型
two = async (item) => {
console.log('打开第二种类型', item);
}
// 打开第二种类型
three = async (item) => {
console.log('打开第二种类型', item);
}
// 打开其他类型
AllDevice = async (item) => {
console.log('打开其他类型', item);
go("/pages/face_report_AllDevice/face_report_AllDevice");
} }
// 上传图片 // 上传图片
handleChooseImage() { handleChooseImage() {
@ -492,13 +530,14 @@ export default class Recording extends Component<any, any> {
{item.online === 1 ? "在线" : "离线"} {item.online === 1 ? "在线" : "离线"}
</View> </View>
</View> </View>
{item.instrumentType === 1 && ( {item.instrumentType === 2 && (
<View <View
className="top-right" className="top-right"
onClick={this.toReport.bind( onClick={this.toReport.bind(
this, this,
item.instrumentId, item.instrumentId,
item.id item.id,
item,
)} )}
> >

Loading…
Cancel
Save