feat: processing 검색 켬/끔 추가

This commit is contained in:
2021-12-23 03:03:43 +09:00
parent 3fc1183be6
commit ffabe96b15
20 changed files with 117 additions and 158 deletions
+31 -1
View File
@@ -2,8 +2,16 @@
<div class="bg0 back_bar">
<button type="button" class="btn btn-sammo-base2 back_btn" @click="back">
돌아가기
</button>
</button><b-button
class="btn-toggle-zoom"
:variant="toggleSearch ? 'info' : 'secondary'"
:pressed="toggleSearch"
v-if="toggleSearch !== undefined"
@click="toggleSearch = !toggleSearch"
>{{ toggleSearch ? "검색 켜짐" : "검색 꺼짐" }}</b-button
>
<h2 class="title">{{ title }}</h2>
</div>
</template>
@@ -25,6 +33,17 @@ export default defineComponent({
}
},
},
data() {
return {
toggleSearch: this.searchable,
};
},
emits: ["update:searchable"],
watch: {
toggleSearch(val: boolean) {
this.$emit("update:searchable", val);
},
},
props: {
title: {
type: String,
@@ -35,6 +54,11 @@ export default defineComponent({
default: "normal",
required: false,
},
searchable: {
type: Boolean,
default: undefined,
required: false,
},
},
});
</script>
@@ -55,6 +79,12 @@ export default defineComponent({
height: 24pt;
}
.btn-toggle-zoom{
position: absolute;
height: 24pt;
right: 0;
}
.title {
text-align: center;
line-height: 24pt;
-15
View File
@@ -1,15 +0,0 @@
type JQueryBootstrapToast = {
container?: JQuery<HTMLElement>,
position?: 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center',
title?: string,
subtitle?: string,
content?: string,
type?: 'info'|'success'|'warning'|'danger'|'error',
delay?: number,
img?: string,
pause_on_hover?: boolean,
}
interface JQueryStatic {
toast(opt: JQueryBootstrapToast): void;
}
+4 -1
View File
@@ -1,5 +1,5 @@
<template>
<TopBackBar :title="commandName" type="chief" />
<TopBackBar :title="commandName" type="chief" v-model:searchable="searchable" />
<div class="bg0">
<div>
재야나 타국의 장수를 등용합니다.<br />
@@ -13,6 +13,7 @@
:generals="generalList"
:groupByNation="nationList"
:textHelper="textHelpGeneral"
:searchable="searchable"
v-model="selectedGeneralID"
/>
</div>
@@ -33,6 +34,7 @@ import TopBackBar from "@/components/TopBackBar.vue";
import BottomBar from "@/components/BottomBar.vue";
import {
convertGeneralList,
getProcSearchable,
procGeneralItem,
procGeneralKey,
procGeneralRawItemList,
@@ -85,6 +87,7 @@ export default defineComponent({
}
return {
searchable: getProcSearchable(),
selectedGeneralID,
generalList,
nationList,
+4 -1
View File
@@ -1,5 +1,5 @@
<template>
<TopBackBar :title="commandName" type="chief" />
<TopBackBar :title="commandName" type="chief" v-model:searchable="searchable" />
<div class="bg0">
<div v-if="commandName == '등용'">
재야나 타국의 장수를 등용합니다.<br />
@@ -16,6 +16,7 @@
<SelectGeneral
:generals="generalList"
:textHelper="textHelpGeneral"
:searchable="searchable"
v-model="selectedGeneralID"
/>
</div>
@@ -36,6 +37,7 @@ import TopBackBar from "@/components/TopBackBar.vue";
import BottomBar from "@/components/BottomBar.vue";
import {
convertGeneralList,
getProcSearchable,
procGeneralItem,
procGeneralKey,
procGeneralRawItemList,
@@ -80,6 +82,7 @@ export default defineComponent({
}
return {
searchable: getProcSearchable(),
selectedGeneralID,
generalList,
commandName,
+8 -3
View File
@@ -1,5 +1,5 @@
<template>
<TopBackBar :title="commandName" type="chief" />
<TopBackBar :title="commandName" type="chief" v-model:searchable="searchable" />
<div class="bg0">
<div>
국가에 임관합니다.<br />
@@ -10,7 +10,11 @@
<div class="row">
<div class="col-6 col-md-3">
국가 :
<SelectNation :nations="nationList" v-model="selectedNationID" />
<SelectNation
:nations="nationList"
v-model="selectedNationID"
:searchable="searchable"
/>
</div>
<div class="col-4 col-md-2 d-grid">
<b-button @click="submit">{{ commandName }}</b-button>
@@ -62,7 +66,7 @@ import { unwrap } from "@/util/unwrap";
import { Args } from "@/processing/args";
import TopBackBar from "@/components/TopBackBar.vue";
import BottomBar from "@/components/BottomBar.vue";
import { procNationItem, procNationList } from "../processingRes";
import { procNationItem, procNationList, getProcSearchable } from "../processingRes";
import { isBrightColor } from "@/util/isBrightColor";
declare const commandName: string;
@@ -99,6 +103,7 @@ export default defineComponent({
}
return {
searchable: getProcSearchable(),
nationList: ref(nationList),
selectedNationID,
commandName,
@@ -1,5 +1,5 @@
<template>
<TopBackBar :title="commandName" type="chief" />
<TopBackBar :title="commandName" type="chief" v-model:searchable="searchable" />
<div class="bg0">
<div>
장비를 구입하거나 매각합니다.<br />
@@ -29,7 +29,7 @@
deselectGroupLabel=""
placeholder="아이템 선택"
:maxHeight="400"
:searchable="searchMode"
:searchable="searchable"
>
<template v-slot:option="props">
<div
@@ -81,7 +81,7 @@ import { entriesWithType } from "@util/entriesWithType";
import { Args } from "@/processing/args";
import TopBackBar from "@/components/TopBackBar.vue";
import BottomBar from "@/components/BottomBar.vue";
import { procItemList, procItemType } from "../processingRes";
import { getProcSearchable, procItemList, procItemType } from "../processingRes";
import { ItemTypeKey, ItemTypeNameMap, NoneValue, ValuesOf } from "@/defs";
import { convertSearch초성 } from "@/util/convertSearch초성";
@@ -164,7 +164,6 @@ export default defineComponent({
forFind.push(forBuy);
}
const searchMode = ref(true);
async function submit(e: Event) {
const event = new CustomEvent<Args>("customSubmit", {
@@ -178,7 +177,7 @@ export default defineComponent({
return {
...procRes,
searchMode,
searchable: getProcSearchable(),
forFind,
NoneValue,
ItemTypeNameMap,
@@ -1,5 +1,5 @@
<template>
<TopBackBar :title="commandName" type="chief" />
<TopBackBar :title="commandName" type="chief" v-model:searchable="searchable" />
<div class="bg0">
<div>
장수를 따라 임관합니다.<br />
@@ -14,6 +14,7 @@
:generals="generalList"
:groupByNation="nationList"
:textHelper="textHelpGeneral"
:searchable="searchable"
v-model="selectedGeneralID"
/>
</div>
@@ -68,6 +69,7 @@ import TopBackBar from "@/components/TopBackBar.vue";
import BottomBar from "@/components/BottomBar.vue";
import {
convertGeneralList,
getProcSearchable,
procGeneralItem,
procGeneralKey,
procGeneralRawItemList,
@@ -122,6 +124,7 @@ export default defineComponent({
}
return {
searchable: getProcSearchable(),
nationList: ref(nationList),
selectedGeneralID,
generalList,
@@ -1,5 +1,5 @@
<template>
<TopBackBar :title="commandName" type="chief" />
<TopBackBar :title="commandName" type="chief" v-model:searchable="searchable" />
<div class="bg0">
<MapLegacyTemplate
:isDetailMap="false"
@@ -37,7 +37,7 @@
<div class="row">
<div class="col-6 col-md-3">
국가 :
<SelectNation :nations="nationList" v-model="selectedNationID" />
<SelectNation :nations="nationList" v-model="selectedNationID" :searchable="searchable" />
</div>
<div class="col-6 col-md-0"></div>
<div class="col-8 col-md-4">
@@ -79,7 +79,7 @@ import { unwrap } from "@/util/unwrap";
import { Args } from "@/processing/args";
import TopBackBar from "@/components/TopBackBar.vue";
import BottomBar from "@/components/BottomBar.vue";
import { procNationItem, procNationList } from "../processingRes";
import { getProcSearchable, procNationItem, procNationList } from "../processingRes";
declare const mapTheme: string;
declare const commandName: string;
@@ -137,6 +137,7 @@ export default defineComponent({
}
return {
searchable: getProcSearchable(),
mapTheme,
goldAmount,
riceAmount,
+5 -2
View File
@@ -1,5 +1,5 @@
<template>
<TopBackBar :title="commandName" type="chief" />
<TopBackBar :title="commandName" type="chief" v-model:searchable="searchable" />
<div class="bg0">
<MapLegacyTemplate
:isDetailMap="false"
@@ -23,12 +23,13 @@
:generals="generalList"
:troops="troops"
:textHelper="textHelpGeneral"
:searchable="searchable"
v-model="selectedGeneralID"
/>
</div>
<div class="col-6 col-md-4">
도시 :
<SelectCity :cities="citiesMap" v-model="selectedCityID" />
<SelectCity :cities="citiesMap" v-model="selectedCityID" :searchable="searchable" />
</div>
<div class="col-4 col-md-2 d-grid">
<b-button variant="primary" @click="submit">{{ commandName }}</b-button>
@@ -51,6 +52,7 @@ import TopBackBar from "@/components/TopBackBar.vue";
import BottomBar from "@/components/BottomBar.vue";
import {
convertGeneralList,
getProcSearchable,
procGeneralItem,
procGeneralKey,
procGeneralRawItemList,
@@ -127,6 +129,7 @@ export default defineComponent({
}
return {
searchable: getProcSearchable(),
mapTheme: ref(mapTheme),
citiesMap: ref(citiesMap),
selectedCityID,
@@ -1,5 +1,5 @@
<template>
<TopBackBar :title="commandName" type="chief" />
<TopBackBar :title="commandName" type="chief" v-model:searchable="searchable" />
<div class="bg0">
<MapLegacyTemplate
:isDetailMap="false"
@@ -20,7 +20,7 @@
<div class="row">
<div class="col-4 col-md-3">
국가 :
<SelectNation :nations="nationList" v-model="selectedNationID" />
<SelectNation :nations="nationList" v-model="selectedNationID" :searchable="searchable" />
</div>
<div class="col-5 col-md-3">
기간 :
@@ -60,7 +60,7 @@ import { unwrap } from "@/util/unwrap";
import { Args } from "@/processing/args";
import TopBackBar from "@/components/TopBackBar.vue";
import BottomBar from "@/components/BottomBar.vue";
import { procNationItem, procNationList } from "../processingRes";
import { getProcSearchable, procNationItem, procNationList } from "../processingRes";
declare const mapTheme: string;
declare const commandName: string;
@@ -115,6 +115,7 @@ export default defineComponent({
}
return {
searchable: getProcSearchable(),
...procRes,
selectedYear,
selectedMonth,
@@ -1,5 +1,5 @@
<template>
<TopBackBar :title="commandName" type="chief" />
<TopBackBar :title="commandName" type="chief" v-model:searchable="searchable" />
<div class="bg0">
<MapLegacyTemplate
:isDetailMap="false"
@@ -22,7 +22,7 @@
<div class="row">
<div class="col-6 col-md-3">
국가 :
<SelectNation :nations="nationList" v-model="selectedNationID" />
<SelectNation :nations="nationList" v-model="selectedNationID" :searchable="searchable" />
</div>
<div class="col-3 col-md-2">
<label>전략 :</label>
@@ -49,7 +49,7 @@ import { unwrap } from "@/util/unwrap";
import { Args } from "@/processing/args";
import TopBackBar from "@/components/TopBackBar.vue";
import BottomBar from "@/components/BottomBar.vue";
import { procNationItem, procNationList } from "../processingRes";
import { getProcSearchable, procNationItem, procNationList } from "../processingRes";
declare const mapTheme: string;
declare const commandName: string;
@@ -122,6 +122,7 @@ export default defineComponent({
}
return {
searchable: getProcSearchable(),
...procRes,
selectedCommandID,
commandTypesOption,
+4 -2
View File
@@ -1,5 +1,5 @@
<template>
<TopBackBar :title="commandName" />
<TopBackBar :title="commandName" v-model:searchable="searchable" />
<div class="bg0">
<MapLegacyTemplate
:isDetailMap="false"
@@ -65,7 +65,7 @@
<div class="row">
<div class="col-4 col-md-2">
도시:
<SelectCity :cities="citiesMap" v-model="selectedCityID" />
<SelectCity :cities="citiesMap" v-model="selectedCityID" :searchable="searchable" />
</div>
<div class="col-4 col-md-2 d-grid">
<b-button @click="submit">{{ commandName }}</b-button>
@@ -92,6 +92,7 @@ import { Args } from "@/processing/args";
import TopBackBar from "@/components/TopBackBar.vue";
import BottomBar from "@/components/BottomBar.vue";
import { pick as JosaPick } from "@util/JosaUtil";
import { getProcSearchable } from "./processingRes";
declare const mapTheme: string;
declare const currentCity: number;
declare const commandName: string;
@@ -140,6 +141,7 @@ export default defineComponent({
}
return {
searchable: getProcSearchable(),
mapTheme: ref(mapTheme),
citiesMap: ref(citiesMap),
selectedCityID,
+4 -1
View File
@@ -1,5 +1,5 @@
<template>
<TopBackBar :title="commandName" type="chief" />
<TopBackBar :title="commandName" type="chief" v-model:searchable="searchable" />
<div class="bg0">
<div v-if="commandName == '몰수'">
장수의 자금이나 군량을 몰수합니다.<br />
@@ -19,6 +19,7 @@
:generals="generalList"
v-model="selectedGeneralID"
:textHelper="textHelpGeneral"
:searchable="searchable"
/>
</div>
<div class="col-2 col-md-1">
@@ -55,6 +56,7 @@ import TopBackBar from "@/components/TopBackBar.vue";
import BottomBar from "@/components/BottomBar.vue";
import {
convertGeneralList,
getProcSearchable,
procGeneralItem,
procGeneralKey,
procGeneralRawItemList,
@@ -122,6 +124,7 @@ export default defineComponent({
}
return {
searchable: getProcSearchable(),
amount,
isGold,
selectedGeneralID,
+4 -3
View File
@@ -1,5 +1,5 @@
<template>
<TopBackBar :title="commandName" type="chief" />
<TopBackBar :title="commandName" type="chief" v-model:searchable="searchable" />
<div class="bg0">
<MapLegacyTemplate
:isDetailMap="false"
@@ -54,7 +54,7 @@
<div class="row">
<div class="col-6 col-md-3">
국가 :
<SelectNation :nations="nationList" v-model="selectedNationID" />
<SelectNation :nations="nationList" v-model="selectedNationID" :searchable="searchable" />
</div>
<div class="col-4 col-md-2 d-grid">
<b-button @click="submit">{{ commandName }}</b-button>
@@ -74,7 +74,7 @@ import { unwrap } from "@/util/unwrap";
import { Args } from "@/processing/args";
import TopBackBar from "@/components/TopBackBar.vue";
import BottomBar from "@/components/BottomBar.vue";
import { procNationItem, procNationList } from "./processingRes";
import { getProcSearchable, procNationItem, procNationList } from "./processingRes";
declare const mapTheme: string;
declare const commandName: string;
@@ -121,6 +121,7 @@ export default defineComponent({
}
return {
searchable: getProcSearchable(),
startYear: procRes.startYear,
mapTheme: ref(mapTheme),
nationList: ref(nationList),
+6 -2
View File
@@ -14,7 +14,7 @@
deselectGroupLabel=""
placeholder="도시 선택"
:maxHeight="400"
:searchable="searchMode"
:searchable="searchable"
>
<template v-slot:option="props"
><span
@@ -58,6 +58,11 @@ export default defineComponent({
type: Map as PropType<Map<number, { name: string; info?: string }>>,
required: true,
},
searchable: {
type: Boolean,
required: false,
default: true,
},
},
emits: ["update:modelValue"],
watch: {
@@ -89,7 +94,6 @@ export default defineComponent({
}
return {
selectedCity,
searchMode: true,
citiesForFind,
targets,
};
+6 -2
View File
@@ -17,7 +17,7 @@
deselectGroupLabel=""
placeholder="장수 선택"
:maxHeight="400"
:searchable="searchMode"
:searchable="searchable"
>
<template v-slot:option="props">
<div v-if="props.option.title" v-html="props.option.title"></div>
@@ -81,6 +81,11 @@ export default defineComponent({
required: false,
default: undefined,
},
searchable:{
type: Boolean,
required: false,
default: true,
}
},
emits: ["update:modelValue"],
watch: {
@@ -146,7 +151,6 @@ export default defineComponent({
}
return {
selectedGeneral,
searchMode: true,
forFind,
targets,
isBrightColor,
+6 -2
View File
@@ -14,7 +14,7 @@
deselectGroupLabel=""
placeholder="국가 선택"
:maxHeight="400"
:searchable="searchMode"
:searchable="searchable"
>
<template v-slot:option="props">
<span
@@ -63,6 +63,11 @@ export default defineComponent({
type: Map as PropType<Map<number, procNationItem>>,
required: true,
},
searchable: {
type: Boolean,
required: false,
default: true,
}
},
emits: ["update:modelValue"],
watch: {
@@ -95,7 +100,6 @@ export default defineComponent({
}
return {
selectedNation,
searchMode: true,
forFind,
targets,
};
+14 -1
View File
@@ -1,5 +1,6 @@
import { ItemTypeKey } from "@/defs";
import { combineArray } from "@/util/combineArray";
import { Ref, ref, watch } from "vue";
export type procGeneralItem = {
no: number,
@@ -95,4 +96,16 @@ export type procItemType = {
export type procItemList = Record<ItemTypeKey, {
typeName: string,
values: procItemType[],
}>
}>
//XXX: vuex 쓰기 전까지...
export const searchableProcessingMode = 'sam.processing.searchable';
const searchable = ref((localStorage.getItem(searchableProcessingMode) ?? "0") != "0");
watch(searchable, (val) => {
localStorage.setItem(searchableProcessingMode, val ? "1" : "0");
});
export function getProcSearchable():Ref<boolean>{
return searchable;
}
-103
View File
@@ -1,103 +0,0 @@
import { unwrap_any } from '@util/unwrap_any';
declare const leadership: number;
declare const fullLeadership: number;
declare const currentCrewType: number;
declare const currentCrew: number;
//declare const currentGold: number;
declare const is모병 = false;
function calc(id: number) {
const $obj = $(`#crewType${id}`);
const crew = parseInt(unwrap_any<string>($obj.find('.form_double').val()));
const baseCost = $obj.data('cost');
const $cost = $obj.find('.form_cost');
let cost = crew * baseCost;
if (is모병) {
cost *= 2;
}
$cost.val(Math.round(cost));
}
export function recruitCrewForm(): void {
const $formAmount = $('#amount');
const $formCrewtype = $('#crewType');
$('.form_double').on('keyup change', function (e) {
const $this = $(this);
const $parent = $this.parents('.input_form');
const crewtype = parseInt($parent.data('crewtype'));
calc(crewtype);
$formCrewtype.val(crewtype);
$formAmount.val(parseFloat(unwrap_any<string>($this.val())) * 100);
if (e.which === 13) {
void window.submitAction();
}
return false;
});
$('.btn_half').on('click', function () {
const $this = $(this);
const $parent = $this.closest('.input_form');
const crewtype = parseInt($parent.data('crewtype'));
const $input = $parent.find('.form_double:eq(0)');
const fillValue = Math.round(leadership / 2);
$formCrewtype.val(crewtype);
$input.val(fillValue).change();
return false;
});
$('.btn_fill').on('click', function () {
const $this = $(this);
const $parent = $this.closest('.input_form');
const crewtype = parseInt($parent.data('crewtype'));
const $input = $parent.find('.form_double:eq(0)');
let fillValue = Math.ceil((leadership * 100 - currentCrew) / 100);
if (crewtype != currentCrewType) {
fillValue = leadership;
}
$formCrewtype.val(crewtype);
$input.val(fillValue).change();
return false;
});
$('.btn_full').on('click', function () {
const $this = $(this);
const $parent = $this.closest('.input_form');
const crewtype = parseInt($parent.data('crewtype'));
const $input = $parent.find('.form_double:eq(0)');
const fillValue = fullLeadership + 15;
$formCrewtype.val(crewtype);
$input.val(fillValue).change();
return false;
});
$('.submit_btn').on('click', function () {
const $this = $(this);
const $parent = $this.closest('tr').find('.input_form');
const crewtype = parseInt($parent.data('crewtype'));
const $input = $parent.find('.form_double');
$formCrewtype.val(crewtype);
$formAmount.val(parseFloat(unwrap_any<string>($input.val())) * 100);
void window.submitAction();
});
$('.btn_fill').click();
$('#show_unavailable_troops').change(function () {
const show = $('#show_unavailable_troops').is(":checked");
if (show) {
$('.show_default_false').show();
}
else {
$('.show_default_false').hide();
}
});
$('.show_default_false').hide();
}
+1 -4
View File
@@ -1,12 +1,10 @@
import '@scss/processing.scss';
import { exportWindow } from '@util/exportWindow';
import axios from 'axios';
import { setAxiosXMLHttpRequest } from '@util/setAxiosXMLHttpRequest';
import { convertFormData } from '@util/convertFormData';
import { InvalidResponse } from '@/defs';
import { unwrap } from "@util/unwrap";
import { recruitCrewForm } from '@/recruitCrewForm';
import BootstrapVue3 from 'bootstrap-vue-3'
import Multiselect from 'vue-multiselect';
import { commandMap as GeneralActions } from "@/processing/General";
@@ -98,10 +96,9 @@ if (app === undefined) {
console.error(`모듈이 지정되지 않음`, entryInfo);
}
else {
const div = unwrap(document.querySelector('#container'));
div.addEventListener('customSubmit', (e: Event) => {
const {detail} = e as unknown as CustomEvent<Args>;
const { detail } = e as unknown as CustomEvent<Args>;
void submitCommand(entryInfo[0] == 'Nation', turnList, entryInfo[1], detail);
}, true);