main
wangqiujuan0808 2023-12-05 19:28:55 +08:00
parent 8a5ab2fcb6
commit 23e081053f
10 changed files with 72 additions and 35 deletions

View File

@ -1,7 +1,7 @@
#app { #app {
margin: 0; margin: 0;
padding: 0; padding: 0;
background: url(../image/bg1.jpg) no-repeat; // background: url(../image/bg1.jpg) no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
background-attachment: fixed; background-attachment: fixed;
background-size: cover; background-size: cover;

View File

@ -8,13 +8,13 @@
<template v-if="appStore.device !== 'mobile'"> <template v-if="appStore.device !== 'mobile'">
<header-search id="header-search" class="right-menu-item" /> <header-search id="header-search" class="right-menu-item" />
<el-tooltip content="源码地址" effect="dark" placement="bottom"> <!-- <el-tooltip content="源码地址" effect="dark" placement="bottom">
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" /> <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip>
<el-tooltip content="文档地址" effect="dark" placement="bottom"> <el-tooltip content="文档地址" effect="dark" placement="bottom">
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" /> <ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip> -->
<screenfull id="screenfull" class="right-menu-item hover-effect" /> <screenfull id="screenfull" class="right-menu-item hover-effect" />

View File

@ -19,7 +19,7 @@
<div>{{ week }}</div> <div>{{ week }}</div>
</div> </div>
</p> </p>
<header-search id="header-search" class="right-menu-item" /> <!-- <header-search id="header-search" class="right-menu-item" />
<el-tooltip content="源码地址" effect="dark" placement="bottom"> <el-tooltip content="源码地址" effect="dark" placement="bottom">
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" /> <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
@ -27,8 +27,8 @@
<el-tooltip content="文档地址" effect="dark" placement="bottom"> <el-tooltip content="文档地址" effect="dark" placement="bottom">
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" /> <ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip> -->
<el-icon size="28" @click="goHome"><HomeFilled /></el-icon>
<screenfull id="screenfull" class="right-menu-item hover-effect" /> <screenfull id="screenfull" class="right-menu-item hover-effect" />
<el-tooltip content="布局大小" effect="dark" placement="bottom"> <el-tooltip content="布局大小" effect="dark" placement="bottom">
@ -74,6 +74,7 @@ import useAppStore from '@/store/modules/app'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import useSettingsStore from '@/store/modules/settings' import useSettingsStore from '@/store/modules/settings'
import dayjs from "dayjs"; import dayjs from "dayjs";
const router = useRouter();
const appStore = useAppStore() const appStore = useAppStore()
const userStore = useUserStore() const userStore = useUserStore()
@ -121,6 +122,10 @@ function logout() {
}) })
}).catch(() => { }); }).catch(() => { });
} }
function goHome() {
router.push('/index');
}
const updateTime = () => { const updateTime = () => {
currentTime.value = dayjs().format("YYYY年 MM月 DD日"); currentTime.value = dayjs().format("YYYY年 MM月 DD日");
time.value = dayjs().format("HH:mm"); time.value = dayjs().format("HH:mm");

View File

@ -113,7 +113,7 @@ const getPie3D = (pieData, internalDiameterRatio, rateName) => {
} }
}, },
formatter: data => { formatter: data => {
return data.value ? `{title|${data.data.name}} return data.value ? `{title|${data.data.name}}
{rich|${data.data.rate}%}` : '' {rich|${data.data.rate}%}` : ''
} // 值为0的就不展示默认的示例 } // 值为0的就不展示默认的示例
}, },

View File

@ -43,7 +43,7 @@ const { buildInfo } = toRefs(data);
right: 10px; right: 10px;
// background: #0a1f2e; // background: #0a1f2e;
// border: 1px solid red; // border: 1px solid red;
width: 320px; width: 360px;
height: 340px; height: 340px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@ -67,7 +67,8 @@ const openDialog = () => {
<style lang='scss' scoped> <style lang='scss' scoped>
.deviceDiv { .deviceDiv {
position: absolute; position: absolute;
top: 410px; // top: 410px;
bottom: 40px;
right: 10px; right: 10px;
width: 360px; width: 360px;
// height: 460px; // height: 460px;

View File

@ -2,9 +2,9 @@
<div class="deviceDiv"> <div class="deviceDiv">
<TopDiv title="资产信息"></TopDiv> <TopDiv title="资产信息"></TopDiv>
<dv-border-box-10 backgroundColor="#00174b" :color="['#3cbfdf', '#3cbfdf']"> <dv-border-box-10 backgroundColor="#00174b" :color="['#3cbfdf', '#3cbfdf']">
<div class="container1"> <!-- <div class="container1">
</div> </div> -->
<div class="container"> <div class="container">
<div class="chartsGl" id="charts"></div> <div class="chartsGl" id="charts"></div>
</div> </div>
@ -24,9 +24,9 @@ const emit = defineEmits(['openDialog'])
const data = reactive({ const data = reactive({
optionsData: [ optionsData: [
{ value: 34, name: "A类设备" }, { value: 34, name: "A类设备" },
{ value: 20, name: "B类设备" }, { value: 200, name: "B类设备" },
{ value: 16, name: "C类设备" }, { value: 16, name: "C类设备" },
{ value: 40, name: "D类设备" }] { value: 50, name: "D类设备" }]
}); });
const { optionsData } = toRefs(data); const { optionsData } = toRefs(data);
@ -34,7 +34,7 @@ const { optionsData } = toRefs(data);
const optionData = optionsData.value.map((item) => { const optionData = optionsData.value.map((item) => {
return { return {
...item, ...item,
rate: (item.value / 100) *100, rate: ((item.value / 300).toFixed(1)) *100,
}; };
}); });
@ -67,10 +67,10 @@ const openDialog = () => {
<style lang='scss' scoped> <style lang='scss' scoped>
.deviceDiv { .deviceDiv {
position: absolute; position: absolute;
top: 410px; bottom: 40px;
right: 10px; right: 10px;
width: 360px; width: 360px;
height: 460px; height: 320px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
@ -79,15 +79,13 @@ const openDialog = () => {
:deep(.border-box-content) { :deep(.border-box-content) {
padding: 10px; padding: 10px;
border: 1px solid red;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
>div { >div {
width: 100%; width: 100%;
height: 48%; height: 100%;
border: 1px solid red;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;

View File

@ -38,7 +38,7 @@ const { equipmentInfo } = toRefs(data);
position: absolute; position: absolute;
top: 10px; top: 10px;
right: 10px; right: 10px;
width: 320px; width: 360px;
height: 340px; height: 340px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@ -61,9 +61,10 @@ const openDialog = () => {
<style lang='scss' scoped> <style lang='scss' scoped>
.deviceDiv { .deviceDiv {
position: absolute; position: absolute;
top: 410px; // top: 410px;
bottom: 40px;
right: 10px; right: 10px;
width: 320px; width: 360px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;

View File

@ -53,7 +53,7 @@ onMounted(() => {
loadSence(); loadSence();
// //
renderScene(); renderScene();
document.addEventListener("click", modelMouseClick); document.addEventListener("click", onMouseDown);
}); });
const init = () => { const init = () => {
scene = new THREE.Scene("#00ffff"); scene = new THREE.Scene("#00ffff");
@ -61,7 +61,7 @@ const init = () => {
texture.mapping = THREE.EquirectangularReflectionMapping; texture.mapping = THREE.EquirectangularReflectionMapping;
scene.background = texture scene.background = texture
scene.environment = texture scene.environment = texture
const canvas = document.querySelector("#three"); const canvas = document.querySelector("#three");
var cubeLoader = new THREE.CubeTextureLoader(); var cubeLoader = new THREE.CubeTextureLoader();
// WebGLRenderer使 // WebGLRenderer使
@ -123,23 +123,55 @@ const modelMouseClick = (event) => {
var intersects = raycaster.intersectObjects(scene.children); var intersects = raycaster.intersectObjects(scene.children);
// //
if (originalColors && originalColors.length > 0) { if (originalColors && originalColors.length > 0) {
for (var i = 0; i < originalColors.length; i++) { for (var i = 0; i < originalColors.length; i++) {
originalColors[i].object.material.color.set(originalColors[i].color); originalColors[i].object.material.color.set(originalColors[i].color);
} }
} }
// //
var originalColors = []; var originalColors = [];
// //
if (intersects.length > 0) { if (intersects.length > 0) {
intersects[0].object.material.color.set(0xff0000); intersects[0].object.material.color.set(0xff0000);
// //
scene.traverse( (object) => { scene.traverse((object) => {
if (object.isMesh && object !== intersects[0].object) { if (object.isMesh && object !== intersects[0].object) {
originalColors.push({ object: object, color: object.material.color.clone() }); originalColors.push({ object: object, color: object.material.color.clone() });
} }
}); });
} }
}; };
//
let selectedObject = null;
let selectedMaterial = null;
// const mouse = new THREE.Vector2();
const onMouseDown = (event) => {
var raycaster = new THREE.Raycaster()
//
if (selectedObject && selectedMaterial) {
selectedObject.material = selectedMaterial;
selectedObject = null;
selectedMaterial = null;
}
//
mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
// 线
raycaster.setFromCamera(mouse, camera);
// 线
const intersects = raycaster.intersectObjects(scene.children, true);
// 绿
if (intersects.length > 0) {
const clickedObject = intersects[0].object;
//
selectedObject = clickedObject;
selectedMaterial = clickedObject.material;
// 绿
selectedObject.material = new THREE.MeshBasicMaterial({ color: 0x00ff00 });
}
}
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
#three { #three {