├── .DS_Store
├── .gitignore
├── README.md
├── app.js
├── app.json
├── app.wxss
├── images
├── .DS_Store
├── icons
│ ├── .DS_Store
│ ├── background.png
│ ├── code.png
│ ├── company.png
│ ├── down.png
│ ├── error.png
│ ├── go.png
│ ├── location.png
│ ├── more.png
│ ├── noquick.png
│ ├── nosign.png
│ ├── sent.png
│ ├── signOk.png
│ ├── signoff.png
│ ├── staff.png
│ ├── time.png
│ └── wechat.png
└── tarbar
│ ├── business-HL.png
│ ├── bussiness.png
│ ├── check-HL.png
│ ├── check.png
│ ├── home.png
│ └── homeHL.png
├── pages
├── address
│ ├── address.js
│ ├── address.json
│ ├── address.wxml
│ └── address.wxss
├── applylist
│ ├── applylist.js
│ ├── applylist.json
│ ├── applylist.wxml
│ └── applylist.wxss
├── attendance
│ ├── attendance.js
│ ├── attendance.json
│ ├── attendance.wxml
│ └── attendance.wxss
├── audit
│ ├── audit.js
│ ├── audit.json
│ ├── audit.wxml
│ └── audit.wxss
├── boss
│ ├── boss.js
│ ├── boss.json
│ ├── boss.wxml
│ └── boss.wxss
├── code
│ ├── code.js
│ ├── code.json
│ ├── code.wxml
│ └── code.wxss
├── confirm
│ ├── confirm.js
│ ├── confirm.json
│ ├── confirm.wxml
│ └── confirm.wxss
├── create
│ ├── create.js
│ ├── create.json
│ ├── create.wxml
│ └── create.wxss
├── editName
│ ├── editName.js
│ ├── editName.json
│ ├── editName.wxml
│ └── editName.wxss
├── fail
│ ├── fail.js
│ ├── fail.json
│ ├── fail.wxml
│ └── fail.wxss
├── feedback
│ ├── feedback.js
│ ├── feedback.json
│ ├── feedback.wxml
│ └── feedback.wxss
├── list
│ ├── list.js
│ ├── list.json
│ ├── list.wxml
│ └── list.wxss
├── login
│ ├── login.js
│ ├── login.json
│ ├── login.wxml
│ └── login.wxss
├── name
│ ├── name.js
│ ├── name.json
│ ├── name.wxml
│ └── name.wxss
├── qrcode
│ ├── qrcode.js
│ ├── qrcode.json
│ ├── qrcode.wxml
│ └── qrcode.wxss
├── scan
│ ├── scan.js
│ ├── scan.json
│ ├── scan.wxml
│ └── scan.wxss
├── select
│ ├── select.js
│ ├── select.json
│ ├── select.wxml
│ └── select.wxss
├── self
│ ├── self.js
│ ├── self.json
│ ├── self.wxml
│ └── self.wxss
├── signMemo
│ ├── signMemo.js
│ ├── signMemo.json
│ ├── signMemo.wxml
│ └── signMemo.wxss
├── success
│ ├── success.js
│ ├── success.json
│ ├── success.wxml
│ └── success.wxss
├── unAuth
│ ├── unAuth.js
│ ├── unAuth.json
│ ├── unAuth.wxml
│ └── unAuth.wxss
└── workers
│ ├── workers.js
│ ├── workers.json
│ ├── workers.wxml
│ └── workers.wxss
├── template
├── company-item.wxml
└── wokers-item.wxml
└── utils
├── api.js
└── util.js
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/.DS_Store
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | secret.js
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # 打卡签到小程序
3 |
4 | 用微信小程序实现的一个简单的打卡签到的小程序
5 |
6 | ## 拒绝授权-unAuth
7 |
8 | 这是一个比较孤立的页面,只有一个入口,也就是用户在登录页面拒绝授权后才会跳转至此页面。
9 |
10 | ## 登录页面-login
11 |
12 | 该页面是程序的初始页面,小程序有几个入口,该页面就可以从这些入口进入,主要分为两类:
13 |
14 | 1. 某公司生成的带有参数的,用于打卡的二维码
15 | 2. 其他(包括搜索、发现 -> 小程序、推广时不带参数的小程序二维码)
16 |
17 | 该页面程序逻辑包括:
18 |
19 | ```
20 | if(登录) {
21 | switch(用户类型) {
22 | case: '某公司的管理员': 跳转至 管理界面
23 | case: '某公司的员工': {
24 | if(打卡二维码进入)扫码签到
25 | else 个人考勤
26 | }
27 | case: '以上都不是': 跳转至选择页面
28 | }
29 | }
30 | handleLoginBtn() {
31 | //获取token
32 | //设置localStorage,包括:access_token, 能判断出用户类型的字段
33 | //跳转至选择页面
34 | }
35 | ```
36 |
37 | get 员工列表 asdfa /token
38 | ```
39 | GET token
40 | type: 'admin','staff','user',
41 |
42 | ```
43 | ## 选择页面-select
44 |
45 | 选择页面有三个入口,一是登录页面过来,二是员工退出团队后而来,三是管理员解散团队而来。
46 | 这三种情况可以算作一种情况,用户都是已登录过的普通用户!
47 |
48 | - handleCreateBtn()
49 | - handleJoinBtn()
50 |
51 | ## 创建团队-create
52 |
53 | ```
54 | POST 创建团队
55 | ```
56 |
57 | 弹出提示创建成功,跳转至 管理页面
58 |
59 |
60 | ## 加入团队/公司列表-list
61 |
62 | ```
63 | GET 所有公司列表
64 | ```
65 | 给 确认加入 页面传入 公司id
66 |
67 | ## 确认加入-confirm
68 | 从之前的页面获取 公司id
69 | ```
70 | GET 单个公司信息
71 | ```
72 |
73 | ```
74 | POST 加入某个公司
75 | ```
76 |
77 | ## 审核页面-audit
78 |
79 | 该页面属于 纯静态页面
80 |
81 | -----------------
82 |
83 | ## 员工列表信息-workers
84 | ```
85 | 获取员工列表
86 | ```
87 |
88 | ## 单个员工信息-worker
89 |
90 | ```
91 | 获取单个员工
92 | 修改单个员工的真实姓名,即备注信息
93 | ```
94 |
95 | ## boss
96 |
97 | ```
98 | 修改团队的信息,包括上下班时间,地理位置
99 | 还能生成二维码
100 | ```
101 |
102 | --------------------------
103 | ## 扫码页面-scan
104 | 调用wx.scanCode(),只能获取信息,
105 |
106 |
107 |
108 |
109 |
110 | - unAuth: 拒绝授权
111 | - login: 登录页面
112 | - select: 选择页面
113 | - create: 创建团队/公司
114 | - list: 公司列表
115 | - confirm: 确认加入
116 | - audit:审核页面
117 | - workers:员工列表信息,tarbar左部页面
118 | - worker: 查看单个员工考勤信息
119 | - boss: 管理者,tarbar右部页面
120 | -
121 | - scan-扫码页面
122 | - clock-打卡页面
123 | - success 打卡成功
124 | - fail 打卡失败
125 | - self-查看个人考勤信息
126 |
127 |
128 | 问题: ?
129 |
130 | 1. 判断用户类型
131 | 2. 打卡二维码的参数
132 | 3. 怎么打卡
133 | 4. 生成打卡二维码的API
134 |
135 | 推广时的二维码:
136 | ```
137 | {
138 | "path": "pages/login/login?",
139 | "width": 430
140 | }
141 | ```
142 |
143 | 打卡时的二维码
144 | ```
145 | {
146 | "path": "pages/login/login?add=''"
147 | }
148 | ```
149 |
150 | 生产二维码码
151 | httpx...
152 | post
153 | {
154 | compantId
155 | location
156 | }
157 |
158 | 返回二维码的图片
159 |
160 |
161 |
162 | 打卡的时候
163 |
164 | (获取二维码的信息。(公司的companyId + location)
165 | + 打卡的信息,位置,时间啊,token
166 |
167 |
168 | 打卡成功
169 |
170 | 打卡失败
171 |
172 | ## bug修复,界面与逻辑的优化
173 | 1. 在scan.js增加定时器,增加打卡逻辑判断,当点击一次后将禁用10秒
174 | 2. 在self.js更改增加获取今天日期并显示
175 | 3. util.js 增加方法 obtainIndate
176 | 4. scan界面样式.seconds和其二级父元素
177 | 5. login界面样式.button
178 | 6. 在login.js将按钮登陆增加用户类型判断,由于现阶段无扫码进入,
179 |
180 | |
181 | | 默认登陆过(非按钮登陆)增加一个虚拟 encrypt
182 | | 则判定为扫了公司二维码
183 | |_________________________________________|__
184 | | 登陆按钮点击则判断用户类型 员工不会跳转去公司列表
185 | | 并且不会有虚拟 encrypt 所以会跳往打卡详情
186 | _____________________________________________
187 |
188 | 7. 修改了scan.js
189 | 8. 修改了success
190 | 9. 修改了fail
191 | 10. 修改了applylist的无申请人员显示界面
192 | 11. 增加了日期选择右边箭头
193 | 12. self 修改了暂无打卡纪录显示界面
194 | 13. 稍微调整了以下workers界面,只要能获得打卡时间等数据就可以设置为可能异常就黄色,其他的就灰色
195 | 14. 修改了app.json 的底部tebar
196 | 15. util.js增加了一个定时器
197 | |
198 | | 通过 util.disable(1000,10, (backData) => {
199 | | if (backData == false) {
200 | | console.log('禁用解除')
201 | | this.setData({
202 | | btnDis: false
203 | | })
204 | | }
205 | | })
206 | | 如上方式调用
207 | |_________________________________________|__
208 | | 第一个参数为计时的间隔,一般设置1000(1秒)
209 | | 第二个参数是计时的长度,10为10秒的意思
210 | _____________________________________________
211 | 16. select : 增加点击延时,防止重复跳转
212 | 17. login : 增加延时,防止重复登陆和跳转
213 | 18. audit : 增加一个返回企业列表的按钮 (待议事项)
214 | 19. select : 修改图片
215 | 20. login : 修改标题内容
216 | ----
217 | 增加图片 icons: signOk.png signoff.png nosign.png noquick.png
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 | onLaunch: function () {
4 | },
5 |
6 | globalData:{
7 |
8 | }
9 | })
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages":[
3 | "pages/login/login",
4 | "pages/scan/scan",
5 | "pages/workers/workers",
6 | "pages/applylist/applylist",
7 | "pages/create/create",
8 | "pages/signMemo/signMemo",
9 | "pages/editName/editName",
10 | "pages/select/select",
11 | "pages/list/list",
12 | "pages/confirm/confirm",
13 | "pages/audit/audit",
14 | "pages/boss/boss",
15 | "pages/name/name",
16 | "pages/qrcode/qrcode",
17 | "pages/unAuth/unAuth",
18 | "pages/address/address",
19 | "pages/success/success",
20 | "pages/fail/fail",
21 | "pages/attendance/attendance",
22 | "pages/self/self",
23 | "pages/feedback/feedback",
24 | "pages/code/code"
25 | ],
26 | "window":{
27 | "backgroundTextStyle":"light",
28 | "navigationBarBackgroundColor": "#fff",
29 | "navigationBarTitleText": "打卡咯",
30 | "navigationBarTextStyle":"black"
31 | },
32 | "tabBar": {
33 |
34 | "list": [{
35 | "pagePath": "pages/workers/workers",
36 | "text": "员工",
37 | "iconPath": "images/tarbar/check.png",
38 | "selectedIconPath": "images/tarbar/check-HL.png"
39 | },{
40 | "pagePath": "pages/boss/boss",
41 | "text": "管理",
42 | "iconPath": "images/tarbar/bussiness.png",
43 | "selectedIconPath": "images/tarbar/business-HL.png"
44 | }],
45 | "color": "#000000",
46 | "selectedColor": "#22a1e0"
47 | },
48 | "debug": true
49 | }
50 |
--------------------------------------------------------------------------------
/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | .container {
3 | height: 100%;
4 | display: flex;
5 | flex-direction: column;
6 | align-items: center;
7 | justify-content: space-between;
8 | padding: 200rpx 0;
9 | box-sizing: border-box;
10 | }
11 |
--------------------------------------------------------------------------------
/images/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/.DS_Store
--------------------------------------------------------------------------------
/images/icons/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/icons/.DS_Store
--------------------------------------------------------------------------------
/images/icons/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/icons/background.png
--------------------------------------------------------------------------------
/images/icons/code.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/icons/code.png
--------------------------------------------------------------------------------
/images/icons/company.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/icons/company.png
--------------------------------------------------------------------------------
/images/icons/down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/icons/down.png
--------------------------------------------------------------------------------
/images/icons/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/icons/error.png
--------------------------------------------------------------------------------
/images/icons/go.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/icons/go.png
--------------------------------------------------------------------------------
/images/icons/location.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/icons/location.png
--------------------------------------------------------------------------------
/images/icons/more.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/icons/more.png
--------------------------------------------------------------------------------
/images/icons/noquick.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/icons/noquick.png
--------------------------------------------------------------------------------
/images/icons/nosign.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/icons/nosign.png
--------------------------------------------------------------------------------
/images/icons/sent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/icons/sent.png
--------------------------------------------------------------------------------
/images/icons/signOk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/icons/signOk.png
--------------------------------------------------------------------------------
/images/icons/signoff.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/icons/signoff.png
--------------------------------------------------------------------------------
/images/icons/staff.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/icons/staff.png
--------------------------------------------------------------------------------
/images/icons/time.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/icons/time.png
--------------------------------------------------------------------------------
/images/icons/wechat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/icons/wechat.png
--------------------------------------------------------------------------------
/images/tarbar/business-HL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/tarbar/business-HL.png
--------------------------------------------------------------------------------
/images/tarbar/bussiness.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/tarbar/bussiness.png
--------------------------------------------------------------------------------
/images/tarbar/check-HL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/tarbar/check-HL.png
--------------------------------------------------------------------------------
/images/tarbar/check.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/tarbar/check.png
--------------------------------------------------------------------------------
/images/tarbar/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/tarbar/home.png
--------------------------------------------------------------------------------
/images/tarbar/homeHL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newteo/clockInOut/c21cb17ccc4f15914c0fe85dbfc0a34944113656/images/tarbar/homeHL.png
--------------------------------------------------------------------------------
/pages/address/address.js:
--------------------------------------------------------------------------------
1 | // pages/address/address.js
2 |
3 | var Api = require('../../utils/api.js')
4 |
5 | Page({
6 | data:{
7 | newAddress: ''
8 | },
9 | onLoad:function(options){
10 | // 页面初始化 options为页面跳转所带来的参数
11 | this.setData({
12 | token: wx.getStorageSync('token'),
13 | originAddress: options.address
14 | })
15 | },
16 | onReady:function(){
17 | // 页面渲染完成
18 | },
19 | onShow:function(){
20 | // 页面显示
21 | },
22 | onHide:function(){
23 | // 页面隐藏
24 | },
25 | onUnload:function(){
26 | // 页面关闭
27 | },
28 | bindInputOnchange: function(event) {
29 | this.setData({
30 | newAddress: event.detail.value
31 | })
32 | },
33 | bindChangeAddressBtn: function() {
34 | wx.request({
35 | url: Api.information + this.data.token,
36 | data: {
37 | address: this.data.newAddress
38 | },
39 | method: 'POST',
40 | success: function(res){
41 | console.log(res)
42 | wx.showToast({
43 | title: '修改成功',
44 | icon: 'success',
45 | duration: 2000
46 | })
47 | wx.navigateBack({
48 | delta: 1, // 回退前 delta(默认为1) 页面
49 | })
50 | }
51 | })
52 | }
53 | })
--------------------------------------------------------------------------------
/pages/address/address.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/address/address.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/pages/address/address.wxss:
--------------------------------------------------------------------------------
1 | /* pages/address/address.wxss */
2 |
3 |
4 | page {
5 | background: #fafafa;
6 | }
7 |
8 |
9 | .header {
10 |
11 | display: flex;
12 | flex-direction: row;
13 | justify-content: space-between;
14 | align-items: center;
15 | border-bottom: 1rpx solid #eee;
16 | padding:30rpx 40rpx;
17 | font-size: 9.75pt;
18 | color: rgba(0, 0, 0, 0.38);
19 | }
20 | .header text {
21 | flex-grow: 1;
22 | }
23 |
24 | .header button {
25 | background: #fafafa;
26 | color: #22a1e0;
27 | }
28 |
29 | .address input {
30 | background: #ffffff;
31 | border-bottom: 1rpx solid #eee;
32 | padding: 20rpx 40rpx;
33 | color: rgba(0, 0, 0);
34 | font-size: 12.75pt;
35 | }
--------------------------------------------------------------------------------
/pages/applylist/applylist.js:
--------------------------------------------------------------------------------
1 | // pages/applylist/applylist.js
2 |
3 | var Api = require('../../utils/api.js');
4 |
5 | Page({
6 | data: {
7 | list: [],
8 | winWidth: '',
9 | winHeight: '',
10 | },
11 | onLoad: function (options) {
12 | wx.getSystemInfo({
13 | success: (res) => {
14 | this.setData(
15 | {
16 | token: wx.getStorageSync('token'),
17 | })
18 | }
19 | })
20 | this.getApplyList()
21 | },
22 | onReady: function () {
23 | // 页面渲染完成
24 | },
25 | onShow: function () {
26 | // 页面显示
27 | },
28 | onHide: function () {
29 | // 页面隐藏
30 | },
31 | onUnload: function () {
32 | // 页面关闭
33 | },
34 |
35 | getApplyList: function () {
36 | wx.request({
37 | url: Api.applylist + this.data.token,
38 | data: {},
39 | method: 'GET',
40 | success: (res) => {
41 | console.log(res)
42 | this.setData({
43 | list: res.data.applyMember
44 | })
45 | }
46 | })
47 | },
48 |
49 |
50 | submitForm: function(event) {
51 | console.log(event.detail.formId)
52 |
53 | var formId = event.detail.formId
54 | var id = event.detail.target.dataset.id
55 | var applyType = event.detail.target.dataset.applyType
56 | this.handleApply(formId, id, applyType, () => {
57 | this.getApplyList()
58 | })
59 | },
60 |
61 | handleApply: function(formId, id, validation, cb) {
62 | console.log('formId', formId)
63 |
64 | wx.request({
65 | url: Api.verifyApply + id + '?token=' + this.data.token,
66 | data: {
67 | validation: validation,
68 | formId: formId
69 | },
70 | method: 'POST',
71 | success: function (res) {
72 | // success
73 | if (res.statusCode == 201) {
74 | typeof cb === 'function' && cb()
75 | }
76 | }
77 | })
78 | }
79 |
80 | })
--------------------------------------------------------------------------------
/pages/applylist/applylist.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/applylist/applylist.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 暂没有申请者
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | {{item.wxName}}
19 |
20 |
21 |
22 |
23 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/pages/applylist/applylist.wxss:
--------------------------------------------------------------------------------
1 | /* pages/applylist/applylist.wxss */
2 |
3 | page {
4 | background: #fafafa;
5 | }
6 |
7 | .list-item {
8 | display: flex;
9 | flex-direction: row;
10 | height: 110rpx;
11 | justify-content: space-between;
12 | align-items: center;
13 | border-bottom: 1rpx solid #eee;
14 | padding: 42rpx 36rpx 20rpx 40rpx;
15 | box-sizing: border-box;
16 | }
17 |
18 | .user {
19 | display: flex;
20 | flex-direction: row;
21 | align-items: center;
22 | }
23 |
24 | .avatar {
25 | }
26 |
27 | .avatar image {
28 | width: 72rpx;
29 | height: 72rpx;
30 | border-radius: 50%;
31 | }
32 |
33 | .name {
34 | margin-left: 20rpx;
35 | }
36 |
37 | .button {
38 | display: flex;
39 | flex-direction: row;
40 | }
41 |
42 | .refuse {
43 | border-radius: 10rpx;
44 | border: solid 1rpx rgba(0, 0, 0, 0.12);
45 | background-color: #fff;
46 | font-size: 14px;
47 | line-height: 52rpx;
48 | color: rgba(0, 0, 0, 0.54);
49 | text-align: center;
50 | margin-right: 22rpx;
51 | }
52 |
53 | .accept {
54 | border-radius: 10rpx;
55 | border: solid 1rpx rgba(0, 0, 0, 0.12);
56 | background-color: #22a1e0;
57 | font-size: 14px;
58 | line-height: 52rpx;
59 | color: #fff;
60 | text-align: center;
61 | }
62 |
63 | .noquick {
64 | display: flex;
65 | flex-direction: column;
66 | }
67 |
68 | .noquick image {
69 | width: 344rpx;
70 | height: 344rpx;
71 | margin: 224rpx auto 0rpx auto;
72 | }
73 |
74 | .noquick text {
75 | margin: 66rpx auto 0rpx auto;
76 | height: 48rpx;
77 | line-height: 48rpx;
78 | font-size: 34rpx;
79 | letter-spacing: -0.8rpx;
80 | text-align: center;
81 | color: rgba(0, 0, 0, 0.38);
82 | }
83 |
--------------------------------------------------------------------------------
/pages/attendance/attendance.js:
--------------------------------------------------------------------------------
1 | // pages/attendance/attendance.js
2 |
3 | var Api = require('../../utils/api.js')
4 |
5 | Page({
6 | data:{
7 | AMstart: '09:00',
8 | AMend: '12:00',
9 | PMstart: '14:00',
10 | PMend: '18:00'
11 | },
12 | onLoad:function(options){
13 | // 页面初始化 options为页面跳转所带来的参数
14 | this.setData({
15 | token: wx.getStorageSync('token')
16 | })
17 | },
18 | onReady:function(){
19 | // 页面渲染完成
20 | },
21 | onShow:function(){
22 | // 页面显示
23 | this.getAttendance();
24 | },
25 | onHide:function(){
26 | // 页面隐藏
27 | },
28 | onUnload:function(){
29 | // 页面关闭
30 | },
31 | getAttendance: function() {
32 | wx.request({
33 | url: Api.information + this.data.token,
34 | data: {},
35 | method: 'POST',
36 | success: (res) => {
37 | this.setData({
38 | AMstart: res.data.commutingTime[0],
39 | AMend: res.data.commutingTime[1],
40 | PMstart: res.data.commutingTime[2],
41 | PMend: res.data.commutingTime[3]
42 | })
43 | },
44 | fail: function() {
45 | // fail
46 | },
47 | complete: function() {
48 | // complete
49 | }
50 | })
51 | },
52 |
53 | //保存修改的上下班时间
54 | saveCommuterTime: function() {
55 | wx.request({
56 | url: Api.information + this.data.token,
57 | data: {
58 | commutingTime: [this.data.AMstart, this.data.AMend, this.data.PMstart, this.data.PMend]
59 | },
60 | method: 'POST',
61 | success: (res) => {
62 | // success
63 | this.getAttendance()
64 | wx.showToast({
65 | title: '修改成功',
66 | icon: 'success',
67 | duration: 2000,
68 | success: () => {
69 | wx.navigateBack({ delta: 1, })
70 | }
71 | })
72 | }
73 | })
74 | },
75 |
76 | //上下班时间监听函数设置
77 | bindTimeChange: function(event) {
78 | var value = event.detail.value
79 | var time = event.currentTarget.dataset.time
80 |
81 | switch(time) {
82 | case 'AMstart' : this.setData({
83 | AMstart: value
84 | })
85 | break;
86 | case 'AMend' : this.setData({
87 | AMend : value
88 | })
89 | break;
90 | case 'PMstart' : this.setData({
91 | PMstart: value
92 | })
93 | break;
94 | case 'PMend' : this.setData({
95 | PMend : value
96 | })
97 | break;
98 | default:
99 | break;
100 | }
101 | },
102 |
103 | })
--------------------------------------------------------------------------------
/pages/attendance/attendance.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/attendance/attendance.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
10 | 上午时间
11 |
12 |
13 | {{AMstart}}
14 |
15 | -
16 |
17 | {{AMend}}
18 |
19 |
20 |
21 |
22 |
23 | 下午时间
24 |
25 |
26 | {{PMstart}}
27 |
28 | -
29 |
30 | {{PMend}}
31 |
32 |
33 |
34 |
35 |
38 |
--------------------------------------------------------------------------------
/pages/attendance/attendance.wxss:
--------------------------------------------------------------------------------
1 | /* pages/attendance/attendance.wxss */
2 |
3 | page {
4 | background: #fafafa;
5 | }
6 |
7 | .header {
8 | padding: 40rpx 40rpx 20rpx 40rpx;
9 | color: rgba(0, 0, 0, 0.38);
10 | font-size: 9.75pt;
11 | border-bottom: 1rpx solid #eee;
12 | }
13 |
14 | .vLine {
15 | background: #fff;
16 | border-bottom: 1rpx solid #eee;
17 | }
18 |
19 | .vMonning {
20 | height: 88rpx;
21 | margin-left: 40rpx;
22 | border-bottom: 1rpx solid #eee;
23 | display: flex;
24 | flex-direction: row;
25 | justify-content: space-between;
26 | align-items: center;
27 | }
28 |
29 | .vAfternoon {
30 | height: 88rpx;
31 | margin-left: 40rpx;
32 | background: #fff;
33 | display: flex;
34 | flex-direction: row;
35 | justify-content: space-between;
36 | align-items: center;
37 | }
38 |
39 | .item-left {
40 | flex: 1;
41 | line-height: 48rpx;
42 | font-size: 12.75pt;
43 | color: #000;
44 | }
45 |
46 | .item-right {
47 | display: flex;
48 | flex-direction: row;
49 | justify-content: flex-end;
50 | align-items: center;
51 | color: rgba(0, 0, 0, 0.54);
52 | }
53 |
54 | .picker {
55 | padding: 10rpx;
56 | font-size: 12.75pt;
57 | }
58 |
59 | .button {
60 | margin-top: 100rpx;
61 | width: 80%;
62 | background: #22a1e0;
63 | color: #fff;
64 | }
65 | .hover {
66 | background-color: #22a1e0;
67 | opacity: 0.7;
68 | }
69 |
--------------------------------------------------------------------------------
/pages/audit/audit.js:
--------------------------------------------------------------------------------
1 | var util = require('../../utils/util.js')
2 | Page({
3 | data: {
4 | winHeight: '',
5 | winWidth: '',
6 | message: '',
7 | companyName: '',
8 | btnDis: false,
9 | },
10 | onLoad: function (options) {
11 | var that = this;
12 | // 获取系统信息
13 | wx.getSystemInfo({
14 | success: function (res) {
15 | that.setData(
16 | {
17 | winWidth: res.windowWidth,
18 | winHeight: res.windowHeight,
19 | message: options.message,
20 | companyName: options.companyName,
21 | });
22 | }
23 | });
24 | },
25 | back: function (e) {
26 | if (this.data.btnDis != true) {
27 | this.setData({
28 | btnDis: true
29 | })
30 | wx.redirectTo({ url: '/pages/list/list' })
31 | util.disable(1000, 3, (backData) => {
32 | if (backData == false)
33 | this.setData({
34 | btnDis: false
35 | })
36 | console.log('解除禁用')
37 | })
38 | }
39 | }
40 | })
--------------------------------------------------------------------------------
/pages/audit/audit.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "审核中"
3 | }
--------------------------------------------------------------------------------
/pages/audit/audit.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{message}}
4 | 请等待 {{companyName}} 审核
5 |
6 |
--------------------------------------------------------------------------------
/pages/audit/audit.wxss:
--------------------------------------------------------------------------------
1 | .vTitle {
2 | display: flex;
3 | flex-direction: column;
4 | align-items: center;
5 | background-color: #fafafa;
6 | }
7 |
8 | .tLabel {
9 | margin-top: 90rpx;
10 | font-size: 40rpx;
11 | height: 56rpx;
12 | }
13 |
14 | .tMessage {
15 | height: 84rpx;
16 | font-size: 28rpx;
17 | line-height: 3;
18 | text-align: center;
19 | color: #888;
20 | }
21 |
22 | .vTitle image {
23 | margin-top: 200rpx;
24 | height: 300rpx;
25 | }
26 |
27 | .bBack {
28 | width: 90%;
29 | height: 94rpx;
30 | line-height: 94rpx;
31 | border: solid 4rpx rgba(5, 5, 5, 0.1);
32 | margin-top: 112rpx;
33 | font-size: 36rpx;
34 | text-align: center;
35 | background-color: #1976d2;
36 | color: #fff;
37 | }
38 |
39 | .btn-hover {
40 | background-color: #1976d2;
41 | opacity: 0.7;
42 | }
43 |
--------------------------------------------------------------------------------
/pages/boss/boss.js:
--------------------------------------------------------------------------------
1 | // pages/boss/boss.js
2 |
3 | var Api = require('../../utils/api.js');
4 |
5 | Page({
6 | data:{
7 | name: '',
8 | address: ''
9 | },
10 | onLoad:function(options){
11 | // 页面初始化 options为页面跳转所带来的参数
12 | this.setData({
13 | token: wx.getStorageSync('token')
14 | })
15 | },
16 | onReady:function(){
17 | // 页面渲染完成
18 | },
19 | onShow:function(){
20 | // 页面显示
21 | this.getInformation()
22 | },
23 | onHide:function(){
24 | // 页面隐藏
25 | },
26 | onUnload:function(){
27 | // 页面关闭
28 | },
29 |
30 | //获取公司信息
31 | getInformation: function() {
32 | wx.request({
33 | url: Api.information + this.data.token,
34 | data: {},
35 | method: 'POST',
36 | success: (res) => {
37 | // success
38 | console.log(res)
39 | this.setData({
40 | name: res.data.name,
41 | address: res.data.address,
42 | latitude: res.data.coordinate_latitude,
43 | longitude: res.data.coordinate_longitude
44 | })
45 | },
46 | fail: function() {
47 | // fail
48 | },
49 | complete: function() {
50 | // complete
51 | }
52 | })
53 | },
54 |
55 | //去修改公司名称
56 | toCompanyName: function() {
57 | wx.navigateTo({
58 | url: '/pages/name/name?name=' + this.data.name,
59 | })
60 | },
61 |
62 | //去修改公司地理位置
63 | toAddress: function() {
64 | wx.navigateTo({
65 | url: '/pages/address/address?address=' + this.data.address,
66 | })
67 | },
68 |
69 | //去修改考勤时间
70 | toAttendance: function() {
71 | wx.navigateTo({
72 | url: '/pages/attendance/attendance',
73 | })
74 | },
75 |
76 | //精准定位
77 | handleUpdateLocation: function() {
78 | this.updateLocation(() => {
79 | wx.showToast({
80 | title: '更新成功',
81 | icon: 'success'
82 | })
83 | this.getInformation()
84 | })
85 | },
86 |
87 | //更新地理位置信息
88 | updateLocation: function(cb) {
89 | wx.getLocation({
90 | type: 'wgs84', // 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标
91 | success: (res) => {
92 | // 更新经度纬度
93 | wx.request({
94 | url: Api.information + this.data.token,
95 | data: {
96 | latitude: res.latitude,
97 | longitude: res.longitude
98 | },
99 | method: 'POST',
100 | success: (res) => {
101 | typeof cb == 'function' && cb()
102 | }
103 | })
104 | }
105 | })
106 | },
107 |
108 | //生产二维码
109 | getQRCode: function() {
110 | wx.showModal({
111 | title: '提示',
112 | content: '请在公司打卡位置生成二维码',
113 | success: (res) => {
114 | if (res.confirm) {
115 | console.log('用户点击确定')
116 | this.updateLocation(() => {
117 | wx.request({
118 | url: Api.qrcode + this.data.token,
119 | data: {},
120 | method: 'GET',
121 | success: (res) => {
122 | wx.navigateTo({
123 | url: '/pages/qrcode/qrcode?QRCodeUrl=' + res.data.QRCodeUrl
124 | + '&name=' + this.data.name
125 | + '&address=' + this.data.address,
126 | })
127 | }
128 | })
129 | })
130 | }
131 | }
132 | })
133 |
134 | },
135 |
136 | //申请列表
137 | toApplyList: function() {
138 | wx.navigateTo({
139 | url: '/pages/applylist/applylist',
140 | })
141 | },
142 |
143 | //解散企业
144 | dissolveCompany: function() {
145 | wx.showModal({
146 | title: '警告',
147 | content: '解散企业会清空所有信息,您确定要解散企业吗?',
148 | success: (res) => {
149 | if (res.confirm) {
150 | wx.request({
151 | url: Api.deleteCompany + this.data.token,
152 | data: {},
153 | method: 'DELETE',
154 | success: function(res){
155 | // success
156 | console.log(res)
157 | if(res.statusCode == 200) {
158 | wx.showToast({
159 | title: '解散成功',
160 | icon: 'success'
161 | })
162 | wx.setStorage({
163 | key: 'userType',
164 | data: res.data.types,
165 | success: function(res){
166 | // success
167 | wx.redirectTo({ url: '/pages/select/select', })
168 | }
169 | })
170 | }
171 | else {
172 | wx.showModal({
173 | title: '提示',
174 | content: '解散企业失败,请稍后再试'
175 | })
176 | }
177 | }
178 | })
179 | }
180 | }
181 | })
182 | },
183 |
184 | feedback: function() {
185 | wx.navigateTo({
186 | url: '/pages/feedback/feedback',
187 | })
188 | }
189 | })
--------------------------------------------------------------------------------
/pages/boss/boss.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/boss/boss.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
10 |
11 | 公司
12 |
13 |
14 | {{name}}
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | 详细地址
23 |
24 |
25 | {{address}}
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | 精准定位
34 |
35 |
36 | 纬度:{{latitude}}-经度:{{longitude}}
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | 考勤时间
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | 申请列表
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | 解散企业
66 |
67 |
68 |
69 |
70 |
71 |
72 | 欢迎反馈
73 |
74 |
--------------------------------------------------------------------------------
/pages/boss/boss.wxss:
--------------------------------------------------------------------------------
1 | /* pages/boss/boss.wxss */
2 |
3 | page {
4 | background-color: #fafafa;
5 | }
6 |
7 | .header {
8 | font-size: 9.75pt;
9 | color: rgba(0, 0, 0, 0.38);
10 | padding: 40rpx 40rpx 18rpx 40rpx;
11 | border-bottom: 1rpx solid #eee;
12 | }
13 |
14 | .content {
15 | background: #fff;
16 | border-bottom: 1rpx solid #eee;
17 | }
18 |
19 | .item {
20 | display: flex;
21 | flex-direction: row;
22 | justify-content: space-between;
23 | align-items: center;
24 | margin-left: 40rpx;
25 | padding: 20rpx 40rpx 20rpx 0;
26 | }
27 |
28 | .item-left {
29 | padding-right: 20rpx;
30 | color: rgba(0, 0, 0, 0.87);
31 | font-size: 12.75pt;
32 | line-height: 48rpx;
33 | }
34 |
35 | .item-right {
36 | flex: 1;
37 | display: flex;
38 | flex-direction: row;
39 | justify-content: flex-end;
40 | align-items: center;
41 | font-size: 12.75pt;
42 | color: rgba(0, 0, 0, 0.54);
43 | line-height: 48rpx;
44 | }
45 |
46 | .bottom {
47 | border-bottom: 1rpx solid #eee;
48 | }
49 |
50 | .content-bottom {
51 | margin-top: 40rpx;
52 | background: #fff;
53 | border-bottom: 1rpx solid #eee;
54 | border-top: 1rpx solid #eee;
55 | }
56 |
57 | .arrow {
58 | border-top: 4rpx solid #c7c7c7;
59 | border-right: 4rpx solid #c7c7c7;
60 | width: 20rpx;
61 | height: 20rpx;
62 | transform: rotate(45deg);
63 | }
64 |
65 | .feedback {
66 | position: absolute;
67 | bottom: 80rpx;
68 | left: 42%;
69 | font-size: 9.75pt;
70 | color: #576b95;
71 | }
72 | .click {
73 | background-color: rgba(200,200,200,0.3);
74 | }
75 |
--------------------------------------------------------------------------------
/pages/code/code.js:
--------------------------------------------------------------------------------
1 | // pages/code/code.js
2 |
3 | var Api = require('../../utils/api.js')
4 |
5 | Page({
6 | data:{},
7 | onLoad:function(options){
8 | // 页面初始化 options为页面跳转所带来的参数
9 |
10 | this.setData({
11 | encrypt: options.encrypt
12 | })
13 |
14 | wx.getStorage({
15 | key: 'token',
16 | success: (res) => {
17 | // success
18 | this.setData({
19 | token: res.data
20 | })
21 | },
22 | fail: function() {
23 | wx.redirectTo({ url: '/pages/login/login' })
24 | }
25 | })
26 |
27 |
28 | },
29 | onReady:function(){
30 | // 页面渲染完成
31 | this.getLocation()
32 | },
33 | onShow:function(){
34 | // 页面显示
35 | },
36 | onHide:function(){
37 | // 页面隐藏
38 | },
39 | onUnload:function(){
40 | // 页面关闭
41 | },
42 |
43 | getLocation: function(cb) {
44 | wx.getLocation({
45 | type: 'wgs84', // 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标
46 | success: (res) => {
47 | // success
48 | this.punch(res.latitude, res.longitude)
49 | wx.showToast({
50 | title: '正在打卡',
51 | icon: 'loading',
52 | duration: 2000
53 | })
54 | },
55 | fail: function() {
56 | wx.redirectTo({
57 | url: '/pages/fail/fail',
58 | })
59 | }
60 | })
61 | },
62 |
63 | punch: function (latitude, longitude) {
64 | var now = new Date()
65 | wx.request({
66 | url: Api.punch + 'encrypt=' + this.data.encrypt + '&token=' + this.data.token,
67 | data: {
68 | latitude: latitude,
69 | longitude: longitude,
70 | time: now
71 | },
72 | method: 'POST',
73 | success: (res) => {
74 | // success
75 |
76 | if (res.statusCode == 201) {
77 | wx.navigateTo({
78 | url: '/pages/success/success?place=' + res.data.place + '&time=' + res.data.h_m_s + '&status=' + res.data.owner.status,
79 | })
80 | }
81 | else if (res.statusCode == 403) {
82 | wx.navigateTo({
83 | url: '/pages/fail/fail?info=' + '超出范围',
84 | })
85 | }
86 | else {
87 | wx.navigateTo({
88 | url: '/pages/fail/fail',
89 | })
90 | }
91 | }
92 | })
93 | },
94 |
95 | })
--------------------------------------------------------------------------------
/pages/code/code.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/code/code.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/pages/code/code.wxss:
--------------------------------------------------------------------------------
1 | /* pages/code/code.wxss */
2 |
3 |
--------------------------------------------------------------------------------
/pages/confirm/confirm.js:
--------------------------------------------------------------------------------
1 | const Api = require('../../utils/api.js')
2 |
3 | Page({
4 | data: {
5 | companyName: '',
6 | companyLocation: '',
7 | checkButton: true,
8 | winWidth: '',
9 | winHeight: '',
10 | },
11 |
12 | onLoad: function (options) {
13 | // 获取系统信息
14 | wx.getSystemInfo({
15 | success: (res) => {
16 | this.setData({
17 | winWidth: res.windowWidth,
18 | winHeight: res.windowHeight
19 | })
20 | }
21 | })
22 |
23 | this.setData({
24 | id: options.companyId,
25 | token: wx.getStorageSync('token')
26 | })
27 |
28 | },
29 |
30 | onShow: function() {
31 | this.getCompanyInfo()
32 | },
33 |
34 | //获取单个公司信息
35 | getCompanyInfo: function() {
36 | wx.request({
37 | url: Api.companyDetail + this.data.id + '?token=' + this.data.token,
38 | data: {},
39 | method: 'GET',
40 | success: (res) => {
41 | console.log(res)
42 | if(res.statusCode == 200) {
43 | this.setData({
44 | companyName: res.data.name,
45 | companyLocation: res.data.address,
46 | })
47 | }
48 | }
49 | })
50 | },
51 |
52 | formAsk: function (event) {
53 | console.log(event.detail)
54 | wx.showModal({
55 | title: '申请加入公司',
56 | content: '确定加入该公司吗?这无法变更,请仔细考虑',
57 | success: (res) => {
58 | if (res.confirm) {
59 | wx.request({
60 | url: Api.joinCompany + this.data.token,
61 | data: {
62 | companyId: this.data.id,
63 | formId: event.detail.formId
64 | },
65 | method: 'POST',
66 | success: (res) => {
67 | wx.redirectTo({
68 | url: '/pages/audit/audit?companyName=' + this.data.companyName + '&message=' + res.data.message
69 | })
70 | }
71 | })
72 | }
73 | else {
74 | wx.navigateBack({
75 | delta: 1, // 回退前 delta(默认为1) 页面
76 | })
77 | }
78 | }
79 | })
80 |
81 | }
82 |
83 | })
--------------------------------------------------------------------------------
/pages/confirm/confirm.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/confirm/confirm.wxml:
--------------------------------------------------------------------------------
1 |
2 | {{companyName}}
3 |
4 |
5 | {{companyLocation}}
6 |
7 |
14 |
--------------------------------------------------------------------------------
/pages/confirm/confirm.wxss:
--------------------------------------------------------------------------------
1 | .vWall {
2 | background-color: #fafafa;
3 | display: flex;
4 | flex-direction: column;
5 | }
6 |
7 | .vWall text {
8 | height: 56rpx;
9 | margin-top: 386rpx;
10 | font-size: 40rpx;
11 | color: #000;
12 | text-align: center;
13 | }
14 |
15 | .vLocation {
16 | margin:10rpx 30rpx 0rpx 30rpx;
17 | display: flex;
18 | justify-content: center;
19 | }
20 |
21 | .vLocation image {
22 | width: 40rpx;
23 | height: 40rpx;
24 | }
25 |
26 | .vLocation text {
27 | height: 48rpx;
28 | font-size: 34rpx;
29 | color: #b2b2b2;
30 | margin: auto 0rpx auto 10rpx;
31 | }
32 |
33 |
34 | .checkBtn {
35 | width: 85%;
36 | margin-top: 108rpx;
37 | background-color: #22a1e0;
38 | color: #fff;
39 | }
40 | .hover {
41 | background-color: #22a1e0;
42 | opacity: 0.7;
43 | }
--------------------------------------------------------------------------------
/pages/create/create.js:
--------------------------------------------------------------------------------
1 | // pages/create/create.js
2 |
3 | var Api = require('../../utils/api.js')
4 |
5 | Page({
6 | data: {
7 | name: '',
8 | location: '',
9 | errMsg: '',
10 | btnDis: true,
11 | },
12 | onLoad: function (options) {
13 | // 页面初始化 options为页面跳转所带来的参数
14 | this.setData({
15 | token: wx.getStorageSync('token')
16 | })
17 | },
18 | onShow: function () {
19 | // 页面显示
20 | },
21 |
22 |
23 | //公司输入
24 | handleInput: function (event) {
25 | var flag = false
26 | var na = event.detail.value
27 | var loca = this.data.location
28 | if (na == '') {
29 | flag = true
30 | }
31 | if (loca == '') {
32 | flag = true
33 | }
34 | this.setData({
35 | name: event.detail.value,
36 | btnDis: flag
37 | })
38 | },
39 |
40 | //选择定位
41 | chooseLocation: function () {
42 | wx.chooseLocation({
43 | success: (res) => {
44 | var flag = false
45 | if (this.data.name == '') {
46 | flag = true
47 | }
48 | this.setData({
49 | location: res,
50 | btnDis: flag
51 | })
52 | }
53 | })
54 | wx.getLocation({
55 | type: 'wgs84',
56 | success: (res) => {
57 | this.setData({
58 | latitude: res.latitude,
59 | longitude: res.longitude
60 | })
61 | }
62 | })
63 | },
64 |
65 | //创建按钮
66 | handleCreateCompany: function () {
67 | this.checkInput((res) => {
68 | if (res == 'success') {
69 | console.log('验证通过')
70 | this.createCompany()
71 | wx.showNavigationBarLoading()
72 | }
73 | })
74 | },
75 |
76 | //创建公司
77 | createCompany: function () {
78 | this.setData({ btnDis: true })
79 | var apiUrl = Api.company + this.data.token
80 | wx.request({
81 | url: apiUrl,
82 | data: {
83 | name: this.data.name,
84 | address: this.data.location.address,
85 | latitude: this.data.latitude,
86 | longitude: this.data.longitude
87 | },
88 | method: 'POST',
89 | success: function (res) {
90 | console.log(res)
91 | if (res.statusCode == 201) {
92 | //创建成功
93 | wx.hideNavigationBarLoading()
94 | wx.setStorageSync('userType', res.data.types)
95 | wx.showToast({
96 | title: '创建成功',
97 | icon: 'success'
98 | })
99 | wx.switchTab({ url: '/pages/workers/workers' })
100 | }
101 | else {
102 | //创建失败
103 | wx.hideNavigationBarLoading()
104 | if (res.statusCode == 403) {
105 | wx.setStorageSync('userType', 'manager')
106 | wx.showModal({
107 | title: '创建失败',
108 | content: '你已经创建了一个公司,点击确定查看',
109 | success: function (res) {
110 | if (res.confirm) {
111 | wx.switchTab({ url: '/pages/workers/workers' })
112 | }
113 | }
114 | })
115 | }else {
116 | wx.showModal({
117 | title: '创建失败',
118 | content: '请您稍后再试',
119 | success: (res) => {
120 | if (res.confirm) {
121 | this.setData({
122 | btnDIs: false
123 | })
124 | }
125 | }
126 | })
127 | }
128 | }
129 | }
130 | })
131 | },
132 |
133 | //验证输入信息
134 | checkInput: function (cb) {
135 | if (this.data.name == '') {
136 | this.setData({
137 | errMsg: '公司名称不能为空'
138 | })
139 | }
140 | else if (this.data.location == '') {
141 | this.setData({
142 | errMsg: '地址位置不能为空'
143 | })
144 | }
145 | else {
146 | this.setData({
147 | errMsg: ''
148 | })
149 | typeof cb == 'function' && cb('success')
150 | }
151 | }
152 |
153 | })
--------------------------------------------------------------------------------
/pages/create/create.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/create/create.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 | 公司
10 |
11 |
12 |
13 |
14 |
15 |
16 | 位置
17 |
18 | {{location.address}}
19 |
20 |
21 |
22 |
23 |
24 | {{errMsg}}
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/pages/create/create.wxss:
--------------------------------------------------------------------------------
1 | page
2 | {
3 | background: #fafafa;
4 | }
5 | .create {
6 | height: 100%;
7 | }
8 |
9 | .header {
10 | height: 100rpx;
11 | background: #fafafa;
12 | font-size: 14px;
13 | padding-left: 40rpx;
14 | color: rgba(0,0,0,0.38);
15 | line-height: 100rpx;
16 | }
17 | .vLine
18 | {
19 | border-top:1rpx solid #eee;
20 | background: #fff;
21 | }
22 | .company {
23 | /*background: blue;*/
24 | display: flex;
25 | flex-direction: row;
26 | justify-content: flex-start;
27 | align-items: center;
28 | border-bottom: 1rpx solid #eee;
29 | height: 88rpx;
30 | margin-left: 20rpx;
31 | box-sizing: border-box;
32 | font-size: 17px;
33 | line-height: 48rpx;
34 | color: rgba(0,0,0,0.87);
35 | }
36 |
37 | .company input {
38 | /*background: lightgoldenrodyellow;*/
39 | padding-left: 32rpx;
40 | color: #757575;
41 | font-size: 12.75pt;
42 | flex: 1
43 | }
44 |
45 | .company icon{
46 | margin-right: 20rpx;
47 | height: 48rpx;
48 | }
49 | .location {
50 | padding: 20rpx 40rpx 20rpx 0rpx;
51 | display: flex;
52 | flex-direction: row;
53 | justify-content: flex-start;
54 | align-items: center;
55 | margin-left: 20rpx;
56 | box-sizing: border-box;
57 | font-size: 17px;
58 | line-height: 48rpx;
59 | }
60 | .address {
61 | padding-left: 20rpx;
62 | flex: 1;
63 | color: rgba(0, 0, 0, 0.54);
64 | font-size: 12.75pt;
65 | }
66 | .vBottomline
67 | {
68 | border-bottom: 1rpx solid #eee;
69 | background: #fff;
70 | }
71 | .arrow {
72 | border-top: 4rpx solid #c7c7c7;
73 | border-right: 4rpx solid #c7c7c7;
74 | width: 20rpx;
75 | height: 20rpx;
76 | transform: rotate(45deg);
77 | }
78 |
79 | .error {
80 | padding: 20rpx;
81 | font-size: 14px;
82 | color: red;
83 | }
84 |
85 | .button {
86 | margin: 120rpx 40rpx;
87 | }
88 |
89 | .default-button {
90 | background-color: #22a1e0;
91 | font-size: 18px;
92 | color: #fff;
93 | }
94 |
95 | .hover {
96 | background-color: #22a1e0;
97 | opacity: 0.7;
98 | }
--------------------------------------------------------------------------------
/pages/editName/editName.js:
--------------------------------------------------------------------------------
1 | var inpuData = '';
2 | Page({
3 | data: {
4 | winWidth: '',
5 | winHeight: '',
6 | name: '',
7 | },
8 | onLoad: function (options) {
9 |
10 | wx.getSystemInfo({
11 | success: (res) => {
12 | this.setData(
13 | {
14 | winWidth: res.windowWidth,
15 | winHeight: res.windowHeight,
16 | name: options.name,
17 | });
18 | }
19 | })
20 | },
21 | bindInput: function(e)
22 | {
23 | inpuData = e.detail.value
24 | }
25 | })
--------------------------------------------------------------------------------
/pages/editName/editName.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/editName/editName.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 修改备注
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/pages/editName/editName.wxss:
--------------------------------------------------------------------------------
1 | .vLine {
2 | background-color: #fafafa;
3 | height: 1rpx;
4 | }
5 |
6 | .vLocation {
7 | height: 88rpx;
8 | border-top: 1rpx solid #eee;
9 | border-bottom: 1rpx solid #eee;
10 | display: flex;
11 | align-items: center;
12 | background-color: #fff;
13 | }
14 |
15 | .vLocation input {
16 | margin: 20rpx auto 20rpx 20rpx;
17 | }
18 |
19 | .tLabel {
20 | margin: 10rpx auto 10rpx 20rpx;
21 | height: 48rpx;
22 | line-height: 48rpx;
23 | font-size: 28rpx;
24 | color: rgba(0, 0, 0, 0.38);
25 | }
26 |
--------------------------------------------------------------------------------
/pages/fail/fail.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | info: '',
4 | winWidth: '',
5 | winHeight: '',
6 | },
7 | onLoad: function (options) {
8 | if(options.info) {
9 | this.setData({
10 | info: options.info
11 | })
12 | }
13 | else {
14 | this.setData({
15 | info: ''
16 | })
17 | }
18 |
19 | wx.getSystemInfo({
20 | success: (res) => {
21 | this.setData(
22 | {
23 | winWidth: res.windowWidth,
24 | winHeight: res.windowHeight,
25 | errMsg: options.errmsg
26 | });
27 | }
28 | })
29 | },
30 | back_click: function () {
31 | wx.navigateBack({
32 | delta: 1, // 回退前 delta(默认为1) 页面
33 | success: function (res) {
34 | // success
35 | }
36 | })
37 | }
38 | })
--------------------------------------------------------------------------------
/pages/fail/fail.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/fail/fail.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 打卡失败
7 |
8 | {{info}}
9 |
10 |
11 |
--------------------------------------------------------------------------------
/pages/fail/fail.wxss:
--------------------------------------------------------------------------------
1 | .vIcon-style {
2 | display: flex;
3 | justify-content: center;
4 | }
5 |
6 | .iIcon {
7 | width: 300rpx;
8 | height: 318rpx;
9 | margin-top: 116rpx;
10 | }
11 |
12 | .vSuccessMsg {
13 | display: flex;
14 | justify-content: center;
15 | margin-top: 78rpx;
16 | }
17 | .vSuccessMsg text
18 | {
19 | height: 80rpx;
20 | object-fit: contain;
21 | font-family: PingFangSC;
22 | font-size: 56rpx;
23 | text-align: center;
24 | color: rgba(255, 111, 0, 0.87);
25 | line-height: 60rpx;
26 | }
27 |
28 | .vDate-part {
29 | margin-top: 146rpx;
30 | }
31 |
32 | .vDate-part text {
33 | height: 100%;
34 | font-size: 36rpx;
35 | letter-spacing: -0.8rpx;
36 | text-align: center;
37 | color: rgba(0, 0, 0, 0.54);
38 | margin: auto 0rpx auto 0rpx;
39 | }
40 |
41 | .vTime-style {
42 | display: flex;
43 | }
44 |
45 | .iTime {
46 | width: 50rpx;
47 | height: 50rpx;
48 | margin-left: 34rpx;
49 | margin-right: 14rpx;
50 | }
51 |
52 | .vLocation-style {
53 | display: flex;
54 | align-items: center;
55 | margin-top: 20rpx;
56 | }
57 |
58 | .iLocation {
59 | width: 50rpx;
60 | height: 50rpx;
61 | margin-left: 34rpx;
62 | margin-right: 14rpx;
63 | }
64 |
65 | .bBack {
66 | width: 90%;
67 | height: 94rpx;
68 | line-height: 94rpx;
69 | border: solid 4rpx rgba(5, 5, 5, 0.1);
70 | margin-top: 336rpx;
71 | font-size: 36rpx;
72 | text-align: center;
73 | color: rgba(0, 0, 0, 0.54);
74 | }
75 |
76 | .info {
77 | margin-top: 40rpx;
78 | text-align: center;
79 | color: rgba(0,0,0,0.54);
80 | }
--------------------------------------------------------------------------------
/pages/feedback/feedback.js:
--------------------------------------------------------------------------------
1 | // pages/feedback/feedback.js
2 | Page({
3 | data:{},
4 | onLoad:function(options){
5 | // 页面初始化 options为页面跳转所带来的参数
6 | // wx.getSystemInfo({
7 | // success: function(res) {
8 | // this.setData({
9 | // windowHeight: res.windowHeight,
10 | // windowWidth: res.windowWidth
11 | // })
12 | // }
13 | // })
14 | },
15 | onReady:function(){
16 | // 页面渲染完成
17 | },
18 | onShow:function(){
19 | // 页面显示
20 | },
21 | onHide:function(){
22 | // 页面隐藏
23 | },
24 | onUnload:function(){
25 | // 页面关闭
26 | }
27 | })
--------------------------------------------------------------------------------
/pages/feedback/feedback.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/feedback/feedback.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/pages/feedback/feedback.wxss:
--------------------------------------------------------------------------------
1 | /* pages/feedback/feedback.wxss */
2 | page {
3 | background: #fafafa;
4 | }
5 |
6 | .feedback {
7 | text-align: center;
8 | margin-top: 200rpx;
9 |
10 | }
11 |
12 | .feedback image {
13 | box-shadow: 8rpx 8rpx 8rpx #eee;
14 | }
--------------------------------------------------------------------------------
/pages/list/list.js:
--------------------------------------------------------------------------------
1 | const Api = require('../../utils/api.js')
2 |
3 | Page({
4 | data: {
5 | lists: [],
6 | winWidth: '',
7 | winHeight: ''
8 | },
9 | onLoad: function () {
10 | //设置token
11 | this.setData({
12 | token: wx.getStorageSync('token')
13 | })
14 |
15 | // 获取系统信息
16 | wx.getSystemInfo({
17 | success: (res) => {
18 | this.setData({
19 | winWidth: res.windowWidth,
20 | winHeight: res.windowHeight
21 | })
22 | }
23 | })
24 | },
25 |
26 | onShow: function() {
27 | this.getCompanyList()
28 | },
29 |
30 | //获取已创建的公司列表
31 | getCompanyList: function() {
32 | wx.request({
33 | url: Api.companyList + this.data.token,
34 | data: {},
35 | method: 'GET',
36 | success: (res) => {
37 | if(res.statusCode == 200) {
38 | this.setData({
39 | lists: res.data
40 | })
41 | }
42 | }
43 | })
44 | },
45 |
46 | //事件处理函数
47 | item_click: function (event) {
48 | var id = event.currentTarget.dataset.companyid
49 | wx.navigateTo({
50 | url: '/pages/confirm/confirm?companyId=' + id
51 | })
52 | },
53 | })
54 |
--------------------------------------------------------------------------------
/pages/list/list.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/list/list.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 请选择要加入的公司
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/pages/list/list.wxss:
--------------------------------------------------------------------------------
1 | page
2 | {
3 | background: #fafafa;
4 | }
5 | .click
6 | {
7 | background: rgba(200,200,200,0.3)
8 | }
9 |
10 | .vLine {
11 | height: 1rpx;
12 | background-color: #eee;
13 | }
14 |
15 | .vLabel {
16 | height: 120rpx;
17 | display: flex;
18 | align-items: center;
19 | background-color: #fafafa;
20 | }
21 |
22 | .vLabel text {
23 | color: rgba(0,0,0,0.38);
24 | font-size: 35rpx;
25 | margin-left: 40rpx;
26 | }
27 | .vTheitemscolor
28 | {
29 | background: #fff;
30 | }
31 | .vCompanylist {
32 | }
33 |
34 | .companyName {
35 | height: 88rpx;
36 | display: flex;
37 | align-items: center;
38 | margin-left: 40rpx;
39 | border-bottom: 1rpx solid #eee;
40 | }
41 |
42 | .companyName text {
43 | color: rgba(0,0,0,0.54);
44 | font-size: 35rpx;
45 | }
46 |
--------------------------------------------------------------------------------
/pages/login/login.js:
--------------------------------------------------------------------------------
1 |
2 | var util = require('../../utils/util.js');
3 | var Api = require('../../utils/api.js')
4 |
5 | Page({
6 | data: {
7 | btnDis: false
8 | },
9 | onLoad: function (options) {
10 | // 页面初始化 options为页面跳转所带来的参数
11 | // wx.clearStorageSync()
12 | //每次进入小程序都 设置token和userType
13 | var token = wx.getStorageSync('token');
14 | if (token && wx.getStorageSync('userType')) {
15 | util.checkToken(token, (res) => {
16 | if (res == 'invail') {
17 | wx.clearStorageSync()
18 | }
19 | else {
20 | if (res == 'good') {
21 | this.updateUserType((userType) => {
22 | this.switchPages(userType)
23 | })
24 | }
25 | }
26 | })
27 | }
28 | },
29 | onShow: function () {
30 | // 页面显示
31 | },
32 |
33 | switchPages: function (userType) {
34 | console.log(userType)
35 | switch (userType) {
36 | case 'manager':
37 | wx.switchTab({ url: '/pages/workers/workers' })
38 | break;
39 | case 'staff':
40 | wx.redirectTo({ url: '/pages/scan/scan?' })
41 | break;
42 | case 'user':
43 | wx.redirectTo({ url: '/pages/select/select' })
44 | break;
45 | default:
46 | break;
47 | }
48 | },
49 |
50 |
51 | //更新个人的userType
52 | updateUserType: function (cb) {
53 | wx.request({
54 | url: Api.userInfo + wx.getStorageSync('token'),
55 | method: 'GET',
56 | success: (res) => {
57 | console.log(res)
58 | if (res.statusCode == 200) {
59 | wx.setStorageSync('userType', res.data.types)
60 | typeof cb == 'function' && cb(res.data.types)
61 | }
62 | }
63 | })
64 | },
65 |
66 | //登录按钮处理函数
67 | handleLoginBtn() {
68 | wx.showToast({
69 | title: '登录中',
70 | icon: 'loading'
71 | })
72 | if (this.data.btnDis != true) {
73 | this.setData({
74 | btnDis: true
75 | })
76 |
77 | util.getToken((res) => {
78 | console.log(res)
79 | //用户拒绝授权
80 | if (res.errMsg == 'userDenyed') {
81 | wx.redirectTo({
82 | url: '/pages/unAuth/unAuth',
83 | })
84 | }
85 | //用户允许授权
86 | else {
87 | wx.setStorageSync('userType', res.types)
88 | wx.setStorage({
89 | key: 'token',
90 | data: res.token,
91 | success: (sssres) => {
92 | this.switchPages(res.types)
93 | },
94 | fail: function () {
95 | console.error('存储token时失败')
96 | }
97 | })
98 | }
99 | })
100 | util.disable(1000, 3, (backData) => {
101 | if (backData == false)
102 | this.setData({
103 | btnDis: false
104 | })
105 | console.log('解除禁用')
106 | })
107 | }
108 | }
109 | })
--------------------------------------------------------------------------------
/pages/login/login.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/login/login.wxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | 微信登录
7 |
8 |
9 | 「打卡咯」是新潮科技自主研发的打卡小程序,微信登录后不会造成信息泄漏,请放心登录。
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/pages/login/login.wxss:
--------------------------------------------------------------------------------
1 | /* pages/login/login.wxss */
2 |
3 | page {
4 | background: #F3F9FE;
5 | position: absolute;
6 | top: 0;
7 | bottom: 0;
8 | }
9 |
10 | .login {
11 |
12 | display: flex;
13 | flex-direction: column;
14 | justify-content: space-between;
15 | align-items: center;
16 | width: 100%;
17 | }
18 |
19 | .header {
20 | width: 100%;
21 | /*background: greenyellow;*/
22 | }
23 |
24 | .header image {
25 | height: 808rpx;
26 | width: 100%;
27 | }
28 |
29 | .title {
30 | line-height: 130rpx;
31 | font-size: 23px;
32 | color: #64b5f6;
33 | }
34 |
35 | .info {
36 | padding: 0 60rpx;
37 | font-size: 13px;
38 | line-height:37rpx;
39 | color: rgba(0, 0, 0, 0.27);
40 | }
41 |
42 | .button {
43 | margin: 60rpx auto 30rpx auto;
44 | width: 80%;
45 | }
46 |
47 | .btn {
48 | background-color: #1976d2;
49 | color: #ffffff;
50 | }
51 |
52 | .btn-hover {
53 | background-color: #1976d2;
54 | opacity: 0.7;
55 | }
--------------------------------------------------------------------------------
/pages/name/name.js:
--------------------------------------------------------------------------------
1 | // pages/name/name.js
2 |
3 | var Api = require('../../utils/api.js')
4 |
5 | Page({
6 | data:{
7 | newName: ''
8 | },
9 | onLoad:function(options){
10 | // 页面初始化 options为页面跳转所带来的参数
11 | this.setData({
12 | token: wx.getStorageSync('token'),
13 | originName: options.name
14 | })
15 | },
16 | onReady:function(){
17 | // 页面渲染完成
18 | },
19 | onShow:function(){
20 | // 页面显示
21 | },
22 | onHide:function(){
23 | // 页面隐藏
24 | },
25 | onUnload:function(){
26 | // 页面关闭
27 | },
28 | bindInputOnchange: function(event) {
29 | this.setData({
30 | newName: event.detail.value
31 | })
32 | },
33 | bindChangeNameBtn: function() {
34 | wx.request({
35 | url: Api.information + this.data.token,
36 | data: {
37 | name: this.data.newName
38 | },
39 | method: 'POST',
40 | success: function(res){
41 | console.log(res)
42 | wx.showToast({
43 | title: '修改成功',
44 | icon: 'success'
45 | })
46 | wx.navigateBack({
47 | delta: 1, // 回退前 delta(默认为1) 页面
48 | })
49 | }
50 | })
51 | }
52 | })
--------------------------------------------------------------------------------
/pages/name/name.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/name/name.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/pages/name/name.wxss:
--------------------------------------------------------------------------------
1 | /* pages/name/name.wxss */
2 |
3 |
4 | page {
5 | background: #fafafa;
6 | }
7 |
8 |
9 | .header {
10 |
11 | display: flex;
12 | flex-direction: row;
13 | justify-content: space-between;
14 | align-items: center;
15 | border-bottom: 1px solid #eee;
16 | padding:30rpx 40rpx;
17 | font-size: 9.75pt;
18 | color: rgba(0, 0, 0, 0.38);
19 | }
20 | .header text {
21 | flex-grow: 1;
22 | }
23 |
24 | .header button {
25 | background: #fafafa;
26 | color: #22a1e0;
27 | }
28 |
29 | .name input {
30 | background: #ffffff;
31 | border-bottom: 1px solid #eee;
32 | padding: 20rpx 40rpx;
33 | color: rgba(0, 0, 0);
34 | font-size: 12.75pt;
35 | }
--------------------------------------------------------------------------------
/pages/qrcode/qrcode.js:
--------------------------------------------------------------------------------
1 | // pages/qrcode/qrcode.js
2 | Page({
3 | data:{},
4 | onLoad:function(options){
5 | // 页面初始化 options为页面跳转所带来的参数
6 | this.setData({
7 | codeUrl : options.QRCodeUrl,
8 | name: options.name,
9 | address: options.address
10 | })
11 | },
12 | onReady:function(){
13 | // 页面渲染完成
14 | },
15 | onShow:function(){
16 | // 页面显示
17 | },
18 | onHide:function(){
19 | // 页面隐藏
20 | },
21 | onUnload:function(){
22 | // 页面关闭
23 | },
24 | bindLoadCode: function(event) {
25 | console.log(event)
26 | }
27 | })
--------------------------------------------------------------------------------
/pages/qrcode/qrcode.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/qrcode/qrcode.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | {{name}}
11 |
12 |
13 |
14 |
15 | {{address}}
16 |
17 |
18 |
19 |
20 | 该二维码用于员工打卡,用户可将其保存导出打印。
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/pages/qrcode/qrcode.wxss:
--------------------------------------------------------------------------------
1 | /* pages/qrcode/qrcode.wxss */
2 | page {
3 | background: #eee;
4 | }
5 |
6 | .code {
7 | background-color: #fff;
8 | display: flex;
9 | flex-direction: column;
10 | justify-content: center;
11 | align-items: center;
12 | margin: 100rpx 50rpx 0 50rpx;
13 | padding-top: 68rpx;
14 | border-radius: 10px;
15 | border: 1px solid #eee;
16 | }
17 |
18 | .name {
19 | margin-top: 48rpx;
20 | font-size: 17px;
21 | line-height: 24px;
22 | color: rgba(0, 0, 0, 0.54);
23 | }
24 |
25 | .location {
26 | margin-top: 14rpx;
27 | font-size: 14px;
28 | line-height: 24px;
29 | color: #b2b2b2;
30 | padding-bottom: 54rpx;
31 | display: flex;
32 | justify-content: center;
33 | align-items: center;
34 | }
35 |
36 | .location image {
37 | width: 40rpx;
38 | height: 40rpx;
39 | margin-right: 10rpx;
40 | }
41 |
42 | .info {
43 | margin: 0 50rpx;
44 | border: 1px solid #eee;
45 | background: #fff;
46 | border-radius: 20rpx;
47 | line-height: 64px;
48 | text-align: center;
49 | height: 128rpx;
50 | font-size: 13px;
51 | color: rgba(0, 0, 0, 0.87);
52 | }
--------------------------------------------------------------------------------
/pages/scan/scan.js:
--------------------------------------------------------------------------------
1 | // pages/scan/scan.js
2 |
3 | //按钮打卡页面
4 |
5 | var Api = require('../../utils/api.js')
6 | var util = require('../../utils/util.js')
7 | var seconds = 10
8 | var ing //定时器
9 | Page({
10 | data: {
11 | encrypt: '',
12 | wxName: '',
13 | avatar: '',
14 | btnStr: '打卡',
15 | touchBled: false,
16 | },
17 |
18 | onShareAppMessage: function () {
19 | return {
20 | title: '打卡咯',
21 | path: '/pages/login/login?'
22 | }
23 | },
24 |
25 |
26 | onLoad: function (options) {
27 |
28 | this.setData({
29 | token: wx.getStorageSync('token')
30 | })
31 |
32 | this.getUserInfo((info) => {
33 | this.setData({
34 | encrypt: info.belongsTo._id,
35 | wxName: info.wxName,
36 | avatar: info.img
37 | })
38 | })
39 | },
40 | onReady: function () {
41 | // 页面渲染完成
42 | // this.getLocation()
43 | // this.getUserInfo()
44 | },
45 | onShow: function () {
46 | // 页面显示
47 | this.startTime()
48 | },
49 | onHide: function () {
50 | // 页面隐藏
51 | },
52 | onUnload: function () {
53 | // 页面关闭
54 | },
55 |
56 | //获取公司id和个人信息
57 | getUserInfo: function (cb) {
58 | wx.request({
59 | url: Api.userInfo + this.data.token,
60 | data: {},
61 | method: 'GET',
62 | success: function (res) {
63 | // success
64 | console.log(res)
65 | typeof cb == 'function' && cb(res.data)
66 | }
67 | })
68 | },
69 |
70 | //打卡按钮
71 |
72 | toClock: function () {
73 | wx.showNavigationBarLoading()
74 | ing = setInterval(() => { this.sleepOneMinute() }, 1000);
75 | console.log("2")
76 |
77 | wx.getLocation({
78 | type: 'wgs84',
79 | success: (res) => {
80 | console.log('location', res)
81 | this.setData({
82 | touchBled: true
83 | })
84 | this.punch(res.latitude, res.longitude)
85 | },
86 | fail: (res) => {
87 | wx.hideNavigationBarLoading()
88 | this.setData({
89 | info: '打卡功能需要获取您的地理位置信息,请稍后重试'
90 | })
91 | }
92 | })
93 | },
94 |
95 | punch: function (latitude, longitude) {
96 | var now = new Date()
97 | console.log(now)
98 | wx.request({
99 | url: Api.punch + 'encrypt=' + this.data.encrypt + '&token=' + this.data.token,
100 | data: {
101 | latitude: latitude,
102 | longitude: longitude,
103 | time: now
104 | },
105 | method: 'POST',
106 | success: (res) => {
107 | // success
108 | wx.hideNavigationBarLoading()
109 | console.log(res)
110 | if (res.statusCode == 201) {
111 | wx.navigateTo({
112 | url: '/pages/success/success?place=' + res.data.place + '&time=' + res.data.h_m_s + '&status=' + res.data.owner.status,
113 | })
114 | }
115 | else if (res.statusCode == 403) {
116 | wx.navigateTo({
117 | url: '/pages/fail/fail?info=' + '超出范围',
118 | })
119 | }
120 | else {
121 | wx.navigateTo({
122 | url: '/pages/fail/fail=',
123 | })
124 | }
125 | }
126 | })
127 | },
128 |
129 | toList: function () {
130 | wx.navigateTo({
131 | url: '/pages/self/self',
132 | })
133 | },
134 |
135 | startTime: function () {
136 | var today = new Date();
137 | var month = today.getMonth();
138 | var day = today.getDate();
139 | var week = today.getDay();
140 | var h = today.getHours();
141 | var m = today.getMinutes();
142 | var s = today.getSeconds();// 在小于10的数字钱前加一个‘0’
143 | month = this.checkTime(month);
144 | day = this.checkTime(day);
145 | m = this.checkTime(m);
146 | s = this.checkTime(s);
147 | this.setData({
148 | hours: h,
149 | minutes: m,
150 | seconds: s,
151 | month: util.translateMonth(month),
152 | day: day,
153 | week: util.translateWeek(week)
154 | })
155 |
156 | var t = setTimeout(() => { this.startTime() }, 500);
157 | },
158 |
159 | checkTime: function (i) {
160 | if (i < 10) {
161 | i = "0" + i;
162 | }
163 | return i;
164 | },
165 |
166 | sleepOneMinute: function () {
167 | if (this.data.touchBled == true) {
168 | seconds--
169 | this.setData({
170 | btnStr: (seconds + ' 秒后可再打卡')
171 | })
172 | if (seconds == 0) {
173 | this.setData({
174 | btnStr: '打卡',
175 | touchBled: false,
176 | })
177 | seconds = 10
178 | clearInterval(ing)
179 | }
180 | }
181 | }
182 | })
--------------------------------------------------------------------------------
/pages/scan/scan.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/scan/scan.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 | {{hours}}:{{minutes}}
11 |
12 |
13 | {{seconds}}
14 |
15 |
16 |
17 | {{month}}月{{day}}日 {{week}}
18 |
19 |
20 |
26 |
--------------------------------------------------------------------------------
/pages/scan/scan.wxss:
--------------------------------------------------------------------------------
1 | /* pages/scan/scan.wxss */
2 |
3 | page {
4 | background-color: #fafafa;
5 | }
6 |
7 |
8 | .header {
9 | display: flex;
10 | flex-direction: column;
11 | justify-content: space-between;
12 | align-items: center;
13 | margin: 80rpx 40rpx 0 40rpx;
14 | border-bottom: 1rpx solid rgba(0, 0, 0, 0.12);
15 | }
16 |
17 | .avatar image {
18 | width: 168rpx;
19 | height: 168rpx;
20 | border-radius: 50%;
21 | }
22 |
23 | .name {
24 | margin-top: 20rpx;
25 | margin-bottom: 40rpx;
26 | line-height: 32px;
27 | font-size: 17.25pt;
28 | color: #000000;
29 | }
30 |
31 | .time-section {
32 | margin-top: 110rpx;
33 |
34 | }
35 |
36 | .time {
37 | display: flex;
38 | flex-direction: row;
39 | justify-content: center;
40 | }
41 |
42 | .hourminuts {
43 | line-height: 154rpx;
44 | font-size: 41.25pt;
45 | color: rgba(0, 0, 0, 0.87);
46 |
47 | }
48 |
49 | .seconds {
50 | line-height: 72rpx;
51 | font-size: 18.75pt;
52 | color: #f5a623;
53 | margin: auto 0rpx 20rpx 0rpx;
54 | }
55 |
56 | .date {
57 | margin-top: 12rpx;
58 | text-align: center;
59 | font-weight: 500;
60 | line-height: 22px;
61 | font-size: 12pt;
62 | color: rgba(0, 0, 0, 0.54);
63 | margin-bottom: 120rpx;
64 | }
65 |
66 | .footer {
67 | /*display: flex;
68 | flex-direction: column;
69 | justify-content: center;*/
70 | /*align-items: center;*/
71 | margin: 0 auto;
72 | width: 80%;
73 | }
74 |
75 | .to-clock {
76 | background-color: #22a1e0;
77 | color: #ffffff;
78 | margin-bottom: 40rpx;
79 | }
80 |
81 | .hover-to-clock {
82 | opacity: 0.7;
83 | }
84 |
85 | .to-list {
86 | color: rgba(0, 0, 0, 0.54);
87 | margin-bottom: 40rpx;
88 | }
89 |
90 | .hover-to-list {
91 | opacity: 0.7;
92 | }
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/pages/select/select.js:
--------------------------------------------------------------------------------
1 | var util = require('../../utils/util.js')
2 | Page({
3 | data: {
4 | btnDis: false
5 | },
6 | onLoad: function (options) {
7 | // 页面初始化 options为页面跳转所带来的参数
8 | },
9 | onReady: function () {
10 | // 页面渲染完成
11 | },
12 | onShow: function () {
13 | // 页面显示
14 | },
15 | onHide: function () {
16 | // 页面隐藏
17 | },
18 | onUnload: function () {
19 | // 页面关闭
20 | },
21 | handleCreateBtn: function () {
22 |
23 | if (this.data.btnDis != true) {
24 | {
25 | this.setData({
26 | btnDis: true
27 | })
28 | wx.navigateTo({
29 | url: '/pages/create/create',
30 | })
31 | util.disable(1000, 2, (backData) => {
32 | if (backData == false) {
33 | console.log('禁用解除')
34 | this.setData({
35 | btnDis: false
36 | })
37 | }
38 | })
39 | }
40 | } else {
41 | wx.showToast({
42 | title: '点击过于频繁',
43 | icon: 'success',
44 | duration: 2000
45 | })
46 | }
47 | },
48 | handleJoinBtn: function () {
49 | if (this.data.btnDis != true) {
50 | {
51 | this.setData({
52 | btnDis: true
53 | })
54 | wx.navigateTo({
55 | url: '/pages/list/list',
56 | })
57 | util.disable(1000, 2, (backData) => {
58 | if (backData == false) {
59 | console.log('禁用解除')
60 | this.setData({
61 | btnDis: false
62 | })
63 | }
64 | })
65 | }
66 | }else {
67 | wx.showToast({
68 | title: '点击过于频繁',
69 | icon: 'success',
70 | duration: 2000
71 | })
72 | }
73 | },
74 |
75 | })
--------------------------------------------------------------------------------
/pages/select/select.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/select/select.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | — 选择身份登录 —
6 |
7 |
8 |
9 | 企业
10 |
11 |
12 |
13 | 员工
14 |
15 |
--------------------------------------------------------------------------------
/pages/select/select.wxss:
--------------------------------------------------------------------------------
1 | /* pages/select/select.wxss */
2 |
3 | page {
4 | background-color: #fafafa;
5 | }
6 |
7 | .select {
8 | display: flex;
9 | width: 100%;
10 | flex-direction: column;
11 | justify-content: center;
12 | align-items: center;
13 | }
14 |
15 | .title {
16 | margin: 60rpx 0 100rpx 0;
17 | line-height: 32px;
18 | font-size: 23px;
19 | color: rgba(0, 0, 0, 0.58);
20 | }
21 |
22 | .company {
23 | display: flex;
24 | flex-direction: column;
25 | justify-content: flex-start;
26 | align-items: center;
27 | font-size: 40rpx;
28 | color: rgba(0, 0, 0, 0.58);
29 | }
30 |
31 | .company image {
32 | height: 280rpx;
33 | width: 240rpx;
34 | }
35 |
36 | .staff {
37 | margin-top: 80rpx;
38 | display: flex;
39 | flex-direction: column;
40 | justify-content: flex-start;
41 | align-items: center;
42 | font-size: 40rpx;
43 | color: rgba(0, 0, 0, 0.58);
44 | }
45 |
46 | .staff image {
47 | height: 280rpx;
48 | width: 240rpx;
49 | }
50 |
--------------------------------------------------------------------------------
/pages/self/self.js:
--------------------------------------------------------------------------------
1 | // pages/self/self.js
2 |
3 | var Api = require('../../utils/api.js')
4 | var util = require('../../utils/util.js')
5 |
6 | Page({
7 | data: {
8 | date: '2017-03-02',
9 | lists: []
10 | },
11 | onLoad: function (options) {
12 | // 页面初始化 options为页面跳转所带来的参数
13 | this.setData({
14 | token: wx.getStorageSync('token')
15 | })
16 | wx.getSystemInfo({
17 | success: (res) => {
18 | this.setData({
19 | winWidth: res.windowWidth,
20 | winHeight: res.windowHeight
21 | })
22 | }
23 | })
24 | },
25 | onReady: function () {
26 | // 页面渲染完成
27 | },
28 | onShow: function () {
29 | // 页面显示
30 | util.obtainIndate((Inday) => {
31 | this.setData({
32 | date: Inday
33 | })
34 | this.getSelfClockList()
35 | })
36 |
37 | },
38 | onHide: function () {
39 | // 页面隐藏
40 | },
41 | onUnload: function () {
42 | // 页面关闭
43 | },
44 |
45 | getSelfClockList: function () {
46 |
47 | wx.request({
48 | url: Api.selftList + this.data.token + '&today=' + this.data.date,
49 | data: {
50 | // today: this.data.date
51 | },
52 | method: 'GET',
53 | success: (res) => {
54 | // success
55 | console.log(res)
56 | if (res.data.length == 0) {
57 | this.setData({
58 | lists: []
59 | })
60 | }
61 | else {
62 | this.setData({
63 | lists: res.data[0].sweeps
64 | })
65 | }
66 | },
67 | fail: function () {
68 | // fail
69 | },
70 | complete: function () {
71 | // complete
72 | }
73 | })
74 | },
75 |
76 | handleQuit: function () {
77 | wx.showModal({
78 | title: '警告',
79 | content: '退出之后将删除所有个人信息,您确定么?',
80 | success: (res) => {
81 | if (res.confirm) {
82 | console.log('用户点击确定')
83 | this.quitCompany()
84 | }
85 | }
86 | })
87 | },
88 |
89 | quitCompany: function () {
90 | wx.request({
91 | url: Api.tofree + this.data.token,
92 | data: {},
93 | method: 'DELETE',
94 | success: (res) => {
95 | // success
96 | if (res.statusCode == 200) {
97 | wx.setStorageSync('userType', 'user')
98 | wx.redirectTo({
99 | url: '/pages/select/select'
100 | })
101 | }
102 | else {
103 | wx.navigateTo({
104 | url: '/pages/login/login',
105 | })
106 | }
107 | }
108 | })
109 | },
110 |
111 | //日期监听
112 | bindDateChange: function (e) {
113 | this.setData({
114 | date: e.detail.value
115 | })
116 | this.getSelfClockList()
117 | },
118 | })
--------------------------------------------------------------------------------
/pages/self/self.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/self/self.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
19 |
20 |
21 | 暂无打卡记录
22 |
23 |
24 |
25 |
26 |
27 |
28 | {{item.h_m_s}}
29 |
30 |
31 | {{item.place}}
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/pages/self/self.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: #fafafa;
3 | }
4 |
5 | .header {
6 | display: flex;
7 | flex-direction: row;
8 | justify-content: space-between;
9 | align-items: center;
10 | height: 100rpx;
11 | padding: 0 40rpx;
12 | box-sizing: border-box;
13 | /*background: firebrick;*/
14 | width: 100%;
15 | }
16 |
17 | .picker {
18 | font-size: 12.75pt;
19 | color: #000000;
20 | }
21 |
22 | .button {
23 |
24 | border-radius: 8rpx;
25 | font-size: 10.5pt;
26 | line-height: 55rpx;
27 | border: solid 1px rgba(0, 0, 0, 0.12);
28 | color: rgba(0, 0, 0, 1);
29 | }
30 |
31 | .hover-button {
32 | opacity: 0.7;
33 | }
34 |
35 | .list-item {
36 | background-color: #fff;
37 | padding: 30rpx 0rpx 0rpx 40rpx;
38 | }
39 |
40 | .time {
41 | font-size: 12.75pt;
42 | line-height: 48rpx;
43 | color: rgba(0, 0, 0, 0.87);
44 | }
45 |
46 | .place {
47 | border-bottom: 1px solid #eee;
48 | padding-top: 16rpx;
49 | padding-bottom: 30rpx;
50 | line-height: 36rpx;
51 | font-size: 9.75pt;
52 | color: rgba(0, 0, 0, 0.54);
53 | }
54 |
55 | .no-record {
56 | display: flex;
57 | flex-direction: column;
58 | }
59 | .no-record image
60 | {
61 | width: 150rpx;
62 | height: 180rpx;
63 | margin: 200rpx auto 0rpx auto;
64 | }
65 | .no-record text
66 | {
67 | margin-top: 77rpx;
68 | height: 48rpx;
69 | font-size: 34rpx;
70 | letter-spacing: -0.8rpx;
71 | text-align: center;
72 | color: rgba(0, 0, 0, 0.38);
73 | }
--------------------------------------------------------------------------------
/pages/signMemo/signMemo.js:
--------------------------------------------------------------------------------
1 | var util = require('../../utils/util.js')
2 | var staffId, Inday, flag = true;
3 | Page({
4 | data: {
5 | winWidth: '',
6 | winHeight: '',
7 | date: '2017-03',
8 | modalDate: '',
9 | modalTime: '',
10 | modalHidden: false,
11 | weeks: [{ week: '一', TYPE: 'vWeeklabel' },
12 | { week: '二', TYPE: 'vWeeklabel' },
13 | { week: '三', TYPE: 'vWeeklabel' },
14 | { week: '四', TYPE: 'vWeeklabel' },
15 | { week: '五', TYPE: 'vWeeklabel' },
16 | { week: '六', TYPE: 'vWeeklabel' },
17 | { week: '日', TYPE: 'vWeeklabel' },],
18 | calendars: []
19 | },
20 | onLoad: function (options) {
21 | wx.getSystemInfo({
22 | success: (res) => {
23 | this.setData(
24 | {
25 | winWidth: res.windowWidth,
26 | winHeight: res.windowHeight,
27 | });
28 | }
29 | })
30 | staffId = options.staffid
31 |
32 | this.loadDate(this.data.date)
33 | },
34 | loadDate: function (date) {
35 | var inday = new Date();
36 | inday.setMonth(inday.getMonth() + 1)
37 | Inday = inday.getDate()
38 | var newdate = new Date(date)
39 | newdate.setDate(1)
40 | this.setData({ calendars: this.data.weeks, date: date })
41 | for (var n = 1; n < newdate.getDay(); n++) {//
42 | // 判断一号是星期几
43 | this.setData({
44 | calendars: this.data.calendars.concat({ week: '', TYPE: 'vWeeknull' }),
45 | })
46 | }
47 | for (var m = 1; m < 31; m++) {
48 | this.setData({
49 | calendars: this.data.calendars.concat({ week: m, TYPE: 'vWeekgray' })
50 | })
51 | }
52 | util.loadStaffDate(date, staffId, (day, backData) => {
53 | console.log(backData)
54 |
55 | // 每一天
56 | for (var i = 0; i < backData.data.length; i++) {
57 | // 循环某一天
58 | var SignDate = new Date(backData.data[i].today)
59 | console.log(SignDate.getDay())
60 |
61 | this.setData({
62 | calendars: this.data.calendars.map((m) => {
63 | console.log(SignDate.getDate())
64 | if (m.week == Inday) {
65 | //如果是今天
66 | m.TYPE = 'vWeekinday'
67 | flag = false
68 | return Object.assign(m, { time: backData.data[i].sweeps[0].h_m_s })
69 | } else {
70 | if (m.week == SignDate.getDate()) {
71 | // 如果是有打卡的
72 | for (var y = 0; y < backData.data[i].sweeps.length; y++)
73 | if (backData.data[i].sweeps[y].conditions != 'ok') {
74 | // 如果打卡不异常
75 | m.TYPE = 'vWeekyellow'
76 | return Object.assign(m, { time: backData.data[i].sweeps[y].h_m_s })
77 | }
78 | } else {
79 | if (flag == false) {
80 | // m.TYPE = 'vWeekred'
81 | }
82 | }
83 | }
84 | return m;
85 | }
86 | ),
87 | date: date
88 | })
89 | }
90 | })
91 | this.setData({
92 | calendars: this.data.calendars.map((m) => {
93 | if (m.week == Inday) {
94 | //如果是今天
95 | m.TYPE = 'vWeekinday'
96 | }
97 | return m
98 | }
99 | )
100 | })
101 | flag = true
102 | },
103 |
104 | changeDate: function (e) {
105 | var str = e.detail.value.split('-')
106 | this.loadDate(e.detail.value)
107 | },
108 | ToChangeName: function (e) {
109 | wx.navigateTo({ url: '/pages' })
110 | },
111 | day_click: function (e) {
112 | console.log(e)
113 | this.setData({
114 | modalHidden: true,
115 | modalDate: this.data.date + '-' + e.currentTarget.dataset.msg,
116 | modalTime: e.currentTarget.dataset.type
117 | })
118 | },
119 | modal_click: function (e) {
120 | this.setData({
121 | modalHidden: false,
122 | modalDate: '',
123 | modalTime: ''
124 | })
125 | },
126 |
127 |
128 | })
--------------------------------------------------------------------------------
/pages/signMemo/signMemo.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/signMemo/signMemo.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 修改备注
5 |
6 |
7 |
8 |
9 | {{date}}
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | {{item.week}}
19 |
20 |
21 |
22 |
23 |
24 |
25 | {{modalDate}}
26 |
--------------------------------------------------------------------------------
/pages/signMemo/signMemo.wxss:
--------------------------------------------------------------------------------
1 | .vChangename {
2 | background-color: #fff;
3 | height: 88rpx;
4 | border-bottom: 1rpx solid #e5e5e5;
5 | border-top: 1rpx solid #e5e5e5;
6 | display: flex;
7 | align-items: center;
8 | }
9 |
10 | .vChangename text {
11 | margin-left: 40rpx;
12 | font-size: 34rpx;
13 | color: rgba(0, 0, 0, 0.87);
14 | }
15 |
16 | .vLabel {
17 | display: flex;
18 | margin-left: 66rpx;
19 | margin-right: 78rpx;
20 | margin-top: 40rpx;
21 | }
22 |
23 | .vDatelabel {
24 | display: flex;
25 | align-items: center;
26 | }
27 |
28 | .tDate {
29 | height: 48rpx;
30 | line-height: 50rpx;
31 | font-size: 34rpx;
32 | letter-spacing: -0.8rpx;
33 | text-align: center;
34 | color: rgba(0, 0, 0, 0.87);
35 | }
36 |
37 | .bClearstaff {
38 | width: 138rpx;
39 | height: 52rpx;
40 | border-radius: 8rpx;
41 | border: solid 1px rgba(0, 0, 0, 0.12);
42 | line-height: 52rpx;
43 | padding-left: 0rpx;
44 | padding-right: 0rpx;
45 | font-size: 28rpx;
46 | color: rgba(0, 0, 0, 0.38);
47 | margin-right: 0rpx;
48 | }
49 |
50 | .vCalendar {
51 | width: 620rpx;
52 | height: 474rpx;
53 | border-radius: 20rpx;
54 | background-color: #fff;
55 | box-shadow: 0 4rpx 8rpx 0 rgba(0, 0, 0, 0.1);
56 | margin: 36rpx auto auto auto;
57 | display: flex;
58 | flex-flow: row wrap;
59 | }
60 |
61 | .vCalendarPadding {
62 | margin: 0rpx 25rpx 0rpx 25rpx;
63 | width: 620rpx;
64 | height: 474rpx;
65 | display: flex;
66 | flex-flow: row wrap;
67 | }
68 |
69 | .vItem {
70 | }
71 |
72 | /*下面是各种打卡状态样式表*/
73 |
74 | .vWeek {
75 | height: 45rpx;
76 | width: 45rpx;
77 | margin: 5rpx 18.5rpx auto 19rpx;
78 | text-align: center;
79 | font-size: 34rpx;
80 | border-radius: 50%;
81 | line-height: 50rpx;
82 | }
83 |
84 | .vWeeklabel {
85 | color: #22a1e0;
86 | height: 45rpx;
87 | width: 45rpx;
88 | margin: 5rpx 18.5rpx auto 19rpx;
89 | text-align: center;
90 | font-size: 34rpx;
91 | border-radius: 50%;
92 | line-height: 50rpx;
93 | }
94 |
95 | .vWeekred {
96 | color: #fff;
97 | height: 45rpx;
98 | width: 45rpx;
99 | margin: 5rpx 18.5rpx auto 19rpx;
100 | text-align: center;
101 | font-size: 34rpx;
102 | border-radius: 50%;
103 | line-height: 50rpx;
104 | background-color: #d0011b;
105 | }
106 |
107 | .vWeekyellow {
108 | color: #fff;
109 | height: 45rpx;
110 | width: 45rpx;
111 | margin: 5rpx 18.5rpx auto 19rpx;
112 | text-align: center;
113 | font-size: 34rpx;
114 | border-radius: 50%;
115 | line-height: 50rpx;
116 | background-color: #ffb74d;
117 | }
118 |
119 | .vWeekinday {
120 | color: rgba(34, 161, 224, 0.87);
121 | height: 45rpx;
122 | width: 45rpx;
123 | margin: 5rpx 18.5rpx auto 19rpx;
124 | text-align: center;
125 | font-size: 34rpx;
126 | border-radius: 50%;
127 | line-height: 50rpx;
128 | border-bottom: 4rpx solid #22a1e0;
129 | }
130 |
131 | .vWeekgray {
132 | color: rgba(0, 0, 0, 0.38);
133 | height: 45rpx;
134 | width: 45rpx;
135 | margin: 5rpx 18.5rpx auto 19rpx;
136 | text-align: center;
137 | font-size: 34rpx;
138 | border-radius: 50%;
139 | line-height: 50rpx;
140 | }
141 |
142 | .vWeeknull {
143 | height: 45rpx;
144 | width: 45rpx;
145 | margin: 5rpx 18.5rpx auto 19rpx;
146 | }
147 | .mModal
148 | {
149 | }
150 | .tModalMsg
151 | {
152 | text-align: center;
153 | }
--------------------------------------------------------------------------------
/pages/success/success.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | offwork: true,
4 | time: '',
5 | location: '',
6 | winWidth: '',
7 | winHeight: '',
8 | },
9 | onLoad: function (options) {
10 | wx.getSystemInfo({
11 | success: (res) => {
12 | this.setData(
13 | {
14 | winWidth: res.windowWidth,
15 | winHeight: res.windowHeight,
16 | errMsg: options.errmsg
17 | });
18 | }
19 | })
20 | if (options.status != 'work') {
21 |
22 | this.setData({
23 | time: options.time,
24 | offwork: false,
25 | location: options.place
26 | })
27 | } else {
28 | this.setData({
29 | time: options.time,
30 | location: options.place
31 | })
32 | }
33 | },
34 | timeCheck: function (timeStr, callback) {
35 | var hour = '', minute = ''
36 | if (timeStr.getHours() < 10)
37 | hour = '0'
38 |
39 | if (timeStr.getMinutes() < 10)
40 | minute = '0'
41 | typeof callback == "function" && callback(hour + timeStr.getHours() + ':' + minute + timeStr.getMinutes())
42 | },
43 | back: function()
44 | {
45 | wx.navigateBack({})
46 | }
47 | })
--------------------------------------------------------------------------------
/pages/success/success.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/success/success.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 打卡成功
8 |
9 |
10 |
11 |
12 | {{time}}
13 |
14 |
15 |
16 | {{location}}
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/pages/success/success.wxss:
--------------------------------------------------------------------------------
1 | .vIcon-style {
2 | display: flex;
3 | justify-content: center;
4 | }
5 |
6 | .iIcon {
7 | height: 318rpx;
8 | margin-top: 200rpx;
9 | }
10 |
11 | .vSuccessMsg {
12 | display: flex;
13 | justify-content: center;
14 | margin-top: 78rpx;
15 | }
16 | .vSuccessMsg text
17 | {
18 | height: 80rpx;
19 | object-fit: contain;
20 | font-family: PingFangSC;
21 | font-size: 56rpx;
22 | text-align: center;
23 | color: rgba(0, 0, 0, 0.54);
24 | line-height: 60rpx;
25 | }
26 |
27 | .vDate-part {
28 | margin-top: 146rpx;
29 | }
30 |
31 | .vDate-part text {
32 | height: 100%;
33 | font-size: 36rpx;
34 | letter-spacing: -0.8rpx;
35 | text-align: center;
36 | color: rgba(0, 0, 0, 0.54);
37 | margin: auto 0rpx auto 0rpx;
38 | }
39 |
40 | .vTime-style {
41 | display: flex;
42 | }
43 |
44 | .iTime {
45 | width: 50rpx;
46 | height: 50rpx;
47 | margin-left: 34rpx;
48 | margin-right: 14rpx;
49 | }
50 |
51 | .vLocation-style {
52 | display: flex;
53 | align-items: center;
54 | margin-top: 20rpx;
55 | }
56 |
57 | .iLocation {
58 | width: 50rpx;
59 | height: 50rpx;
60 | margin-left: 34rpx;
61 | margin-right: 14rpx;
62 | }
63 |
64 | .bBack {
65 | width: 90%;
66 | height: 94rpx;
67 | line-height: 94rpx;
68 | border: solid 4rpx rgba(5, 5, 5, 0.1);
69 | margin-top: 112rpx;
70 | font-size: 36rpx;
71 | text-align: center;
72 | color: rgba(0, 0, 0, 0.54);
73 | }
74 | .vOutcompany
75 | {
76 | height: 40rpx;
77 | font-size: 28rpx;
78 | color: rgba(0, 0, 0, 0.38);
79 | text-align: center;
80 | margin-top: 38rpx;
81 | }
--------------------------------------------------------------------------------
/pages/unAuth/unAuth.js:
--------------------------------------------------------------------------------
1 | // pages/unAuth/unAuth.js
2 | Page({
3 | data:{},
4 | onLoad:function(options){
5 | // 页面初始化 options为页面跳转所带来的参数
6 | },
7 | onReady:function(){
8 | // 页面渲染完成
9 | },
10 | onShow:function(){
11 | // 页面显示
12 | },
13 | onHide:function(){
14 | // 页面隐藏
15 | },
16 | onUnload:function(){
17 | // 页面关闭
18 | }
19 | })
--------------------------------------------------------------------------------
/pages/unAuth/unAuth.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/unAuth/unAuth.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | 该小程序需允许授权才能正常使用
9 | 请退出之后再试
10 |
11 |
12 |
--------------------------------------------------------------------------------
/pages/unAuth/unAuth.wxss:
--------------------------------------------------------------------------------
1 | /* pages/unAuth/unAuth.wxss */
2 |
3 | .unauth {
4 | display: flex;
5 | height: 100%;
6 | flex-direction: column;
7 | justify-content: space-between;
8 | align-items: center;
9 | }
10 |
11 | .warn {
12 | padding-top: 200rpx;
13 | }
14 |
15 | .introduction {
16 |
17 | width: 100%;
18 | line-height: 1.5em;
19 | margin-top: 360rpx;
20 | display: flex;
21 | flex-direction: column;
22 | align-items: center
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/pages/workers/workers.js:
--------------------------------------------------------------------------------
1 | var Api = require('../../utils/api.js')
2 | var util = require('../../utils/util.js')
3 | var companyId, commutingTime;
4 | Page({
5 | data: {
6 | lists: [],
7 | date: '2017-03-02',
8 | },
9 | onLoad: function (options) {
10 | this.setData({
11 | token: wx.getStorageSync('token')
12 | })
13 | companyId = options.companyId
14 | },
15 | onShow: function () {
16 | this.obtainList()
17 | },
18 | onShareAppMessage: function () {
19 | return {
20 | title: '打卡咯',
21 | path: '/pages/login/login?'
22 | }
23 | },
24 | obtainList: function (cb) {
25 | util.obtainIndate((inday) => {
26 | wx.request({
27 | url: Api.clockList + wx.getStorageSync('token'),
28 | method: 'GET',
29 | success: (res) => {
30 | this.setData({
31 | lists: res.data,
32 | date: inday
33 | })
34 | this.obtainDate(this.data.date)
35 | },
36 | fail: function (fail) {
37 | console.log(fail)
38 | },
39 | })
40 | })
41 | },
42 | obtainDate: function (d) {
43 | wx.request({
44 | url: Api.clockList + wx.getStorageSync('token'),
45 | data: {
46 | today: d
47 | },
48 | method: 'GET',
49 | success: (res) => {
50 | console.log(res)
51 | this.setData({
52 | lists: res.data.map((newdata) => {
53 | for (var i = 0; i < newdata.punchCardRecord.length; i++) {
54 | if (newdata.punchCardRecord[i] != null) {
55 | newdata.punchCardRecord[i].sweeps.map((changeSecond) => {
56 | var time = changeSecond.h_m_s.split(':')
57 | changeSecond.h_m_s = time[0] + ":" + time[1]
58 | return changeSecond
59 | })
60 | return Object.assign(newdata, { times: newdata.punchCardRecord[i].sweeps })
61 | }
62 | }
63 | return newdata
64 | })
65 |
66 | })
67 | console.log(this.data.lists)
68 | },
69 | fail: function (fail) {
70 | console.log(fail)
71 | },
72 | })
73 | },
74 | dataChange: function (event) {
75 | console.log(event.detail.value)
76 | this.setData({
77 | date: event.detail.value,
78 | })
79 | this.obtainDate(event.detail.value)
80 | },
81 |
82 | formatChange: function (list) {
83 | // 你可能需要将时间12:00:00的格式转成12:00
84 | var newtime = []
85 | return newtime
86 | },
87 | more_click: function (e) {
88 | wx.navigateTo({ url: '/pages/signMemo/signMemo?staffid=' + e.currentTarget.dataset.staffid })
89 | },
90 | })
--------------------------------------------------------------------------------
/pages/workers/workers.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/workers/workers.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{date}}
6 |
7 |
8 |
9 |
10 |
11 |
12 | {{item.wxName}}
13 |
14 | {{item.times[0].h_m_s}}—{{item.times[1].h_m_s}}
15 | {{item.times[2].h_m_s}}—{{item.times[3].h_m_s}}
16 |
17 |
19 |
20 | -
21 |
22 |
23 |
24 |
25 |
26 |
27 | 暂无员工
28 |
29 |
30 |
--------------------------------------------------------------------------------
/pages/workers/workers.wxss:
--------------------------------------------------------------------------------
1 | .vLine {
2 | height: 2rpx;
3 | background-color: rgba(0, 0, 0, 0.12);
4 | }
5 |
6 | .vDate {
7 | margin-left: 40rpx;
8 | display: flex;
9 | align-items: center;
10 | }
11 | .vLabeldate
12 | {
13 | height: 48rpx;
14 | line-height: 58rpx;
15 | font-size: 34rpx;
16 | color: rgba(0, 0, 0, 0.87);
17 | }
18 |
19 | .vDate image {
20 | width: 25rpx;
21 | height: 25rpx;
22 | margin-left: 18rpx;
23 | /*transform: rotate(90deg);*/
24 | }
25 |
26 | .vWorkRecord {
27 | border-bottom: 1rpx solid rgba(0, 0, 0, 0.12);
28 | margin-left: 40rpx;
29 | height: 132rpx;
30 | display: flex;
31 | align-items: center;
32 | }
33 |
34 | .pWorkers-item {
35 | height: 86rpx;
36 | background-color: #fafafa;
37 | display: flex;
38 | align-items: center;
39 | border-bottom: 1rpx solid rgba(0, 0, 0, 0.12);
40 | }
41 |
42 | .vStaffData {
43 | display: flex;
44 | flex-direction: column;
45 | margin-left: 20rpx;
46 | }
47 |
48 | .tName {
49 | height: 48rpx;
50 | line-height: 48rpx;
51 | font-size: 34rpx;
52 | }
53 |
54 | .tWorkTime {
55 | height: 40rpx;
56 | font-size: 28rpx;
57 | color: rgba(0, 0, 0, 0.38);
58 | margin: 0rpx 40rpx 0rpx 0rpx;
59 | }
60 |
61 | .tNoWorkTime {
62 | margin: 0rpx auto 0rpx 20rpx;
63 | }
64 |
65 | .iHead {
66 | width: 100rpx;
67 | height: 100rpx;
68 | border-radius: 50%;
69 | }
70 |
71 | .iMore {
72 | width: 52rpx;
73 | height: 100%;
74 | margin: 0rpx 40rpx 0rpx auto;
75 | }
76 |
77 | .noquick {
78 | display: flex;
79 | flex-direction: column;
80 | }
81 |
82 | .noquick image {
83 | width: 344rpx;
84 | height: 344rpx;
85 | margin: 224rpx auto 0rpx auto;
86 | }
87 |
88 | .noquick text {
89 | margin: 66rpx auto 0rpx auto;
90 | height: 48rpx;
91 | line-height: 48rpx;
92 | font-size: 34rpx;
93 | letter-spacing: -0.8rpx;
94 | text-align: center;
95 | color: rgba(0, 0, 0, 0.38);
96 | }
--------------------------------------------------------------------------------
/template/company-item.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{item.name}}
4 |
5 |
--------------------------------------------------------------------------------
/template/wokers-item.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{item.wxName}}王小二
5 | {{item.newtime}}
6 | -
7 |
8 |
--------------------------------------------------------------------------------
/utils/api.js:
--------------------------------------------------------------------------------
1 |
2 | var host = 'https://api.clock.newteo.com/';
3 |
4 | var session = host + 'session';
5 | var company = host + 'company/new?token=';
6 | var companyList = host + 'user/companies?token=';
7 | var companyDetail = host + 'user/company/';
8 | var joinCompany = host + 'user/company?token=';
9 | var applylist = host + 'company/applylist?token=';
10 | var deleteCompany = host + 'company/now?token=';
11 | var verifyApply = host + 'company/applylist/';
12 |
13 | var staffsList = host + 'company/staffs?token='
14 | var worktime = host + 'company/information?token=' //用于获取该公司上班时间
15 |
16 | var information = host + 'company/information?token='
17 |
18 | var staffAttdance = host + 'company/staffs/day?token='
19 |
20 | var qrcode = host + 'qrcode/get?token='
21 |
22 | var tofree = host + 'user/tofree?token='
23 |
24 | var punch = host + 'user/punch?'
25 |
26 | var userInfo = host + 'user/info?token='
27 |
28 | var clockList = host + 'company/staffs/day?token='
29 |
30 | var selftList = host + 'user/record?token='
31 | var staffsigns = host + 'company/staffs/'
32 |
33 | module.exports = {
34 | session: session,
35 | company: company,
36 | companyList: companyList,
37 | companyDetail: companyDetail,
38 | joinCompany: joinCompany,
39 | applylist: applylist,
40 | deleteCompany: deleteCompany,
41 | verifyApply: verifyApply,
42 | staffsList: staffsList,
43 | worktime: worktime,
44 | information: information,
45 | staffAttdance: staffAttdance,
46 | qrcode: qrcode,
47 | tofree: tofree,
48 | punch: punch,
49 | userInfo: userInfo,
50 | clockList: clockList,
51 | selftList: selftList,
52 | staffsigns: staffsigns,
53 |
54 | }
55 |
56 | //58b42745679e8155e0a771de
57 | //58b42b04679e8155e0a771e0
58 |
59 | //新增公司
60 | //POST http://localhost:?/company/new?token=${token}
61 |
62 | //获取公司列表
63 | //GET http://localhost:?/user/companies?token=${token}
64 |
65 |
66 | //查看公司详情
67 | //GET http://localhost:?/user/company/:id?token=${token}
68 |
69 |
70 | //申请加入
71 | //POST http://localhost:?/user/company?token=${token}
72 |
73 |
74 | //获取申请人员列表
75 | //GET http://localhost:?/company/applylist?token=${token}
76 |
77 | //删除公司信息
78 | //DELETE http://localhost:?/company/now?token=${token}
79 |
80 |
81 |
82 | //验证申请人员
83 | //POST http://localhost:?/company/applylist/:applyId?token=${token}
84 |
85 |
86 | //获取单天成员打卡信息
87 | // POST http://localhost:?/company/staffs/day?token=${token}
88 |
89 |
90 | //获取成员列表
91 | //GET http://localhost:?/company/staffs?token=${token}
92 |
93 | //获取二维码
94 | //GET http://localhost:?/qrcode/get?token=${token}
95 |
96 | //退出公司
97 | // DELETE http://localhost:?/user/tofree?token=${token}
98 |
99 |
100 | //打卡API
101 | //POST http://localhost:?/user/punch/:companyId?token=${token}
102 |
103 | //获取单天成员打卡信息
104 | // GET http://localhost:?/company/staffs/day?token=${token}&today=${today}
105 |
106 | // 查看自己个人打卡记录
107 | // GET http://localhost:?/user/records?token=${token}
108 |
109 | //查看个人信息
110 | // GET http://localhost:?/user/info?token=${token}
111 |
--------------------------------------------------------------------------------
/utils/util.js:
--------------------------------------------------------------------------------
1 | var delay = 10
2 | var key = require('../secret.js')
3 | var time
4 | var Api = require('./api.js')
5 | //获取code
6 | var getCode = function (callback) {
7 | wx.login({
8 | success: function (res) {
9 | if (res.code) {
10 | typeof callback === "function" && callback(res.code)
11 | }
12 | else {
13 | console.log('获取code失败!' + res.errMsg)
14 | }
15 | }
16 | })
17 | }
18 |
19 | // 获取access_token
20 | function getToken(callback) {
21 | getCode((code) => {
22 | wx.getUserInfo({
23 | success: function (res) {
24 | console.log('用户允许授权')
25 | wx.request({
26 | url: Api.session,
27 | data: {
28 | code: code,
29 | newteo: key.newteo,
30 | iv: res.iv,
31 | encryptedData: res.encryptedData
32 | },
33 | method: 'GET',
34 | success: function (res) {
35 | typeof callback == "function" && callback(res.data)
36 | },
37 | fail: function () {
38 | console.log('wx.request 请求失败')
39 | }
40 | })
41 | },
42 | fail: function (res) {
43 | if (res.errMsg) {
44 | console.log('用户拒绝授权', res)
45 | typeof callback == "function" && callback({ errMsg: "userDenyed" })
46 | }
47 | }
48 | })
49 | })
50 | }
51 |
52 |
53 | var translateMonth = function (month) {
54 | month = month * 1 + 1
55 | if (month < 10) {
56 | return month = '0' + month
57 | }
58 | else return month = month + ''
59 | }
60 |
61 | var translateWeek = function (week) {
62 | switch (week) {
63 | case 0:
64 | return '星期日';
65 | case 1:
66 | return '星期一';
67 | case 2:
68 | return '星期二';
69 | case 3:
70 | return '星期三';
71 | case 4:
72 | return '星期四';
73 | case 5:
74 | return '星期五';
75 | case 6:
76 | return '星期六';
77 | default:
78 | }
79 | }
80 |
81 |
82 | function loadStaffDate(value, id, callback) {
83 | var newdate = new Date(value);
84 | var month;
85 | if (newdate.getMonth() < 10) {
86 | month = '0' + (newdate.getMonth() + 1)
87 | }
88 | wx.request({
89 | url: Api.staffsigns + id,
90 | data: {
91 | today: newdate.getFullYear() + '-' + month,
92 | token: wx.getStorageSync('token')
93 | },
94 | method: 'GET',
95 | success: (res) => {
96 | //服务器返回的员工某月的打卡纪录
97 | console.log(res)
98 | typeof callback == "function" && callback(newdate.getDay(), res)
99 | },
100 | fail: function (fail) {
101 | console.log(fail)
102 | },
103 | })
104 | }
105 | function obtainIndate(cb) {
106 | var obtainInday = new Date()
107 | obtainInday.setMonth(obtainInday.getMonth() + 1)
108 | var month = obtainInday.getMonth(), day = obtainInday.getDate()
109 | if (month < 10)
110 | month = '0' + month
111 | if (day < 10)
112 | day = '0' + day
113 | typeof cb == "function" && cb(obtainInday.getFullYear()
114 | + '-' + month
115 | + '-' + day)
116 | }
117 |
118 | var checkToken = function (token, cb) {
119 | wx.request({
120 | url: Api.userInfo + token,
121 | data: {},
122 | method: 'GET',
123 | success: function (res) {
124 | // success
125 | if (res.statusCode == 200) {
126 | console.log('token有效')
127 | typeof cb == 'function' && cb('good')
128 | }
129 | else {
130 | console.log('token无效')
131 | typeof cb == 'function' && cb('invail')
132 | }
133 |
134 | }
135 | })
136 | }
137 | function disable(seconds, total, callback) {
138 | if (total != '')
139 | delay = total
140 | delay--;
141 | if (delay == 0) {
142 | delay = 10
143 | clearTimeout(time)
144 | typeof callback == "function" && callback(false)
145 | console.log('清除了定时器')
146 | } else {
147 | console.log('重开了定时器计时' + delay)
148 | time = setTimeout(() => { this.disable(seconds,'', callback) }, seconds);
149 | }
150 |
151 | }
152 |
153 | module.exports = {
154 | getToken: getToken,
155 | checkToken: checkToken,
156 | translateMonth: translateMonth,
157 | translateWeek: translateWeek,
158 | loadStaffDate: loadStaffDate,
159 | obtainIndate: obtainIndate,
160 | disable: disable,
161 | }
--------------------------------------------------------------------------------