Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-promotion-wechat
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-promotion-wechat
Commits
19c8ada2
提交
19c8ada2
authored
11月 05, 2024
作者:
lidongxu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
打卡成功
上级
22bc9a1e
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
53 行增加
和
48 行删除
+53
-48
index.js
api/attendance/index.js
+4
-2
index.vue
pages/attendance/index.vue
+10
-7
index.vue
pages/index.vue
+1
-2
getters.js
store/getters.js
+2
-2
map.js
store/modules/map.js
+2
-1
request.js
utils/request.js
+33
-33
storage.js
utils/storage.js
+1
-1
没有找到文件。
api/attendance/index.js
浏览文件 @
19c8ada2
...
...
@@ -18,9 +18,10 @@ export const getAttendanceDetailAPI = (ruleId) => {
* @returns
*/
export
const
addAttendanceAPI
=
(
data
)
=>
{
console
.
log
(
data
)
return
request
({
url
:
'/operation/kqmx/core'
,
method
:
'
post
'
,
data
method
:
'
POST
'
,
data
:
data
})
}
\ No newline at end of file
pages/attendance/index.vue
浏览文件 @
19c8ada2
...
...
@@ -102,17 +102,20 @@ export default {
'off'
:
3
// 前端考勤类型,对应后端数字代表考勤类型
}
const
{
addressComponent
,
location
}
=
await
this
.
$store
.
getters
.
location
const
{
lng
,
lat
}
=
location
const
{
province
,
city
,
district
,
street
}
=
addressComponent
await
addAttendanceAPI
({
"kqLocal"
:
[
100.111
,
99.333
lng
,
lat
],
"kqProvinc"
:
"内蒙古自治区"
,
"kqCity"
:
"呼和浩特市"
,
"kqCounty"
:
"新城区"
,
"kqAddress"
:
"第一街道66号"
,
"kqProvinc"
:
province
,
"kqCity"
:
city
,
"kqCounty"
:
district
,
"kqAddress"
:
street
,
"kqPicurl"
:
"https://www.baidu.com"
,
"kqType"
:
3
"kqType"
:
attendanceType
[
type
]
})
}
}
...
...
pages/index.vue
浏览文件 @
19c8ada2
...
...
@@ -72,14 +72,13 @@ export default {
async
addendanceClick
()
{
const
result
=
await
this
.
$store
.
getters
.
location
// 判断用户位置和获取位置-城市是否一致
if
(
result
.
result
.
addressComponent
.
city
.
startsWith
(
this
.
$store
.
getters
.
user
.
workCityName
))
{
if
(
result
.
addressComponent
.
city
.
startsWith
(
this
.
$store
.
getters
.
user
.
workCityName
))
{
// 跳转到打卡页面
this
.
$tab
.
navigateTo
(
'/pages/attendance/index'
)
}
else
{
// 不一致,提示
this
.
$modal
.
msgError
(
"工作地点与定位地点不同"
);
}
}
}
}
...
...
store/getters.js
浏览文件 @
19c8ada2
...
...
@@ -13,8 +13,8 @@ const getters = {
if
(
state
.
map
.
location
)
{
resolve
(
state
.
map
.
location
)
}
else
{
const
location
=
await
store
.
dispatch
(
'GetLocation'
)
state
.
map
.
location
=
location
const
result
=
await
store
.
dispatch
(
'GetLocation'
)
state
.
map
.
location
=
result
resolve
(
location
)
}
})
...
...
store/modules/map.js
浏览文件 @
19c8ada2
...
...
@@ -24,11 +24,12 @@ const location = {
uni
.
getLocation
({
success
:
async
(
res
)
=>
{
// 经纬度调 百度 逆地理编码获取省市区名字
const
result
=
await
reverseGeocoding
({
const
{
result
}
=
await
reverseGeocoding
({
params
:
{
location
:
res
.
latitude
+
","
+
res
.
longitude
}
})
console
.
log
(
'2'
,
result
)
commit
(
'SET_LOCATION'
,
result
)
resolve
(
result
)
}
...
...
utils/request.js
浏览文件 @
19c8ada2
...
...
@@ -22,39 +22,39 @@ const request = config => {
}
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
request
({
method
:
config
.
method
||
'get'
,
timeout
:
config
.
timeout
||
timeout
,
url
:
config
.
baseUrl
||
baseUrl
+
config
.
url
,
data
:
config
.
data
,
header
:
config
.
header
,
dataType
:
'json'
}).
then
(
response
=>
{
let
[
error
,
res
]
=
response
if
(
error
)
{
toast
(
'后端接口连接异常'
)
reject
(
'后端接口连接异常'
)
return
}
const
code
=
res
.
data
.
code
||
200
const
msg
=
errorCode
[
code
]
||
res
.
data
.
msg
||
errorCode
[
'default'
]
if
(
code
===
401
)
{
showConfirm
(
'登录状态已过期,您可以继续留在该页面,或者重新登录?'
).
then
(
res
=>
{
if
(
res
.
confirm
)
{
store
.
dispatch
(
'LogOut'
).
then
(
res
=>
{
uni
.
reLaunch
({
url
:
'/pages/login'
})
})
}
})
reject
(
'无效的会话,或者会话已过期,请重新登录。'
)
}
else
if
(
code
===
500
)
{
toast
(
msg
)
reject
(
'500'
)
}
else
if
(
code
!==
200
)
{
toast
(
msg
)
reject
(
code
)
}
resolve
(
res
.
data
)
})
method
:
config
.
method
||
'get'
,
timeout
:
config
.
timeout
||
timeout
,
url
:
config
.
baseUrl
||
baseUrl
+
config
.
url
,
data
:
config
.
data
,
header
:
config
.
header
,
dataType
:
'json'
}).
then
(
response
=>
{
let
[
error
,
res
]
=
response
if
(
error
)
{
toast
(
'后端接口连接异常'
)
reject
(
'后端接口连接异常'
)
return
}
const
code
=
res
.
data
.
code
||
200
const
msg
=
errorCode
[
code
]
||
res
.
data
.
msg
||
errorCode
[
'default'
]
if
(
code
===
401
)
{
showConfirm
(
'登录状态已过期,您可以继续留在该页面,或者重新登录?'
).
then
(
res
=>
{
if
(
res
.
confirm
)
{
store
.
dispatch
(
'LogOut'
).
then
(
res
=>
{
uni
.
reLaunch
({
url
:
'/pages/login'
})
})
}
})
reject
(
'无效的会话,或者会话已过期,请重新登录。'
)
}
else
if
(
code
===
500
)
{
toast
(
msg
)
reject
(
'500'
)
}
else
if
(
code
!==
200
)
{
toast
(
msg
)
reject
(
code
)
}
resolve
(
res
.
data
)
})
.
catch
(
error
=>
{
let
{
message
}
=
error
if
(
message
===
'Network Error'
)
{
...
...
utils/storage.js
浏览文件 @
19c8ada2
...
...
@@ -4,7 +4,7 @@ import constant from './constant'
let
storageKey
=
'storage_data'
// 存储节点变量名
let
storageNodeKeys
=
[
constant
.
avatar
,
constant
.
name
,
constant
.
roles
,
constant
.
permissions
,
constant
.
user
]
let
storageNodeKeys
=
[
constant
.
avatar
,
constant
.
name
,
constant
.
roles
,
constant
.
permissions
,
constant
.
user
,
constant
.
location
]
const
storage
=
{
set
:
function
(
key
,
value
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论