NEZ-289 perf: 标题色调浅、优化动画

This commit is contained in:
chenjinsong
2020-06-03 14:53:02 +08:00
parent aee8d53da0
commit 38388645bd
6 changed files with 150 additions and 26 deletions

View File

@@ -845,6 +845,104 @@ li{
transform-origin: right; transform-origin: right;
} }
} }
@keyframes unfold-200 {
0%{
visibility: hidden;
opacity: 0;
max-height: 0;
}
25%{
opacity: 0;
max-height: 50px;
}
50%{
opacity: 0;
max-height: 100px;
}
75%{
opacity: 0.4;
max-height: 150px;
}
100% {
visibility: visible;
opacity: 1;
max-height: 200px;
}
}
@keyframes fold-200 {
0% {
opacity: 1;
max-height: 200px;
visibility: visible;
}
25%{
opacity: 0.4;
max-height: 150px;
}
50%{
opacity: 0;
max-height: 100px;
}
75%{
opacity: 0;
max-height: 50px;
}
100% {
visibility: hidden;
opacity: 0;
max-height: 0;
}
}
@keyframes unfold-500 {
0%{
visibility: hidden;
opacity: 0;
max-height: 0;
}
25%{
opacity: 0;
max-height: 125px;
}
50%{
opacity: 0;
max-height: 250px;
}
75%{
opacity: 0.4;
max-height: 375px;
}
100% {
visibility: visible;
opacity: 1;
max-height: 500px;
}
}
@keyframes fold-500 {
0% {
opacity: 1;
max-height: 500px;
visibility: visible;
}
25%{
opacity: 0.4;
max-height: 375px;
}
50%{
opacity: 0;
max-height: 250px;
}
75%{
opacity: 0;
max-height: 125px;
}
100% {
visibility: hidden;
opacity: 0;
max-height: 0;
}
}
.right-box-enter-active { .right-box-enter-active {
animation: slide-in-from-right 0.4s; animation: slide-in-from-right 0.4s;
} }

View File

