index.js
2.34 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
export function deepClone(target) {
if (typeof target === 'object' && target) {
let cloneObj = {}
for (const key in target) { // 遍历
const val = target[key]
if (typeof val === 'object' && val) {
cloneObj[key] = deepClone(val) // 是对象就再次调用该函数递归
} else {
cloneObj[key] = val // 基本类型的话直接复制值
}
}
return cloneObj
} else {
return target;
}
}
// 判断内容是否含有表情字符,现有数据库不支持。
export function hasEmoji (str = '') {
const reg = /[^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF\u0080-\u009F\u2000-\u201f\u2026\u2022\u20ac\r\n]/g;
return str.match(reg) && str.match(reg).length
}
// 单张图片上传
export const uploadImgServer = 'http://backend-api-02.newbee.ltd/manage-api/v1/upload/file'
// 多张图片上传
export const uploadImgsServer = 'http://backend-api-02.newbee.ltd/manage-api/v1/upload/files'
// 时间格式 年月日时分
export const formatTime = (time) => {
if (time) {
var now = new Date(time),
y = now.getFullYear(),
m = now.getMonth() + 1,
d = now.getDate();
return (
y +
"-" +
(m < 10 ? "0" + m : m) +
"-" +
(d < 10 ? "0" + d : d) +
" " +
now.toTimeString().substr(0, 5)
);
} else {
return null;
}
}
// 时间格式 年月日
export const formatTimeDay = (time) => {
if (time) {
var now = new Date(time),
y = now.getFullYear(),
m = now.getMonth() + 1,
d = now.getDate();
return (
y +
"-" +
(m < 10 ? "0" + m : m) +
"-" +
(d < 10 ? "0" + d : d)
);
} else {
return null;
}
}
export const pathMap = {
Psychology: '咨询预约',
PsychologyReserve: '咨询预约',
Record: '咨询预约',
Term:'教师排班',
Scheduling:'教师排班',
SchedulingDetail:'教师排班',
Science: '科普调适',
ScienceDetail: '科普调适',
Experience: '解忧杂货铺',
ExperienceDetail: '解忧杂货铺',
ExperienceAudit: '解忧杂货铺',
Coach: '个案辅导',
Assessment: '个案辅导',
Interview: '个案辅导',
Study:'数字学习馆',
StudySecond:'数字学习馆',
StudyDetail:'数字学习馆',
UserExtraInfo:'基本信息导入',
InfoDetail:'基本信息导入',
}