diff --git a/common/utils.js b/common/utils.js index c666edb..873094e 100644 --- a/common/utils.js +++ b/common/utils.js @@ -259,3 +259,27 @@ return Math.floor(Math.random() * (m - n + 1) + n); } +export function getDateTime(value) { + let time = new Date(value); + 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 + ":"; + second = second < 10 ? '0'+ second : second; + let a = '上午'; + if(hour < 12) { + a = '上午'; + } else { + a = '下午'; + } + 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..873094e 100644 --- a/common/utils.js +++ b/common/utils.js @@ -259,3 +259,27 @@ return Math.floor(Math.random() * (m - n + 1) + n); } +export function getDateTime(value) { + let time = new Date(value); + 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 + ":"; + second = second < 10 ? '0'+ second : second; + let a = '上午'; + if(hour < 12) { + a = '上午'; + } else { + a = '下午'; + } + 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..5680a18 100644 --- a/pages/checkMessageDetail/checkMessageDetail.vue +++ b/pages/checkMessageDetail/checkMessageDetail.vue @@ -129,9 +129,7 @@ }, 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; diff --git a/common/utils.js b/common/utils.js index c666edb..873094e 100644 --- a/common/utils.js +++ b/common/utils.js @@ -259,3 +259,27 @@ return Math.floor(Math.random() * (m - n + 1) + n); } +export function getDateTime(value) { + let time = new Date(value); + 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 + ":"; + second = second < 10 ? '0'+ second : second; + let a = '上午'; + if(hour < 12) { + a = '上午'; + } else { + a = '下午'; + } + 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..5680a18 100644 --- a/pages/checkMessageDetail/checkMessageDetail.vue +++ b/pages/checkMessageDetail/checkMessageDetail.vue @@ -129,9 +129,7 @@ }, 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; diff --git a/pages/index/index.vue b/pages/index/index.vue index adc4d34..6fcd12f 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -88,6 +88,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..873094e 100644 --- a/common/utils.js +++ b/common/utils.js @@ -259,3 +259,27 @@ return Math.floor(Math.random() * (m - n + 1) + n); } +export function getDateTime(value) { + let time = new Date(value); + 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 + ":"; + second = second < 10 ? '0'+ second : second; + let a = '上午'; + if(hour < 12) { + a = '上午'; + } else { + a = '下午'; + } + 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..5680a18 100644 --- a/pages/checkMessageDetail/checkMessageDetail.vue +++ b/pages/checkMessageDetail/checkMessageDetail.vue @@ -129,9 +129,7 @@ }, 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; diff --git a/pages/index/index.vue b/pages/index/index.vue index adc4d34..6fcd12f 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -88,6 +88,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..74abd42 100644 --- a/pages/message/message.vue +++ b/pages/message/message.vue @@ -3,7 +3,7 @@ - {{item.date}} + {{item.messageTime}}