11-wms/src/views/wmsHome/index.vue
2022-11-03 14:21:07 +08:00

186 lines
4.7 KiB
Vue

<template>
<div id="container" class="choicepart-container">
<div class="choicepat-navbar">
<navbar :showhome="false" :show-title="true" />
</div>
<div class="choicepart-box" :style="{ width: 1585 * beilv + 'px' }">
<div
v-for="(item, index) in moduleList"
:key="item.path"
class="choicepart-item"
:style="{ width: 180 * beilv + 'px', height: 223 * beilv + 'px', margin: 40 * beilv + 'px' }"
@click="handelClick(item, index)"
>
<div class="choicepart-item-border">
<img :src="require(`../../assets/img/choicepart/${item.name}.png`)" alt="" :style="{ width: 90 * beilv + 'px', height: 90 * beilv + 'px', top: 35 * beilv + 'px', left: 50 * beilv + 'px' }">
</div>
<div class="choicepart-item-title" :title="item.meta.title" :style="{ height: 40 * beilv + 'px', lineHeight: 40 * beilv + 'px', fontSize: 16 * beilv + 'px' }">{{ item.meta.title }}</div>
</div>
</div>
<div class="bottom-img">
<img :src="require('../../assets/img/choicepart/choicepart-back-u.png')" alt="">
</div>
</div>
</template>
<script>
import { routes } from '@/router'
import { Navbar } from '@/layout/components'
export default {
name: 'HomeIndex',
components: { Navbar },
data() {
return {
beilv: 1,
moduleList: []
}
},
mounted() {
this.beilv = document.getElementById('container').offsetWidth / 1920
window.addEventListener('resize', () => {
if (this.isFullScreen) {
this.beilv = document.body.offsetWidth / 1920
} else {
this.beilv = document.getElementById('container').offsetWidth / 1920
}
})
this.getModuleList()
const path = location.href
if (path.indexOf('?') !== -1) {
const param = path.split('?')
localStorage.setItem('param', window.btoa(JSON.stringify(param[1])))
}
},
methods: {
getModuleList() {
const temp = []
routes &&
routes.map((item) => {
if (item.hidden) {
return true
}
temp.push(item)
})
this.moduleList = temp
console.log(this.moduleList)
},
handelClick(item, index) {
this.$store.dispatch('app/setChoicepart', index)
if (item.meta.unuse) {
this.$message.warning(this.$t('choisePart.module'))
} else {
this.toRouter(item)
}
},
toRouter(item) {
if (item.children) {
this.toRouter(item.children[0])
} else {
this.$router.push({ name: item.name })
}
}
}
}
</script>
<style lang="scss" scoped>
.choicepart-container {
min-width: 100%;
min-height: 100vh;
background: url('../../assets/img/choicepart/choicepart-back.png') repeat;
background-size: cover;
overflow-x: auto;
.choicepart-box {
// width: 1585px;
margin: 0 auto;
padding-top: 25vh;
.choicepart-item {
display: inline-block;
// width: 180px;
// height: 223px;
// margin: 40px;
background: url('../../assets/img/choicepart/choice-item-back.png') no-repeat;
background-size: 100% 100%;
top: 0;
border-radius: 5px;
overflow: hidden;
cursor: pointer;
position: relative;
img {
// width: 90px;
// height: 90px;
position: absolute;
// top: 32px;
// left: 43px;
}
.choicepart-item-border {
height: 100%;
border-radius: 5px;
padding: 0 5px;
// line-height: 32px;
// font-size: 28px;
font-weight: lighter;
color: #2c6bd8;
overflow: hidden;
}
.choicepart-item-title {
overflow: hidden;
padding: 0 10px;
text-overflow: ellipsis;
white-space: nowrap;
position: absolute;
bottom: 0;
left: 2px;
right: 2px;
text-align: center;
color: #fff;
// font-size: 16px;
// line-height: 40px;
// height: 40px;
letter-spacing: 2px;
background-color: rgba($color: #0b58ff, $alpha: 0.45);
}
}
.choicepart-item:hover {
.choicepart-item-title {
background-color: rgba($color: #0b58ff, $alpha: 1);
}
}
}
.choicepat-navbar {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 10;
}
.bottom-img {
img {
width: 100%;
position: fixed;
bottom: 0;
}
}
}
::-webkit-scrollbar-track-piece {
//滚动条凹槽的颜色,还可以设置边框属性
background: rgba(255, 255, 255, 0.1);
}
::-webkit-scrollbar {
//滚动条的宽度
width: 9px;
height: 9px;
}
::-webkit-scrollbar-thumb {
//滚动条的设置
background-color: #dddddd;
background-clip: padding-box;
min-height: 28px;
border-radius: 9px;
}
::-webkit-scrollbar-thumb:hover {
background-color: #bbb;
}
</style>