Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mingPayMobile
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fengzhaoyu
mingPayMobile
Commits
4eb6fc77
Commit
4eb6fc77
authored
Dec 09, 2019
by
fengzhaoyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
访客隐藏,socket链接地址从全局拿
parent
e98ae274
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
225 additions
and
171 deletions
+225
-171
settings.json
.kaitian/settings.json
+4
-0
http.js
API/http.js
+2
-5
app.js
app.js
+3
-2
historyVistiors.acss
pages/historyVistiors/historyVistiors.acss
+25
-4
historyVistiors.axml
pages/historyVistiors/historyVistiors.axml
+10
-4
historyVistiors.js
pages/historyVistiors/historyVistiors.js
+19
-12
index.axml
pages/index/index.axml
+1
-1
reservations.js
pages/reservations/reservations.js
+13
-8
visitors.acss
pages/visitors/visitors.acss
+1
-1
visitors.axml
pages/visitors/visitors.axml
+2
-3
visitors.js
pages/visitors/visitors.js
+27
-111
visitorsDetail.axml
pages/visitorsDetail/visitorsDetail.axml
+2
-2
visitorsDetail.js
pages/visitorsDetail/visitorsDetail.js
+18
-13
exampleStore.js
stores/exampleStore.js
+94
-3
socket.js
utils/socket.js
+4
-2
No files found.
.kaitian/settings.json
0 → 100644
View file @
4eb6fc77
{
"editor.fontSize"
:
14
}
\ No newline at end of file
API/http.js
View file @
4eb6fc77
...
...
@@ -28,13 +28,10 @@ const $http = (url, data, type, loadingType) => {
data
:
data
,
success
:
function
(
res
)
{
if
(
res
.
data
.
code
==
0
||
res
.
data
.
resultCode
===
0
)
{
console
.
log
(
1111
)
return
resolve
(
res
.
data
.
data
)
dd
.
hideLoading
()
}
else
if
(
res
.
data
.
code
==
401
)
{
console
.
log
(
222
)
dd
.
removeStorageSync
({
key
:
'token'
})
dd
.
hideLoading
()
dd
.
redirectTo
({
...
...
@@ -51,6 +48,7 @@ const $http = (url, data, type, loadingType) => {
}
},
fail
:
function
(
err
)
{
console
.
log
(
JSON
.
stringify
(
err
))
// 服务端没有token
if
(
err
.
status
==
401
)
{
dd
.
httpRequest
({
...
...
@@ -83,7 +81,6 @@ const $http = (url, data, type, loadingType) => {
fail
:
function
(
err
)
{
dd
.
hideLoading
()
if
(
err
.
status
==
426
)
{
console
.
log
(
1121229383
)
dd
.
removeStorageSync
({
key
:
'token'
})
dd
.
redirectTo
({
url
:
'/pages/reTry/reTry'
...
...
@@ -94,7 +91,7 @@ const $http = (url, data, type, loadingType) => {
content
:
'请检查网络并下拉重试'
,
buttonText
:
'确定'
})
}
}
2
}
})
}
...
...
app.js
View file @
4eb6fc77
...
...
@@ -17,7 +17,8 @@ App({
// globalUrl: 'http://192.168.1.101:9999' //本地豪
// globalUrl: 'http://192.168.1.102:4000' //本地豪
// globalUrl:'http://192.168.1.110:9999' // 本地成
// globalUrl:'https://gateway.mingwork.com'
globalUrl
:
'https://gateway-beta.mingwork.com'
globalUrl
:
'https://gateway.mingwork.com'
,
// 线上地址
globalSocketUrl
:
'gateway.mingwork.com'
// 线上地址
// globalUrl:'https://gateway-beta.mingwork.com'
}
});
pages/historyVistiors/historyVistiors.acss
View file @
4eb6fc77
...
...
@@ -3,7 +3,9 @@
font-family: 'PingFangSC-Regular';
letter-spacing: -0.72rpx;
}
.historyVistiors {
padding-bottom: 160rpx;
}
.historyVistiorsTop {
width: 750rpx;
padding: 32rpx 0;
...
...
@@ -196,8 +198,26 @@
line-height: 96rpx;
color: white;
}
.
empty
{
height: 160rpx
;
.
nullImage
{
margin: 0 auto
;
width: 750rpx;
background: #fafafa;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin-top: 200rpx;
}
.nullImage image {
width: 280rpx;
height: 220rpx;
display: block;
margin-bottom: 48rpx;
}
.nullImage text {
display: block;
font-size: 28rpx;
color: rgba(25, 31, 37, 0.48);
}
\ No newline at end of file
pages/historyVistiors/historyVistiors.axml
View file @
4eb6fc77
...
...
@@ -8,11 +8,16 @@
</view>
<view class="historyVistorsCenter">
<view class="selectClass">
<view class="{{type == '1' ? 'clickTabs' : ''}}" data-type="1" onTap="changeType">我的访客</view>
<view class="{{type !== '1' ? 'clickTabs' : ''}}" data-type="0" onTap="changeType">公司访客</view>
<view class="{{type
History
== '1' ? 'clickTabs' : ''}}" data-type="1" onTap="changeType">我的访客</view>
<view class="{{type
History
!== '1' ? 'clickTabs' : ''}}" data-type="0" onTap="changeType">公司访客</view>
</view>
</view>
<view class="historyVistiorsBottom" a:for="{{dataList}}" a:for-index="index" a:for-item="item" onTap="select" data-item="{{item}}">
<view class="nullImage" a:if="{{isNull}}">
<image mode="scaleToFill" src="../../../assets/noPermission.png"/>
<text>当前暂无历史访客记录</text>
</view>
<view a:else>
<view class="historyVistiorsBottom" a:for="{{dataHistoryList}}" a:for-index="index" a:for-item="item" onTap="select" data-item="{{item}}">
<view>
<view class="iconfont iconxuanze {{item.recordId==recordId?'selects':'select'}}"></view>
<view class="name ">{{item.visitorName}}</view>
...
...
@@ -27,8 +32,8 @@
<view class="byVisitor">被访人:{{item.byVisitorName}}</view>
</view>
</view>
<view class="empty"></view>
<view class="button">
<view onTap="confirm">确认选择</view>
</view>
</view>
</view>
\ No newline at end of file
pages/historyVistiors/historyVistiors.js
View file @
4eb6fc77
...
...
@@ -6,23 +6,24 @@ create.Page({
store
:
exampleStore
,
useAll
:
true
,
data
:
{
type
:
'1'
,
dataList
:
[],
type
History
:
'1'
,
data
History
List
:
[],
currentPage
:
1
,
pageSize
:
10
,
totalCount
:
''
,
select
:
''
,
recordId
:
''
,
index
:
''
,
value
:
''
value
:
''
,
isNull
:
true
},
changeType
(
event
)
{
this
.
setData
({
type
:
event
.
target
.
dataset
.
type
,
dataList
:
[],
type
History
:
event
.
target
.
dataset
.
type
,
data
History
List
:
[],
currentPage
:
1
})
this
.
visitorList
(
this
.
data
.
type
)
this
.
visitorList
(
this
.
data
.
type
History
)
},
visitorList
(
type
)
{
const
_that
=
this
...
...
@@ -34,7 +35,7 @@ create.Page({
}
$http
.
$http
(
'/admin/visitor/getRecordList'
,
data
,
'post'
).
then
(
res
=>
{
let
dataList
=
res
.
records
;
let
dataListSource
=
_that
.
data
.
data
List
;
;
let
dataListSource
=
_that
.
data
.
data
HistoryList
;
if
(
dataList
.
length
>
0
)
{
dataList
.
forEach
((
item
,
index
)
=>
{
if
(
new
Date
(
item
.
endTime
.
replace
(
/
\-
/g
,
"/"
)).
getTime
()
<
new
Date
().
getTime
())
{
...
...
@@ -56,8 +57,14 @@ create.Page({
dataList
=
dataListSource
let
totalCount
=
Math
.
ceil
(
parseInt
(
res
.
total
)
/
_that
.
data
.
pageSize
)
_that
.
setData
({
dataList
:
dataList
,
totalCount
:
totalCount
dataHistoryList
:
dataList
,
totalCount
:
totalCount
,
isNull
:
false
})
}
else
{
_that
.
setData
({
isNull
:
true
})
}
})
...
...
@@ -89,7 +96,7 @@ create.Page({
});
this
.
setData
({
index
:
query
.
index
,
dataList
:
[]
data
History
List
:
[]
})
},
visitorInput
(
event
)
{
...
...
@@ -100,7 +107,7 @@ create.Page({
serchConfirm
()
{
const
_that
=
this
this
.
setData
({
dataList
:
[]
data
History
List
:
[]
})
_that
.
visitorList
()
...
...
@@ -153,7 +160,7 @@ create.Page({
this
.
setData
({
currentPage
:
currentNum
})
this
.
visitorList
(
this
.
data
.
type
)
this
.
visitorList
(
this
.
data
.
type
History
)
}
},
onShareAppMessage
()
{
...
...
pages/index/index.axml
View file @
4eb6fc77
...
...
@@ -19,6 +19,6 @@
<view onTap="navigatorToNext" data-type="2"><image mode="scaleToFill" src="./../../assets/recharge.png"/>充值</view>
<view onTap="navigatorToNext" data-type="3"><image mode="scaleToFill" src="./../../assets/allowance.png"/>津贴</view>
<view onTap="navigatorToNext" data-type="4"><image mode="scaleToFill" src="./../../assets/bill.png"/>账单</view>
<
view onTap="navigatorToNext" data-type="5"><image mode="scaleToFill" src="./../../assets/bill.png"/>{{visitorName}}</view
>
<
!-- <view onTap="navigatorToNext" data-type="5"><image mode="scaleToFill" src="./../../assets/bill.png"/>{{visitorName}}</view> --
>
</view>
</view>
pages/reservations/reservations.js
View file @
4eb6fc77
...
...
@@ -140,7 +140,7 @@ create.Page({
title
:
'外部联人'
,
multiple
:
false
,
//是否多选 true多选,false单选,默认是单选
limitTips
:
"请单选"
,
success
:
function
(
res
)
{
success
:
function
(
res
)
{
if
(
_that
.
data
.
index
==
0
)
{
_that
.
store
.
data
.
visitorPhone
=
''
_that
.
store
.
data
.
visitorName
=
res
[
0
].
name
...
...
@@ -154,7 +154,7 @@ create.Page({
_that
.
update
()
}
},
fail
:
function
(
err
)
{
fail
:
function
(
err
)
{
_that
.
store
.
data
.
selectVisitors
=
false
_that
.
update
()
}
...
...
@@ -176,7 +176,7 @@ create.Page({
dd
.
choosePhonebook
({
title
:
'手机通讯录'
,
multiple
:
false
,
//是否多选: true多选 false单选; 默认true
success
:
function
(
res
)
{
success
:
function
(
res
)
{
console
.
log
(
res
,
'res'
)
if
(
_that
.
data
.
index
==
0
)
{
_that
.
store
.
data
.
visitorPhone
=
res
[
0
].
mobile
...
...
@@ -190,7 +190,7 @@ create.Page({
_that
.
update
()
}
},
fail
:
function
(
err
)
{
fail
:
function
(
err
)
{
_that
.
store
.
data
.
selectVisitors
=
false
_that
.
update
()
}
...
...
@@ -239,7 +239,7 @@ create.Page({
title
:
"选择周知人"
,
//标题
multiple
:
false
,
//是否多选
responseUserOnly
:
true
,
//返回人,或者返回人和部门
success
:
function
(
res
)
{
success
:
function
(
res
)
{
console
.
log
(
res
,
'copyPerson'
)
res
.
users
.
forEach
((
item
,
index
)
=>
{
_that
.
data
.
copyPerson
.
push
(
item
)
...
...
@@ -248,7 +248,7 @@ create.Page({
copyPerson
:
_that
.
duplicateRemoval
(
_that
.
data
.
copyPerson
)
})
},
fail
:
function
(
err
)
{
fail
:
function
(
err
)
{
console
.
log
(
err
,
'copyPerson'
)
}
})
...
...
@@ -259,7 +259,8 @@ create.Page({
content
:
'最多可选取6人'
,
buttonText
:
'确定'
})
}
},
}
},
// 周知人去重
duplicateRemoval
(
person
)
{
let
obj
=
{};
...
...
@@ -308,6 +309,10 @@ create.Page({
}
if
(
this
.
data
.
formValidation
)
{
$http
.
$http
(
'/admin/visitor/addRecord'
,
data
,
'post'
).
then
(
res
=>
{
this
.
store
.
data
.
dataList
=
[]
this
.
store
.
visitorList
(
1
,
10
,
1
,
1
)
this
.
store
.
data
.
type
=
'1'
this
.
update
()
dd
.
alert
({
content
:
'预约成功'
,
buttonText
:
'确定'
,
...
...
@@ -513,7 +518,7 @@ create.Page({
// 页面显示
// 关闭遮照层
const
_that
=
this
setTimeout
(
function
(
res
)
{
setTimeout
(
function
(
res
)
{
_that
.
store
.
data
.
selectVisitors
=
false
;
_that
.
update
()
},
0.1
)
...
...
pages/visitors/visitors.acss
View file @
4eb6fc77
...
...
@@ -184,8 +184,8 @@
.appointment {
padding: 16rpx 36rpx;
background: white;
position: absolute;
position: fixed;
background-attachment: fixed;
bottom: 0;
left: 0;
right: 0;
...
...
pages/visitors/visitors.axml
View file @
4eb6fc77
...
...
@@ -25,7 +25,7 @@
<view>{{`${item.startTime.year}.${item.startTime.month}.${item.startTime.date}~${item.endTime.year}.${item.endTime.month}.${item.endTime.date}`}}</view>
</view>
</view>
<view class='appointment'>
</view>
<view class='appointment'>
<view class='appointmentButton' onTap="appointment">立即预约</view>
</view>
</view>
\ No newline at end of file
pages/visitors/visitors.js
View file @
4eb6fc77
const
app
=
getApp
()
import
$http
from
'./../../API/http'
Page
({
import
create
from
'dd-store'
import
exampleStore
from
'/stores/exampleStore'
create
.
Page
({
store
:
exampleStore
,
useAll
:
true
,
data
:
{
type
:
'1'
,
dataList
:
[],
currentPage
:
1
,
pageSize
:
10
,
totalCount
:
''
,
overdue
:
false
,
todayVisit
:
0
,
arrivedVisit
:
0
,
isNull
:
true
// 列表默认为空
},
arriveStaus
(
self
)
{
const
_that
=
this
let
data
=
{
type
:
0
,
self
:
self
,
}
$http
.
$http
(
'/admin/visitor/getCurrentCount'
,
data
,
'post'
).
then
(
res
=>
{
_that
.
setData
({
todayVisit
:
res
[
1
],
arrivedVisit
:
res
[
0
]
})
}).
catch
(
err
=>
{
})
},
// 我的访客 公司访客 切换
changeType
(
event
)
{
this
.
setData
({
type
:
event
.
target
.
dataset
.
type
,
dataList
:
[],
currentPage
:
1
})
this
.
visitorList
(
this
.
data
.
type
)
this
.
arriveStaus
(
this
.
data
.
type
)
},
visitorList
(
type
)
{
const
_that
=
this
let
data
=
{
currentPage
:
this
.
data
.
currentPage
,
pageSize
:
this
.
data
.
pageSize
,
type
:
type
}
$http
.
$http
(
'/admin/visitor/getRecordList'
,
data
,
'post'
).
then
(
res
=>
{
let
dataList
=
res
.
records
;
let
dataListSource
=
_that
.
data
.
dataList
;;
if
(
dataList
.
length
>
0
)
{
dataList
.
forEach
((
item
,
index
)
=>
{
if
(
new
Date
(
item
.
endTime
.
replace
(
/
\-
/g
,
"/"
)).
getTime
()
<
new
Date
().
getTime
())
{
item
.
overdue
=
true
}
else
{
item
.
overdue
=
false
}
if
(
new
Date
(
item
.
endTime
.
replace
(
/
\-
/g
,
"/"
)).
getTime
()
-
new
Date
(
item
.
startTime
.
replace
(
/
\-
/g
,
"/"
)).
getTime
()
<
24
*
60
*
60
*
3
*
1000
)
{
item
.
longTime
=
false
}
else
{
item
.
longTime
=
true
}
item
.
endTime
=
_that
.
timeToStr
(
item
.
endTime
)
item
.
startTime
=
_that
.
timeToStr
(
item
.
startTime
)
dataListSource
.
push
(
item
)
})
dataList
=
dataListSource
let
totalCount
=
Math
.
ceil
(
parseInt
(
res
.
total
)
/
_that
.
data
.
pageSize
)
_that
.
setData
({
dataList
:
dataList
,
totalCount
:
totalCount
,
isNull
:
false
})
}
else
{
_that
.
setData
({
dataList
:
[],
totalCount
:
1
,
isNull
:
true
})
}
currentPage
:
1
,
})
this
.
store
.
data
.
type
=
event
.
target
.
dataset
.
type
this
.
store
.
data
.
dataList
=
[]
this
.
update
()
this
.
store
.
visitorList
(
this
.
data
.
currentPage
,
this
.
data
.
pageSize
,
event
.
target
.
dataset
.
type
,
event
.
target
.
dataset
.
type
)
},
timeToStr
(
time
)
{
if
(
/-/
.
test
(
time
))
{
time
=
time
.
replace
(
/
\-
/g
,
"/"
)
}
let
timeData
=
new
Date
(
time
)
let
year
=
timeData
.
getFullYear
()
let
month
=
timeData
.
getMonth
()
+
1
let
date
=
timeData
.
getDate
()
let
hour
=
timeData
.
getHours
()
let
minute
=
timeData
.
getMinutes
()
return
{
year
:
year
,
month
:
month
.
toString
().
length
>
1
?
month
:
'0'
+
month
,
date
:
date
.
toString
().
length
>
1
?
date
:
'0'
+
date
,
hour
:
hour
.
toString
().
length
>
1
?
hour
:
'0'
+
hour
,
minute
:
minute
.
toString
().
length
>
1
?
minute
:
'0'
+
minute
,
yearMonthDate
:
`
${
year
}
年
${
month
.
toString
().
length
>
1
?
month
:
'0'
+
month
}
月
${
date
.
toString
().
length
>
1
?
date
:
'0'
+
date
}
日`
,
hourMinute
:
`
${
hour
.
toString
().
length
>
1
?
hour
:
'0'
+
hour
}
:
${
minute
.
toString
().
length
>
1
?
minute
:
'0'
+
minute
}
`
,
allTime
:
`
${
year
}
年
${
month
.
toString
().
length
>
1
?
month
:
'0'
+
month
}
月
${
date
.
toString
().
length
>
1
?
date
:
'0'
+
date
}
日
${
hour
.
toString
().
length
>
1
?
hour
:
'0'
+
hour
}
:
${
minute
.
toString
().
length
>
1
?
minute
:
'0'
+
minute
}
分`
}
},
// 进入访客详情页面
navigatorToNext
(
event
)
{
dd
.
navigateTo
({
url
:
`./../visitorsDetail/visitorsDetail?item=
${
JSON
.
stringify
(
event
.
target
.
dataset
.
item
)}
`
})
},
// 进入立即预约页面
appointment
()
{
dd
.
navigateTo
({
url
:
'./../reservations/reservations'
});
},
resetData
()
{
this
.
setData
({
type
:
'1'
,
dataList
:
[],
currentPage
:
1
,
pageSize
:
10
,
totalCount
:
''
,
overdue
:
false
,
todayVisit
:
0
,
arrivedVisit
:
0
})
this
.
store
.
data
.
dataList
=
[]
this
.
store
.
data
.
type
=
'1'
this
.
update
()
},
onLoad
(
query
)
{
console
.
log
(
'进入onLoad'
)
this
.
resetData
()
dd
.
setNavigationBar
({
title
:
'智能访客'
});
this
.
visitorList
(
1
)
this
.
arriveStaus
(
1
)
this
.
store
.
visitorList
(
this
.
data
.
currentPage
,
this
.
data
.
pageSize
,
1
,
1
)
},
onReady
()
{
},
onShow
()
{
// 页面显示
console
.
log
(
'进入onshow'
)
// 页面显示 兼容iOS 不加延时数据发生改变也不会重新渲染
const
_that
=
this
setTimeout
(()
=>
{
_that
.
update
()
},
100
);
},
onHide
()
{
// 页面隐藏
...
...
@@ -145,27 +65,23 @@ Page({
},
onReachBottom
()
{
let
currentNum
=
''
;
if
(
this
.
data
.
currentPage
<
this
.
data
.
totalCount
)
{
if
(
this
.
data
.
currentPage
<
this
.
store
.
data
.
totalCount
)
{
currentNum
=
this
.
data
.
currentPage
+
1
this
.
setData
({
currentPage
:
currentNum
})
this
.
visitorList
(
this
.
data
.
type
)
this
.
store
.
visitorList
(
this
.
data
.
currentPage
,
this
.
data
.
pageSize
,
this
.
data
.
type
,
this
.
data
.
type
)
}
},
onPullDownRefresh
()
{
this
.
setData
({
type
:
'1'
,
dataList
:
[],
currentPage
:
1
,
pageSize
:
10
,
totalCount
:
''
,
overdue
:
false
,
})
this
.
visitorList
(
this
.
data
.
type
)
this
.
arriveStaus
(
1
)
this
.
store
.
data
.
dataList
=
[]
this
.
update
()
this
.
store
.
visitorList
(
this
.
data
.
currentPage
,
this
.
data
.
pageSize
,
this
.
data
.
type
,
this
.
data
.
type
)
dd
.
stopPullDownRefresh
()
},
onShareAppMessage
()
{
// 返回自定义分享信息
...
...
pages/visitorsDetail/visitorsDetail.axml
View file @
4eb6fc77
<view class="visitorsDetail">
<view class="visitorTab">
<view class='visitorTabLeft'>{{visitor
Name.substring(visitor
Name.length-2)}}</view>
<view class='visitorTabLeft'>{{visitor
DetailName.substring(visitorDetail
Name.length-2)}}</view>
<view class="visitorTabRight">
<view class="name">
<view>{{visitorName}}</view>
<view>{{visitor
Detail
Name}}</view>
<text class="iconzhankai iconfont" onTap="isHidden" ></text>
<view class="hidden " a:if={{isHidden}} >
<view class="{{item.mobile == selectId?'select':''}}" a:for="{{visitorList1}}" a:for-index="index" a:for-item="item" onTap="selectVisitor" data-item='{{item}}'>
...
...
pages/visitorsDetail/visitorsDetail.js
View file @
4eb6fc77
const
app
=
getApp
()
import
$http
from
'./../../API/http'
Page
({
import
create
from
'dd-store'
import
exampleStore
from
'/stores/exampleStore'
create
.
Page
({
store
:
exampleStore
,
useAll
:
true
,
data
:
{
visitorName
:
''
,
//访客的名字
visitor
Detail
Name
:
''
,
//访客的名字
company
:
''
,
// 到访者的公司
startTimeYear
:
''
,
// 开始时间的年月日
startHour
:
''
,
// 开始时间的小时
...
...
@@ -31,12 +35,9 @@ Page({
this
.
setData
({
isHidden
:
true
})
}
},
selectVisitor
(
event
)
{
console
.
log
(
event
.
target
.
dataset
.
item
.
mobile
,
11111111
)
if
(
this
.
data
.
isHidden
)
{
this
.
setData
({
isHidden
:
false
...
...
@@ -49,15 +50,13 @@ Page({
}
this
.
setData
({
visitorName
:
event
.
target
.
dataset
.
item
.
name
,
visitor
Detail
Name
:
event
.
target
.
dataset
.
item
.
name
,
phone
:
event
.
target
.
dataset
.
item
.
mobile
,
selectId
:
event
.
target
.
dataset
.
item
.
mobile
,
})
},
onLoad
(
event
)
{
console
.
log
(
JSON
.
parse
(
event
.
item
),
'query'
)
//由JSON字符串转换为JSON对象)
const
that
=
this
let
query
=
JSON
.
parse
(
event
.
item
)
...
...
@@ -67,7 +66,7 @@ Page({
this
.
setData
({
visitorList1
:
query
.
visitorList1
,
self
:
query
.
self
,
visitorName
:
query
.
visitorName
,
visitor
Detail
Name
:
query
.
visitorName
,
company
:
query
.
companyName
,
startTimeYear
:
`
${
query
.
startTime
.
yearMonthDate
}
`
,
startHour
:
`
${
query
.
startTime
.
hourMinute
}
`
,
...
...
@@ -84,6 +83,8 @@ Page({
recordId
:
query
.
recordId
,
selectId
:
query
.
mobile
})
console
.
log
(
this
.
data
.
visitorDetailName
,
'query'
)
},
onReady
()
{
...
...
@@ -102,8 +103,10 @@ Page({
recordId
:
this
.
data
.
recordId
}
$http
.
$http
(
'/admin/visitor/cancelVisit'
,
data
,
'post'
).
then
(
res
=>
{
console
.
log
(
res
)
this
.
setData
({
processStatus
:
'cancel'
})
this
.
store
.
data
.
dataList
=
[]
this
.
store
.
visitorList
(
1
,
10
,
this
.
store
.
data
.
type
,
this
.
store
.
data
.
type
)
this
.
update
()
})
}
},
...
...
@@ -124,8 +127,10 @@ Page({
recordId
:
this
.
data
.
recordId
}
$http
.
$http
(
'/admin/visitor/confirmVisit'
,
data
,
'post'
).
then
(
res
=>
{
console
.
log
(
res
)
this
.
setData
({
processStatus
:
'arrive'
})
this
.
store
.
data
.
dataList
=
[]
this
.
store
.
visitorList
(
1
,
10
,
this
.
store
.
data
.
type
,
this
.
store
.
data
.
type
)
this
.
update
()
})
}
...
...
@@ -142,9 +147,9 @@ Page({
phoneNumber
:
this
.
data
.
phone
,
// 期望拨打的电话号码
code
:
'+86'
,
// 国家代号,中国是+86
showDingCall
:
true
,
// 是否显示钉钉电话
success
:
function
(
res
)
{
success
:
function
(
res
)
{
},
fail
:
function
(
err
)
{
fail
:
function
(
err
)
{
}
});
},
...
...
stores/exampleStore.js
View file @
4eb6fc77
import
$http
from
'../API/http'
class
Store
{
data
=
{
title
:
'测试'
,
visitorName
:
''
,
// 主访客的姓名
visitorPhone
:
''
,
selectVisitors
:
false
,
//控制遮照层是否层出
visitorPeer
:[],
// 同行
backgroundColor
:
'#fff'
,
//预约访客页面顶部导航栏的背景色
visitorPeer
:
[],
// 同行
dataList
:
[],
// 访客列表
isNull
:
false
,
// 访客列表是否为空 默认为空
totalCount
:
''
,
// 分页数量
todayVisit
:
0
,
// 今天的访客
arrivedVisit
:
0
,
// 已到访的访客
type
:
'1'
,
// 默认选中我的访客
}
// 访客列表
visitorList
(
currentPage
,
pageSize
,
type
,
self
)
{
let
data
=
{
currentPage
:
currentPage
,
// 当前页数
pageSize
:
pageSize
,
// 每页几条数据
type
:
type
// 0: 公司访客 1: 我的访客
}
$http
.
$http
(
'/admin/visitor/getRecordList'
,
data
,
'post'
).
then
(
res
=>
{
let
dataList
=
res
.
records
;
console
.
log
(
dataList
,
'dataList'
)
let
dataListSource
=
this
.
data
.
dataList
;
if
(
dataList
.
length
>
0
)
{
// overdue 是否过期 overdue==true 代表没有过期 overdue==false 代表过期
// longTime 预约是否为长期 longTime==true 为长期 longTime==false 为短期
dataList
.
forEach
((
item
,
index
)
=>
{
if
(
new
Date
(
item
.
endTime
.
replace
(
/
\-
/g
,
"/"
)).
getTime
()
<
new
Date
().
getTime
())
{
item
.
overdue
=
true
}
else
{
item
.
overdue
=
false
}
if
(
new
Date
(
item
.
endTime
.
replace
(
/
\-
/g
,
"/"
)).
getTime
()
-
new
Date
(
item
.
startTime
.
replace
(
/
\-
/g
,
"/"
)).
getTime
()
<
24
*
60
*
60
*
3
*
1000
)
{
item
.
longTime
=
false
}
else
{
item
.
longTime
=
true
}
item
.
endTime
=
this
.
timeToStr
(
item
.
endTime
)
item
.
startTime
=
this
.
timeToStr
(
item
.
startTime
)
dataListSource
.
push
(
item
)
})
let
totalCount
=
Math
.
ceil
(
parseInt
(
res
.
total
)
/
pageSize
)
this
.
data
.
dataList
=
dataListSource
this
.
data
.
totalCount
=
totalCount
this
.
data
.
isNull
=
false
this
.
arriveStaus
(
self
)
this
.
update
()
}
else
{
this
.
data
.
dataList
=
[]
this
.
data
.
totalCount
=
1
this
.
data
.
isNull
=
true
this
.
data
.
todayVisit
=
0
this
.
data
.
arrivedVisit
=
0
this
.
update
()
}
})
}
// 处理时间
timeToStr
(
time
)
{
if
(
/-/
.
test
(
time
))
{
time
=
time
.
replace
(
/
\-
/g
,
"/"
)
}
let
timeData
=
new
Date
(
time
)
let
year
=
timeData
.
getFullYear
()
let
month
=
timeData
.
getMonth
()
+
1
let
date
=
timeData
.
getDate
()
let
hour
=
timeData
.
getHours
()
let
minute
=
timeData
.
getMinutes
()
return
{
year
:
year
,
month
:
month
.
toString
().
length
>
1
?
month
:
'0'
+
month
,
date
:
date
.
toString
().
length
>
1
?
date
:
'0'
+
date
,
hour
:
hour
.
toString
().
length
>
1
?
hour
:
'0'
+
hour
,
minute
:
minute
.
toString
().
length
>
1
?
minute
:
'0'
+
minute
,
yearMonthDate
:
`
${
year
}
年
${
month
.
toString
().
length
>
1
?
month
:
'0'
+
month
}
月
${
date
.
toString
().
length
>
1
?
date
:
'0'
+
date
}
日`
,
hourMinute
:
`
${
hour
.
toString
().
length
>
1
?
hour
:
'0'
+
hour
}
:
${
minute
.
toString
().
length
>
1
?
minute
:
'0'
+
minute
}
`
,
allTime
:
`
${
year
}
年
${
month
.
toString
().
length
>
1
?
month
:
'0'
+
month
}
月
${
date
.
toString
().
length
>
1
?
date
:
'0'
+
date
}
日
${
hour
.
toString
().
length
>
1
?
hour
:
'0'
+
hour
}
:
${
minute
.
toString
().
length
>
1
?
minute
:
'0'
+
minute
}
分`
}
}
// 到访状态
// 到访的
arriveStaus
(
self
)
{
let
data
=
{
type
:
0
,
// type 当月的
self
:
self
,
// 代表公司还是我的访客
}
$http
.
$http
(
'/admin/visitor/getCurrentCount'
,
data
,
'post'
).
then
(
res
=>
{
this
.
data
.
todayVisit
=
res
[
1
]
this
.
data
.
arrivedVisit
=
res
[
0
]
this
.
update
()
}).
catch
(
err
=>
{
})
}
}
...
...
utils/socket.js
View file @
4eb6fc77
var
app
=
getApp
()
// socket已经连接成功
var
socketOpen
=
false
// socket已经调用关闭function
...
...
@@ -35,8 +36,9 @@ var webSocket = {
socketClose
=
false
socketMsgQueue
=
[]
dd
.
connectSocket
({
url
:
`wss://gateway-beta.mingwork.com/mingpay-phone-websocket/v1/mingpaywebsocket?param=
${
dd
.
corpId
}
_
${
dd
.
getStorageSync
({
key
:
'userId'
}).
data
}
`
,
// url: `ws://192.168.1.102:8400/v1/mingpaywebsocket?param=${dd.corpId}_${dd.getStorageSync({ key: 'userId' }).data}`,
// url: `wss://gateway.mingwork.com/mingpay-phone-websocket/v1/mingpaywebsocket?param=${dd.corpId}_${dd.getStorageSync({ key: 'userId' }).data}`,
// url: `wss://gateway-beta.mingwork.com/mingpay-phone-websocket/v1/mingpaywebsocket?param=${dd.corpId}_${dd.getStorageSync({ key: 'userId' }).data}`,
url
:
`wss://
${
app
.
globalData
.
globalSocketUrl
}
/mingpay-phone-websocket/v1/mingpaywebsocket?param=
${
dd
.
corpId
}
_
${
dd
.
getStorageSync
({
key
:
'userId'
}).
data
}
`
,
data
:
{
userType
:
0
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment