diff --git a/pages.json b/pages.json
index db6c4fa..1a3bdad 100644
--- a/pages.json
+++ b/pages.json
@@ -97,6 +97,24 @@
"style": {
"navigationBarTitleText": ""
}
+ },
+ {
+ "path": "clockIn/index",
+ "style": {
+ "navigationBarTitleText": "审批打卡"
+ }
+ },
+ {
+ "path": "clockIn/apply",
+ "style": {
+ "navigationBarTitleText": "审批打卡"
+ }
+ },
+ {
+ "path": "clockIn/record",
+ "style": {
+ "navigationBarTitleText": "我的打卡记录"
+ }
}
]
}],
diff --git a/pages/user/user.vue b/pages/user/user.vue
index a5c159c..cbc8e7c 100644
--- a/pages/user/user.vue
+++ b/pages/user/user.vue
@@ -39,7 +39,11 @@
// {
// title: '账号密码',
// path: '/subPackages/user/accountPassword'
- // }
+ // },
+ {
+ title: '我的打卡记录',
+ path: '/subPackages/clockIn/record'
+ }
],
userInfo: {group_data: {}}
}
diff --git a/static/js/CommonFunction.js b/static/js/CommonFunction.js
index 68291ab..bdc460c 100644
--- a/static/js/CommonFunction.js
+++ b/static/js/CommonFunction.js
@@ -185,4 +185,56 @@ Vue.prototype.calculateDistance = (lat1, lon1, lat2, lon2) => {
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
return R * c;
+}
+
+/**
+ * @description 格式化时间
+ * @param {String|Number} dateTime 需要格式化的时间戳
+ * @param {String} fmt 格式化规则 yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合 默认yyyy-mm-dd
+ * @returns {string} 返回格式化后的字符串
+ */
+ Vue.prototype.timeFormat = (dateTime = null, formatStr = 'yyyy-mm-dd')=> {
+ let date
+ // 若传入时间为假值,则取当前时间
+ if (!dateTime) {
+ date = new Date()
+ }
+ // 若为unix秒时间戳,则转为毫秒时间戳(逻辑有点奇怪,但不敢改,以保证历史兼容)
+ else if (/^\d{10}$/.test(dateTime?.toString().trim())) {
+ date = new Date(dateTime * 1000)
+ }
+ // 若用户传入字符串格式时间戳,new Date无法解析,需做兼容
+ else if (typeof dateTime === 'string' && /^\d+$/.test(dateTime.trim())) {
+ date = new Date(Number(dateTime))
+ }
+ // 处理平台性差异,在Safari/Webkit中,new Date仅支持/作为分割符的字符串时间
+ // 处理 '2022-07-10 01:02:03',跳过 '2022-07-10T01:02:03'
+ else if (typeof dateTime === 'string' && dateTime.includes('-') && !dateTime.includes('T')) {
+ date = new Date(dateTime.replace(/-/g, '/'))
+ }
+ // 其他都认为符合 RFC 2822 规范
+ else {
+ date = new Date(dateTime)
+ }
+
+ const timeSource = {
+ 'y': date.getFullYear().toString(), // 年
+ 'm': (date.getMonth() + 1).toString().padStart(2, '0'), // 月
+ 'd': date.getDate().toString().padStart(2, '0'), // 日
+ 'h': date.getHours().toString().padStart(2, '0'), // 时
+ 'M': date.getMinutes().toString().padStart(2, '0'), // 分
+ 's': date.getSeconds().toString().padStart(2, '0') // 秒
+ // 有其他格式化字符需求可以继续添加,必须转化成字符串
+ }
+
+ for (const key in timeSource) {
+ const [ret] = new RegExp(`${key}+`).exec(formatStr) || []
+ if (ret) {
+ // 年可能只需展示两位
+ const beginIndex = key === 'y' && ret.length === 2 ? 2 : 0
+ formatStr = formatStr.replace(ret, timeSource[key].slice(beginIndex))
+ }
+ }
+
+ return formatStr
}
\ No newline at end of file
diff --git a/subPackages/clockIn/apply.vue b/subPackages/clockIn/apply.vue
new file mode 100644
index 0000000..11a0315
--- /dev/null
+++ b/subPackages/clockIn/apply.vue
@@ -0,0 +1,223 @@
+
+
+
+
+
+ 打卡日期
+
+
+ {{timeFormat(new Date())}}
+
+
+
+
+
+ 审批事由
+
+
+
+
+
+
+ 提交
+
+
+
+
+
+
+
+
+
+
diff --git a/subPackages/clockIn/index.vue b/subPackages/clockIn/index.vue
new file mode 100644
index 0000000..b786dda
--- /dev/null
+++ b/subPackages/clockIn/index.vue
@@ -0,0 +1,186 @@
+
+
+
+
+
+ {{item.guide_name}}的审批打卡
+ {{status[item.status]}}
+
+
+ 审批编号:
+ {{item.id}}
+
+
+ 提交时间:
+ {{item.create_time}}
+
+
+ 打卡日期:
+ {{item.date}}
+
+
+
+
+ 打卡事由:
+ {{item.reason}}
+
+
+
+
+ 审批流程
+
+
+
+ 审批人:
+ 张大庄({{status[item.status]}})
+
+
+
+
+
+ 撤销
+
+
+
+
+
+
\ No newline at end of file
diff --git a/subPackages/clockIn/record.vue b/subPackages/clockIn/record.vue
new file mode 100644
index 0000000..b364f34
--- /dev/null
+++ b/subPackages/clockIn/record.vue
@@ -0,0 +1,116 @@
+
+
+
+
+ {{ item.date }}
+
+ {{item.type==1?item.create_time.slice(11):item.update_time.slice(11) }}
+
+
+
+ {{item.status==0?'审批中':item.status==1?'打卡正常':item.status==2?'审批拒绝':item.status==3?'审批取消':''}}
+
+
+
+
+
+ 暂无打卡记录
+
+
+
+
+
+
+
\ No newline at end of file