优化
This commit is contained in:
@@ -434,6 +434,36 @@ class API extends HTTP {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取医生问诊消息列表
|
||||
getDoctorInquiryMessage(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/inquiry/message`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取医生问诊消息用户属性
|
||||
getDoctorInquiryMessageAttr(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/inquiry/message/attr`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取患者问诊病例
|
||||
getDoctorInquiryCase(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/inquiry/case`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,9 @@ class HTTP {
|
||||
} else {
|
||||
reject(res.data.message)
|
||||
this._show_error(res.data.message)
|
||||
wx.navigateTo({
|
||||
url: "/Pages/index/index"
|
||||
})
|
||||
}
|
||||
} else {
|
||||
resolve(res.data)
|
||||
@@ -68,6 +71,7 @@ class HTTP {
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,17 @@ const formatTime = date => {
|
||||
return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
|
||||
}
|
||||
|
||||
const formatChatTime = date => {
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
const hour = date.getHours()
|
||||
const minute = date.getMinutes()
|
||||
const second = date.getSeconds()
|
||||
|
||||
return `${[year, month, day].map(formatNumber).join('-')} ${[hour, minute].map(formatNumber).join(':')}`
|
||||
}
|
||||
|
||||
const getDateArr = date => {
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
@@ -25,8 +36,37 @@ const formatNumber = n => {
|
||||
return n[1] ? n : `0${n}`
|
||||
}
|
||||
|
||||
const getTimeAgo = stringTime =>{
|
||||
var minute = 1000 * 60;
|
||||
var hour = minute *60;
|
||||
var day = hour *24;
|
||||
var week = day * 7;
|
||||
var month = day * 30;
|
||||
var time1 = new Date().getTime();//当前的时间戳
|
||||
var time2 = stringTime*1000;//指定时间的时间戳
|
||||
var time = time1 - time2;
|
||||
var result = null;
|
||||
if(time < 0){
|
||||
return '刚刚';
|
||||
}else if(time/month >= 1){
|
||||
result = formatChatTime(new Date(time2));
|
||||
}else if(time/week >= 1){
|
||||
result = formatChatTime(new Date(time2));
|
||||
}else if(time/day >= 1){
|
||||
result = formatChatTime(new Date(time2));
|
||||
}else if(time/hour >= 1){
|
||||
result = parseInt(time/hour) + "小时前";
|
||||
}else if(time/minute >= 1){
|
||||
result = parseInt(time/minute) + "分钟前";
|
||||
}else {
|
||||
result = "刚刚";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
formatTime,
|
||||
getDateArr,
|
||||
formatNumber,
|
||||
getTimeAgo,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user