Commit 6d50c0f3 by fengzhaoyu

修改ios不兼容

parent 1eba81b5
......@@ -54,7 +54,7 @@ Page({
method: 'POST',
dataType: 'json',
success: function(res) {
console.log(res,res)
console.log(res,'11111111')
if(res.data.resultCode == 0) {
const data = res.data.data
dd.setStorageSync({
......
......@@ -6,24 +6,24 @@ create.Page({
store: exampleStore,
useAll: true,
data: {
query:''
query: ''
},
onLoad(query) {
console.log(query.index, 'query')
this.setData({ query: query.index })
this.setData({ query: query.index })
dd.setNavigationBar({
title: '手机通讯录',
});
},
onReady() {
const _that = this
_that.store.data.selectVisitors = false
_that.update()
dd.choosePhonebook({
multiple: false, //是否多选: true多选 false单选; 默认true
success: function(res) {
if (_that.data.query == 0) {
_that.store.data.visitorName = res[0].name
_that.store.data.selectVisitors = false
_that.update()
}
else {
_that.store.data.visitorPeer[_that.data.query - 1] = res[0].name
......
......@@ -17,7 +17,7 @@
访客手机
</view>
<view class=" visitorInput visitorPhoneInput ">
<input placeholder="请输入" data-type='visitorPhone' onInput='visitorInput'/>
<input placeholder="请输入" pattern="[0-9]*" data-type='visitorPhone' onInput='visitorInput' type="number" value="{{visitorPhone}}"/>
</view>
</view>
<view class="visitorName">
......@@ -99,7 +99,7 @@
访客手机
</view>
<view class=" visitorInput visitorPhoneInput ">
<input placeholder="请输入" data-type='visitorPeerPhone' data-index='{{index + 1}}' onInput='visitorInput' value="{{item.phone}}" />
<input type="number" pattern="[0-9]*" placeholder="请输入" data-type='visitorPeerPhone' data-index='{{index + 1}}' onInput='visitorInput' value="{{item.phone}}" />
</view>
</view>
</view>
......
......@@ -25,7 +25,8 @@ create.Page({
visitorCompany: '',// 访客的单位
visitorPurpose: '', // 访客手动输入的目的
visitorNode: '',// 访客的备注
isPackUp: false // 是否收起更多消息
isPackUp: false, // 是否收起更多消息
formValidation: false,
},
onLoad(query) {
this.reSet()
......@@ -75,9 +76,9 @@ create.Page({
startTimeYear: startTimeYear,
startTimeHour: startTimeHour,
endTimeYear: endTimeYear,
endTimeHour: `24:00`,
endTimeHour: `23时59分`,
startTime: `${startTime.year}-${startTime.month}-${startTime.date} ${startTime.hour}:${startTime.minute}`,
endTime: `${startTime.year}-${startTime.month}-${startTime.date} 24:00`
endTime: `${startTime.year}-${startTime.month}-${startTime.date} 23:59`
})
},
//本页面input输入事件
......@@ -101,13 +102,13 @@ create.Page({
console.log(_that.store.data.visitorPeer[event.currentTarget.dataset.index - 1])
_that.store.data.visitorPeer[event.currentTarget.dataset.index - 1].name = event.detail.value
_that.store.data.visitorPeer[event.currentTarget.dataset.index - 1].index = event.currentTarget.dataset.index
_that.update
break;
case "visitorPeerPhone":
_that.store.data.visitorPeer[event.currentTarget.dataset.index - 1].phone = event.detail.value
_that.store.data.visitorPeer[event.currentTarget.dataset.index - 1].index = event.currentTarget.dataset.index
_that.update
console.log(_that.store.data.visitorPeer[event.currentTarget.dataset.index - 1])
break;
case "visitorNode":
_that.setData({ visitorNode: event.detail.value })
......@@ -130,11 +131,59 @@ create.Page({
},
// 点击外部联系人
externalContactSelect(event) {
dd.navigateTo({ url: `./../externalContact/externalContact?index=${this.data.index}` });
const _that = this
dd.chooseExternalUsers({
title: '外部联人',
multiple: false, //是否多选 true多选,false单选,默认是单选
limitTips: "请单选",
success: function(res) {
if (_that.data.index == 0) {
_that.store.data.visitorName = res[0].name
_that.store.data.selectVisitors = false
_that.update()
}
else {
_that.store.data.visitorPeer[_that.data.index - 1].name = res[0].name
_that.store.data.selectVisitors = false
_that.update()
}
},
fail: function(err) {
_that.store.data.selectVisitors = false
_that.update()
}
});
},
// 点击手机通讯录
phoneAddressBookSelect() {
dd.navigateTo({ url: `./../phoneAddressBook/phoneAddressBook?index=${this.data.index}` });
const _that = this
dd.choosePhonebook({
title: '手机通讯录',
multiple: false, //是否多选: true多选 false单选; 默认true
success: function(res) {
console.log(res, 'res')
if (_that.data.index == 0) {
_that.setData({
visitorPhone: res[0].mobile
})
_that.store.data.visitorName = res[0].name
_that.update()
console.log(_that.data.visitorPhone, 'visitorPhone')
console.log(res[0].mobile, 'res[0].mobile')
}
else {
_that.store.data.visitorPeer[_that.data.index - 1] = res[0].name
_that.store.data.selectVisitors = false
_that.update()
}
},
fail: function(err) {
_that.store.data.selectVisitors = false
_that.update()
}
});
},
// 添加同行人员
addCompanions() {
......@@ -212,10 +261,10 @@ create.Page({
// 提交预约单
confirmAppointment() {
const _that = this
// _that.formValidation()
console.log(_that.store.data.visitorPeer, 'number电话号码')
let participator = ''
_that.data.copyPerson.forEach((item, index) => {
participator = participator + item.userId + ','
participator = participator + item.name + ':' + item.userId + ','
})
participator = participator.substring(0, participator.length - 1)
......@@ -232,6 +281,8 @@ create.Page({
else {
purpose = this.data.currentPurpose
}
console.log(this.store.data.visitorPeer, 'number111')
this.formValidation()
let data = {
startTime: this.data.startTime + '' + ':00',
endTime: this.data.endTime + '' + ':00',
......@@ -241,26 +292,44 @@ create.Page({
visitorPurpose: this.data.visitorPurpose,
visitAddress: this.data.defaultAddress,
visitorNode: this.data.visitorNode,
participator: participator
participator: participator,
ddUserId: dd.getStorageSync({ key: 'userId' }).data
}
if (this.data.formValidation) {
$http.$http('/admin/visitor/addRecord', data, 'post').then(res => {
dd.alert({
content: '预约成功',
buttonText: '确定',
success: () => {
dd.navigateBack({
delta: 1
})
},
});
}).catch(err => {
console.log(err)
})
}
$http.$http('/admin/visitor/addRecord', data, 'post').then(res => {
dd.alert({
content: '预约成功',
buttonText: '确定',
success: () => {
dd.redirectTo({
url: '/pages/visitors/visitors'
})
},
});
}).catch(err => {
console.log(err)
})
},
// 表单验证
formValidation() {
if (this.store.data.visitorName == '' || this.store.data.visitorName.length > 20) {
dd.alert({ content: '访客姓名不能为空且长度小于20个字符', buttonText: '确定' })
console.log(this.store.data.visitorPeer, 'number1')
// 手机号码相同
let number = [this.data.visitorPhone]
let name = false
let mobile = false
this.store.data.visitorPeer.forEach((item, index) => {
if (item.name == '' || item.length > 10) {
name = true
}
else if (item.phone == '' || !(/^[1][3,4,5,7,8][0-9]{9}$/).test(this.data.visitorPhone)) {
mobile = true
}
number.push(item.phone)
})
let s = this.isRepeat(number);
if (this.store.data.visitorName == '' || this.store.data.visitorName.length > 10) {
dd.alert({ content: '访客姓名不能为空且长度小于10个字符', buttonText: '确定' })
return
}
else if (this.data.visitorPhone == '' || !(/^[1][3,4,5,7,8][0-9]{9}$/).test(this.data.visitorPhone)) {
......@@ -271,7 +340,7 @@ create.Page({
dd.alert({ content: '访客单位的长度小于20个字符', buttonText: '确定' })
return
}
else if (new Date(this.data.startTime).getTime() < new Date(this.data.endTime)) {
else if (new Date(this.data.startTime).getTime() > new Date(this.data.endTime).getTime()) {
dd.alert({ content: '开始时间不能晚于结束时间', buttonText: '确定' })
return
}
......@@ -279,6 +348,30 @@ create.Page({
dd.alert({ content: '来访目的的长度小于20个字符', buttonText: '确定' })
return
}
else if (number.length > 1 && this.isRepeat(number)) {
dd.alert({ content: '手机号码不能相同', buttonText: '确定' })
return
}
else if (name) {
dd.alert({ content: '访客姓名不能为空且长度小于10个字符', buttonText: '确定' })
return
}
else if (mobile) {
return dd.alert({ content: '访客姓名不能为空且长度小于10个字符', buttonText: '确定' })
}
this.setData({
formValidation: true
})
},
// 手机号码不能重复
isRepeat(ary) {
var number = Array.from(new Set(ary))
if (number.length != ary) {
return false
}
else {
return true
}
},
// 选择开始时间
selectStartTime() {
......@@ -333,9 +426,9 @@ create.Page({
console.log(res, 'arriveAddress')
let arriveAddress = []
res.forEach((item, index) => {
arriveAddress.push(item.address)
arriveAddress.push(item.address + item.addressDetail)
if (item.isDefault == '0') {
this.setData({ defaultAddress: item.address })
this.setData({ defaultAddress: item.address + item.addressDetail })
}
})
if (this.data.defaultAddress == '') {
......@@ -395,16 +488,13 @@ create.Page({
}
},
test() {
},
onReady() {
},
onShow() {
// 页面显示
// 关闭遮照层
this.store.data.selectVisitors = false
this.store.data.selectVisitors = false;
this.update()
},
onHide() {
......
<view class='visitors'>
<view class="tabs">
<view class="{{type === '0' ? 'clickTabs' : ''}}" data-type="0" onTap="changeType">我的访客</view>
<view class="{{type !== '0' ? 'clickTabs' : ''}}" data-type="1" onTap="changeType">公司访客</view>
<view class="{{type == '1' ? 'clickTabs' : ''}}" data-type="1" onTap="changeType">我的访客</view>
<view class="{{type !== '1' ? 'clickTabs' : ''}}" data-type="0" onTap="changeType">公司访客</view>
</view>
<view class='visitorSituation' a:if="{{dataList.length !== 0}}">今天共
<text>{{todayVisit}}</text>位访客,到访
......@@ -18,7 +18,7 @@
<view class='{{item.processStatus=="cancel"|| item.overdue?"ashStaus":(item.processStatus=="invite" ? "status":"arrive")}}'>{{item.processStatus == 'invite'?'待访问':(item.processStatus == 'cancel'?"已取消":"已到访")}}</view>
</view>
<view class='visitorListCenter'>
<view class='{{item.processStatus=="cancel" || item.overdue?"asglongTime":"longTime"}}'a:if='item.longTime'>长期</view>
<view class='{{item.processStatus=="cancel" || item.overdue?"asglongTime":"longTime"}}' a:if='{{item.longTime}}'>长期</view>
<view class='people'>被访人:{{item.byVisitorName}}</view>
</view>
<view class='visitorListBottom'>
......
......@@ -2,7 +2,7 @@ const app = getApp()
import $http from './../../API/http'
Page({
data: {
type: '0',
type: '1',
dataList: [],
currentPage: 1,
pageSize: 10,
......@@ -46,13 +46,13 @@ Page({
console.log(dataList.length)
if (dataList.length > 0) {
dataList.forEach((item, index) => {
if (new Date(item.endTime).getTime() < new Date().getTime()) {
if (new Date(item.endTime.replace(/\-/g, "/")).getTime() < new Date().getTime()) {
item.overdue = true
}
else {
item.overdue = false
}
if (new Date(item.endTime).getTime() - new Date(item.startTime).getTime() < 24 * 60 * 60 * 3 * 1000) {
if (new Date(item.endTime.replace(/\-/g, "/")).getTime() - new Date(item.startTime.replace(/\-/g, "/")).getTime() < 24 * 60 * 60 * 3 * 1000) {
item.longTime = false
}
else {
......@@ -98,15 +98,31 @@ Page({
appointment() {
dd.navigateTo({ url: './../reservations/reservations' });
},
resetData() {
this.setData({
type: '1',
dataList: [],
currentPage: 1,
pageSize: 10,
totalCount: '',
overdue: false,
todayVisit: 0,
arrivedVisit: 0
})
},
onLoad(query) {
console.log('进入onLoad')
this.resetData()
dd.setNavigationBar({ title: '智能访客' });
this.visitorList(0)
this.visitorList(1)
this.arriveStaus()
},
onReady() {
},
onShow() {
// 页面显示
console.log('进入onshow')
},
onHide() {
// 页面隐藏
......@@ -129,7 +145,7 @@ Page({
},
onPullDownRefresh() {
this.setData({
type: '0',
type: '1',
dataList: [],
currentPage: 1,
pageSize: 10,
......@@ -138,6 +154,7 @@ Page({
})
this.visitorList(this.data.type)
dd.stopPullDownRefresh()
this.arriveStaus()
},
onShareAppMessage() {
// 返回自定义分享信息
......
......@@ -74,7 +74,7 @@
</view>
</view>
</view>
<view class="staus" a:if="{{processStatus == 'invite'}}">
<view class="staus" a:if="{{processStatus == 'invite' && self}}">
<view class="noOverdue" a:if='{{!overdue}}'>
<view class="cancel" onTap="cancel">取消访客</view>
<view class="reception" onTap="reception">接待访客</view>
......
......@@ -15,7 +15,8 @@ Page({
phone: '', // 访客的手机号
processStatus: '', // 访客的状态
overdue: '',
visitAddress: '' //到访的地址
visitAddress: '', //到访的地址
self:true
},
onLoad(event) {
console.log(JSON.parse(event.item), 'query')
......@@ -26,6 +27,7 @@ Page({
title: "访客详情",
});
this.setData({
self:query.self,
visitorName: query.visitorName,
company: query.companyName,
startTimeYear: `${query.startTime.yearMonthDate}`,
......@@ -34,8 +36,8 @@ Page({
endHour: `${query.endTime.hourMinute}`,
byVisitorName: `${query.byVisitorName}`,
purpose: query.purpose,
visitAddress:query.visitAddress,
participatorUserList:query.participatorUserList,
visitAddress: query.visitAddress,
participatorUserList: query.participatorUserList,
participator: '',
phone: query.mobile,
processStatus: query.processStatus,
......@@ -53,32 +55,49 @@ Page({
confirmButtonText: '确认',
cancelButtonText: '取消',
success: (result) => {
console.log(result,11111111111)
let data = {
recordId: this.data.recordId
if (result.confirm == false) {
}
else {
let data = {
recordId: this.data.recordId
}
$http.$http('/admin/visitor/cancelVisit', data, 'post').then(res => {
console.log(res)
this.setData({ processStatus: 'cancel' })
})
}
$http.$http('/admin/visitor/cancelVisit', data, 'post').then(res => {
console.log(res)
this.setData({ processStatus: 'cancel' })
})
},
});
},
reception() {
console.log(3333333)
dd.confirm({
title: '确认已接待',
confirmButtonText: '确认',
cancelButtonText: '取消',
success: (result) => {
let data = {
recordId: this.data.recordId
console.log(result)
console.log(4444)
if (result.confirm == 'false') {
console.log(11111111111111)
}
else {
console.log(222222)
let data = {
recordId: this.data.recordId
}
$http.$http('/admin/visitor/confirmVisit', data, 'post').then(res => {
console.log(res)
this.setData({ processStatus: 'arrive' })
})
}
$http.$http('/admin/visitor/confirmVisit', data, 'post').then(res => {
console.log(res)
this.setData({ processStatus: 'arrive' })
})
},
fail: (err) => {
console.log(66666)
}
});
......@@ -93,7 +112,6 @@ Page({
fail: function(err) {
}
});
},
onShow() {
// 页面显示
......
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