@@ -33,7 +33,7 @@
<span><i :class="{'el-icon-caret-right':hideBasic,'el-icon-caret-bottom':!hideBasic}"></i></span> <span><i :class="{'el-icon-caret-right':hideBasic,'el-icon-caret-bottom':!hideBasic}"></i></span>
<span>{{$t('asset.createAssetTab.basicTitle')}}</span> <span>{{$t('asset.createAssetTab.basicTitle')}}</span>
</div> </div>
<div class="basic-content" :class="{'shrink':hideBasic}"> <div class="basic-content basic-content-asset" :class="{'fold':hideBasic, 'unfold':!hideBasic}">
<template v-if="assetInfos.Basic && Object.keys(assetInfos.Basic).length>0"> <template v-if="assetInfos.Basic && Object.keys(assetInfos.Basic).length>0">
<div v-for="(item,index) in basicKey" :key="index" class="content-item hover-bg"> <div v-for="(item,index) in basicKey" :key="index" class="content-item hover-bg">
<div class="content-item-key item-tip" :id="'basicKey' + index"> <div class="content-item-key item-tip" :id="'basicKey' + index">
@@ -63,7 +63,7 @@
<span><i :class="{'el-icon-caret-right':hideFeature,'el-icon-caret-bottom':!hideFeature}"></i></span> <span><i :class="{'el-icon-caret-right':hideFeature,'el-icon-caret-bottom':!hideFeature}"></i></span>
<span>{{$t('asset.createAssetTab.featureTitle')}}</span> <span>{{$t('asset.createAssetTab.featureTitle')}}</span>
</div> </div>
<div class="feature-content" :class="{'shrink':hideFeature}"> <div class="feature-content feature-content-asset" :class="{'fold':hideFeature, 'unfold':!hideFeature}">
<div v-for="(value,key,index) in assetInfos.Feature" class="content-item item-tip"> <div v-for="(value,key,index) in assetInfos.Feature" class="content-item item-tip">
<div class="content-item-key item-tip" :id="'featureKey' + index"> <div class="content-item-key item-tip" :id="'featureKey' + index">
<span>{{key}}</span> <span>{{key}}</span>
@@ -282,9 +282,9 @@
}else{ }else{
this.hideFeature=!this.hideFeature this.hideFeature=!this.hideFeature
} }
this.$nextTick(()=>{ setTimeout(()=>{
this.$refs.scrollbar.update(); this.$refs.scrollbar.update();
}) },400);
}, },
replaceSplit(key){ replaceSplit(key){
if(key){ if(key){

View File

@@ -196,6 +196,7 @@
this.dataListDragTmp = [...this.dataList]; this.dataListDragTmp = [...this.dataList];
}, },
end (event) { end (event) {
console.info("end event:", event)
let item = event.item; let item = event.item;
let oldIndex = event.oldIndex; let oldIndex = event.oldIndex;
let newIndex = event.newIndex; let newIndex = event.newIndex;

View File

@@ -21,7 +21,7 @@
</span> </span>
</el-popover> </el-popover>
<span class="el-dropdown-link chart-title" @click="dropdownMenuShow=!dropdownMenuShow"> <span class="el-dropdown-link chart-title" @click="dropdownMenuShow=!dropdownMenuShow">
<span class="chart-title-text">{{$t('asset.createAssetTab.assetInfo')}}</span> <span class="chart-title-text">{{$t('project.chart.projectInfo')}}</span>
</span> </span>
</div> </div>
<div class="mt-10 chart-info-container" v-cloak v-show="firstShow" > <div class="mt-10 chart-info-container" v-cloak v-show="firstShow" >
@@ -30,10 +30,10 @@
<div style="padding: 0 15px"> <div style="padding: 0 15px">
<div class="basic-container"> <div class="basic-container">
<div class="basic-title asset-info-content-title" @click="hideElement('basic')"> <div class="basic-title asset-info-content-title" @click="hideElement('basic')">
<span><i :class="{'el-icon-caret-right':hidebasic,'el-icon-caret-bottom':!hidebasic}"></i></span> <span><i :class="{'el-icon-caret-right':hideBasic,'el-icon-caret-bottom':!hideBasic}"></i></span>
<span>{{$t('project.chart.basicTitle')}}</span> <span>{{$t('project.chart.basicTitle')}}</span>
</div> </div>
<div class="basic-content" :class="{'shrink':hidebasic}"> <div class="basic-content basic-content-project" :class="{'fold':hideBasic, 'unfold':!hideBasic}">
<template v-if="projectInfos.basic && Object.keys(projectInfos.basic).length>0"> <template v-if="projectInfos.basic && Object.keys(projectInfos.basic).length>0">
<div v-for="(item,index) in basicKey" :key="index" class="content-item"> <div v-for="(item,index) in basicKey" :key="index" class="content-item">
<div class="content-item-key item-tip" :id="'basicKey' + index"> <div class="content-item-key item-tip" :id="'basicKey' + index">
@@ -57,11 +57,11 @@
</div> </div>
</div> </div>
<div class="feature-container" v-for="(module, mi) in projectInfos.module" :key="mi"> <div class="feature-container" v-for="(module, mi) in projectInfos.module" :key="mi">
<div class="feature-title asset-info-content-title" @click="hideElement(module.id)" > <div class="feature-title asset-info-content-title" @click.stop="hideElement(module.id)" >
<span><i :class="{'el-icon-caret-right':showModuleId != module.id,'el-icon-caret-bottom':showModuleId == module.id}"></i></span> <span><i :class="{'el-icon-caret-right': showModuleIds.indexOf(module.id) == -1,'el-icon-caret-bottom': showModuleIds.indexOf(module.id) > -1}"></i></span>
<span>{{$t('project.module.module')}}{{module.name}}</span> <span>{{$t('project.module.module')}}{{module.name}}</span>
</div> </div>
<div class="feature-content" :class="{'shrink':showModuleId != module.id}"> <div class="feature-content feature-content-project" :class="{'fold': showModuleIds.indexOf(module.id) == -1, 'unfold': showModuleIds.indexOf(module.id) > -1}">
<div v-for="(item,index) in moduleKey" :key="index" class="content-item"> <div v-for="(item,index) in moduleKey" :key="index" class="content-item">
<div class="content-item-key item-tip" :id="'featureKey' + module.id + '-' + index"> <div class="content-item-key item-tip" :id="'featureKey' + module.id + '-' + index">
<span>{{item.label}}</span> <span>{{item.label}}</span>
@@ -140,8 +140,8 @@
start_time: '', start_time: '',
end_time: '', end_time: '',
}, },
hidebasic:false, hideBasic:false,
showModuleId: 0, showModuleIds: [],
firstShow: false, // 默认不显示操作按钮, firstShow: false, // 默认不显示操作按钮,
caretShow:false, caretShow:false,
dragTitleShow:false, dragTitleShow:false,
@@ -238,17 +238,18 @@
}, },
hideElement:function(type){ hideElement:function(type){
if(type == 'basic'){ if(type == 'basic'){
this.hidebasic=!this.hidebasic; this.hideBasic=!this.hideBasic;
}else{ }else{
if (this.showModuleId == type) { let index = this.showModuleIds.indexOf(type);
this.showModuleId = 0; if (index == -1) {
this.showModuleIds.push(type);
} else { } else {
this.showModuleId = type; this.showModuleIds.splice(index, 1);
} }
} }
this.$nextTick(()=>{ setTimeout(()=>{
this.$refs.scrollbar.update(); this.$refs.scrollbar.update();
}) },400);
}, },
replaceSplit(key){ replaceSplit(key){
if(key){ if(key){

View File

@@ -209,23 +209,46 @@
height: calc(100% - 10px); height: calc(100% - 10px);
} }
.asset-info-content-title { .asset-info-content-title {
background-image: linear-gradient(#f5f5f5, #e7e7e7); background-image: linear-gradient(#fafafa, #f0f0f0);
font-size: 13px; font-size: 13px;
color: #505255; color: #505255;
padding-left: 2px; padding-left: 2px;
height: 25px; height: 25px;
line-height: 25px; line-height: 25px;
} }
.basic-content.shrink, .feature-content.shrink { .basic-content-asset.fold, .feature-content-asset.fold {
height: 0; animation-name: fold-500; //该动画定义在main.scss里
transform: scaleY(0); animation-duration: 0.3s;
animation-iteration-count:1;
opacity: 0; opacity: 0;
max-height: 0;
visibility: hidden;
} }
.basic-content, .feature-content { .basic-content-project.fold, .feature-content-project.fold {
height: 100%; animation-name: fold-200; //该动画定义在main.scss里
animation-duration: 0.3s;
animation-iteration-count:1;
opacity: 0;
max-height: 0;
visibility: hidden;
}
.basic-content-asset.unfold, .feature-content-asset.unfold {
animation-name: unfold-500;
animation-duration: 0.3s;
animation-iteration-count:1;
opacity: 1; opacity: 1;
transform-origin: top; max-height: 500px;
transition: all 0.2s linear; visibility: visible;
}
.basic-content-project.unfold, .feature-content-project.unfold {
animation-name: unfold-200;
animation-duration: 0.3s;
animation-iteration-count:1;
opacity: 1;
max-height: 200px;
visibility: visible;
}
.basic-content, .feature-content {
width: 100%; width: 100%;
margin-bottom: 5px; margin-bottom: 5px;
box-sizing: border-box; box-sizing: border-box;

View File

@@ -798,6 +798,7 @@ const en = {
basicTitle: "Basic info", basicTitle: "Basic info",
alertStat: "Alert state", alertStat: "Alert state",
endpointStat: "Endpoint state", endpointStat: "Endpoint state",
projectInfo: "Project information"
}, },
project: { project: {
project: 'Project',//"系统" project: 'Project',//"系统"