import colorModule from './modules/color.js' import regModule from './modules/regexValidate.js' export let color = colorModule; export let regexValidate = regModule; /* 生成随机uuid * n:uuid的长度 * type:类型(0-大小写字母+数字,1-小写字母+数字,2-纯数字,3-大小写字母,4-小写字母) */ export function uuid(n=6,type=0){ let res='', uType=0; const __uuidLetter = function(){ const __tempArr = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] return __tempArr[Math.floor(Math.random()*26)]; } for (let i=0;i0) { for (let j=0;j<_arr.length;j++) { if (_arr[j].code==value) { res = _arr[j].name; break; } } if (!res) res = '无此字典' } else { res = '无此字典' } } else { res = 'Failed' } return res; }; /* 下载更新 */ export function downloadApk($config){ try{ const _downFun = function(){ try{ plus.runtime.openURL($config.downUrl, function(res) {console.log(res);}); }catch(ex){ console.log('_downFun Error!') console.log(ex) } setTimeout(()=>{ uni.hideLoading(); },10000) } uni.showLoading({ title: '开启下载...', mask:true }); if (plus.networkinfo.getCurrentType() != 3){ uni.hideLoading(); uni.showModal({ title:'系统提示', content:'当前非WIFI环境,确认继续下载吗?', success:(res)=>{ if (res.confirm) { uni.showLoading({ title: '开启下载...', mask:true }); _downFun() } } }) } else { _downFun() } } catch(e){ uni.hideLoading(); uni.showModal({ title:'系统提示', content:'下载失败', showCancel:false }) console.log('DownloadApk Error!') console.log(e) } };