blak-kong 2 years ago
parent e4fea82132
commit b348772e31

Binary file not shown.

Binary file not shown.

@ -1,334 +0,0 @@
.infobox1 {
position: relative;
background: #fff;
border-radius: 0 0 30rpx 30rpx;
padding: 19rpx 29rpx 44rpx 29rpx;
box-shadow: -2.6rpx 0 11rpx 0.5rpx rgba(129, 129, 129, 0.05);
transition: all 0.3s;
}
.infobox1 .selectbox {
margin-top: 38rpx;
}
.infobox1 .selectbox .block {
position: relative;
}
.infobox1 .selectbox .block picker,
.infobox1 .selectbox .block picker view {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: 99;
opacity: 0;
}
.infobox1 .selectbox .block .title {
font-size: 36rpx;
font-weight: 500;
color: #000000;
font-family: Poppins;
}
.infobox1 .selectbox .block .icon {
width: 30rpx;
height: 30rpx;
margin-left: 35rpx;
}
.right_icon {
width: 10rpx;
height: 20rpx;
margin-left: 14rpx;
}
.calendar_view {
margin-top: 44rpx;
font-size: 24rpx;
font-weight: 500;
color: #666666;
justify-content: center;
}
.calendar_views {
font-size: 24rpx;
font-weight: 500;
color: #000;
justify-content: center;
}
.calendar_view > view,
.calendar_views > view {
text-align: center;
color: #666666;
font-size: 24rpx;
font-weight: 500;
width: 98rpx;
height: 60rpx;
position: relative;
}
.calendar_views .block {
text-align: center;
width: 49rpx;
height: 49rpx;
border-radius: 50%;
color: #000000;
font-weight: 500;
font-size: 24rpx;
line-height: 49rpx;
}
.calendar_views .blockstatus1 {
width: 6rpx;
height: 6rpx;
background: #e9cd9e;
border-radius: 50%;
position: absolute;
left: 50%;
bottom: 14rpx;
margin-left: -3rpx;
}
.statubox {
justify-content: flex-end;
padding: 0 0 14rpx 0;
border-bottom: 1rpx solid rgba(105, 100, 96, 0.1);
}
.statubox .status1 {
}
.statubox .status1 .block {
width: 18rpx;
height: 18rpx;
border-radius: 50%;
background: #f1ece6;
}
.statubox .status1 .title {
font-size: 22rpx;
color: #202020;
margin-left: 12rpx;
}
.statubox .status2 {
margin-left: 26rpx;
}
.statubox .status2 .block {
width: 6rpx;
height: 6rpx;
border-radius: 50%;
background: #e9cd9e;
}
.statubox .status2 .title {
font-size: 22rpx;
color: #202020;
margin-left: 12rpx;
display: flex;
align-items: center;
justify-content: center;
}
.calendar_views .status1 {
border: 2rpx solid #eecda1;
border-radius: 50%;
}
.calendar_views .cur_day {
background: linear-gradient(0deg, #fff0da, #ffe4c0);
border-radius: 50%;
}
.calendar_views .status4 {
border: 2rpx solid #f2f2f2;
border-radius: 50%;
}
.calendar_views .no_cur_month {
color: #cccccc;
}
.menubox {
color: #202020;
font-size: 24rpx;
font-weight: bold;
margin-top: 44rpx;
}
.menubox .record {
background: #e2c6a3;
border-radius: 22rpx;
color: #202020;
font-size: 24rpx;
height: 44rpx;
line-height: 44rpx;
width: 120rpx;
text-align: center;
}
.van-tabs__scroll--line {
background: transparent !important;
}
image {
width: 100%;
height: 100%;
display: flex;
border-radius: 0;
}
.color {
color: #f1ab15;
}
.ellipsis2 {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.nodata {
color: #666666;
text-align: center;
margin-top: 50rpx;
font-size: 28rpx;
}
.MT30 {
margin-top: 30rpx;
}
.submitbtn {
position: absolute;
bottom: 100rpx;
width: 400rpx;
left: 50%;
margin-left: -200rpx;
}
.submitbtn .btn {
position: absolute;
top: 20rpx;
color: #fff;
font-weight: bold;
font-size: 32rpx;
text-align: center;
width: 100%;
bottom: 0;
}
.avatar-wrapper {
position: absolute;
bottom: 0;
width: 100%;
height: 100%;
left: 0;
right: 0;
top: 0;
z-index: 99;
opacity: 0;
}
.flex {
display: flex;
}
.aitems {
align-items: center;
}
.jcenter {
justify-content: center;
}
.sb {
justify-content: space-between;
}
.sa {
justify-content: space-around;
}
.wrap {
flex-wrap: wrap;
}
.echartsboxs {
font-size: 24rpx;
font-weight: 500;
color: #666;
display: flex;
justify-content: center;
}
.echartsboxs .blockbox {
width: 98rpx;
height: 60rpx;
}
.echartsboxs .blockbox .title {
font-weight: 500;
text-align: center;
color: #000000;
font-size: 24rpx;
margin: 20rpx auto 0;
width: 49rpx;
height: 49rpx;
line-height: 49rpx;
border-radius: 50%;
}
.echartsboxs .blockbox .cur_day {
background: linear-gradient(0deg, #fff0da, #ffe4c0);
}
.echartsboxs .blockbox .status1 {
border: 2rpx solid #eecda1;
}
.echartsboxs .blockbox .status4 {
border: 2rpx solid #f2f2f2;
}
.arrow_box {
position: absolute;
left: 50%;
bottom: 0;
transform: translate(-50%);
/*width: 100%;*/
height: 13rpx;
padding: 40rpx 80rpx 14rpx;
}
.arrow {
transform: rotate(180deg);
transition-property: all;
transition-duration: 0.5s;
width: 24rpx;
height: 100%;
margin: 0 auto;
}
.toolbar {
padding: 30rpx;
}
.toolbar .toolbar_title {
font-size: 36rpx;
font-weight: 600;
text-align: center;
}
.toolbar .select_box .text {
color: #cccccc;
font-size: 24rpx;
margin-bottom: 20rpx;
margin-top: 40rpx;
}
.toolbar .select_box .date {
color: #000;
font-size: 28rpx;
font-weight: 500;
}
.btn_confirm {
height: 90rpx;
background: #000;
color: #fff;
text-align: center;
line-height: 90rpx;
font-size: 32rpx;
font-weight: 700;
margin: 0 30rpx 40rpx;
border-radius: 50rpx;
}

@ -1,355 +0,0 @@
import { Component } from "react";
import Taro from "@tarojs/taro";
import classnames from "classnames";
import { go } from "../../utils/traoAPI";
import { date, getdates } from "../../utils/util";
import { PunchingCardListIOT } from "../../utils/Interface";
import "./calendar2.less";
import { Block, View, Image } from "@tarojs/components";
import { DatetimePicker, Popup } from "@antmjs/vantui";
export default class Calendar2 extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
name: "时间组件",
days: [],
weeklist: [],
year: new Date().getFullYear(),
month: String(new Date().getMonth() + 1).padStart(2, "0"),
day: String(new Date().getDate()).padStart(2, "0"),
consyear: new Date().getFullYear(),
consmonth: String(new Date().getMonth() + 1).padStart(2, "0"),
constday: String(new Date().getDate()).padStart(2, "0"),
week: "",
monthtext: new Date().getMonth() + 1 + "月",
selectlist: [
{
name: "每月",
id: 2,
},
{
name: "每周",
id: 1,
},
],
selectlistindex: 1,
curMonthDate:
String(new Date().getFullYear()) +
"-" +
String(new Date().getMonth() + 1).padStart(2, "0"),
curDate: new Date().getTime(),
selectDate: date(),
temDate: null,
today: date().replace(/\-/g, "."),
maxDate: new Date().getTime(),
yearlist: [],
monthlist: [],
totalcount: 0,
showDatePicker: false,
};
}
async onLoad() {
// // 状态栏高度
}
componentDidMount() {}
componentWillUnmount() {}
componentDidShow() {}
componentDidHide() {}
onChangeDate = async (event) => {
const { showDatePicker, curDate, temDate } = this.state;
if (showDatePicker && event.type !== "close") {
if (curDate !== temDate) {
this.setState({
selectDate: getdates(temDate),
curDate: temDate,
curMonthDate: getdates(temDate).slice(0, 7),
});
await this.PunchingCardListIOT();
}
}
// this.getTabBar().setState({
// showBar: showDatePicker
// })
this.setState({ showDatePicker: !showDatePicker });
};
onInput = (event) => {
this.setState({ temDate: event.detail });
};
gourl = (e) => {
const { url } = e.currentTarget.dataset;
if (!this.state.userInfo.mobile) {
//未注册授权
// showModal({
// t2: '暂未授权注册,请点击注册',
// btn1show: false
// }).then(res => {
// Taro.navigateTo({
// url: '/pages/register/register',
// })
// })
return false;
}
go(url);
};
onChangeCalendar = () => {
const { selectlistindex } = this.state;
if (!selectlistindex) {
this.setState({ selectlistindex: 1 });
} else {
this.setState({ selectlistindex: 0 });
}
this.PunchingCardListIOT();
console.log(this.state.curMonthDate);
};
PunchingCardListIOT = async () => {
Taro.showLoading({
title: "加载中",
});
let { data } = await PunchingCardListIOT({
type: this.state.selectlist[this.state.selectlistindex].id,
times: this.state.selectDate + " 00:00:01",
});
if (data.code === 200) {
if (this.state.selectlist[this.state.selectlistindex].id === 2) {
data.data.list = data.data.list.map((item) => ({
...item,
date: parseInt(item.addtime.slice(-2)),
month: item.addtime.slice(0, 7),
curDate: item.addtime.replace(/-/g, "."),
}));
this.setState({
days: data.data.list,
});
}
if (this.state.selectlist[this.state.selectlistindex].id === 1) {
let totalcount = 0;
let week: any = new Date().getDay();
if (week === 1) week = "周一";
else if (week === 2) week = "周二";
else if (week === 3) week = "周三";
else if (week === 4) week = "周四";
else if (week === 5) week = "周五";
else if (week === 6) week = "周六";
else week = "周日";
let now = Date.now();
data.data.list.map((item, index) => {
item.week2 = week;
item.day = parseInt(item.addtime.substring(8, 10));
item.curDate = item.addtime.replace(/-/g, ".");
if (item.times) {
item.fen = item.times.substring(0, item.times.indexOf(":"));
item.miao = item.times.substring(
item.times.indexOf(":") + 1,
item.times.length
);
item.total =
Number(item.fen * 60) + Number(item.miao) > 980
? 980
: Number(item.fen * 60) + Number(item.miao);
item.totals = Number(item.fen * 60) + Number(item.miao);
let yu = 3.4;
item.height = item.total / yu;
if (now > new Date(item.addtime.replace(/-/g, "/")).getTime()) {
item.bgcolor = "#E8D3B1";
item.textcolor = "";
totalcount += item.totals;
} else {
if (item.c_status) {
item.bgcolor = "#F2F2F2";
item.textcolor = "#202020";
}
}
if (Number(item.fen) > 1440) {
item.times = "1440:00";
}
} else {
item.height = 0;
}
});
this.setState({
weeklist: data.data.list,
atotalcount: this.s_to_hs(totalcount),
});
}
}
Taro.hideLoading();
};
s_to_hs = (s) => {
//计算分钟
//算法将秒数除以60然后下舍入既得到分钟数
let h;
h = Math.floor(s / 60);
//计算秒
//算法:取得秒%60的余数既得到秒数
s = s % 60;
//将变量转换为字符串
h += "";
s += "";
//如果只有一位数前面增加一个0
h = h.length === 1 ? "0" + h : h;
s = s.length === 1 ? "0" + s : s;
return h + "分" + s + "秒";
};
render() {
let {
selectlist,
selectlistindex,
today,
days,
curMonthDate,
weeklist,
showDatePicker,
selectDate,
curDate,
maxDate,
} = this.state;
return (
<Block>
<View
className="infobox1"
style={{
height: selectlist[selectlistindex].id === 1 ? 260 : "550rpx",
}}
>
<View className="selectbox flex sb">
<View className="Block flex aitems" onClick={this.onChangeDate}>
<View className="title">{today}</View>
<View className="icon">
<Image
src={require("../../img/index/calendar.png")}
mode="aspectFill"
/>
</View>
</View>
<View
className="flex aitems"
onClick={this.gourl}
style="font-size: 26rpx; font-weight: 500; color: #666"
data-url="/pages/recording/recording"
>
<View></View>
<Image
className="right_icon"
src={require("../../img/right.png")}
mode="aspectFill"
></Image>
</View>
</View>
{selectlist[selectlistindex].id === 2 && (
<Block>
<View className="calendar_View flex">
<View></View>
<View></View>
<View></View>
<View></View>
<View></View>
<View></View>
<View></View>
</View>
<View className="calendar_Views flex aitems wrap">
{days.map((item, index) => {
return (
<View className="flex jcenter aitems" key={"days_" + index}>
{/* {{item.curDate === today ? 'cur_day' : item.status === 1 || item.status === 2 ? 'status1' : item.month !== curMonthDate ? 'no_cur_month' : item.status === 4 ? 'status4' : ''}} */}
<View
className={classnames("Block", {
cur_day: item.curDate === today,
status1: item.status === 1 || item.status === 2,
no_cur_month: item.month !== curMonthDate,
status4: item.status === 4,
})}
>
{item.date}
</View>
</View>
);
})}
</View>
</Block>
)}
{selectlist[selectlistindex].id === 1 && (
<Block>
<View className="calendar_View flex">
<View></View>
<View></View>
<View></View>
<View></View>
<View></View>
<View></View>
<View></View>
</View>
<View className="echartsboxs flex">
{weeklist.map((item, index) => {
return (
<View className="Blockbox" key={"weeklist_" + index}>
<View
className={classnames("title", {
cur_day: item.curDate === today,
status1: item.status === 1 || item.status === 2,
status4: item.status === 4,
})}
>
<View>{item.day}</View>
</View>
</View>
);
})}
</View>
</Block>
)}
<View className="arrow_box" onClick={this.onChangeCalendar}>
<Image
className="arrow"
style={{
transform:
"rotate(" + !selectlistindex ? "-180deg" : "0deg" + ")",
}}
src={require("../../img/index/arrow-down.png")}
mode="aspectFill"
/>
</View>
</View>
<Popup
show={showDatePicker}
position="bottom"
closeable
// close-icon="/img/fr200/close.png"
round
onClick={this.onChangeDate}
>
<View className="toolbar">
<View className="toolbar_title"></View>
<View className="select_box">
<View className="text"></View>
<View className="date">{selectDate}</View>
</View>
</View>
<DatetimePicker
type="date"
value={curDate}
maxDate={maxDate}
onInput={this.onInput}
/>
<View className="btn_confirm" onClick={this.onChangeDate}>
</View>
</Popup>
</Block>
);
}
}

@ -11,6 +11,7 @@ import "./popup.less";
* isLarge
* isShow
* isClose
* type 1
* title
* content
* cancelButtonText
@ -69,7 +70,9 @@ export default class PopupConfirm extends Component<any, any> {
isShow,
isClose,
isLarge,
type = 0,
} = this.props;
console.log("type", type);
return (
<Block>
<PageMeta pageStyle={isShow ? "overflow: hidden;" : ""} />

Loading…
Cancel
Save