screenFront/src/views/index.vue

196 lines
4.2 KiB
Vue
Raw Normal View History

2023-05-12 08:41:33 +00:00
<!--
* @FilePath: \code\gitscreenFront\src\views\index.vue
2023-05-12 08:41:33 +00:00
* @Author: 王路平
* @文件版本: V1.0.0
* @Date: 2023-01-29 15:34:48
* @Description:
*
* 版权信息 : 2023 by ${再登软件}, All Rights Reserved.
-->
<template>
<div :class="$style['container']" ref="appRef">
<div class="navbar">
2023-08-07 09:14:54 +00:00
<h2 class="title">物联大屏系统</h2>
2023-08-07 09:09:03 +00:00
<div class="dropdown">
<el-dropdown @command="changelang">
<span class="el-dropdown-link">
<!-- <img src="../assets/svg/gateway.svg" alt="" class="langimg" height="20px" width="20px"> -->
<i class="iconfont icon-zhongyingwen langimg"></i>
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item v-for="item in language" :class="item.name == lang ? 'select' : ''"
:command="item.value">{{ item.simple }}</el-dropdown-item>
2023-08-07 09:09:03 +00:00
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
2023-05-12 08:41:33 +00:00
</div>
<div class="itemlist">
<list v-for="res in routerList" :hash="res.hash" :path="res.path" :is-link="res.isLink" :title="res.title"
:key="res.id" :url="res.url"></list>
2023-05-12 08:41:33 +00:00
</div>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, onUnmounted } from "vue";
2023-05-12 08:41:33 +00:00
import list from "@/components/assembly/indexList.vue";
import { useI18n } from "vue-i18n";
import { getStoredLanguage, saveStoredLanguage, languageHash } from "@/utils/languageStorage";
import { useRoute,useRouter } from 'vue-router'
2023-08-03 03:37:01 +00:00
import { getScreenByHash } from "@/http/rule/index"
import { imgurlAddXhr } from "@/utils/devSever"
2023-08-03 03:37:01 +00:00
let langicon = require("@/assets/svg/language.svg")
2023-08-02 10:04:04 +00:00
let route = useRoute()
let router = useRouter()
2023-05-12 08:41:33 +00:00
window.document.title = "大屏物联管理系统";
let { t } = useI18n();
let language = reactive([
{
name: "简体中文",
simple: "简体中文",
value: "zh",
},
{
name: "English/USD",
simple: "English",
value: "en",
},
{
name: "Spanish/USD",
simple: "Español",
value: "es",
2023-08-03 03:37:01 +00:00
}
])
let routerList = ref()
2023-08-03 03:37:01 +00:00
let lang = ref(getStoredLanguage() || '简体中文')
function changelang(val) {
saveStoredLanguage(languageHash(val))
2023-08-03 03:37:01 +00:00
location.reload()
}
async function reqScreenByHash() {
let hash = sessionStorage.getItem('screen_hash')
let res: any = await getScreenByHash({ hash });
2023-08-03 03:37:01 +00:00
if (res.code === 200) {
let { data } = res
routerList.value = data.map((item: any) => {
2023-12-18 03:05:46 +00:00
const regex = /^(http|https):\/\/[^ "]+$/;
let isTrue = regex.test(item.img);
2023-08-03 03:37:01 +00:00
return {
id: item.id,
isLink: false,
path: item.path,
title: item.title,
url: isTrue ? item.img : imgurlAddXhr(item.img),
2023-08-03 03:37:01 +00:00
hash: hash
}
})
2023-08-03 03:37:01 +00:00
}
2023-05-12 08:58:35 +00:00
2023-05-12 08:41:33 +00:00
}
2023-08-02 10:04:04 +00:00
onMounted(() => {
2023-08-03 03:37:01 +00:00
reqScreenByHash()
2023-08-02 10:04:04 +00:00
});
2023-08-03 03:37:01 +00:00
onUnmounted(() => { });
2023-05-12 08:41:33 +00:00
</script>
<style module>
.container {
height: 1080px;
width: 1920px;
}
</style>
<style scoped>
2023-05-12 08:58:35 +00:00
@import '../assets/css/iconfont.css';
2023-08-03 03:37:01 +00:00
.langimg {
2023-05-12 08:58:35 +00:00
width: 50px;
height: 50px;
font-size: 50px;
color: #fff;
}
2023-08-03 03:37:01 +00:00
2023-05-12 08:41:33 +00:00
.itemlist {
2023-08-15 06:59:32 +00:00
height: 990px;
2023-05-12 08:41:33 +00:00
width: 1920px;
color: #20aec5;
background-color: #100c2a;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
overflow: auto !important;
}
2023-08-03 03:37:01 +00:00
2023-08-07 09:09:03 +00:00
.title {
font-size: 40px;
text-align: center;
font-weight: bold;
color: white;
}
.dropdown {
position: absolute;
top: 0;
right: 90px;
}
2023-05-12 08:41:33 +00:00
.navbar {
position: relative;
2023-05-12 08:41:33 +00:00
height: 50px;
font-size: 20px;
margin: 20px;
margin-top: 40px;
2023-05-12 08:41:33 +00:00
display: flex;
justify-content: center;
2023-05-12 08:41:33 +00:00
align-items: center;
}
2023-08-03 03:37:01 +00:00
2023-05-12 08:41:33 +00:00
.el-dropdown-link {
font-size: 30px;
color: #fff;
}
2023-05-12 08:58:35 +00:00
2023-05-12 08:41:33 +00:00
.el-dropdown-menu {
background-color: #303133 !important;
color: #fff;
}
2023-08-03 03:37:01 +00:00
.el-dropdown-menu__item {
color: #fff !important;
2023-05-12 08:41:33 +00:00
}
2023-08-03 03:37:01 +00:00
2023-05-12 08:41:33 +00:00
.el-popper.is-light .el-popper__arrow::before {
background-color: #303133 !important;
color: #fff;
}
2023-08-03 03:37:01 +00:00
2023-05-12 08:58:35 +00:00
:deep(.select) {
background-color: #e4f5f5 !important;
color: #409EFF !important;
}
2023-05-12 08:41:33 +00:00
</style>
<style>
body {
--header: 150px;
/* --content:calc(100vh - var(--header)) */
overflow: hidden !important;
-ms-overflow-style: none;
/* IE + Edge */
scrollbar-width: none;
/* Firefox */
}
::-webkit-scrollbar {
display: none;
}
</style>