对接接口

master
rongweikang 2 years ago
parent 834fbb1394
commit cfbe62e194

@ -16,7 +16,7 @@ page {
color: #666; color: #666;
padding: 0 32rpx; padding: 0 32rpx;
position: sticky; position: sticky;
top: 176rpx; top: 174rpx;
z-index: 9; z-index: 9;
} }
@ -176,6 +176,7 @@ page {
color: #999; color: #999;
} }
// .instrument_item { // .instrument_item {
// margin-top: 20rpx; // margin-top: 20rpx;
// background: #ffffff; // background: #ffffff;
@ -207,10 +208,10 @@ page {
// text-align: center; // text-align: center;
// } // }
// .tag_active { .tag_active {
// background: #f8f8f8; background: #f8f8f8;
// color: #999; color: #999;
// } }
// .report_btn { // .report_btn {
// font-size: 26rpx; // font-size: 26rpx;
@ -527,8 +528,6 @@ page {
.top-left { .top-left {
display: flex; display: flex;
.date { .date {
width: 131rpx;
height: 22rpx;
font-size: 28rpx; font-size: 28rpx;
font-weight: bold; font-weight: bold;
color: #000000; color: #000000;
@ -574,25 +573,29 @@ page {
margin-right: 38rpx; margin-right: 38rpx;
} }
.bottom-right { .bottom-right {
padding: 4rpx 0 3rpx; display: flex;
flex-flow: column;
justify-content: space-between;
height: 140rpx;
.title { .title {
font-size: 28rpx; font-size: 28rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: bold; font-weight: bold;
color: #000000; color: #000000;
margin-bottom: 10rpx;
} }
.subtitle-box { .subtitle-box {
display: flex; display: flex;
flex-flow: column; flex-flow: column;
justify-content: space-between; justify-content: space-between;
height: 65rpx; // height: 65rpx;
.subtitle { .subtitle {
font-size: 24rpx; font-size: 24rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: #999999; color: #999999;
margin-top: 11rpx; }
.subtitle:last-child{
margin-top: 10rpx;
} }
} }
} }

@ -3,7 +3,7 @@ import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react"; import { Component, PropsWithChildren, useEffect, useState } from "react";
import { Block, View, Text, Image, Input, Button, ScrollView, Picker } from "@tarojs/components"; import { Block, View, Text, Image, Input, Button, ScrollView, Picker } from "@tarojs/components";
import { go } from "@/utils/traoAPI";
import { Tab, Tabs } from "@antmjs/vantui"; import { Tab, Tabs } from "@antmjs/vantui";
/** 自定义组件 **/ /** 自定义组件 **/
@ -11,6 +11,9 @@ import Navbar from "../../components/navbar/navbar";
import PopupAlert from "../../components/popup/popup-alert"; import PopupAlert from "../../components/popup/popup-alert";
/** 自定义组件 **/ /** 自定义组件 **/
import { InstrumentInfo } from '../../utils/Interface'
import { date, getdates, previewImage } from "../../utils/util";
import "./recording.less"; import "./recording.less";
export default class Recording extends Component<any, any> { export default class Recording extends Component<any, any> {
@ -20,30 +23,125 @@ export default class Recording extends Component<any, any> {
name: "护理历程", name: "护理历程",
current: 0, current: 0,
array: [1, 2, 3, 4, 5], array: [1, 2, 3, 4, 5],
recordList: [],
bindingInstrumentList: [],
curIndex: null,
clockStatistics: [],
statistics:[],
year:new Date().getFullYear(),
today: new Date()
}; };
} }
async onLoad() { }
componentDidMount() { } componentDidMount() { }
componentWillUnmount() { } componentWillUnmount() { }
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 getBindingInstrumentList() {
let res = await InstrumentInfo.bindingInstrumentList()
if (res.data.code === 200) {
this.setState({ bindingInstrumentList: res.data.data })
}
}
async getRecord(id) {
let data = {}
if (id != null) {
data['instrumentId'] = id
}
let res = await InstrumentInfo.nursingLog.getRecord(data)
if (res.data.code === 200) {
res.data.rows.map(item => {
item.nursingTime = this.getTime(item.nursingTime)
item.createTime = getdates(item.createTime).replace(/-/g, '.')
})
this.setState({ recordList: res.data.rows })
}
}
/**分页获取用户的打卡记录 page size*/
async getClockStatistics(year=this.state.year) {
let res = await InstrumentInfo.clock.getClockStatistics({year})
if (res.data.code === 200) {
res.data.data.reverse()
res.data.data.map(item=>{
item.isMore = false
})
this.setState({ clockStatistics: res.data.data })
}
}
// 查询用户护理记录的当月统计信息
async getStatistics(id) {
let data = {}
if (id != null) {
data['instrumentId'] = id
}
let res = await InstrumentInfo.nursingLog.getStatistics(data)
// if (res.data.code === 200) {
// this.setState({ statistics: res.data.rows })
// }
}
onChangeProduct(id) {
this.setState({ curIndex: id })
this.getRecord(id)
};
onChangeMore(id){
this.state.clockStatistics.map(item=>{
if(item.id === id){
item.isMore = !item.isMore
}
})
this.setState({ clockStatistics:this.state.clockStatistics})
}
async onLoad() {
this.getRecord(null)
this.getBindingInstrumentList()
}
componentDidShow() { } componentDidShow() { }
componentDidHide() { } componentDidHide() { }
async initData() { } async initData() { }
onChangeYear() { } onChangeYear(event) {
this.setState({ year: event.detail.value})
this.getClockStatistics(event.detail.value)
}
onTab = async (event) => { onTab = async (event) => {
const { current } = event.currentTarget.dataset; const { current } = event.currentTarget.dataset;
console.log("current", current);
this.setState({ current }); this.setState({ current });
if (current === 1) {
this.getClockStatistics()
}
}; };
toReport() {
go("/pages/face_report/face_report");
}
render() { render() {
let { current, array, name } = this.state; let { current, array, name, recordList, bindingInstrumentList, curIndex, clockStatistics,statistics,year,today } = this.state;
return ( return (
<Block> <Block>
<Navbar isBack titleSlot='护理记录'></Navbar> <Navbar isBack titleSlot='护理记录'></Navbar>
@ -68,16 +166,24 @@ export default class Recording extends Component<any, any> {
</View> </View>
</View> </View>
{current === 0 && <ScrollView className='products_list' scroll-x='true' > {current === 0 && <ScrollView className='products_list' scroll-x='true' >
<View className="{{!curIndex ? 'all products_item_active' : 'all'}}" data-id='{{0}}' > <View className={classnames("all", {
</View> products_item_active: !curIndex,
<View className="{{curIndex === item.id ? 'products_item products_item_active' : 'products_item'}}" })} onClick={this.onChangeProduct.bind(this, null)}
data-id='{{item.id}}' >
>
<Image className='products_cover'
src={require("../../img/test/1706692819894.jpg")} mode='aspectFit'
></Image>
<View className='products_title'></View>
</View> </View>
{bindingInstrumentList.map((item: any, index: any) => (
<View key={item.id}
className={classnames("products_item", {
products_item_active: curIndex === item.id,
})}
onClick={this.onChangeProduct.bind(this, item.id)}
>
<Image className='products_cover'
src={require("../../img/test/1706692819894.jpg")} mode='aspectFit'
></Image>
<View className='products_title'></View>
</View>
))}
</ScrollView>} </ScrollView>}
{current === 0 && {current === 0 &&
@ -94,7 +200,7 @@ export default class Recording extends Component<any, any> {
</View> </View>
)} )}
{current === 0 && ( {current === 0 && (
<View> <View style='padding-bottom:200px'>
{/* <View className='instrument_item' > {/* <View className='instrument_item' >
<View className='instrument_top flex sb aitems'> <View className='instrument_top flex sb aitems'>
<View className='time_box flex aitems'> <View className='time_box flex aitems'>
@ -122,38 +228,42 @@ export default class Recording extends Component<any, any> {
</View> */} </View> */}
<View className='instrument_list '>
{array.map((item: any, index: any) => ( {recordList.map((item: any, index: any) => (
<View className='recording-box' key={index}> <View className='recording-box' key={item.id}>
<View className='box-top'> <View className='box-top'>
<View className='top-left'> <View className='top-left'>
<View className='date'>2024.1.31</View> <View className='date'>{item.createTime}</View>
<View className='tip'>线</View> <View className={classnames("tip", {
</View> tag_active: item.online === 0,
<View className='top-right'> })}
>{item.online ? '在线' : '离线'}</View>
<Image className='arrow_icon' src={require("../../img/index/right.png")} mode='aspectFill'></Image> </View>
<View className='top-right' onClick={this.toReport}>
<Image className='arrow_icon' src={require("../../img/index/right.png")} mode='aspectFill'></Image>
</View>
</View> </View>
</View> <View className='box-bottom'>
<View className='box-bottom'> <Image
<Image className='recording_img'
className='recording_img' src={item.modeImage}
src={require("../../img/test/1706667011027.jpg")} ></Image>
></Image> <View className='bottom-right'>
<View className='bottom-right'> <View className='title'>{item.instrumentName}</View>
<View className='title'></View> <View className='subtitle-box'>
<View className='subtitle-box'> <View className='subtitle'>{item.modeName}</View>
<View className='subtitle'></View> <View className='subtitle'>{item.nursingTime}</View>
<View className='subtitle'>1500</View> </View>
</View> </View>
</View> </View>
</View> </View>
</View> ))}
))} </View>
</View> </View>
)} )}
{current === 1 && ( {current === 1 && (
<View > <View style='padding-bottom:200px'>
{/* <View className='nodata'> {/* <View className='nodata'>
<Image <Image
className='nodata_img' className='nodata_img'
@ -165,9 +275,9 @@ export default class Recording extends Component<any, any> {
<View className='clock_in_statistics m-x-30 flex sb'> <View className='clock_in_statistics m-x-30 flex sb'>
<View className='flex sb ab'> <View className='flex sb ab'>
<View className='clock_in_statistics_title'></View> <View className='clock_in_statistics_title'></View>
<Picker mode='date' fields='year' onChange={this.onChangeYear} value='2024' end='{{today}}'> <Picker mode='date' fields='year' onChange={this.onChangeYear.bind(this)} value='{{year}}' end='{{today}}'>
<View className='clock_in_statistics_date flex aitems'> <View className='clock_in_statistics_date flex aitems'>
<View>2024</View> <View>{year}</View>
<Image className='more_icon' src={require('../../img/arrow-down.png')} mode='widthFix'></Image> <Image className='more_icon' src={require('../../img/arrow-down.png')} mode='widthFix'></Image>
</View> </View>
</Picker> </Picker>
@ -182,39 +292,47 @@ export default class Recording extends Component<any, any> {
</View> </View>
<View style='padding-bottom: env(safe-area-inset-bottom)' > <View style='padding-bottom: env(safe-area-inset-bottom)' >
<View className='month_box m-x-30'> <View className='month_box m-x-30'>
<View className='month_statistics'> {clockStatistics.map(item => (
<View className='flex aitems sb'> <View className='month_statistics' key={item.id}>
<View className='time'>20241</View> <View className='flex aitems sb'>
<View data-item='{{item}}' data-index='{{index}}' className='more_box flex aitems' > <View className='time'>{item.year}{item.month}</View>
<View className='more_text'> </View> <View className='more_box flex aitems' onClick={this.onChangeMore.bind(this,item.id)}>
<Image style='transform: rotate({{ item.isMore ? 180 : 0 }}deg)' className='more_icon' <View className='more_text'> {!item.isMore ? '展开更多' : '收起更多'}</View>
src={require("../../img/arrow-down.png")} mode='widthFix' <Image style={{transform: (item.isMore) ? 'rotate(180deg)':'rotate(0deg)'}} className='more_icon'
></Image> src={require("../../img/arrow-down.png")} mode='widthFix'
</View> ></Image>
</View> </View>
<View style='height: 59rpx'></View> </View>
<View className='statistic'> <View style='height: 59rpx'></View>
<View className='statistic_item'> <View className='statistic'>
<View className='statistic_num'>10</View> <View className='statistic_item'>
<View className='statistic_desc'></View> <View className='statistic_num'>{item.clockNum}</View>
</View> <View className='statistic_desc'></View>
<View className='statistic_item'> </View>
<View className='statistic_num'>80%</View> <View className='statistic_item'>
<View className='statistic_desc'></View> <View className='statistic_num'>{item.percentage*100}%</View>
<View className='statistic_desc'></View>
</View>
<View className='border'></View>
</View>
{ item.isMore&&
<View>
<View style='height: 57rpx' ></View>
<View className='month_item'>
<View className='month_item_date'>2024.5.23</View>
<View className='month_image_box flex sb'>
<Image className='month_item_cover' src={require("../../img/test/1706667011027.jpg")} ></Image>
</View>
<View className='month_item_date'>PRO </View>
<View className='month_item_note'></View>
</View>
</View>
}
</View> </View>
<View className='border'></View> ))
</View> }
<View style='height: 57rpx'></View>
<View className='month_item'>
<View className='month_item_date'>2024.5.23</View>
<View className='month_image_box flex sb'>
<Image className='month_item_cover' src={require("../../img/test/1706667011027.jpg")} ></Image>
</View>
<View className='month_item_date'>PRO </View>
<View className='month_item_note'></View>
</View>
</View>
</View> </View>
</View> </View>
</View> </View>
)} )}

Loading…
Cancel
Save