diff --git a/common/utils.js b/common/utils.js index c666edb..0b50694 100644 --- a/common/utils.js +++ b/common/utils.js @@ -259,3 +259,31 @@ return Math.floor(Math.random() * (m - n + 1) + n); } +export function getDateTime(value) { + let time = new Date(value); + let yearNowStamp = new Date(Date.now()); + let yearNow = yearNowStamp.getFullYear()+'年'; + let year = time.getFullYear()+'年'; + let month = (time.getMonth()+1); + let date = time.getDate(); + let hour = time.getHours(); + let minute = time.getMinutes(); + let second = time.getSeconds(); + month = month < 10 ? '0'+ month +'月' : month +'月'; + date = date < 10 ? '0'+ date +'日': date +'日'; + hour = hour < 10 ? '0'+ hour + ":" : hour + ":"; + minute = minute < 10 ? '0'+ minute : minute; + let a = '上午'; + if(hour < 12) { + a = '上午'; + } else { + a = '下午'; + } + if(String(year) === String(yearNow)) { + return String(month)+String(date)+ ' ' + a + String(hour) + String(minute); + } + let str = String(year)+String(month)+String(date)+ ' ' + a + String(hour) + String(minute); + return str; +} + + diff --git a/common/utils.js b/common/utils.js index c666edb..0b50694 100644 --- a/common/utils.js +++ b/common/utils.js @@ -259,3 +259,31 @@ return Math.floor(Math.random() * (m - n + 1) + n); } +export function getDateTime(value) { + let time = new Date(value); + let yearNowStamp = new Date(Date.now()); + let yearNow = yearNowStamp.getFullYear()+'年'; + let year = time.getFullYear()+'年'; + let month = (time.getMonth()+1); + let date = time.getDate(); + let hour = time.getHours(); + let minute = time.getMinutes(); + let second = time.getSeconds(); + month = month < 10 ? '0'+ month +'月' : month +'月'; + date = date < 10 ? '0'+ date +'日': date +'日'; + hour = hour < 10 ? '0'+ hour + ":" : hour + ":"; + minute = minute < 10 ? '0'+ minute : minute; + let a = '上午'; + if(hour < 12) { + a = '上午'; + } else { + a = '下午'; + } + if(String(year) === String(yearNow)) { + return String(month)+String(date)+ ' ' + a + String(hour) + String(minute); + } + let str = String(year)+String(month)+String(date)+ ' ' + a + String(hour) + String(minute); + return str; +} + + diff --git a/pages/checkMessageDetail/checkMessageDetail.vue b/pages/checkMessageDetail/checkMessageDetail.vue index 4d4ead6..09356c3 100644 --- a/pages/checkMessageDetail/checkMessageDetail.vue +++ b/pages/checkMessageDetail/checkMessageDetail.vue @@ -121,17 +121,17 @@ }, ], status: '已提交', - name: '张三', - time: '2012', - place: '一期主楼', + name: '', + time: '', + place: '', willchange: '', + // messageId: '', //消息id + solveId: '', //管理员处理id } }, mounted() { const id = getLocationParams('id'); - if(uni.getStorageSync('userInfo')) { - const userInfo = JSON.parse(uni.getStorageSync('userInfo')); - } + const userInfo = JSON.parse(uni.getStorageSync('userInfo')); this.userId = userInfo.id; if(userInfo.salt === '物业人员') { this.isManager = true; @@ -179,6 +179,7 @@ this.name = res.visitorName; this.time = res.inTime + ' ~ ' + res.outTime; this.place = res.visitPosition; + this.solveId = res.id; this.list.forEach(item => { for(let key in res) { if(item.id === key) { @@ -191,7 +192,7 @@ }, //管理员处理是否通过申请 async solveStatusData() { - await solveStatus(this.willchange, this.userId); + await solveStatus(this.willchange, this.solveId); } } } diff --git a/common/utils.js b/common/utils.js index c666edb..0b50694 100644 --- a/common/utils.js +++ b/common/utils.js @@ -259,3 +259,31 @@ return Math.floor(Math.random() * (m - n + 1) + n); } +export function getDateTime(value) { + let time = new Date(value); + let yearNowStamp = new Date(Date.now()); + let yearNow = yearNowStamp.getFullYear()+'年'; + let year = time.getFullYear()+'年'; + let month = (time.getMonth()+1); + let date = time.getDate(); + let hour = time.getHours(); + let minute = time.getMinutes(); + let second = time.getSeconds(); + month = month < 10 ? '0'+ month +'月' : month +'月'; + date = date < 10 ? '0'+ date +'日': date +'日'; + hour = hour < 10 ? '0'+ hour + ":" : hour + ":"; + minute = minute < 10 ? '0'+ minute : minute; + let a = '上午'; + if(hour < 12) { + a = '上午'; + } else { + a = '下午'; + } + if(String(year) === String(yearNow)) { + return String(month)+String(date)+ ' ' + a + String(hour) + String(minute); + } + let str = String(year)+String(month)+String(date)+ ' ' + a + String(hour) + String(minute); + return str; +} + + diff --git a/pages/checkMessageDetail/checkMessageDetail.vue b/pages/checkMessageDetail/checkMessageDetail.vue index 4d4ead6..09356c3 100644 --- a/pages/checkMessageDetail/checkMessageDetail.vue +++ b/pages/checkMessageDetail/checkMessageDetail.vue @@ -121,17 +121,17 @@ }, ], status: '已提交', - name: '张三', - time: '2012', - place: '一期主楼', + name: '', + time: '', + place: '', willchange: '', + // messageId: '', //消息id + solveId: '', //管理员处理id } }, mounted() { const id = getLocationParams('id'); - if(uni.getStorageSync('userInfo')) { - const userInfo = JSON.parse(uni.getStorageSync('userInfo')); - } + const userInfo = JSON.parse(uni.getStorageSync('userInfo')); this.userId = userInfo.id; if(userInfo.salt === '物业人员') { this.isManager = true; @@ -179,6 +179,7 @@ this.name = res.visitorName; this.time = res.inTime + ' ~ ' + res.outTime; this.place = res.visitPosition; + this.solveId = res.id; this.list.forEach(item => { for(let key in res) { if(item.id === key) { @@ -191,7 +192,7 @@ }, //管理员处理是否通过申请 async solveStatusData() { - await solveStatus(this.willchange, this.userId); + await solveStatus(this.willchange, this.solveId); } } } diff --git a/pages/index/index.vue b/pages/index/index.vue index 9b9173a..798608d 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -89,6 +89,7 @@ }, confirmPhone() { this.phone = this.inputValue; + this.show = false; this.checkphone(); }, async checkphone() { diff --git a/common/utils.js b/common/utils.js index c666edb..0b50694 100644 --- a/common/utils.js +++ b/common/utils.js @@ -259,3 +259,31 @@ return Math.floor(Math.random() * (m - n + 1) + n); } +export function getDateTime(value) { + let time = new Date(value); + let yearNowStamp = new Date(Date.now()); + let yearNow = yearNowStamp.getFullYear()+'年'; + let year = time.getFullYear()+'年'; + let month = (time.getMonth()+1); + let date = time.getDate(); + let hour = time.getHours(); + let minute = time.getMinutes(); + let second = time.getSeconds(); + month = month < 10 ? '0'+ month +'月' : month +'月'; + date = date < 10 ? '0'+ date +'日': date +'日'; + hour = hour < 10 ? '0'+ hour + ":" : hour + ":"; + minute = minute < 10 ? '0'+ minute : minute; + let a = '上午'; + if(hour < 12) { + a = '上午'; + } else { + a = '下午'; + } + if(String(year) === String(yearNow)) { + return String(month)+String(date)+ ' ' + a + String(hour) + String(minute); + } + let str = String(year)+String(month)+String(date)+ ' ' + a + String(hour) + String(minute); + return str; +} + + diff --git a/pages/checkMessageDetail/checkMessageDetail.vue b/pages/checkMessageDetail/checkMessageDetail.vue index 4d4ead6..09356c3 100644 --- a/pages/checkMessageDetail/checkMessageDetail.vue +++ b/pages/checkMessageDetail/checkMessageDetail.vue @@ -121,17 +121,17 @@ }, ], status: '已提交', - name: '张三', - time: '2012', - place: '一期主楼', + name: '', + time: '', + place: '', willchange: '', + // messageId: '', //消息id + solveId: '', //管理员处理id } }, mounted() { const id = getLocationParams('id'); - if(uni.getStorageSync('userInfo')) { - const userInfo = JSON.parse(uni.getStorageSync('userInfo')); - } + const userInfo = JSON.parse(uni.getStorageSync('userInfo')); this.userId = userInfo.id; if(userInfo.salt === '物业人员') { this.isManager = true; @@ -179,6 +179,7 @@ this.name = res.visitorName; this.time = res.inTime + ' ~ ' + res.outTime; this.place = res.visitPosition; + this.solveId = res.id; this.list.forEach(item => { for(let key in res) { if(item.id === key) { @@ -191,7 +192,7 @@ }, //管理员处理是否通过申请 async solveStatusData() { - await solveStatus(this.willchange, this.userId); + await solveStatus(this.willchange, this.solveId); } } } diff --git a/pages/index/index.vue b/pages/index/index.vue index 9b9173a..798608d 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -89,6 +89,7 @@ }, confirmPhone() { this.phone = this.inputValue; + this.show = false; this.checkphone(); }, async checkphone() { diff --git a/pages/message/message.vue b/pages/message/message.vue index 91853c8..91c953a 100644 --- a/pages/message/message.vue +++ b/pages/message/message.vue @@ -3,7 +3,7 @@ - {{item.date}} + {{item.messageTime}}