Newer
Older
import {Injectable} from "@angular/core";
declare let md5;@Injectable()export class RandomWordService {
/**
* 字符串加密
* @param str
* @returns {any}
*/
hex_md5(str: string) {
return md5(str);
}
/** 产生一个随机的32位长度字符串 */
uuid() {
let text = '';
const possible = 'abcdef0123456789';
for (let i = 0; i < 19; i++) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return text + new Date().getTime();
}}