123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <template>
- <VueDragResize
- ref="ref_drag"
- :isActive="false"
- :z="state.zIndex"
- :layout="layout"
- :isResizable="isResizable"
- :parentLimitation="true"
- @resizing="resize"
- @dragging="resize"
- @mousedown="setZ"
- >
- <div class="drag-window">
- <div class="head">
- <div class="head-bg">
- <img class="img-bg" src="@/assets/images/web/title-bg.png"/>
- <div class="color-bg"/>
- </div>
- <div class="head-content">
- <div class="title">
- {{title}}
- <slot name="title"/>
- </div>
- <div class="buttons">
- <slot name="buttons"/>
- <SvgIcon v-if="expend !== false" class="expend-button __hover" :class="{active: state.notExpend}" @click="state.notExpend = !state.notExpend" name="arrow_4" color="#ffffff" size="18"/>
- <SvgIcon v-if="close !== false" class="__hover" @click="$emit('onClose')" name="close_3" color="#ffffff" size="16"/>
- </div>
- </div>
- </div>
- <div class="content" :class="{'not-expend': expend !== false && state.notExpend}">
- <slot/>
- </div>
- </div>
- </VueDragResize>
- </template>
- <script setup lang="ts">
- import {computed, getCurrentInstance, nextTick, reactive} from "vue";
- import VueDragResize from '@/components/vue-drag-resize/index.vue'
- import {useAppStore} from "@/stores";
- const {proxy} = getCurrentInstance()
- const emit = defineEmits(['update:layout'])
- const appStore = useAppStore()
- const props = defineProps({
- title: {default: ''},
- layout: {required: false},
- isResizable: {default: false},
- close: {default: false},
- expend: {default: false},
- })
- const state: any = reactive({
- zIndex: appStore.getZIndex(),
- notExpend: false
- })
- const resize = (layout) => {
- nextTick(() => {
- let c = layout
- if (props.expend !== false) {
- c = Object.assign(c, {
- height: 'auto'
- })
- }
- emit('update:layout', c)
- })
- }
- const setZ = () => {
- state.zIndex = appStore.getZIndex()
- }
- defineExpose({
- setZ,
- })
- </script>
- <style scoped lang="scss">
- .drag-window {
- display: flex;
- flex-direction: column;
- .head {
- position: relative;
- width: 100%;
- height: 58px;
- display: flex;
- .head-bg {
- width: 100%;
- position: relative;
- z-index: 1;
- opacity: 0.8;
- overflow: hidden;
- border-radius: 16px 16px 0 0;
- .img-bg {
- user-select: none;
- width: 372px;
- height: 100%;
- position: absolute;
- top: 0;
- left: 0;
- z-index: 2;
- }
- .color-bg {
- width: calc(100% - 20px);
- height: 100%;
- background-color: rgba(88, 148, 235, 1);
- position: absolute;
- top: 0;
- right: 0;
- z-index: 1;
- }
- }
- .head-content {
- width: 100%;
- height: 100%;
- position: absolute;
- z-index: 2;
- display: flex;
- align-items: center;
- .title {
- margin-left: 24px;
- font-weight: 400;
- font-size: 20px;
- color: #FFFFFF;
- display: flex;
- line-height: 1;
- align-items: center;
- }
- .buttons {
- margin-left: auto;
- margin-right: 24px;
- display: flex;
- align-items: center;
- .expend-button {
- margin-right: 8px;
- transition: all .2s;
- &.active {
- transform: rotate(180deg) !important;
- }
- }
- }
- }
- }
- .content {
- width: 100%;
- height: calc(100% - 40px);
- background-color: rgba(0, 52, 159, 0.85);
- overflow: hidden;
- transition: height .2s;
- border-radius: 0 0 16px 16px;
- &.not-expend {
- height: 0;
- }
- }
- }
- </style>
|