修改地址

dev
陈博文 4 years ago
parent 482e48b195
commit c8d2bdef14

@ -79,9 +79,34 @@ const Page: FC<PageProps> = () => {
message.warn('请输入算法类型');
return;
}
downLoadLink(
`${url}/openi/secretKey/encryption?type=${type}&algorithm=${algorithm}&length=${length}&count=${file.length}`,
);
let item = undefined;
for (let i = 0; i < file.length; i++) {
if (file[i].name === '数据文件.txt') {
item = file[i];
break;
}
}
if (item) {
var reader = new FileReader();
reader.readAsText(file[0], 'UTF-8');
reader.onload = function (e: any) {
let val = e.target.result;
try {
val = JSON.parse(val);
if (val.count !== undefined) {
downLoadLink(
`${url}/openi/secretKey/encryption?type=${type}&algorithm=${algorithm}&length=${length}&count=${val.count}`,
);
} else {
message.warn('数据文件内容格式错误,请重新导入!');
}
} catch (s) {
message.warn('数据文件内容格式错误,请重新导入!');
}
};
} else {
message.warn('导入文件没有包含数据文件(数据文件.txt),请重新导入!');
}
};
const renderText = () => {

@ -235,7 +235,10 @@ const Page = () => {
};
const getData = (e: any) => {
if (e.origin === 'https://edu-xnfz.educoder.net') {
if (
e.origin === 'https://edu-xnfz.educoder.net' ||
e.origin === 'http://localhost:81'
) {
console.log(e.data, 22222);
let newData: any = [];
try {

Loading…
Cancel
Save