|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="module-style">
|
|
|
|
|
<div class="module-style" ref="moduleRef">
|
|
|
|
|
<div class="module-title-style">
|
|
|
|
|
<span>{{getModuleName()}}</span>
|
|
|
|
|
<div class="icon-container-style">
|
|
|
|
@ -16,83 +16,131 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {moduleData} from './moduleAndLaySettingConfig'
|
|
|
|
|
import {moduleData} from './moduleAndLaySettingConfig';
|
|
|
|
|
export default {
|
|
|
|
|
name: "ModuleBase",
|
|
|
|
|
props:{
|
|
|
|
|
moduleData:{
|
|
|
|
|
type:Object,
|
|
|
|
|
default:function () {
|
|
|
|
|
return{
|
|
|
|
|
module_type_id:'',
|
|
|
|
|
module_id:'',
|
|
|
|
|
size:''
|
|
|
|
|
props: {
|
|
|
|
|
moduleData: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: function () {
|
|
|
|
|
return {
|
|
|
|
|
module_type_id: '',
|
|
|
|
|
module_id: '',
|
|
|
|
|
size: '',
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data:function(){
|
|
|
|
|
return{
|
|
|
|
|
type_id:this.moduleData.module_type_id,
|
|
|
|
|
id:this.moduleData.module_id,
|
|
|
|
|
module_size:this.moduleData.size,
|
|
|
|
|
url: this.initModuleUrl()
|
|
|
|
|
data: function () {
|
|
|
|
|
return {
|
|
|
|
|
type_id: this.moduleData.module_type_id,
|
|
|
|
|
id: this.moduleData.module_id,
|
|
|
|
|
module_size: this.moduleData.size,
|
|
|
|
|
//url: this.initModuleUrl(),
|
|
|
|
|
url: "",
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed:{
|
|
|
|
|
getCom: function (){
|
|
|
|
|
mounted(){
|
|
|
|
|
//初次加载:第一次加载时,模块在屏幕内就加载
|
|
|
|
|
this.initLoadModule();
|
|
|
|
|
//延时加载:随着屏幕向下滚动,模块出现在屏幕中再加载
|
|
|
|
|
let moduleContent = document.getElementById("moduleContent");
|
|
|
|
|
moduleContent.addEventListener("scroll", () => {
|
|
|
|
|
let scrollTop = moduleContent.scrollTop;
|
|
|
|
|
//可见区域底部高度 = 滚动条高度 + 视窗高度
|
|
|
|
|
let visibleBottom = scrollTop + document.documentElement.clientHeight - 100;
|
|
|
|
|
//模块距离顶部高度
|
|
|
|
|
let moduleTop = this.$refs.moduleRef ? this.$refs.moduleRef.offsetTop : 0;
|
|
|
|
|
//如果模块距离顶部高度 小于 可见区域底部高度 就视为可见
|
|
|
|
|
if (moduleTop + 100 < visibleBottom) {
|
|
|
|
|
//开始加载
|
|
|
|
|
this.url = this.getModuleUrl();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
getCom: function () {
|
|
|
|
|
return () => import(`@/views/superFusionPlatform/mainPlatform/moduleAndLayout/moduleCom/${this.url}`)
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
methods:{
|
|
|
|
|
accessSubsystem:function(){
|
|
|
|
|
methods: {
|
|
|
|
|
initLoadModule: function () {
|
|
|
|
|
let moduleTop = this.$refs.moduleRef ? this.$refs.moduleRef.offsetTop : 0;
|
|
|
|
|
let initVisibleBottom = document.documentElement.clientHeight;
|
|
|
|
|
if (moduleTop < initVisibleBottom) {
|
|
|
|
|
//开始加载
|
|
|
|
|
this.url = this.getModuleUrl();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
accessSubsystem: function () {
|
|
|
|
|
debugger;
|
|
|
|
|
let type = (moduleData.filter((type)=>{return type.module_type_id === this.type_id})[0]);
|
|
|
|
|
let module = type.module_list.filter((module)=>{return module.module_id === this.id})[0];
|
|
|
|
|
this.$emit('accessSubsystem',module);
|
|
|
|
|
let type = (moduleData.filter((type) => {
|
|
|
|
|
return type.module_type_id === this.type_id
|
|
|
|
|
})[0]);
|
|
|
|
|
let module = type.module_list.filter((module) => {
|
|
|
|
|
return module.module_id === this.id
|
|
|
|
|
})[0];
|
|
|
|
|
this.$emit('accessSubsystem', module);
|
|
|
|
|
},
|
|
|
|
|
hideModule:function(){
|
|
|
|
|
hideModule: function () {
|
|
|
|
|
this.$emit('hideModule')
|
|
|
|
|
},
|
|
|
|
|
initModuleUrl:function(){
|
|
|
|
|
let type = (moduleData.filter((type)=>{return type.module_type_id === this.moduleData.module_type_id})[0])
|
|
|
|
|
if (this.moduleData.size === 'small'){
|
|
|
|
|
return type.module_list.filter((module)=>{return module.module_id === this.moduleData.module_id})[0].module_url_small
|
|
|
|
|
}else{
|
|
|
|
|
return type.module_list.filter((module)=>{return module.module_id === this.moduleData.module_id})[0].module_url_large
|
|
|
|
|
initModuleUrl: function () {
|
|
|
|
|
let type = (moduleData.filter((type) => {
|
|
|
|
|
return type.module_type_id === this.moduleData.module_type_id
|
|
|
|
|
})[0])
|
|
|
|
|
if (this.moduleData.size === 'small') {
|
|
|
|
|
return type.module_list.filter((module) => {
|
|
|
|
|
return module.module_id === this.moduleData.module_id
|
|
|
|
|
})[0].module_url_small
|
|
|
|
|
} else {
|
|
|
|
|
return type.module_list.filter((module) => {
|
|
|
|
|
return module.module_id === this.moduleData.module_id
|
|
|
|
|
})[0].module_url_large
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
getModuleUrl:function(){
|
|
|
|
|
let type = (moduleData.filter((type)=>{return type.module_type_id === this.type_id})[0])
|
|
|
|
|
if (this.module_size === 'small'){
|
|
|
|
|
return type.module_list.filter((module)=>{return module.module_id === this.id})[0].module_url_small
|
|
|
|
|
}else{
|
|
|
|
|
return type.module_list.filter((module)=>{return module.module_id === this.id})[0].module_url_large
|
|
|
|
|
getModuleUrl: function () {
|
|
|
|
|
let type = (moduleData.filter((type) => {
|
|
|
|
|
return type.module_type_id === this.type_id
|
|
|
|
|
})[0])
|
|
|
|
|
if (this.module_size === 'small') {
|
|
|
|
|
return type.module_list.filter((module) => {
|
|
|
|
|
return module.module_id === this.id
|
|
|
|
|
})[0].module_url_small
|
|
|
|
|
} else {
|
|
|
|
|
return type.module_list.filter((module) => {
|
|
|
|
|
return module.module_id === this.id
|
|
|
|
|
})[0].module_url_large
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
getModuleName:function(){
|
|
|
|
|
return (moduleData.filter((type)=>{return type.module_type_id === this.type_id})[0]).
|
|
|
|
|
module_list.filter((module)=>{return module.module_id === this.id})[0].module_name
|
|
|
|
|
getModuleName: function () {
|
|
|
|
|
return (moduleData.filter((type) => {
|
|
|
|
|
return type.module_type_id === this.type_id
|
|
|
|
|
})[0]).module_list.filter((module) => {
|
|
|
|
|
return module.module_id === this.id
|
|
|
|
|
})[0].module_name
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
watch:{
|
|
|
|
|
moduleData:function (newData) {
|
|
|
|
|
watch: {
|
|
|
|
|
moduleData: function (newData) {
|
|
|
|
|
this.type_id = newData.module_type_id
|
|
|
|
|
this.id = newData.module_id
|
|
|
|
|
this.module_size = newData.size
|
|
|
|
|
this.url = this.getModuleUrl()
|
|
|
|
|
this.showIndex = newData.showIndex
|
|
|
|
|
//this.url = this.getModuleUrl()
|
|
|
|
|
this.initLoadModule();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.module-style{
|
|
|
|
|
.module-style {
|
|
|
|
|
/*float: left;*/
|
|
|
|
|
min-height: 10rem;
|
|
|
|
|
background-color: white;
|
|
|
|
|
margin-bottom: 14px;
|
|
|
|
|
.module-title-style{
|
|
|
|
|
.module-title-style {
|
|
|
|
|
display: flex;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 40px;
|
|
|
|
@ -101,24 +149,24 @@
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
color:white;
|
|
|
|
|
color: white;
|
|
|
|
|
/*justify-items: space-around;*/
|
|
|
|
|
background:linear-gradient(to bottom right,var(--modTitleTwo),var(--modTitleOne));
|
|
|
|
|
background:-moz-linear-gradient(to bottom right,var(--modTitleTwo),var(--modTitleOne));
|
|
|
|
|
background:-webkit-linear-gradient(bottom right,var(--modTitleTwo),var(--modTitleOne));
|
|
|
|
|
.icon-style{
|
|
|
|
|
background: linear-gradient(to bottom right, var(--modTitleTwo), var(--modTitleOne));
|
|
|
|
|
background: -moz-linear-gradient(to bottom right, var(--modTitleTwo), var(--modTitleOne));
|
|
|
|
|
background: -webkit-linear-gradient(bottom right, var(--modTitleTwo), var(--modTitleOne));
|
|
|
|
|
.icon-style {
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
margin-right: 20px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
&:nth-last-of-type(1){
|
|
|
|
|
&:nth-last-of-type(1) {
|
|
|
|
|
margin-right: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.no-module-tip-style{
|
|
|
|
|
.no-module-tip-style {
|
|
|
|
|
display: flex;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height:120px;
|
|
|
|
|
height: 120px;
|
|
|
|
|
align-items: center;
|
|
|
|
|
align-content: center;
|
|
|
|
|
justify-items: center;
|
|
|
|
|