WebPack에 scss와 vue를 사용할 수 있도록 세팅. 현재는 php서버와 코드가 강하게 엮여있기 때문에 vue-cli 대신 수동으로 webpack에 등록. 파일 번들링 경로는 다음과 같음 - scss + style -> css - ts -> js Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/189 Co-authored-by: hide_d <hided62@gmail.com> Co-committed-by: hide_d <hided62@gmail.com>
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import "../scss/inheritPoint.scss";
|
|
|
|
import { sum } from "lodash";
|
|
import { unwrap } from "./util";
|
|
declare global {
|
|
interface Window {
|
|
formStart: ()=>void;
|
|
items: {[name: string]:number};
|
|
helpText: {[name: string]:string};
|
|
}
|
|
}
|
|
|
|
export {}
|
|
|
|
function formStart() {
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
formStart(); |