4528226f
“wangming”
feat: 管理端暗黑焕肤与阿里云...
|
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
if (m.length < 7) return '****'
return `${m.slice(0, 3)}****${m.slice(-4)}`
}
/**
* 按是否开启脱敏返回展示值
* @param {string} mobile
* @param {boolean|number} enabled 1/true 开启脱敏
* @returns {string}
*/
export function formatMobileDisplay(mobile, enabled) {
const raw = mobile == null ? '' : String(mobile).trim()
if (!raw) return ''
return Number(enabled) === 1 ? maskMobileValue(raw) : raw
}
|
e1dcb3a0
“wangming”
1
|
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/**
* 展示用:空值返回 emptyText(默认空串,页面侧可再 `|| '无'`)
* @param {string} mobile
* @param {boolean|number} enabled
* @param {string} [emptyText='']
* @returns {string}
*/
export function displayMobile(mobile, enabled, emptyText = '') {
const v = formatMobileDisplay(mobile, enabled)
return v || emptyText
}
export default {
maskMobileValue,
formatMobileDisplay,
displayMobile
}
|