Commit 4eb6fc77 by fengzhaoyu

访客隐藏,socket链接地址从全局拿

parent e98ae274
{
"editor.fontSize": 14
}
\ No newline at end of file
...@@ -28,13 +28,10 @@ const $http = (url, data, type, loadingType) => { ...@@ -28,13 +28,10 @@ const $http = (url, data, type, loadingType) => {
data:data, data:data,
success: function(res) { success: function(res) {
if( res.data.code == 0 || res.data.resultCode === 0 ) { if( res.data.code == 0 || res.data.resultCode === 0 ) {
console.log(1111)
return resolve(res.data.data) return resolve(res.data.data)
dd.hideLoading() dd.hideLoading()
} }
else if(res.data.code == 401) { else if(res.data.code == 401) {
console.log(222)
dd.removeStorageSync({key: 'token'}) dd.removeStorageSync({key: 'token'})
dd.hideLoading() dd.hideLoading()
dd.redirectTo({ dd.redirectTo({
...@@ -51,6 +48,7 @@ const $http = (url, data, type, loadingType) => { ...@@ -51,6 +48,7 @@ const $http = (url, data, type, loadingType) => {
} }
}, },
fail: function(err) { fail: function(err) {
console.log(JSON.stringify(err))
// 服务端没有token // 服务端没有token
if(err.status == 401 ) { if(err.status == 401 ) {
dd.httpRequest({ dd.httpRequest({
...@@ -83,7 +81,6 @@ const $http = (url, data, type, loadingType) => { ...@@ -83,7 +81,6 @@ const $http = (url, data, type, loadingType) => {
fail: function(err) { fail: function(err) {
dd.hideLoading() dd.hideLoading()
if(err.status == 426) { if(err.status == 426) {
console.log(1121229383)
dd.removeStorageSync({key: 'token'}) dd.removeStorageSync({key: 'token'})
dd.redirectTo({ dd.redirectTo({
url: '/pages/reTry/reTry' url: '/pages/reTry/reTry'
...@@ -94,7 +91,7 @@ const $http = (url, data, type, loadingType) => { ...@@ -94,7 +91,7 @@ const $http = (url, data, type, loadingType) => {
content:'请检查网络并下拉重试', content:'请检查网络并下拉重试',
buttonText: '确定' buttonText: '确定'
}) })
} }2
} }
}) })
} }
......
...@@ -17,7 +17,8 @@ App({ ...@@ -17,7 +17,8 @@ App({
// globalUrl: 'http://192.168.1.101:9999' //本地豪 // globalUrl: 'http://192.168.1.101:9999' //本地豪
// globalUrl: 'http://192.168.1.102:4000' //本地豪 // globalUrl: 'http://192.168.1.102:4000' //本地豪
// globalUrl:'http://192.168.1.110:9999' // 本地成 // globalUrl:'http://192.168.1.110:9999' // 本地成
// globalUrl:'https://gateway.mingwork.com' globalUrl:'https://gateway.mingwork.com', // 线上地址
globalUrl:'https://gateway-beta.mingwork.com' globalSocketUrl:'gateway.mingwork.com' // 线上地址
// globalUrl:'https://gateway-beta.mingwork.com'
} }
}); });
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
font-family: 'PingFangSC-Regular'; font-family: 'PingFangSC-Regular';
letter-spacing: -0.72rpx; letter-spacing: -0.72rpx;
} }
.historyVistiors {
padding-bottom: 160rpx;
}
.historyVistiorsTop { .historyVistiorsTop {
width: 750rpx; width: 750rpx;
padding: 32rpx 0; padding: 32rpx 0;
...@@ -196,8 +198,26 @@ ...@@ -196,8 +198,26 @@
line-height: 96rpx; line-height: 96rpx;
color: white; color: white;
} }
.empty { .nullImage {
height: 160rpx; margin: 0 auto;
width: 750rpx; 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
...@@ -8,11 +8,16 @@ ...@@ -8,11 +8,16 @@
</view> </view>
<view class="historyVistorsCenter"> <view class="historyVistorsCenter">
<view class="selectClass"> <view class="selectClass">
<view class="{{type == '1' ? 'clickTabs' : ''}}" data-type="1" onTap="changeType">我的访客</view> <view class="{{typeHistory == '1' ? 'clickTabs' : ''}}" data-type="1" onTap="changeType">我的访客</view>
<view class="{{type !== '1' ? 'clickTabs' : ''}}" data-type="0" onTap="changeType">公司访客</view> <view class="{{typeHistory !== '1' ? 'clickTabs' : ''}}" data-type="0" onTap="changeType">公司访客</view>
</view> </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>
<view class="iconfont iconxuanze {{item.recordId==recordId?'selects':'select'}}"></view> <view class="iconfont iconxuanze {{item.recordId==recordId?'selects':'select'}}"></view>
<view class="name ">{{item.visitorName}}</view> <view class="name ">{{item.visitorName}}</view>
...@@ -27,8 +32,8 @@ ...@@ -27,8 +32,8 @@
<view class="byVisitor">被访人:{{item.byVisitorName}}</view> <view class="byVisitor">被访人:{{item.byVisitorName}}</view>
</view> </view>
</view> </view>
<view class="empty"></view>
<view class="button"> <view class="button">
<view onTap="confirm">确认选择</view> <view onTap="confirm">确认选择</view>
</view> </view>
</view>
</view> </view>
\ No newline at end of file
...@@ -6,23 +6,24 @@ create.Page({ ...@@ -6,23 +6,24 @@ create.Page({
store: exampleStore, store: exampleStore,
useAll: true, useAll: true,
data: { data: {
type: '1', typeHistory: '1',
dataList: [], dataHistoryList: [],
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
totalCount: '', totalCount: '',
select: '', select: '',
recordId: '', recordId: '',
index: '', index: '',
value: '' value: '',
isNull: true
}, },
changeType(event) { changeType(event) {
this.setData({ this.setData({
type: event.target.dataset.type, typeHistory: event.target.dataset.type,
dataList: [], dataHistoryList: [],
currentPage: 1 currentPage: 1
}) })
this.visitorList(this.data.type) this.visitorList(this.data.typeHistory)
}, },
visitorList(type) { visitorList(type) {
const _that = this const _that = this
...@@ -34,7 +35,7 @@ create.Page({ ...@@ -34,7 +35,7 @@ create.Page({
} }
$http.$http('/admin/visitor/getRecordList', data, 'post').then(res => { $http.$http('/admin/visitor/getRecordList', data, 'post').then(res => {
let dataList = res.records; let dataList = res.records;
let dataListSource = _that.data.dataList;; let dataListSource = _that.data.dataHistoryList;
if (dataList.length > 0) { if (dataList.length > 0) {
dataList.forEach((item, index) => { dataList.forEach((item, index) => {
if (new Date(item.endTime.replace(/\-/g, "/")).getTime() < new Date().getTime()) { if (new Date(item.endTime.replace(/\-/g, "/")).getTime() < new Date().getTime()) {
...@@ -56,8 +57,14 @@ create.Page({ ...@@ -56,8 +57,14 @@ create.Page({
dataList = dataListSource dataList = dataListSource
let totalCount = Math.ceil(parseInt(res.total) / _that.data.pageSize) let totalCount = Math.ceil(parseInt(res.total) / _that.data.pageSize)
_that.setData({ _that.setData({
dataList: dataList, dataHistoryList: dataList,
totalCount: totalCount totalCount: totalCount,
isNull: false
})
}
else {
_that.setData({
isNull: true
}) })
} }
}) })
...@@ -89,7 +96,7 @@ create.Page({ ...@@ -89,7 +96,7 @@ create.Page({
}); });
this.setData({ this.setData({
index: query.index, index: query.index,
dataList: [] dataHistoryList: []
}) })
}, },
visitorInput(event) { visitorInput(event) {
...@@ -100,7 +107,7 @@ create.Page({ ...@@ -100,7 +107,7 @@ create.Page({
serchConfirm() { serchConfirm() {
const _that = this const _that = this
this.setData({ this.setData({
dataList: [] dataHistoryList: []
}) })
_that.visitorList() _that.visitorList()
...@@ -153,7 +160,7 @@ create.Page({ ...@@ -153,7 +160,7 @@ create.Page({
this.setData({ this.setData({
currentPage: currentNum currentPage: currentNum
}) })
this.visitorList(this.data.type) this.visitorList(this.data.typeHistory)
} }
}, },
onShareAppMessage() { onShareAppMessage() {
......
...@@ -19,6 +19,6 @@ ...@@ -19,6 +19,6 @@
<view onTap="navigatorToNext" data-type="2"><image mode="scaleToFill" src="./../../assets/recharge.png"/>充值</view> <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="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="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>
</view> </view>
...@@ -140,7 +140,7 @@ create.Page({ ...@@ -140,7 +140,7 @@ create.Page({
title: '外部联人', title: '外部联人',
multiple: false, //是否多选 true多选,false单选,默认是单选 multiple: false, //是否多选 true多选,false单选,默认是单选
limitTips: "请单选", limitTips: "请单选",
success: function(res) { success: function (res) {
if (_that.data.index == 0) { if (_that.data.index == 0) {
_that.store.data.visitorPhone = '' _that.store.data.visitorPhone = ''
_that.store.data.visitorName = res[0].name _that.store.data.visitorName = res[0].name
...@@ -154,7 +154,7 @@ create.Page({ ...@@ -154,7 +154,7 @@ create.Page({
_that.update() _that.update()
} }
}, },
fail: function(err) { fail: function (err) {
_that.store.data.selectVisitors = false _that.store.data.selectVisitors = false
_that.update() _that.update()
} }
...@@ -176,7 +176,7 @@ create.Page({ ...@@ -176,7 +176,7 @@ create.Page({
dd.choosePhonebook({ dd.choosePhonebook({
title: '手机通讯录', title: '手机通讯录',
multiple: false, //是否多选: true多选 false单选; 默认true multiple: false, //是否多选: true多选 false单选; 默认true
success: function(res) { success: function (res) {
console.log(res, 'res') console.log(res, 'res')
if (_that.data.index == 0) { if (_that.data.index == 0) {
_that.store.data.visitorPhone = res[0].mobile _that.store.data.visitorPhone = res[0].mobile
...@@ -190,7 +190,7 @@ create.Page({ ...@@ -190,7 +190,7 @@ create.Page({
_that.update() _that.update()
} }
}, },
fail: function(err) { fail: function (err) {
_that.store.data.selectVisitors = false _that.store.data.selectVisitors = false
_that.update() _that.update()
} }
...@@ -239,7 +239,7 @@ create.Page({ ...@@ -239,7 +239,7 @@ create.Page({
title: "选择周知人", //标题 title: "选择周知人", //标题
multiple: false, //是否多选 multiple: false, //是否多选
responseUserOnly: true, //返回人,或者返回人和部门 responseUserOnly: true, //返回人,或者返回人和部门
success: function(res) { success: function (res) {
console.log(res, 'copyPerson') console.log(res, 'copyPerson')
res.users.forEach((item, index) => { res.users.forEach((item, index) => {
_that.data.copyPerson.push(item) _that.data.copyPerson.push(item)
...@@ -248,7 +248,7 @@ create.Page({ ...@@ -248,7 +248,7 @@ create.Page({
copyPerson: _that.duplicateRemoval(_that.data.copyPerson) copyPerson: _that.duplicateRemoval(_that.data.copyPerson)
}) })
}, },
fail: function(err) { fail: function (err) {
console.log(err, 'copyPerson') console.log(err, 'copyPerson')
} }
}) })
...@@ -259,7 +259,8 @@ create.Page({ ...@@ -259,7 +259,8 @@ create.Page({
content: '最多可选取6人', content: '最多可选取6人',
buttonText: '确定' buttonText: '确定'
}) })
} }, }
},
// 周知人去重 // 周知人去重
duplicateRemoval(person) { duplicateRemoval(person) {
let obj = {}; let obj = {};
...@@ -308,6 +309,10 @@ create.Page({ ...@@ -308,6 +309,10 @@ create.Page({
} }
if (this.data.formValidation) { if (this.data.formValidation) {
$http.$http('/admin/visitor/addRecord', data, 'post').then(res => { $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({ dd.alert({
content: '预约成功', content: '预约成功',
buttonText: '确定', buttonText: '确定',
...@@ -513,7 +518,7 @@ create.Page({ ...@@ -513,7 +518,7 @@ create.Page({
// 页面显示 // 页面显示
// 关闭遮照层 // 关闭遮照层
const _that = this const _that = this
setTimeout(function(res) { setTimeout(function (res) {
_that.store.data.selectVisitors = false; _that.store.data.selectVisitors = false;
_that.update() _that.update()
}, 0.1) }, 0.1)
......
...@@ -184,8 +184,8 @@ ...@@ -184,8 +184,8 @@
.appointment { .appointment {
padding: 16rpx 36rpx; padding: 16rpx 36rpx;
background: white; background: white;
position: absolute;
position: fixed; position: fixed;
background-attachment: fixed;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
......
...@@ -25,7 +25,7 @@ ...@@ -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>{{`${item.startTime.year}.${item.startTime.month}.${item.startTime.date}~${item.endTime.year}.${item.endTime.month}.${item.endTime.date}`}}</view>
</view> </view>
</view> </view>
<view class='appointment'> </view>
<view class='appointment'>
<view class='appointmentButton' onTap="appointment">立即预约</view> <view class='appointmentButton' onTap="appointment">立即预约</view>
</view>
</view> </view>
\ No newline at end of file
const app = getApp() const app = getApp()
import $http from './../../API/http' import $http from './../../API/http'
Page({ import create from 'dd-store'
import exampleStore from '/stores/exampleStore'
create.Page({
store: exampleStore,
useAll: true,
data: { data: {
type: '1',
dataList: [],
currentPage: 1, currentPage: 1,
pageSize: 10, 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) { changeType(event) {
this.setData({ this.setData({
type: event.target.dataset.type, currentPage: 1,
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
})
}
}) })
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) { navigatorToNext(event) {
dd.navigateTo({ url: `./../visitorsDetail/visitorsDetail?item=${JSON.stringify(event.target.dataset.item)}` }) dd.navigateTo({ url: `./../visitorsDetail/visitorsDetail?item=${JSON.stringify(event.target.dataset.item)}` })
}, },
// 进入立即预约页面
appointment() { appointment() {
dd.navigateTo({ url: './../reservations/reservations' }); dd.navigateTo({ url: './../reservations/reservations' });
}, },
resetData() { resetData() {
this.setData({ this.setData({
type: '1',
dataList: [],
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
totalCount: '',
overdue: false,
todayVisit: 0, todayVisit: 0,
arrivedVisit: 0 arrivedVisit: 0
}) })
this.store.data.dataList = []
this.store.data.type = '1'
this.update()
}, },
onLoad(query) { onLoad(query) {
console.log('进入onLoad') console.log('进入onLoad')
this.resetData() this.resetData()
dd.setNavigationBar({ title: '智能访客' }); dd.setNavigationBar({ title: '智能访客' });
this.visitorList(1) this.store.visitorList(this.data.currentPage, this.data.pageSize, 1, 1)
this.arriveStaus(1)
}, },
onReady() { onReady() {
}, },
onShow() { onShow() {
// 页面显示 // 页面显示 兼容iOS 不加延时数据发生改变也不会重新渲染
console.log('进入onshow') const _that = this
setTimeout(() => {
_that.update()
}, 100);
}, },
onHide() { onHide() {
// 页面隐藏 // 页面隐藏
...@@ -145,27 +65,23 @@ Page({ ...@@ -145,27 +65,23 @@ Page({
}, },
onReachBottom() { onReachBottom() {
let currentNum = ''; let currentNum = '';
if (this.data.currentPage < this.data.totalCount) { if (this.data.currentPage < this.store.data.totalCount) {
currentNum = this.data.currentPage + 1 currentNum = this.data.currentPage + 1
this.setData({ this.setData({
currentPage: currentNum currentPage: currentNum
}) })
this.visitorList(this.data.type) this.store.visitorList(this.data.currentPage, this.data.pageSize, this.data.type, this.data.type)
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.setData({ this.setData({
type: '1',
dataList: [],
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
totalCount: '',
overdue: false,
}) })
this.visitorList(this.data.type) this.store.data.dataList = []
this.arriveStaus(1) this.update()
this.store.visitorList(this.data.currentPage, this.data.pageSize, this.data.type, this.data.type)
dd.stopPullDownRefresh() dd.stopPullDownRefresh()
}, },
onShareAppMessage() { onShareAppMessage() {
// 返回自定义分享信息 // 返回自定义分享信息
......
<view class="visitorsDetail"> <view class="visitorsDetail">
<view class="visitorTab"> <view class="visitorTab">
<view class='visitorTabLeft'>{{visitorName.substring(visitorName.length-2)}}</view> <view class='visitorTabLeft'>{{visitorDetailName.substring(visitorDetailName.length-2)}}</view>
<view class="visitorTabRight"> <view class="visitorTabRight">
<view class="name"> <view class="name">
<view>{{visitorName}}</view> <view>{{visitorDetailName}}</view>
<text class="iconzhankai iconfont" onTap="isHidden" ></text> <text class="iconzhankai iconfont" onTap="isHidden" ></text>
<view class="hidden " a:if={{isHidden}} > <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}}'> <view class="{{item.mobile == selectId?'select':''}}" a:for="{{visitorList1}}" a:for-index="index" a:for-item="item" onTap="selectVisitor" data-item='{{item}}'>
......
const app = getApp() const app = getApp()
import $http from './../../API/http' import $http from './../../API/http'
Page({ import create from 'dd-store'
import exampleStore from '/stores/exampleStore'
create.Page({
store: exampleStore,
useAll: true,
data: { data: {
visitorName: '', //访客的名字 visitorDetailName: '', //访客的名字
company: '', // 到访者的公司 company: '', // 到访者的公司
startTimeYear: '', // 开始时间的年月日 startTimeYear: '', // 开始时间的年月日
startHour: '', // 开始时间的小时 startHour: '', // 开始时间的小时
...@@ -31,12 +35,9 @@ Page({ ...@@ -31,12 +35,9 @@ Page({
this.setData({ this.setData({
isHidden: true isHidden: true
}) })
} }
}, },
selectVisitor(event) { selectVisitor(event) {
console.log(event.target.dataset.item.mobile, 11111111)
if (this.data.isHidden) { if (this.data.isHidden) {
this.setData({ this.setData({
isHidden: false isHidden: false
...@@ -49,15 +50,13 @@ Page({ ...@@ -49,15 +50,13 @@ Page({
} }
this.setData({ this.setData({
visitorName: event.target.dataset.item.name, visitorDetailName: event.target.dataset.item.name,
phone: event.target.dataset.item.mobile, phone: event.target.dataset.item.mobile,
selectId: event.target.dataset.item.mobile, selectId: event.target.dataset.item.mobile,
}) })
}, },
onLoad(event) { onLoad(event) {
console.log(JSON.parse(event.item), 'query')
//由JSON字符串转换为JSON对象) //由JSON字符串转换为JSON对象)
const that = this const that = this
let query = JSON.parse(event.item) let query = JSON.parse(event.item)
...@@ -67,7 +66,7 @@ Page({ ...@@ -67,7 +66,7 @@ Page({
this.setData({ this.setData({
visitorList1: query.visitorList1, visitorList1: query.visitorList1,
self: query.self, self: query.self,
visitorName: query.visitorName, visitorDetailName: query.visitorName,
company: query.companyName, company: query.companyName,
startTimeYear: `${query.startTime.yearMonthDate}`, startTimeYear: `${query.startTime.yearMonthDate}`,
startHour: `${query.startTime.hourMinute}`, startHour: `${query.startTime.hourMinute}`,
...@@ -84,6 +83,8 @@ Page({ ...@@ -84,6 +83,8 @@ Page({
recordId: query.recordId, recordId: query.recordId,
selectId: query.mobile selectId: query.mobile
}) })
console.log(this.data.visitorDetailName, 'query')
}, },
onReady() { onReady() {
...@@ -102,8 +103,10 @@ Page({ ...@@ -102,8 +103,10 @@ Page({
recordId: this.data.recordId recordId: this.data.recordId
} }
$http.$http('/admin/visitor/cancelVisit', data, 'post').then(res => { $http.$http('/admin/visitor/cancelVisit', data, 'post').then(res => {
console.log(res)
this.setData({ processStatus: 'cancel' }) 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({ ...@@ -124,8 +127,10 @@ Page({
recordId: this.data.recordId recordId: this.data.recordId
} }
$http.$http('/admin/visitor/confirmVisit', data, 'post').then(res => { $http.$http('/admin/visitor/confirmVisit', data, 'post').then(res => {
console.log(res)
this.setData({ processStatus: 'arrive' }) 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({ ...@@ -142,9 +147,9 @@ Page({
phoneNumber: this.data.phone, // 期望拨打的电话号码 phoneNumber: this.data.phone, // 期望拨打的电话号码
code: '+86', // 国家代号,中国是+86 code: '+86', // 国家代号,中国是+86
showDingCall: true, // 是否显示钉钉电话 showDingCall: true, // 是否显示钉钉电话
success: function(res) { success: function (res) {
}, },
fail: function(err) { fail: function (err) {
} }
}); });
}, },
......
import $http from '../API/http'
class Store { class Store {
data = { data = {
title: '测试', title: '测试',
visitorName: '', // 主访客的姓名 visitorName: '', // 主访客的姓名
visitorPhone: '', visitorPhone: '',
selectVisitors: false, //控制遮照层是否层出 selectVisitors: false, //控制遮照层是否层出
visitorPeer:[], // 同行 visitorPeer: [], // 同行
backgroundColor:'#fff', //预约访客页面顶部导航栏的背景色 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 => {
})
}
} }
......
var app = getApp()
// socket已经连接成功 // socket已经连接成功
var socketOpen = false var socketOpen = false
// socket已经调用关闭function // socket已经调用关闭function
...@@ -35,8 +36,9 @@ var webSocket = { ...@@ -35,8 +36,9 @@ var webSocket = {
socketClose = false socketClose = false
socketMsgQueue = [] socketMsgQueue = []
dd.connectSocket({ dd.connectSocket({
url: `wss://gateway-beta.mingwork.com/mingpay-phone-websocket/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: `ws://192.168.1.102:8400/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: { data: {
userType: 0 userType: 0
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment