|
@@ -4,7 +4,7 @@ export const clearToken = () => {
|
|
localStorage.setItem('JWT-TOKEN', '');
|
|
localStorage.setItem('JWT-TOKEN', '');
|
|
};
|
|
};
|
|
|
|
|
|
-export const storeToken = token => {
|
|
|
|
|
|
+export const storeToken = (token) => {
|
|
localStorage.setItem('JWT-TOKEN', token);
|
|
localStorage.setItem('JWT-TOKEN', token);
|
|
};
|
|
};
|
|
|
|
|
|
@@ -20,7 +20,6 @@ export const getToken = () => {
|
|
* <a href="url" download/>
|
|
* <a href="url" download/>
|
|
*/
|
|
*/
|
|
export const downloadFile = (url, fileName, encode = true) => {
|
|
export const downloadFile = (url, fileName, encode = true) => {
|
|
-
|
|
|
|
const downloadLink = document.createElement('a');
|
|
const downloadLink = document.createElement('a');
|
|
const body = document.documentElement || document.body;
|
|
const body = document.documentElement || document.body;
|
|
body.appendChild(downloadLink);
|
|
body.appendChild(downloadLink);
|
|
@@ -49,7 +48,9 @@ export function IsImageFile(fileName) {
|
|
}
|
|
}
|
|
|
|
|
|
export function IsVedio(fileName) {
|
|
export function IsVedio(fileName) {
|
|
- return fileName.lastIndexOf('.mp4') !== -1 || fileName.lastIndexOf('.avi') !== -1;
|
|
|
|
|
|
+ return (
|
|
|
|
+ fileName.lastIndexOf('.mp4') !== -1 || fileName.lastIndexOf('.avi') !== -1
|
|
|
|
+ );
|
|
}
|
|
}
|
|
|
|
|
|
export function GetTokenFromUrl() {
|
|
export function GetTokenFromUrl() {
|
|
@@ -96,7 +97,7 @@ export function getUser(params) {
|
|
return;
|
|
return;
|
|
} else {
|
|
} else {
|
|
return (arr = params
|
|
return (arr = params
|
|
- .map(item => {
|
|
|
|
|
|
+ .map((item) => {
|
|
return item.Operator?.CName;
|
|
return item.Operator?.CName;
|
|
})
|
|
})
|
|
.join(','));
|
|
.join(','));
|
|
@@ -124,7 +125,7 @@ export const UnityAction = {
|
|
emit(type, e) {
|
|
emit(type, e) {
|
|
if (!UnityAction.event[type]) return;
|
|
if (!UnityAction.event[type]) return;
|
|
console.log('emit====== type:', type, '====== event:', e);
|
|
console.log('emit====== type:', type, '====== event:', e);
|
|
- UnityAction.event[type].forEach(item => {
|
|
|
|
|
|
+ UnityAction.event[type].forEach((item) => {
|
|
item && item(e);
|
|
item && item(e);
|
|
});
|
|
});
|
|
},
|
|
},
|
|
@@ -215,3 +216,11 @@ export function getData(key) {
|
|
export function clearData(key) {
|
|
export function clearData(key) {
|
|
localStorage.setItem(key, '');
|
|
localStorage.setItem(key, '');
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+export function getRandomString(length = 6) {
|
|
|
|
+ var str = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
|
|
+ var result = '';
|
|
|
|
+ for (var i = length; i > 0; --i)
|
|
|
|
+ result += str[Math.floor(Math.random() * str.length)];
|
|
|
|
+ return result;
|
|
|
|
+}
|