Commit 8ec90efd by 胡悦

提交我的考勤页面

1 parent ccff65c3

2.31 MB | W: | H:

2.32 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
<template>
<view class="calendar-container">
<view class="calendar-box">
<view class="calendar-years">
<view class="calendar-year">{{ currentInfo.year }}年{{ currentInfo.month }}月</view>
<view class="appeal-record" @click="viewAppeal"><view class="sprite-icon icon-appeal-record"></view>考勤申诉记录</view>
</view>
<view class="calendar-body">
<view class="calendar-weekdays">
<view class="calendar-weekday" v-for="weekday in weekdays" :key="weekday">
{{ weekday }}
</view>
</view>
<view class="calendar-dates">
<view class="calendar-date" v-for="(date, index) in dates" :key="index">
<template v-if="date">
<view @click="openDetail(date)">
<view class="tag blue">加班</view>
<view class="date-num" v-if="date != currentInfo.day">{{ date }}</view>
<view class="current-date" v-else>今</view>
<view class="date-desc">09:00:21<view class="sprite-icon icon-dress-code"></view></view>
<view class="date-desc date-red">未打卡</view>
</view>
</template>
</view>
</view>
</view>
</view>
<detailPop ref="detail" :detailInfo="selectInfo"></detailPop>
<AppealRecord ref="appeal"></AppealRecord>
</view>
</template>
<script>
// import point from '@/mixin/point'
// import firstTime from '@/mixin/firstTime'
import detailPop from './detailPop.vue'
import AppealRecord from './appealRecord.vue'
export default {
// mixins: [firstTime],
name: 'calendar',
components: {detailPop, AppealRecord},
props: {
// 是否显示周标题
showWeekdays: {
type: Boolean,
default: true
},
open: {
type: Boolean,
default: false
}
},
data() {
return {
// 当前所处日期 年月日
nowDate: '7',
datesd: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31],
clockInDateList: [],
weekdays: ['一', '二', '三', '四', '五', '六', '日'],
showNextMonth: true, //是否显示查看下个月操作箭头,暂时只能看后一个月
currentInfo: {
year: new Date().getFullYear(),
month: new Date().getMonth() + 1,
day: new Date().getDate()
},
selectInfo: {
year: new Date().getFullYear(),
month: new Date().getMonth() + 1,
day: ''
}
}
},
computed: {
dates() {
const firstDayOfMonth = new Date(this.currentInfo.year, this.currentInfo.month - 1, 1)
const dates = []
for (let i = 0, len = this.datesd.length; i < len; i++) {
dates.push(this.datesd[i])
}
if (firstDayOfMonth.getDay() == 0) {
// 第一行只有一天的情况
for (let i = 1; i <= 6; i++) {
dates.unshift(null)
}
} else {
for (let i = 1; i < firstDayOfMonth.getDay(); i++) {
dates.unshift(null)
}
}
console.log(dates)
return dates
}
},
methods: {
openDetail(date) {
this.selectInfo.day = date
this.$refs.detail.open()
},
viewAppeal() {
this.$refs.appeal.open()
}
}
}
</script>
<style scoped lang="scss">
.calendar-box {
padding: toRpx(48) toRpx(64);
box-sizing: border-box;
width: calc(100% - #{toRpx(64)});
height: calc(100vh - #{toRpx(276)});
border: toRpx(4) solid #fff;
background: #f2f7ff;
box-shadow: inset 0 4px 8px 0 #ffffff80;
border-radius: toRpx(48);
margin-top: toRpx(38);
.calendar-years {
color: #1a1a1a;
font-size: toRpx(48);
position: relative;
.appeal-record {
position: absolute;
display: flex;
align-items: center;
top: 0;
right: 0;
background-color: #E6EDF7;
color: #333;
font-size: toRpx(28);
padding: toRpx(10) toRpx(20);
border-radius: toRpx(16);
.icon-appeal-record {
margin-right: toRpx(8);
}
}
}
.calendar-weekdays {
display: flex;
height: toRpx(56);
margin-top: toRpx(30);
.calendar-weekday {
flex: 1;
font-size: toRpx(28);
color: #808291;
text-align: right;
padding-right: toRpx(21);
}
}
.calendar-dates {
display: flex;
flex-wrap: wrap;
border-radius: toRpx(24);
.calendar-date {
position: relative;
width: calc(100% / 7);
height: calc((100vh - toRpx(550)) / 5);
background-color: #fff;
padding: toRpx(22) toRpx(32);
display: flex;
flex-direction: column;
justify-content: space-between;
box-sizing: border-box;
border: toRpx(2) solid #DEEAFC;
+ .calendar-date {
border-left: none;
border-top: none;
}
&:nth-child(7n + 1) {
border-left: toRpx(2) solid #DEEAFC;
}
&:nth-child(-n + 7) {
border-top: toRpx(2) solid #DEEAFC;
}
.tag {
position: absolute;
right: toRpx(29.14);
top: toRpx(29.14);
padding: toRpx(6) toRpx(16);
font-size: toRpx(24);
box-sizing: content-box;
line-height: toRpx(32);
border-radius: toRpx(12);
&.blue {
color: #00B8F0;
background-color: rgba(0, 184, 240, 0.1);
}
&.red {
color: #EB4E4E;
background-color: rgba(235, 78, 78, 0.1);
}
&.gray {
color: #B6BAC2;
background-color: rgba(160, 163, 173, 0.1);
}
&.purple {
color: #6D58F5;
background-color: rgba(109, 88, 245, 0.1);
}
}
.date-num {
color: #1a1a1a;
font-size: toRpx(36);
margin-bottom: toRpx(24.8);
}
.current-date {
width: toRpx(64);
height: toRpx(64);
border-radius: toRpx(80);
opacity: 1;
background: #ebf1fe;
color: #3773F8;
font-size: toRpx(36);
line-height: toRpx(64);
text-align: center;
margin-bottom: toRpx(12);
}
.date-desc {
display: flex;
align-items: center;
position: relative;
font-size: toRpx(24);
padding-left: toRpx(30);
color: #808291;
&:first-child {
margin-bottom: toRpx(12);
}
&::before {
content: '';
position: absolute;
width: toRpx(12);
top: toRpx(12);
left: 0;
height: toRpx(12);
background: #2cca74;
border-radius: 50%;
}
&.date-red {
color: #eb4e4e;
&::before {
background: #eb4e4e;
}
}
.icon-dress-code {
display: inline-block;
margin-left: toRpx(8);
}
}
}
}
}
</style>
export const TYPE_LIST = [
{
value: 1,
name: '正常'
},
{
value: 2,
name: '加班'
},
{
value: 3,
name: '异常'
},
{
value: 4,
name: '有请假'
},
{
value: 5,
name: '请休假'
}
]
export const ABNORMAL_LIST = [
{
value: 31,
name: '迟到'
},
{
value: 32,
name: '早退'
},
{
value: 33,
name: '未打卡'
},
{
value: 34,
name: '着装异常'
}
]
\ No newline at end of file \ No newline at end of file
<template>
<uni-popup ref="popup" type="bottom" border-radius="toRpx(16)" :mask-click="false">
<view :class="['kf-box', type]">
<view class="title">
<image class="attendance-title" :src="require('@/assets/images/point/attendance-title.png')"
mode="scaleToFill" />
<template v-if="type == 'record'"><view>{{ detailInfo.year }}年{{ detailInfo.month }}月{{ detailInfo.day }}日</view></template>
<template v-else-if="type == 'appeal'">{{ title }}</template>
<view class="close flex" @click="close">
<uni-icons type="closeempty" :size="18" color="#1A1A1A"></uni-icons>
</view>
</view>
<template v-if="type == 'record'">
<view class="timeline-container">
<view class="timeline-item">
<view class="timeline-dot"></view>
<view class="timeline-content">
<text class="time-label">上班</text>
<view class="time-right">
<view class="time-top">
<text class="time">{{ dataInfo.endTime }}</text>
<text class="status" :class="{ 'normal': dataInfo.endStatus }">{{ dataInfo.endStatus }}</text>
</view>
<view class="extra-info">着装正常</view>
<image class="dress-code" @click="openImg('上班')" src="../../../../assets/images/common/qr.webp" mode="scaleToFill" />
</view>
</view>
</view>
<view class="timeline-line bnormal"></view>
<view class="timeline-item">
<view class="timeline-dot"></view>
<view class="timeline-content">
<text class="time-label">下班</text>
<view class="time-right">
<view class="time-top">
<text class="time">{{ dataInfo.endTime }}</text>
<text class="status" :class="{ 'normal': dataInfo.endStatus }">{{ dataInfo.endStatus }}</text>
</view>
<view class="extra-info red">着装正常</view>
<image class="dress-code" @click="openImg('下班')" src="../../../../assets/images/common/qr.webp" mode="scaleToFill" />
</view>
</view>
</view>
</view>
<view class="working-hours">
<view class="sprite-icon icon-time"></view>
工作时长:<text class="missing-card">8:25:16</text>
</view>
<view class="btn" @click="toAppeal">我要申诉</view>
<!-- <view class="submit-btn"><view class="sprite-icon icon-submit"></view>已提交申诉</view> -->
</template>
<template v-else-if="type == 'appeal'">
<view class="appeal-box">
<view class="label">申诉日期:{{ detailInfo.year }}年{{ detailInfo.month }}月{{ detailInfo.day }}日</view>
<view class="label">申诉说明:</view>
<view style="position: relative;">
<textarea :class="['textarea', isRequire?'red':'']" v-model="value" @blur="blur" placeholder-style="color: #C9C9C9" placeholder="请填写申诉说明,字数不超过200字" maxlength="200"></textarea>
<view v-if="isRequire" class="error-tips">请填写申诉说明</view>
</view>
</view>
<view class="btn appeal-btn" @click="handleAppeal">提交申诉</view>
</template>
</view>
<preview ref="img" :isComponents="true" :show="showPreview" :mediaObject="mediaObject" @previewBack="previewBack"></preview>
</uni-popup>
</template>
<script type='text/ecmascript-6'>
import preview from './preview.vue';
export default {
name: 'detailPop',
props: {
detailInfo: Object
},
components: {preview},
data() {
return {
dataInfo: {
startTime: '09:00:21',
endTime: '18:26:05',
startStatus: true,
endStatus: true
},
type: 'record',
title: '考勤申诉',
value: '',
showPreview: false,
mediaObject: {
detailUrl: '',
tabName: '',
sourceType: 1
},
isRequire: false
}
},
mounted() {
},
methods: {
open() {
console.log(this.detailInfo, '===')
this.$refs.popup.open("center");
},
close() {
this.$refs.popup.close()
},
toAppeal() {
this.type = 'appeal'
},
handleAppeal() {
console.log(this.value)
if (!this.value) {
this.isRequire = true
} else {
this.isRequire = false
this.type = 'record'
}
},
openImg(name) {
const url = 'https://img.ixintu.com/download/jpg/201911/e25b904bc42a74d7d77aed81e66d772c.jpg!con'
this.mediaObject.detailUrl = url
this.mediaObject.tabName = `${name}打卡`
this.showPreview = true
},
previewBack() {
this.showPreview = false
},
blur() {
this.isRequire = !this.value
}
}
}
</script>
<style scoped lang='scss'>
.kf-box {
position: relative;
background: #ffffff;
border-radius: toRpx(48);
// padding: 0 toRpx(48);
box-sizing: border-box;
background-image: url(@/assets/images/point/attendance-bg.png);
background-repeat: no-repeat;
padding-bottom: toRpx(80);
&.record {
width: toRpx(1040);
min-height: toRpx(654);
background-size: toRpx(1040) toRpx(400);
}
&.appeal {
width: toRpx(1456);
height: toRpx(992);
background-size: toRpx(1456) toRpx(400);
}
.close {
margin-left: auto;
}
.title {
display: flex;
align-items: center;
font-weight: 500;
font-size: toRpx(40);
padding: toRpx(40) toRpx(46);
.attendance-title {
width: toRpx(80);
height: toRpx(80);
margin-right: toRpx(16);
}
}
.message-bg {
width: toRpx(1040);
height: toRpx(400);
border-radius: toRpx(48);
}
.btn {
margin: toRpx(80) auto 0;
width: toRpx(376);
height: toRpx(88);
border-radius: toRpx(16);
background: linear-gradient(180deg, #61c0ff 0%, #2c66f7 100%);
box-shadow: inset 0 0 toRpx(32) 0 #ffffff80;
color: #ffffff;
font-size: toRpx(36);
font-weight: 500;
text-align: center;
line-height: toRpx(88);
}
}
.timeline-container {
position: relative;
padding-left: toRpx(144);
}
.timeline-line {
position: absolute;
left: toRpx(236);
top: toRpx(20);
width: toRpx(4);
background-color: #E6EAF0;
&.normal {
height: toRpx(154);
}
&.bnormal {
height: toRpx(386);
}
}
.timeline-item {
position: relative;
margin-bottom: toRpx(64);
}
.timeline-dot {
position: absolute;
left: toRpx(86);
top: toRpx(20);
transform: translateY(-50%);
width: toRpx(16);
height: toRpx(16);
border: toRpx(6) solid #181A1F;
border-radius: 50%;
box-sizing: border-box;
z-index: 1111;
flex-shrink: 0;
}
.timeline-content {
display: flex;
}
.time-right {
margin-left: toRpx(40);
}
.time-label {
margin-right: toRpx(24);
color: #808291;
font-size: toRpx(32);
}
.time {
font-size: toRpx(32);
color: #181A1F;
}
.status {
margin-left: toRpx(24);
padding: toRpx(6) toRpx(16);
border-radius: toRpx(12);
font-size: toRpx(24);
&.normal {
background-color: rgba(44, 202, 116, 0.1);
color: #2cca74;
}
&.late {
color: #F59619;
background-color: rgba(245, 150, 25, 0.1);
}
&.missing-card {
color: #EB4E4E;
background-color: rgba(235, 78, 78, 0.1);
}
}
.extra-info {
margin-top: toRpx(16);
color: #808291;
font-size: toRpx(26);
&.red {
color: #EB4E4E;
}
}
.dress-code {
margin-top: toRpx(24);
width: toRpx(144);
height: toRpx(192);
border-radius: toRpx(10);
}
.working-hours {
display: flex;
align-items: center;
margin-left: toRpx(144);
font-size: toRpx(32);
.icon-time {
margin-right: toRpx(16);
}
.missing-card {
color: #EB4E4E;
}
}
.submit-btn {
display: flex;
align-items: center;
justify-content: center;
margin-top: toRpx(80);
color: #2cca74;
font-size: toRpx(36);
font-weight: 500;
.icon-submit {
margin-right: toRpx(12);
}
}
.appeal-box {
margin: 0 toRpx(144) 0;
width: calc(100% - #{topx(288)});
.label {
color: #181a1f;
font-size: toRpx(32);
line-height: toRpx(48);
&:first-child {
margin-bottom: toRpx(32);
}
}
.textarea {
width: toRpx(1168);
height: toRpx(488);
border-radius: toRpx(20);
border: toRpx(2) solid #e8e8e8;
background: #ffffff;
margin-top: toRpx(16);
padding: toRpx(20) toRpx(24);
&.red {
border-color: #EB4E4E;
}
}
.error-tips {
position: absolute;
bottom: toRpx(-20);
transform: translateY(100%);
left: 0;
color: #EB4E4E;
}
}
.btn.appeal-btn {
margin-top: toRpx(48);
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<view class="attendance-container">
<Calendar></Calendar>
</view>
</template>
<script type="text/ecmascript-6">
import Calendar from './Calendar.vue'
export default {
components: {Calendar}
}
</script>
<style scoped lang="scss">
.attendance-container {
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<view
class="popup-box"
v-if="popupShow"
>
<view class="nav-bar">
<view
class="back"
@click="back"
>
<uni-icons
type="left"
:size="20"
color="#fff"
></uni-icons>
</view>
<view class="title">{{ title }}</view>
</view>
<view class="popup-body">
<video
ref="videoPlayer"
:src="detailUrl"
controls
v-if="sourceType == 2"
></video>
<view
class="img-detail"
v-else
>
<image
@click="back"
:src="detailUrl"
:style="{ width: width + 'px' }"
/>
</view>
</view>
</view>
</template>
<script type="text/ecmascript-6">
export default {
props: {
isComponents: Boolean,
show: Boolean,
mediaObject: Object
},
data () {
return {
width: 0,
title: '',
sourceType: '',
detailUrl: ''
}
},
watch:{
show:{
immediate: true,
handler (n) {
if (n) {
console.log(this.mediaObject)
this.init(this.mediaObject)
}
}
}
},
computed: {
popupShow () {
let status = true
if (this.isComponents) status = this.show
return status
},
},
onLoad (options) {
this.init(options)
},
methods: {
init (options) {
const { tabName, sourceType, detailUrl } = options
this.title = tabName
this.sourceType = sourceType
this.detailUrl = detailUrl
const _this = this
uni.getImageInfo({
src: detailUrl, // 替换为你的图片路径
success (img) {
uni.createSelectorQuery().select('.img-detail').boundingClientRect(function (rect) {
_this.width = rect.height * img.height / img.width
}).exec();
},
fail: function (error) {
console.error('获取图片信息失败:', error);
}
});
},
back () {
if (this.isComponents) this.$emit('previewBack')
else uni.navigateBack()
},
}
}
</script>
<style scoped lang="scss">
.popup-box {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: #000;
padding: toRpx(60) 0;
z-index: 999;
.nav-bar {
width: 100%;
height: toRpx(96);
margin-bottom: toRpx(50);
display: flex;
align-items: center;
.back {
height: 100%;
aspect-ratio: 1/1;
display: flex;
align-items: center;
justify-content: center;
}
.title {
color: #fff;
flex: 1;
font-size: toRpx(32);
font-weight: 700;
text-align: center;
}
}
.popup-body {
width: 100%;
height: calc(100% - #{toRpx(200)});
video {
width: 100%;
height: 100%;
}
.img-detail {
height: 100%;
text-align: center;
image {
height: 100%;
width: auto;
}
}
}
}
</style>
...@@ -18,22 +18,26 @@ ...@@ -18,22 +18,26 @@
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import Point from './Point/index.vue' import Point from './Point/index.vue'
import Income from './Income/index.vue' import Income from './Income/index.vue'
import Attendance from './Attendance/index.vue'
import { mapState } from 'vuex' import { mapState } from 'vuex'
export default { export default {
name: '', name: '',
components: { components: {
Point, Point,
Income Income,
Attendance
}, },
data () { data () {
return { return {
activeIndex:0, activeIndex: 2,
componentList:['Point','Income'], componentList:['Point','Income', 'Attendance'],
tabName: 'Point', tabName: 'Attendance',
tabList:[{ tabList:[{
name:'我的积分', name:'我的积分',
},{ },{
name:'我的收入', name:'我的收入',
},{
name:'我的考勤',
}] }]
} }
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!