Add link to send resources
This commit is contained in:
parent
c341c7d794
commit
342a0ec7b3
@ -2,27 +2,45 @@
|
|||||||
<section>
|
<section>
|
||||||
<table class="village-table">
|
<table class="village-table">
|
||||||
<tr v-for="village in shared.villages" :key="village.id">
|
<tr v-for="village in shared.villages" :key="village.id">
|
||||||
<td>{{ village.id }} - {{ village.name }}</td>
|
<td :class="{ active: village.active }">{{ village.id }} - {{ village.name }}</td>
|
||||||
<td>Д: {{ resources(village.id).lumber }}</td>
|
<td>Д: {{ resources(village.id).lumber }}</td>
|
||||||
<td>Г: {{ resources(village.id).clay }}</td>
|
<td>Г: {{ resources(village.id).clay }}</td>
|
||||||
<td>Ж: {{ resources(village.id).iron }}</td>
|
<td>Ж: {{ resources(village.id).iron }}</td>
|
||||||
<td>З: {{ resources(village.id).crop }}</td>
|
<td>З: {{ resources(village.id).crop }}</td>
|
||||||
|
<td>
|
||||||
|
<a
|
||||||
|
v-if="village.id !== activeVillageId"
|
||||||
|
:href="path('/build.php', { newdid: activeVillageId, gid: 17, t: 5, x: village.crd.x, y: village.crd.y })"
|
||||||
|
:title="'Отправить ресурсы в ' + village.name"
|
||||||
|
>РЕС</a
|
||||||
|
>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { path } from '../../utils';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
shared: this.$root.$data,
|
shared: this.$root.$data,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
activeVillageId() {
|
||||||
|
return this.shared.village.id;
|
||||||
|
},
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
resources(id) {
|
resources(id) {
|
||||||
return this.shared.getVillageResources(id);
|
return this.shared.getVillageResources(id);
|
||||||
},
|
},
|
||||||
|
path(name, args) {
|
||||||
|
return path(name, args);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@ -37,4 +55,8 @@ export default {
|
|||||||
border-top: 1px solid #ddd;
|
border-top: 1px solid #ddd;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.village-table td.active {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -40,5 +40,19 @@ function grabVillageInfo($el): Village {
|
|||||||
const id = getNumber(parsedHref.query.newdid);
|
const id = getNumber(parsedHref.query.newdid);
|
||||||
const name = $el.find('.name').text();
|
const name = $el.find('.name').text();
|
||||||
const active = $el.hasClass('active');
|
const active = $el.hasClass('active');
|
||||||
return new Village(id, name, active, new Coordinates(0, 0));
|
const x = getNumber(
|
||||||
|
$el
|
||||||
|
.find('.coordinateX')
|
||||||
|
.text()
|
||||||
|
.replace('−', '-')
|
||||||
|
.replace(/[^0-9-]/gi, '')
|
||||||
|
);
|
||||||
|
const y = getNumber(
|
||||||
|
$el
|
||||||
|
.find('.coordinateY')
|
||||||
|
.text()
|
||||||
|
.replace('−', '-')
|
||||||
|
.replace(/[^0-9-]/gi, '')
|
||||||
|
);
|
||||||
|
return new Village(id, name, active, new Coordinates(x, y));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user