Neue Fieberkurve + Testseite für Variaten
This commit is contained in:
parent
4077a2806c
commit
01bb983492
@ -1,3 +1,288 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="grid-container">
|
||||
<!-- Linker Text -->
|
||||
<div v-if="!hideText" class="item1">
|
||||
<div class="text-pair">anspruchsvoll</div>
|
||||
<div class="text-pair">lustig</div>
|
||||
<div class="text-pair">spannend</div>
|
||||
<div class="text-pair">brutal</div>
|
||||
<div class="text-pair">sittsam</div>
|
||||
</div>
|
||||
|
||||
<!-- Fieberkurve und Punkte -->
|
||||
<div class="item2">
|
||||
<div class="FieberkurveGesamt">
|
||||
<div
|
||||
v-for="(slider, index) in sliders"
|
||||
:key="index"
|
||||
class="Fieberkurve"
|
||||
:class="{ active: slider.clicked }"
|
||||
>
|
||||
<div v-for="i in 7" :key="i" class="kreis" />
|
||||
<input
|
||||
v-model="slider.value"
|
||||
type="range"
|
||||
min="1"
|
||||
max="7"
|
||||
class="slider-bg"
|
||||
:class="{ 'bg-clicked': slider.clicked }"
|
||||
:disabled="isStatic"
|
||||
/>
|
||||
<input
|
||||
v-model="slider.value"
|
||||
type="range"
|
||||
min="1"
|
||||
max="7"
|
||||
class="slider"
|
||||
:class="{ clicked: slider.clicked }"
|
||||
:disabled="isStatic"
|
||||
@input="updateLine"
|
||||
@click="handleClick(index)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<svg class="line-svg">
|
||||
<polyline
|
||||
:points="linePoints"
|
||||
:class="{ clicked: sliders.some(slider => slider.clicked) }"
|
||||
fill="none"
|
||||
stroke-width="3"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Rechter Text -->
|
||||
<div v-if="!hideText" class="item3">
|
||||
<div class="text-pair">leseleicht</div>
|
||||
<div class="text-pair">traurig</div>
|
||||
<div class="text-pair">entspannend</div>
|
||||
<div class="text-pair">gewaltfrei</div>
|
||||
<div class="text-pair">erotisch</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Reset Button -->
|
||||
<div v-if="!isStatic" class="reset-container">
|
||||
<button @click="resetSliders">Fieberkurve zurücksetzen</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, watch, onMounted, defineProps, defineEmits } from "vue"
|
||||
|
||||
const props = defineProps({
|
||||
isStatic: { type: Boolean, default: false },
|
||||
defaultValues: {
|
||||
type: Array,
|
||||
default: () => [
|
||||
{ value: 4, clicked: false },
|
||||
{ value: 4, clicked: false },
|
||||
{ value: 4, clicked: false },
|
||||
{ value: 4, clicked: false },
|
||||
{ value: 4, clicked: false },
|
||||
],
|
||||
},
|
||||
hideText: { type: Boolean, default: false },
|
||||
})
|
||||
|
||||
const emit = defineEmits(["update:values", "filter-by-row"])
|
||||
|
||||
defineExpose({ resetSliders })
|
||||
|
||||
const sliders = ref([...props.defaultValues])
|
||||
|
||||
const linePoints = computed(() => {
|
||||
const Breite = 240
|
||||
const Hoehe = 130
|
||||
const Kreis = 20
|
||||
return sliders.value
|
||||
.map((slider, index) => {
|
||||
const x = (slider.value - 1) * ((Breite - Kreis) / 6) + Kreis / 2
|
||||
const y = index * ((Hoehe - Kreis) / 4) + Kreis / 2
|
||||
return `${x},${y}`
|
||||
})
|
||||
.join(" ")
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props.defaultValues,
|
||||
newValues => {
|
||||
sliders.value = newValues.map(val => ({ ...val }))
|
||||
},
|
||||
{ deep: true },
|
||||
)
|
||||
|
||||
watch(
|
||||
sliders,
|
||||
() => {
|
||||
emit("update:values", sliders.value.map(slider => slider.value))
|
||||
},
|
||||
{ deep: true },
|
||||
)
|
||||
|
||||
function resetSliders() {
|
||||
sliders.value.forEach(slider => {
|
||||
slider.value = 4
|
||||
slider.clicked = false
|
||||
})
|
||||
}
|
||||
|
||||
function handleClick(index) {
|
||||
sliders.value[index].clicked = true
|
||||
emit("filter-by-row", { rowIndex: index, value: sliders.value[index].value })
|
||||
}
|
||||
|
||||
function updateLine() {
|
||||
// Optional: Linien-Update
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// Initial
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.grid-container {
|
||||
display: grid;
|
||||
grid-template-areas: "txtLinks Fieberkurve txtRechts";
|
||||
gap: 10px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.item1,
|
||||
.item3 {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.text-pair {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 26px;
|
||||
}
|
||||
|
||||
.FieberkurveGesamt {
|
||||
height: 130px;
|
||||
width: 240px;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-content: space-between;
|
||||
}
|
||||
|
||||
.Fieberkurve {
|
||||
position: relative;
|
||||
width: 240px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.Fieberkurve.active {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.kreis {
|
||||
z-index: 2;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 100%;
|
||||
background: #ceccccdb;
|
||||
box-shadow: 2px 12px 27px -13px rgba(0, 0, 0, 0.48);
|
||||
}
|
||||
|
||||
.slider-bg {
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: calc(50% - 4px);
|
||||
height: 8px;
|
||||
-webkit-appearance: none;
|
||||
outline: none;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
background: #d3d3d3;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.slider-bg.bg-clicked {
|
||||
background: #e0e0e0;
|
||||
}
|
||||
|
||||
.slider {
|
||||
z-index: 3;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: calc(50% - 4px);
|
||||
height: 8px;
|
||||
-webkit-appearance: none;
|
||||
outline: none;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.slider.clicked::-webkit-slider-thumb {
|
||||
//background-color: rgb(var(--v-theme-error));
|
||||
background-color: #f45246;
|
||||
}
|
||||
|
||||
.slider::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background: rgba(251, 194, 194, 0.86);
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.line-svg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 2;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.line-svg polyline {
|
||||
stroke: rgba(251, 194, 194, 0.86);
|
||||
//background-image: linear-gradient(to bottom, #f9f9f9 0, #f5f5f5 100%);
|
||||
transition: stroke 0.3s ease;
|
||||
}
|
||||
|
||||
.line-svg polyline.clicked {
|
||||
//stroke: rgb(var(--v-theme-error));
|
||||
stroke: #fa574d;
|
||||
}
|
||||
|
||||
.reset-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Alter Code Michi von Fieberkurve 19.01.2025 -->
|
||||
|
||||
<!--
|
||||
<script setup>
|
||||
import { ref, watch, defineProps, defineEmits } from "vue"
|
||||
|
||||
@ -172,9 +457,9 @@ watch([schwierigkeit, stimmung, spannung, gewalt, erotik], () => {
|
||||
sittsam
|
||||
</div>
|
||||
<div class="item2">
|
||||
<!-- Slider -->
|
||||
<!– Slider –>
|
||||
<div style="position: relative; height: 120px">
|
||||
<!-- Fieberkurve -->
|
||||
<!– Fieberkurve –>
|
||||
<canvas
|
||||
id="myCanvas"
|
||||
width="240"
|
||||
@ -209,7 +494,7 @@ watch([schwierigkeit, stimmung, spannung, gewalt, erotik], () => {
|
||||
<div class="kreis" />
|
||||
<div class="kreis" />
|
||||
</div>
|
||||
<!-- :style="{ backgroundColor: vuetifyTheme.current.value.colors.primary }" -->
|
||||
<!– :style="{ backgroundColor: vuetifyTheme.current.value.colors.primary }" –>
|
||||
|
||||
|
||||
<div
|
||||
@ -326,8 +611,8 @@ watch([schwierigkeit, stimmung, spannung, gewalt, erotik], () => {
|
||||
erotisch
|
||||
</div>
|
||||
</div>
|
||||
<!-- ENDE FIEBERKURVE -->
|
||||
<!-- Button Fieberkurve zurücksetzen -->
|
||||
<!– ENDE FIEBERKURVE –>
|
||||
<!– Button Fieberkurve zurücksetzen –>
|
||||
<div
|
||||
v-if="props.showResetButton"
|
||||
style="
|
||||
@ -467,3 +752,4 @@ canvas {
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
-->
|
||||
|
||||
@ -1,65 +1,38 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>Fieberkurve Beispielseite</h1>
|
||||
|
||||
<!-- Interaktive Fieberkurve -->
|
||||
<div>
|
||||
<h2>Interaktive Fieberkurve</h2>
|
||||
<Fieberkurve :isStatic="false" @update:values="updateValues" />
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<!-- Button zum Laden der Daten -->
|
||||
<div class="button-container">
|
||||
<button @click="loadValues">Daten laden</button>
|
||||
</div>
|
||||
|
||||
<!-- Statische Fieberkurve -->
|
||||
<div>
|
||||
<h2>Dynamische Fieberkurve</h2>
|
||||
<Fieberkurve :isStatic="true" :defaultValues="staticValues" />
|
||||
{{ staticValues }}
|
||||
</div>
|
||||
|
||||
<!-- Statische Fieberkurve -->
|
||||
<div>
|
||||
<hr>
|
||||
<br>
|
||||
<h2>Statische Fieberkurve</h2>
|
||||
<Fieberkurve :isStatic="true" :defaultValues="[{ value: 5 }, { value: 2 }, { value: 7 }, { value: 3 }, { value: 5 }]" />
|
||||
<Fieberkurve :isStatic="true" :defaultValues="[{ value: 1 }, { value: 4 }, { value: 7 }, { value: 1 }, { value: 2 }]" />
|
||||
<p>1.
|
||||
< Fieberkurve
|
||||
:isStatic="true"
|
||||
:defaultValues="[{ value: 5 }, { value: 2 }, { value: 7 }, { value: 3 }, { value: 5 }]" />
|
||||
</p>
|
||||
<p>2.
|
||||
< Fieberkurve :isStatic="true"
|
||||
:hideText="true"
|
||||
:defaultValues="[{ value: 1 }, { value: 4 }, { value: 7 }, { value: 1 }, { value: 2 }]" />
|
||||
</p>
|
||||
<hr>
|
||||
<br>
|
||||
<Fieberkurve
|
||||
:is-static="true"
|
||||
:default-values="[{ value: 5 }, { value: 2 }, { value: 7 }, { value: 3 }, { value: 5 }]"
|
||||
/>
|
||||
<Fieberkurve
|
||||
:is-static="true"
|
||||
:hide-text="true"
|
||||
:default-values="[{ value: 1 }, { value: 4 }, { value: 7 }, { value: 1 }, { value: 2 }]"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import Fieberkurve from "@/components/Fieberkurve.vue";
|
||||
|
||||
// Werte der interaktiven Fieberkurve
|
||||
const staticValues = ref([
|
||||
{ value: 4 },
|
||||
{ value: 4 },
|
||||
{ value: 4 },
|
||||
{ value: 4 },
|
||||
{ value: 4 }
|
||||
]);
|
||||
|
||||
// Temporäre Werte für interaktive Fieberkurve
|
||||
const temporaryValues = ref([]);
|
||||
|
||||
// Funktion zum Aktualisieren der temporären Werte
|
||||
function updateValues(values) {
|
||||
temporaryValues.value = values.map(value => ({ value }));
|
||||
}
|
||||
|
||||
// Funktion zum Laden der temporären Werte in die statische Fieberkurve
|
||||
function loadValues() {
|
||||
if (temporaryValues.value != 0){
|
||||
staticValues.value = [...temporaryValues.value]; // Neuzuweisung des Arrays
|
||||
}
|
||||
// console.log(staticValues.value, temporaryValues.value)
|
||||
}
|
||||
import { ref } from "vue"
|
||||
import Fieberkurve from "@/components/Fieberkurve.vue"
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@ -105,7 +78,8 @@ div {
|
||||
|
||||
|
||||
|
||||
<!--<script setup>
|
||||
<!--
|
||||
<script setup>
|
||||
|
||||
import Fieberkurve from "@/components/Fieberkurve.vue";
|
||||
</script>
|
||||
@ -148,4 +122,5 @@ import Fieberkurve from "@/components/Fieberkurve.vue";
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>-->
|
||||
</style>
|
||||
-->
|
||||
|
||||
@ -1,21 +1,142 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>Fieberkurve Beispielseite</h1>
|
||||
|
||||
<!-- Interaktive Fieberkurve -->
|
||||
<div>
|
||||
<h2>Interaktive Fieberkurve</h2>
|
||||
<Fieberkurve :isStatic="false" @update:values="updateValues" />
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<!-- Button zum Laden der Daten -->
|
||||
<div class="button-container">
|
||||
<button @click="loadValues">Daten laden</button>
|
||||
</div>
|
||||
|
||||
<!-- Statische Fieberkurve -->
|
||||
<div>
|
||||
<h2>Dynamische Fieberkurve</h2>
|
||||
<Fieberkurve :isStatic="true" :defaultValues="staticValues" />
|
||||
{{ staticValues }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import Fieberkurve from "@/components/Fieberkurve.vue";
|
||||
|
||||
// Werte der interaktiven Fieberkurve
|
||||
const staticValues = ref([
|
||||
{ value: 4 },
|
||||
{ value: 4 },
|
||||
{ value: 4 },
|
||||
{ value: 4 },
|
||||
{ value: 4 }
|
||||
]);
|
||||
|
||||
// Temporäre Werte für interaktive Fieberkurve
|
||||
const temporaryValues = ref([]);
|
||||
|
||||
// Funktion zum Aktualisieren der temporären Werte
|
||||
function updateValues(values) {
|
||||
temporaryValues.value = values.map(value => ({ value }));
|
||||
}
|
||||
|
||||
// Funktion zum Laden der temporären Werte in die statische Fieberkurve
|
||||
function loadValues() {
|
||||
if (temporaryValues.value != 0){
|
||||
staticValues.value = [...temporaryValues.value]; // Neuzuweisung des Arrays
|
||||
}
|
||||
// console.log(staticValues.value, temporaryValues.value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
h1 {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 20px 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.button-container {
|
||||
text-align: center;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
button {
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
div {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!--<script setup>
|
||||
|
||||
import Fieberkurve from "@/components/Fieberkurve.vue";
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Fieberkurve :show-reset-button="true" :show-categories="true" />
|
||||
<hr>
|
||||
|
||||
<VCard
|
||||
title="Fieberkurven Vorschauseite"
|
||||
subtitle="Hier werden nur ein paar Varianten der Fieberkurve gezeigt!"
|
||||
>
|
||||
|
||||
|
||||
|
||||
|
||||
<h4>Interaktive Fieberkurve:</h4>
|
||||
<!– Interaktive Fieberkurve –>
|
||||
<Fieberkurve :isStatic="false" />
|
||||
<br>
|
||||
<Fieberkurve :show-reset-button="false" :show-categories="true" />
|
||||
<br>
|
||||
<Fieberkurve :isStatic="false" />
|
||||
|
||||
<br>
|
||||
<hr>
|
||||
<br>
|
||||
<Fieberkurve :show-reset-button="false" :show-categories="false" />
|
||||
<h4>Statische Fieberkurve mit vordefinierten Werten:</h4>
|
||||
|
||||
<!– Statische Fieberkurve mit vordefinierten Werten –>
|
||||
<Fieberkurve :isStatic="true" :defaultValues="[{ value: 5 }, { value: 2 }, { value: 7 }, { value: 4 }, { value: 1 }]" />
|
||||
<br>
|
||||
<hr>
|
||||
<br>
|
||||
<Fieberkurve :isStatic="true" :defaultValues="[{ value: 1 }, { value: 2 }, { value: 2 }, { value: 3 }, { value: 1 }]" />
|
||||
<br>
|
||||
<br>
|
||||
<Fieberkurve :isStatic="true" :defaultValues="[{ value: 5 }, { value: 2 }, { value: 3 }, { value: 4 }, { value: 7 }]" />
|
||||
<br>
|
||||
<br>
|
||||
</VCard>
|
||||
</template>
|
||||
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
</style>-->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user