bug修改bug

master
qsj 2 years ago
parent ce09d36d6b
commit 3ee4341aaa

@ -66,6 +66,114 @@ page {
margin: 48rpx 0 34rpx;
}
.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;
.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: 180rpx;
height: 180rpx;
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;

@ -2,8 +2,11 @@ import Taro from "@tarojs/taro";
import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import { Progress } from "@antmjs/vantui";
import { Block, View, Text, Image, Input, Button } from "@tarojs/components";
import { showModal } from "../../utils/traoAPI.js";
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";
/** 自定义组件 **/
@ -22,13 +25,38 @@ export default class Index extends Component<any, any> {
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() {}
componentDidMount() { }
componentWillUnmount() {}
componentWillUnmount() { }
// 打开/关闭弹窗
setShow(show: boolean) {
this.setState({ show });
}
// 查询用户护理记录的当月统计信息
async getStatistics(id) {
let data = {};
@ -67,7 +95,142 @@ export default class Index extends Component<any, any> {
});
}
}
// 文本框输入文字
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");
@ -89,20 +252,21 @@ export default class Index extends Component<any, any> {
}
async onLoad() {
this.getRouteId();
this.getClockStatistics()
}
componentDidShow() {}
componentDidShow() { }
componentDidHide() {}
componentDidHide() { }
async initData() {}
async initData() { }
GoIndex = () => {
Taro.switchTab({ url: "/pages/index/index" });
};
render() {
let { name, statistics, recordList, recordData } = this.state;
let { name, statistics, recordList, recordData, show,clockStatistics,punchInInfo,monthTime } = this.state;
return (
<Block>
<Navbar isBack titleSlot="护理报告"></Navbar>
@ -223,7 +387,7 @@ export default class Index extends Component<any, any> {
</View>
<View className="footer flex aitems">
<View className="btn"></View>
<View className="btn" onClick={this.setShow.bind(this, true)}></View>
<View className="text flex aitems">
<View onClick={this.GoIndex}></View>
<Image
@ -232,6 +396,70 @@ export default class Index extends Component<any, any> {
></Image>
</View>
</View>
<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>
);
}

@ -108,6 +108,7 @@ class Index extends Component<any, any> {
BeforeBindingErrorText: "", // 绑定前校验错误文本
instrumentList: [], // 仪器列表
ViewAddInstrument: true, // 查看是否添加有仪器
unbindingInstrumentList: [], // 未绑定仪器列表
instrumentInfo: {
// 扫码获得的序列号仪器
@ -407,7 +408,9 @@ class Index extends Component<any, any> {
// 护理记录
toNursingRecords = () => {
go("/pages/recording/recording");
let { ViewAddInstrument } = this.state;
// go(`/pages/recording/recording?param1=${param1Value}`);
go(`/pages/recording/recording?param=${ViewAddInstrument}`);
};
gourl = (e) => {
@ -473,8 +476,13 @@ class Index extends Component<any, any> {
mask: true,
});
let { data: res } = await InstrumentInfo.bindingInstrumentList();
Taro.hideLoading();
console.log(res,'查看绑定的设备');
// Taro.hideLoading();
if (res.code === 200) {
if(res.data.length === 0){
this.setState({ ViewAddInstrument: false });
}
this.setState({ instrumentList: res.data });
} else {
// 仪器列表失败todo
@ -951,6 +959,7 @@ class Index extends Component<any, any> {
isExchangeBinding,
instrumentInfo,
instrumentList,
ViewAddInstrument,
showEquipment,
// 升级弹窗

@ -55,7 +55,7 @@ export default class InstrumentClickInUpload extends Component<any, any> {
secondClockImg: null,
thirdClockImg: null,
},
clockcontents: "",
// 现在选中的数据
currentInfo: {
modeVideo: "",
@ -122,6 +122,7 @@ export default class InstrumentClickInUpload extends Component<any, any> {
};
// 获取最新一条打卡记录
getLatestClockRecord = async () => {
let { punchInInfo } = this.state;
let res = await InstrumentInfo.apiClock.getLatestClockRecord();
if (res.data.code === 200) {
@ -260,8 +261,10 @@ export default class InstrumentClickInUpload extends Component<any, any> {
videoLoadedMetaData = async () => {};
handleTextareaInput = async (e) => {
this.setState({ punchInInfo: { clockContent: e.detail.value } });
handleTextareaInput = (e) => {
const punchInInfo = this.state.punchInInfo;
this.setState({ punchInInfo: { ...punchInInfo,clockContent: e.detail.value } });
};
onModeLockOpen = async () => {
@ -292,7 +295,7 @@ export default class InstrumentClickInUpload extends Component<any, any> {
punchInInfo,
isTipShow,
currentInfo,
clockcontents,
clockcontent,
modeInfo,
nurseInfo,
isModeLock,
@ -304,7 +307,6 @@ export default class InstrumentClickInUpload extends Component<any, any> {
stepIndex,
autoPlay,
sysInfo,
clockContent,
} = this.state;
return (
<Block>
@ -476,7 +478,7 @@ export default class InstrumentClickInUpload extends Component<any, any> {
placeholder-className="placeh和给g'holder"
maxlength={100}
onInput={this.handleTextareaInput}
value={clockcontents}
value={punchInInfo.clockContent}
placeholder="请记录一下今天打卡的心得吧~"
></Textarea>
{/* {tipshow && (
@ -488,6 +490,7 @@ export default class InstrumentClickInUpload extends Component<any, any> {
)} */}
<View className="tips-num">
{punchInInfo.clockContent.length}/100
{/* {punchInInfo.clockContent.length}/100 */}
</View>
</View>
</View>

@ -32,9 +32,11 @@ export default class Recording extends Component<any, any> {
this.state = {
name: "护理历程",
current: 0,
ViewAddInstrument:false, //用来记录有没有添加设备
array: [1, 2, 3, 4, 5],
recordList: [],
bindingInstrumentList: [],
clockShow: false,
curIndex: null,
clockStatistics: [],
statistics: [],
@ -62,9 +64,9 @@ export default class Recording extends Component<any, any> {
};
}
componentDidMount() {}
componentDidMount() { }
componentWillUnmount() {}
componentWillUnmount() { }
// 格式化时间
getTime(time) {
const hour = time.slice(0, 2);
@ -86,15 +88,21 @@ export default class Recording extends Component<any, any> {
}
// 获取护理历程
async getRecord(id) {
let data = {};
if (id != null) {
data["instrumentId"] = id;
}
let res = await InstrumentInfo.apiNursingLog.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, ".");
let createTime = getdates(item.createTime)
item.createTime = createTime&& createTime.replace(/-/g, ".");
});
this.setState({ recordList: res.data.rows });
}
@ -133,7 +141,9 @@ export default class Recording extends Component<any, any> {
/**分页获取用户的打卡记录 page size*/
async getClockStatistics(year = this.state.year) {
let res = await InstrumentInfo.apiClock.getClockStatistics({ year });
if (res.data.code === 200) {
res.data.data.reverse();
if (res.data.data.length > 0) {
res.data.data.map((item, index) => {
@ -172,7 +182,8 @@ export default class Recording extends Component<any, any> {
}
// 文本框输入文字
handleTextareaInput = (e) => {
this.setState({ punchInInfo: { clockContent: e.detail.value } });
const punchInInfo = this.state.punchInInfo;
this.setState({ punchInInfo: { ...punchInInfo, clockContent: e.detail.value } });
};
// 打开/关闭弹窗
setShow(show: boolean) {
@ -205,32 +216,68 @@ export default class Recording extends Component<any, any> {
};
let res = await InstrumentInfo.apiClock.getList(data);
if (res.data.code === 200) {
console.log(this.state.clockStatistics, 88888);
console.log(res, 88888,this.state.clockStatistics,id);
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, ".");
let updateTime =getdates(obj.updateTime)
obj.updateTime = updateTime && updateTime.replace(/-/g, ".");
});
}
});
this.setState({ clockStatistics: this.state.clockStatistics });
}
}
async DayTime() {
let storedData = Taro.getStorageSync('DayTime')
const day = new Date();
if (storedData === undefined || storedData === "") {
this.setState({
clockShow: false
})
} else {
const storedDate = new Date(storedData);
const currentDate = new Date(day.toISOString());
const isSameDate = storedDate.toDateString() === currentDate.toDateString();
if (isSameDate) {
this.setState({
clockShow: true
})
} else {
this.setState({
clockShow: false
})
}
}
async onLoad() {
}
async onLoad(options) {
const ViewAddInstrument = options.param;
this.setState({
ViewAddInstrument: ViewAddInstrument
})
this.getRecord(null);
this.getBindingInstrumentList();
this.getLatestClockRecord();
this.getClockStatistics();
this.DayTime()
}
componentDidShow() {}
componentDidShow() { }
componentDidHide() {}
componentDidHide() { }
async initData() {}
async initData() { }
// 选择年份
onChangeYear(event) {
this.setState({ year: event.detail.value });
@ -304,7 +351,14 @@ export default class Recording extends Component<any, any> {
t2: "您已完成今日打卡",
btn1show: false,
}).then(() => {
let data = new Date
Taro.setStorageSync('DayTime', data.toISOString())
this.setState({
clockShow: true
})
this.getClockStatistics();
this.setShow(false);
});
});
}
@ -319,7 +373,9 @@ export default class Recording extends Component<any, any> {
array,
name,
recordList,
ViewAddInstrument,
bindingInstrumentList,
clockShow,
curIndex,
clockStatistics,
statistics,
@ -328,7 +384,6 @@ export default class Recording extends Component<any, any> {
monthTime,
show,
punchInInfo,
clockContent,
} = this.state;
return (
@ -433,10 +488,10 @@ export default class Recording extends Component<any, any> {
tag_active: item.online === 2,
})}
>
{item.online ? "在线" : "离线"}
{item.online === 1 ? "在线" : "离线"}
</View>
</View>
{item.instrumentType === 2 && (
{item.instrumentType === 1 && (
<View
className="top-right"
onClick={this.toReport.bind(
@ -585,7 +640,8 @@ export default class Recording extends Component<any, any> {
))}
</View>
<View className="month_item_date">
PRO{" "}
{/* 小紫弹智能射频仪、花至抗老射频仪PRO{" "} */}
{obj.instrumentName === null ? "" : obj.instrumentName}
</View>
<View className="month_item_note">
{obj.clockContent}
@ -601,14 +657,18 @@ export default class Recording extends Component<any, any> {
</View>
</View>
)}
<View className="footer flex aitems">
<View className="btn" onClick={this.setShow.bind(this, true)}>
</View>
<View className="text" onClick={this.back}>
{
!clockShow && ViewAddInstrument === "true" && (
<View className="footer flex aitems">
<View className="btn" onClick={this.setShow.bind(this, true)}>
</View>
{/* <View className="text" onClick={this.back}>
&gt;
</View>
</View>
</View> */}
</View>
)
}
<Popup show={show} onClose={() => this.setState({ show: false })}>
<View className="popBox">

@ -94,14 +94,13 @@ const date = () => {
};
const getdates = (date) => {
date = date.replace(/-/g, "/"); // 部分iphone new Date不兼容[2023-01-01]格式,需要转换
date = date && date.replace(/-/g, "/"); // 部分iphone new Date不兼容[2023-01-01]格式,需要转换
const year = new Date(date).getFullYear();
const month = new Date(date).getMonth() + 1;
const day = new Date(date).getDate();
const hour = new Date(date).getHours();
const minute = new Date(date).getMinutes();
const second = new Date(date).getSeconds();
// return `${[year, month, day].map(formatNumber).join('-')} ${[hour, minute, second].map(formatNumber).join(':')}`
return `${[year, month, day].map(formatNumber).join("-")}`;
};

Loading…
Cancel
Save