city_card/utils/util.js
2023-07-15 14:25:28 +08:00

23 lines
1.2 KiB
JavaScript

var t = function(t) {
return (t = t.toString())[1] ? t : "0".concat(t);
};
module.exports = {
formatTime: function(a) {
var n = a.getFullYear(), e = a.getMonth() + 1, o = a.getDate(), r = a.getHours(), i = a.getMinutes(), s = a.getSeconds();
return "".concat([ n, e, o ].map(t).join("/"), " ").concat([ r, i, s ].map(t).join(":"));
},
bdMapToQQMap: function(t, a) {
if (null == t || "" == t || null == a || "" == a) return [ t, a ];
var n = 3.141592653589793, e = parseFloat(t) - .0065, o = parseFloat(a) - .006, r = Math.sqrt(e * e + o * o) - 2e-5 * Math.sin(o * n), i = Math.atan2(o, e) - 3e-6 * Math.cos(e * n);
return [ t = (r * Math.cos(i)).toFixed(7), a = (r * Math.sin(i)).toFixed(7) ];
},
qqMapToBMap: function(t, a) {
if (null == t || "" == t || null == a || "" == a) return [ t, a ];
var n = 3.141592653589793, e = parseFloat(t), o = parseFloat(a), r = Math.sqrt(e * e + o * o) + 2e-5 * Math.sin(o * n), i = Math.atan2(o, e) + 3e-6 * Math.cos(e * n);
return [ t = (r * Math.cos(i) + .0065).toFixed(5), a = (r * Math.sin(i) + .006).toFixed(5) ];
},
isMobile: function(t) {
return !!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(t);
}
};