utils.js
1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import oauth from '@/apis/modules/oauth.js'
import clueApi from '@/apis/modules/clue.js'
const utils = {
gettime() {
const now = new Date();
// 年
const year = now.getFullYear();
// 月(注意:月份从 0 开始,需要 +1)
const month = now.getMonth() + 1;
// 日
const day = now.getDate();
// 时
const hour = now.getHours();
// 分
const minute = now.getMinutes();
// 秒
const second = now.getSeconds();
// 格式化时间(补零处理)
const formatTime =
`${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')} ${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}:${second.toString().padStart(2, '0')}`;
console.log('当前时间:', formatTime);
return formatTime
},
async gethy(e) {
let c1 = '暂无'
const result = await clueApi.getCustomerClues({
currentPage: 1,
pageSize: 1,
keyword: e
});
if(result.code == 200 && result.data.list.length>0){
c1 = result.data.list[0].id
}
return c1
}
};
export default utils;