mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-03 05:18:10 +00:00
Wersja 1.2.3
Aktualizacja aplikacji
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pojazdownik",
|
"name": "pojazdownik",
|
||||||
"version": "1.2.2",
|
"version": "1.2.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
+1
-1
@@ -70,7 +70,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
const stockData = await (
|
const stockData = await (
|
||||||
await fetch(`https://spythere.github.io/api/stockDataNew.json?t=${Math.floor(Date.now() / 60000)}`)
|
await fetch(`https://spythere.github.io/api/td2/data/stockData.json?t=${Math.floor(Date.now() / 60000)}`)
|
||||||
).json();
|
).json();
|
||||||
|
|
||||||
this.store.stockData = stockData;
|
this.store.stockData = stockData;
|
||||||
|
|||||||
@@ -3,20 +3,22 @@
|
|||||||
<div class="train-image__wrapper">
|
<div class="train-image__wrapper">
|
||||||
<div class="train-image__content">
|
<div class="train-image__content">
|
||||||
<transition name="img-message-anim">
|
<transition name="img-message-anim">
|
||||||
<div class="empty-message" v-if="store.imageLoading && store.chosenVehicle?.imageSrc">ŁADOWANIE OBRAZU...</div>
|
<div class="empty-message" v-if="store.imageLoading && store.chosenVehicle?.imageSrc">
|
||||||
|
ŁADOWANIE OBRAZU...
|
||||||
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
||||||
<div class="no-img" v-if="!store.chosenVehicle">PODGLĄD WYBRANEGO POJAZDU</div>
|
<div class="no-img" v-if="!store.chosenVehicle">PODGLĄD WYBRANEGO POJAZDU</div>
|
||||||
|
|
||||||
<img
|
<img
|
||||||
v-if="store.chosenVehicle && store.chosenVehicle.imageSrc"
|
v-if="store.chosenVehicle"
|
||||||
:src="store.chosenVehicle.imageSrc"
|
:src="`https://spythere.github.io/api/td2/images/${store.chosenVehicle.type}--300px.jpg`"
|
||||||
:alt="store.chosenVehicle.type"
|
:alt="store.chosenVehicle.type"
|
||||||
@load="onImageLoad"
|
@load="onImageLoad"
|
||||||
@click="onImageClick"
|
@click="onImageClick"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="empty-message" v-if="store.chosenVehicle && !store.chosenVehicle.imageSrc">Ten pojazd nie ma jeszcze podglądu!</div>
|
<!-- <div class="empty-message" v-if="store.chosenVehicle && !store.chosenVehicle.imageSrc">Ten pojazd nie ma jeszcze podglądu!</div> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="train-image__info" v-if="store.chosenVehicle">
|
<div class="train-image__info" v-if="store.chosenVehicle">
|
||||||
@@ -81,6 +83,8 @@ export default defineComponent({
|
|||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
chosenVehicle(vehicle: Vehicle, prevVehicle: Vehicle) {
|
chosenVehicle(vehicle: Vehicle, prevVehicle: Vehicle) {
|
||||||
|
console.log(vehicle);
|
||||||
|
|
||||||
if (vehicle && vehicle.type != prevVehicle?.type) {
|
if (vehicle && vehicle.type != prevVehicle?.type) {
|
||||||
this.store.imageLoading = true;
|
this.store.imageLoading = true;
|
||||||
}
|
}
|
||||||
@@ -101,7 +105,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
if (!chosenVehicle) return;
|
if (!chosenVehicle) return;
|
||||||
|
|
||||||
this.store.vehiclePreviewSrc = chosenVehicle.imageSrc.replace('300', '800');
|
this.store.vehiclePreviewSrc = `https://spythere.github.io/api/td2/images/${chosenVehicle.type}--800px.jpg`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -133,12 +133,12 @@ export function carDataList(state: IStore) {
|
|||||||
return Object.keys(stockData.info).reduce((acc, vehicleTypeKey) => {
|
return Object.keys(stockData.info).reduce((acc, vehicleTypeKey) => {
|
||||||
if (!vehicleTypeKey.startsWith('car')) return acc;
|
if (!vehicleTypeKey.startsWith('car')) return acc;
|
||||||
|
|
||||||
const carVehiclesData = (stockData.info)[vehicleTypeKey as TStockInfoKey];
|
const carVehiclesData = stockData.info[vehicleTypeKey as TStockInfoKey];
|
||||||
|
|
||||||
carVehiclesData.forEach((car) => {
|
carVehiclesData.forEach((car) => {
|
||||||
if (state.showSupporter && !car[3]) return;
|
if (state.showSupporter && !car[3]) return;
|
||||||
|
|
||||||
const carPropsData = stockData.props.find((v) => car[0].toString().includes(v.type));
|
const carPropsData = stockData.props.find((v) => car[0].toString().startsWith(v.type));
|
||||||
|
|
||||||
acc.push({
|
acc.push({
|
||||||
useType: vehicleTypeKey as 'car-passenger' | 'car-cargo',
|
useType: vehicleTypeKey as 'car-passenger' | 'car-cargo',
|
||||||
@@ -148,7 +148,7 @@ export function carDataList(state: IStore) {
|
|||||||
supportersOnly: car[3] as boolean,
|
supportersOnly: car[3] as boolean,
|
||||||
maxSpeed: Number(car[4] as string),
|
maxSpeed: Number(car[4] as string),
|
||||||
imageSrc: car[5] as string,
|
imageSrc: car[5] as string,
|
||||||
cargoList: carPropsData?.cargo.includes(';')
|
cargoList: carPropsData?.cargo.split(';').filter((s) => s.length > 0)
|
||||||
? carPropsData.cargo.split(';').map((cargo) => ({
|
? carPropsData.cargo.split(';').map((cargo) => ({
|
||||||
id: cargo.split(':')[0],
|
id: cargo.split(':')[0],
|
||||||
totalMass: Number(cargo.split(':')[1]),
|
totalMass: Number(cargo.split(':')[1]),
|
||||||
@@ -327,5 +327,3 @@ export function chosenRealStock(state: IStore) {
|
|||||||
// }),
|
// }),
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user