유산 보기 페이지

This commit is contained in:
2021-08-11 02:32:41 +09:00
parent e5b5c5e1cf
commit ea58e1e5c5
5 changed files with 83 additions and 22 deletions
+27 -10
View File
@@ -1,21 +1,38 @@
import {random, range} from "lodash"
import { sum } from "lodash";
import { unwrap } from "./util";
declare global {
interface Window { formStart: any; }
interface Window {
formStart: ()=>void;
items: {[name: string]:number};
helpText: {[name: string]:string};
}
}
export {}
function formStart() {
console.log(window.pathConfig.root);
const a = 10;
const b:number[] = [];
for(const v of range(10)){
b.push(random()*v);
const dSum = unwrap(document.querySelector('#inherit_sum_value')) as HTMLInputElement ;
const dOld = unwrap(document.querySelector('#inherit_previous_value')) as HTMLInputElement;
const dNew = unwrap(document.querySelector('#inherit_new_value')) as HTMLInputElement;
const sumPoint = Math.floor(sum(Object.values(window.items)));
const oldPoint = Math.floor(window.items['previous']);
const sumNewPoint = sumPoint - oldPoint;
dSum.value = sumPoint.toLocaleString();
dOld.value = oldPoint.toLocaleString();
dNew.value = sumNewPoint.toLocaleString();
for(const [key, val] of Object.entries(window.items)){
const dItem = unwrap(document.querySelector(`#inherit_${key}_value`)) as HTMLInputElement ;
dItem.value = Math.floor(val).toLocaleString();
}
for(const [key, text] of Object.entries(window.helpText)){
const dText = unwrap(document.querySelector(`#inherit_${key} small.form-text`)) as HTMLElement;
dText.innerHTML = text;
}
console.log(a + 10);
console.log(b);
}
window.formStart = formStart;