From 8356b1850885fe03a6bd388500a447dd5c42692c Mon Sep 17 00:00:00 2001 From: YANGDL <114714267@qq.com> Date: 星期二, 05 一月 2021 10:23:30 +0800 Subject: [PATCH] 优化逻辑 --- src/components/LayerController/LayerController.vue | 108 ++++++++++++++++++++++++++++++++---------------------- 1 files changed, 64 insertions(+), 44 deletions(-) diff --git a/src/components/LayerController/LayerController.vue b/src/components/LayerController/LayerController.vue index 1255f2a..5481419 100644 --- a/src/components/LayerController/LayerController.vue +++ b/src/components/LayerController/LayerController.vue @@ -1,23 +1,22 @@ <template> - <div class="floatPanel"> + <div class="float-panel"> <!-- <i class="horn horn-tl"></i> --> <!-- <i class="horn horn-tr"></i> --> <i class="horn horn-br"></i> <i class="horn horn-bl"></i> - <div class="head titleBorder"> - <div class="titleTextBorder"> - <div class="titleIcon"></div> - <div class="titleText">涓氬姟鐪嬫澘</div> - <div class="titleButton" :class="{switchHeadUp:true, switchHeadDown: !panelSwitch.main}" @click="switchPanel"> + <div class="head title-border"> + <div class="title-text-border"> + <div class="title-icon"></div> + <div class="title-text">涓氬姟鐪嬫澘</div> + <div class="title-button" :class="{'switch-head-up':true, 'switch-head-down': !panelSwitch.main}" @click="switchPanel"> <!-- <i class="el-icon-arrow-down"></i> --> </div> </div> </div> - <div class="body" id="panelContent"> - <div id="panelInnerContent" style="height: auto; overflow: hidden;"> - - + <div class="body-box" id="panelContent"> + <div id="panelInnerContent" :style="{ height:height }"> + <slot></slot> </div> </div> </div> @@ -25,10 +24,12 @@ <script> import api from './LayerControllerAPI' -import { mapState, mapMutations } from 'vuex' +// import { mapState, mapMutations } from 'vuex' import '@assets/css/map/magic.min.css' import presets from './layerControllerPresets' -import $ from 'jquery' +// import $ from 'jquery' + +import iconSetting from '@/assets/images/map-pages/icon/setting.png' export default { name: 'LayerController', @@ -40,15 +41,25 @@ } }, computed: { - ...mapState({ - map: state => state.map, - L: state => state.L, - layerHelper: state => state.layerHelper, - layerControllerVisible: state => state.layerControllerVisible - }) + map(){ + return this.$store.state.map.map + }, + L(){ + return this.$store.state.map.L + }, + layerHelper(){ + return this.$store.state.map.layerHelper + }, + layerControllerVisible(){ + return this.$store.state.map.layerControllerVisible + } }, data() { return { + height:'200px', + icons:{ + setting:iconSetting + }, panelSwitch: { main: true // 涓荤獥鍙� } @@ -61,8 +72,7 @@ }) }, methods: { - ...mapMutations(['updateLayerControllerVisible']), - async init() { + init() { this.initPreset() }, initPreset() { @@ -72,19 +82,16 @@ if (prmPreset === 'undefined') { console.log('璇ュ浘灞傛帶鍒堕潰鏉跨殑棰勮娌℃湁鎵惧埌锛岃妫�鏌ラ璁惧悕绉版槸鍚︽纭紒') } else { - this.updateLayerControllerVisible(this.layerControllerVisible) + this.$store.commit('updateLayerControllerVisible', this.layerControllerVisible); } } }, switchPanel() { this.panelSwitch.main = !this.panelSwitch.main if (this.panelSwitch.main) { - $('#panelInnerContent').animate({ height: '500px' }, 'fast', 'swing', () => { - $('#panelInnerContent').css('height', 'auto') - $('#panelContent').css('height', 'auto') - }) + this.height = '200px' } else { - $('#panelInnerContent').animate({ height: '0px' }, 'fast', 'swing') + this.height = '0px' } }, } @@ -93,7 +100,7 @@ <style lang="less"> -.floatPanel{ +.float-panel{ position: absolute; left: 10px; bottom: 10px; @@ -104,7 +111,11 @@ div{ color:#90c8e0; } - .titleBorder{ + #panelInnerContent{ + overflow: hidden; + transition: all 0.5s linear; + } + .title-border{ width: 100%; height: 28px; background: #10488c; @@ -112,7 +123,7 @@ clip-path: polygon(0px 0px, 0px 28px, 230px 28px, 230px 9px, 95px 9px, 86px 0px); position: relative; } - .titleBorder:before { + .title-border:before { content: ""; display: block; position: absolute; @@ -122,7 +133,7 @@ left: 0; background-color: #38c8ef; } - .titleBorder:after { + .title-border:after { content: ""; display: block; position: absolute; @@ -134,22 +145,22 @@ -webkit-clip-path: polygon(0px 0px, 0px 1px, 5px 1px, 5px 6px, 6px 6px, 6px 0px); clip-path: polygon(0px 0px, 0px 1px, 5px 1px, 5px 6px, 6px 6px, 6px 0px); } - .titleTextBorder { + .title-text-border { width: 100%; height: 28px; background: #091331; -webkit-clip-path: polygon(1px 1px, 1px 27px, 229px 27px, 229px 10px, 94px 10px, 85px 1px); clip-path: polygon(1px 1px, 1px 27px, 229px 27px, 229px 10px, 94px 10px, 85px 1px); } - .titleIcon{ + .title-icon{ float: left; width: 22px; height: 22px; margin-top: 4px; margin-left: 2px; - background: url(/assets/images/map-page/icon/setting.png); + background-image: url(/assets/images/map-pages/icon/setting.png); } - .titleText{ + .title-text{ float: left; width: 150px; color: #00d0f9; @@ -157,10 +168,11 @@ line-height: 20px; font-weight: bold; margin-top: 6px; + text-align: left; filter: brightness(100%); text-shadow: 0 0 5px #00d0f9, 0 0 0 #00d0f9, 0 0 0 #00d0f9, 0 0 0 #0258c5, 0 0 0 #0258c5, 0 0 2px #0258c5, 0 0 5px #0258c5, 0 0 15px #0258c5; } - .titleline{ + .title-line{ display: inline-block; width: 120px; height: 1px; @@ -170,7 +182,7 @@ line-height: 5px; vertical-align: middle; } - .titlepoint{ + .title-point{ display: inline-block; width: 5px; height: 5px; @@ -179,7 +191,7 @@ line-height: 5px; vertical-align: middle; } - .titleButton{ + .title-button{ float: right; width: 28px; height: 28px; @@ -189,19 +201,27 @@ color: white; } } - .switchHeadUp{ + + .body-box{ + background-color: rgba(44,62,80, 0.6); + border: 1px solid #10488c; + margin-top: -1px; + height: auto; + } + + .switch-head-up{ width: 22px; height: 16px; float: right; margin-top: 10px; margin-right: 10px; cursor: pointer; - background: url(/assets/images/map-page/icon/xljt1.png); + background-image: url(/assets/images/map-pages/icon/xljt1.png); transform: rotateX(0deg); transform-origin: 50% 50%; transition: transform 0.5s linear 0s; } - .switchHeadDown{ + .switch-head-down{ transform: rotateX(180deg); transform-origin: 50% 50%; transition: transform 0.5s linear 0s; @@ -221,22 +241,22 @@ position: absolute; } .horn-tl{ - background: url(/assets/images/map-page/cosmetics/horn_tl.png) center center no-repeat; + background-image: url(/assets/images/map-pages/cosmetics/horn_tl.png) center center no-repeat; left: -1px; top: -1px; } .horn-tr{ - background: url(/assets/images/map-page/cosmetics/horn_tr.png) center center no-repeat; + background-image: url(/assets/images/map-pages/cosmetics/horn_tr.png) center center no-repeat; right: -1px; top: -1px; } .horn-bl{ - background: url(/assets/images/map-page/cosmetics/horn_bl.png) center center no-repeat; + background-image: url(/assets/images/map-pages/cosmetics/horn_bl.png) center center no-repeat; left: -1px; bottom: -1px; } .horn-br{ - background: url(/assets/images/map-page/cosmetics/horn_br.png) center center no-repeat; + background-image: url(/assets/images/map-pages/cosmetics/horn_br.png) center center no-repeat; right: -1px; bottom: -1px; } -- Gitblit v1.8.0