objects3d-modal.vue 5.34 KB
<template>
    <section class="objects3d">
        <div class="object-shape">
            <span
                :class="selecteditem === item.key ? 'item selected' : 'item'"
                v-for="item in items"
                :key="item.key"
                @click="onSelect(item.key)"
            >
                <img :src="item.image" />
                <div class="text" v-text="$t(item.key)" />
            </span>
        </div>
        <div class="parameter">
            <span class="parameteritem" v-for="(item, key) in parameteritems" :key="key">
                <span v-text="$t(key)"></span>
                <span class="inputNumber">
                    <el-input-number
                        v-model.number="parameteritems[key]"
                        :precision="2"
                        :step="1"
                        controls-position="right"
                        :max="99.99"
                        :min="1"
                    />
                </span>
            </span>
        </div>
        <span class="button-big" v-text="$t('apply')" @click="onClick" />
    </section>
</template>
<script setup>
import { useObjects3dStore } from '@/views/stores/funtional-toolbar/useObjects3dStore';
import { storeToRefs } from 'pinia';

const store = useObjects3dStore();
const { items, selecteditem, parameteritems } = storeToRefs(store);
const { setSelectedItem, setApplyGenerateMesh } = store;

const onSelect = (key) => {
    setSelectedItem(key);
};

const onClick = () => {
    setApplyGenerateMesh();
};
</script>
<style lang="less" scoped>
.objects3d {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
    .object-shape {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        .item {
            box-sizing: border-box;
            display: flex;
            cursor: pointer;
            background-color: #ffffff;
            padding: 8px 11px;
            border: 1px solid #cdd1d5;
            border-radius: 8px;
            border-image: initial;
            display: flex;
            flex-direction: column;
            img {
                width: 32px;
                height: 32px;
                margin: auto;
                display: block;
            }
            .text {
                width: max-content;
                padding-top: 5px;
                margin: 0px;
                font-size: 14px;
                line-height: 22px;
                font-weight: 500;
                color: #333333;
                margin: auto;
                display: block;
                font-weight: 550;
            }
            &.selected {
                background-color: @color-button-selected-background;
                border-color: @color-button-main-selected-border;
            }
            &:hover {
                background-color: @color-button-hover-background;
            }
        }
    }
    .parameter {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin: 12px 0 12px 0;
        height: 120px;
        .parameteritem {
            display: flex;
            flex-direction: row;
            -webkit-box-align: center;
            align-items: center;
            -webkit-box-pack: justify;
            justify-content: space-between;
            height: 34px;
            margin: 0px;
            font-size: 14px;
            line-height: 22px;
            font-weight: 500;
            color: #333333;
            .inputNumber {
                width: fit-content;
                height: 34px;
                position: relative;
                box-sizing: content-box;
                border-radius: 4px;
                user-select: none;
                :deep(.el-input-number) {
                    width: 120px;
                    height: 32px;
                    display: inline-block;
                    text-align: right;
                    outline: none;
                    border-radius: 4px;
                    font-size: 14px;
                    font-weight: 400;
                    line-height: 22px;
                    letter-spacing: -0.3px;
                    border: 0px;
                    color: rgb(51, 51, 51);
                    .el-input__wrapper {
                        background-color: rgb(246, 247, 248);
                        padding-left: 0 !important;
                    }
                }
                .el-input-number-unit[data-unit] {
                    position: relative;
                    --el-input-number-unit-offset-x: 35px;
                }

                .el-input-number-unit[data-unit]::after {
                    content: attr(data-unit);
                    height: 100%;
                    display: flex;
                    align-items: center;
                    position: absolute;
                    top: 0;
                    right: var(--el-input-number-unit-offset-x);
                    color: #606266;
                    font-size: 12px;
                }
            }
        }
    }
    .button-big {
        display: flex;
        width: 100%;
        -webkit-box-pack: center;
        justify-content: center;
        -webkit-box-align: center;
        align-items: center;
        padding: 0px;
        height: 46px;
        border-radius: 8px;
        cursor: pointer;
        margin: 0px;
        font-size: 14px;
        line-height: 20px;
        font-weight: 600;
    }
}
</style>