You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.2 KiB
40 lines
1.2 KiB
const formatTime = 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, second].map(formatNumber).join(':')
|
|
}
|
|
|
|
const formatNumber = n => {
|
|
n = n.toString()
|
|
return n[1] ? n : '0' + n
|
|
}
|
|
|
|
const formatHtml = content => {
|
|
content = content.replace(/\<img/gi, '<img style="width:100% !important;height:auto !important;margin:0;display:flex;" ');
|
|
content = content.replace(/\<td/gi, '<td cellspacing="0" cellpadding="0" border="0" style="display:block;vertical-align:top;margin: 0px; padding: 0px; border: 0px;outline-width:0px;" ');
|
|
content = content.replace(/width=/gi, 'sss=');
|
|
content = content.replace(/height=/gi, 'sss=');
|
|
content = content.replace(/ \/\>/gi, ' style="max-width:100% !important;height:auto !important;margin:0;display:block;" \/\>');
|
|
return content;
|
|
}
|
|
|
|
/**
|
|
* 移除购物车Tabbar的数字
|
|
*/
|
|
const removeTabBadge = () => {
|
|
wx.removeTabBarBadge({
|
|
index: 2
|
|
})
|
|
}
|
|
|
|
module.exports = {
|
|
formatTime: formatTime,
|
|
formatHtml: formatHtml,
|
|
removeTabBadge: removeTabBadge
|
|
}
|