This commit is contained in:
lnljyang
2026-01-05 15:07:49 +08:00
parent 4ad393a9a1
commit 3bb5419386
138 changed files with 118289 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
<!--
* @Author: szy
* @Date: 2022-02-28 16:29:08
* @LastEditors: Please set LastEditors
* @LastEditTime: 2022-09-27 15:05:45
* @FilePath: \web-pc\src\pages\big-screen\components\echart\index.vue
-->
<template>
<div :id="id" :class="className" :style="{ height: height, width: width }" />
</template>
<script>
import * as echarts from 'echarts';
export default {
name: 'echart',
props: {
className: {
type: String,
default: 'chart'
},
id: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '100%'
},
options: {
type: Object,
default: ()=>({})
}
},
data () {
return {
chart: null
}
},
watch: {
options: {
handler (options) {
// 设置true清空echart缓存
this.chart.setOption(options, true)
},
deep: true
}
},
mounted () {
this.initChart();
},
beforeDestroy () {
this.chart.dispose()
this.chart = null
},
methods: {
initChart () {
// 初始化echart
this.chart = echarts.init(this.$el)
this.chart.setOption(this.options, true)
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,97 @@
<!--
* @Author: szy
* @Date: 2022-03-01 09:16:22
* @LastEditors: Please set LastEditors
* @LastEditTime: 2022-09-29 15:12:34
* @FilePath: \web-pc\src\pages\big-screen\components\item-wrap\item-wrap.vue
-->
<template>
<dv-border-box-13 class="lr_titles">
<div class="item_title" v-if="title !== ''">
<div class="zuo"></div>
<span class="title-inner"> &nbsp;&nbsp;{{ title }}&nbsp;&nbsp; </span>
<div class="you"></div>
</div>
<div
:class="title !== '' ? 'item_title_content' : 'item_title_content_def'"
>
<slot></slot>
</div>
</dv-border-box-13>
</template>
<script>
export default {
data() {
return {};
},
props: {
title: {
type: String,
default: () => "",
},
},
created() {},
mounted() {},
methods: {},
};
</script>
<style lang='scss' scoped>
$item-title-height: 38px;
$item_title_content-height: calc(100% - 38px);
.lr_titles {
box-sizing: border-box;
:deep(.border-box-content) {
box-sizing: border-box;
padding: 6px 16px 0px;
}
.item_title {
height: $item-title-height;
line-height: $item-title-height;
width: 100%;
color: #1976d2;
text-align: center;
// background: linear-gradient(to right, transparent, #f5f7fa, transparent);
position: relative;
display: flex;
align-items: center;
justify-content: center;
.zuo,
.you {
width: 58px;
height: 14px;
background-image: url("../../assets/img/titles/zuo.png");
}
.you {
transform: rotate(180deg);
}
.title-inner {
font-weight: 900;
letter-spacing: 2px;
background: linear-gradient(
92deg,
#666666 0%,
#1976d2 48.8525390625%,
#1565c0 100%
);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
}
.item_title_content {
height: $item_title_content-height;
}
.item_title_content_def {
width: 100%;
height: 100%;
}
}
</style>

43
src/components/kong.vue Normal file
View File

@@ -0,0 +1,43 @@
<template>
<div class='kong'>
<slot></slot>
</div>
</template>
<script>
export default {
components: {},
data() {
return {
};
},
props:{
data:{
type:Array,
default:()=>[]
}
},
computed: {},
methods: {
init(){
},
},
created() {
},
mounted() {
},
beforeDestroy() {
},
}
</script>
<style lang='scss' scoped>
.kong{
width: 100%;
height: 100%;
}
</style>

View File

@@ -0,0 +1,49 @@
/*
* @Author: szy
* @Date: 2022-02-16 17:08:26
* @LastEditors: Please set LastEditors
* @LastEditTime: 2022-04-25 10:12:36
* @FilePath: \yhht-ui\yhht-ui\packagesEle\getXY\src\main.js
*/
import Vue from 'vue';
import Main from './message.vue';
import {isObject,isVNode} from '@/lib/types'
let Message = Vue.extend(Main);
let instance;
var message = function (options) {
if (Vue.prototype.$isServer) return;
if(!instance){
instance = new Message({
data: {
...options
},
});
instance.$mount();
}
instance.destroy=()=>{
document.body.removeChild(instance.$el);
instance&&instance.$destroy()
instance=null
return null
}
instance.init(options)
document.body.appendChild(instance.$el);
return instance;
};
['success', 'warning', 'info', 'error'].forEach(type => {
message[type] = (options) => {
if (isObject(options) && !isVNode(options)) {
return message({
...options,
type
});
}
return message({
type,
text: options
});
};
});
export default message;

View File

@@ -0,0 +1,74 @@
<!--
* @Author: szy
* @Date: 2022-03-02 17:07:40
* @LastEditors: Please set LastEditors
* @LastEditTime: 2022-04-26 11:41:27
* @FilePath: \web-pc\src\pages\big-screen\components\message\message.vue
-->
<template>
<div class="messages" v-if="visible">
<svg fill="none" viewBox="0 0 16 16" width="1em" height="1em" class="message-icon">
<path fill="currentColor" d="M15 8A7 7 0 101 8a7 7 0 0014 0zM8.5 4v5.5h-1V4h1zm-1.1 7h1.2v1.2H7.4V11z"
fill-opacity="0.9" v-if="'warning'==type"></path>
</svg>
{{ text }}
</div>
</template>
<script>
export default {
data() {
return {
visible: false,
text: "",
type:'warning'
};
},
props: {},
created() { },
mounted() { },
methods: {
init(param) {
clearTimeout(this.timer);
this.visible = true;
this.text = param.text || "";
this.type = param.type || "success";
this.timer = setTimeout(() => {
this.visible = false;
clearTimeout(this.timer);
}, 2000);
},
},
};
</script>
<style lang='scss' scoped>
.messages {
position: fixed;
min-width: 200px;
top: 160px;
left: 50%;
transform: translate(-50%, 0);
border: solid 1px #4b4b4b;
// box-shadow: 0 16px 24px rgba(0, 0, 0, 0.14), 0 6px 30px rgba(0, 0, 0, 12%),
// 0 8px 10px rgba(0, 0, 0, 20%), inset 0 0.5px 0 #5e5e5e,
// inset 0.5px 0 0 #5e5e5e, inset 0 -0.5px 0 #5e5e5e, inset -0.5px 0 0 #5e5e5e;
width: fit-content;
border-radius: 6px;
display: flex;
align-items: center;
z-index: 999;
color: rgba(255, 255, 255, 0.9);
background-color: #242424;
line-height: 22px;
font-size: 14px;
padding: 13px 16px;
.message-icon {
color: #cf6e2d;
font-size: 20px;
margin-right: 8px;
fill: currentColor;
}
}
</style>

View File

@@ -0,0 +1,64 @@
<template>
<div class='reacquire flex justify-center blocks cursor-pointer' :style="{ lineHeight: lineHeight }"
@click="getData">
<span>
重新获取
</span>
</div>
</template>
<script>
export default {
components: {},
props: {
lineHeight: {
type: String,
default: '200px'
}
},
data() {
return {
};
},
computed: {},
methods: {
init() {
},
getData(e){
this.$emit("onclick",e)
}
},
created() {
},
mounted() {
},
beforeDestroy() {
},
}
</script>
<style lang='scss' scoped>
.reacquire {
user-select:none;
color: rgb(168, 168, 168);
span:hover{
color:$primary-color ;
text-decoration: underline;
}
}
.blocks {
width: 100%;
height: 100%;
}
.cursor-pointer {
cursor: pointer;
}
</style>

View File

@@ -0,0 +1,253 @@
<!--
* @Author: wei
* @description: 大屏自适应容器组件
* @LastEditTime: 2022-09-09 16:42:40
-->
<template>
<!-- <section class="screen-box" :style="boxStyle"> -->
<div class="screen-wrapper" ref="screenWrapper" :style="wrapperStyle">
<slot></slot>
</div>
<!-- </section> -->
</template>
<script>
/**
* 防抖函数
* @param {T} fn
* @param {number} delay
* @return
*/
function debounce(fn, delay) {
let timer = null;
return function (...args) {
timer = setTimeout(
() => {
typeof fn === "function" && fn.apply(null, args);
clearTimeout(timer);
},
delay > 0 ? delay : 100
);
};
}
export default {
name: "VScaleScreen",
props: {
width: {
type: [String, Number],
default: 1920,
},
height: {
type: [String, Number],
default: 1080,
},
fullScreen: {
type: Boolean,
default: false,
},
autoScale: {
type: [Object, Boolean],
default: true,
},
selfAdaption: {
type: Boolean,
default: true,
},
delay: {
type: Number,
default: 500,
},
boxStyle: {
type: Object,
default: () => ({}),
},
wrapperStyle: {
type: Object,
default: () => ({}),
},
},
data() {
return {
currentWidth: 0,
currentHeight: 0,
originalWidth: 0,
originalHeight: 0,
onResize: null,
observer: null,
};
},
watch: {
selfAdaption(val) {
if (val) {
this.resize();
this.addListener();
} else {
this.clearListener();
this.clearStyle();
}
},
},
computed: {
screenWrapper() {
return this.$refs["screenWrapper"];
},
},
methods: {
initSize() {
return new Promise((resolve, reject) => {
// console.log("初始化样式");
//给父元素设置 overflow:hidden
this.screenWrapper.parentNode.style.overflow = "hidden";
this.screenWrapper.parentNode.scrollLeft = 0;
this.screenWrapper.parentNode.scrollTop = 0;
this.$nextTick(() => {
// region 获取大屏真实尺寸
if (this.width && this.height) {
this.currentWidth = this.width;
this.currentHeight = this.height;
} else {
this.currentWidth = this.screenWrapper.clientWidth;
this.currentHeight = this.screenWrapper.clientHeight;
}
// endregion
// region 获取画布尺寸
if (!this.originalHeight || !this.originalWidth) {
this.originalWidth = window.screen.width;
this.originalHeight = window.screen.height;
}
// endregion
resolve();
});
});
},
updateSize() {
if (this.currentWidth && this.currentHeight) {
this.screenWrapper.style.width = `${this.currentWidth}px`;
this.screenWrapper.style.height = `${this.currentHeight}px`;
} else {
this.screenWrapper.style.width = `${this.originalWidth}px`;
this.screenWrapper.style.height = `${this.originalHeight}px`;
}
},
handleAutoScale(scale) {
if (!this.autoScale) return;
const screenWrapper = this.screenWrapper;
const domWidth = screenWrapper.clientWidth;
const domHeight = screenWrapper.clientHeight;
const currentWidth = document.body.clientWidth;
const currentHeight = document.body.clientHeight;
screenWrapper.style.transform = `scale(${scale},${scale}) `;
let mx = Math.max((currentWidth - domWidth * scale) / 2, 0);
let my = Math.max((currentHeight - domHeight * scale) / 2, 0);
if (typeof this.autoScale === "object") {
// @ts-ignore
!this.autoScale.x && (mx = 0);
// @ts-ignore
!this.autoScale.y && (my = 0);
}
// console.log({
// mx,
// my,
// currentWidth,
// currentHeight,
// domWidth,
// domHeight,
// scale,
// });
this.screenWrapper.style.margin = `${my}px ${mx}px`;
},
updateScale() {
const screenWrapper = this.screenWrapper;
// 获取真实视口尺寸
const currentWidth = document.body.clientWidth;
const currentHeight = document.body.clientHeight;
// 获取大屏最终的宽高onResize
const realWidth = this.currentWidth || this.originalWidth;
const realHeight = this.currentHeight || this.originalHeight;
// 计算缩放比例
const widthScale = currentWidth / realWidth;
const heightScale = currentHeight / realHeight;
// console.log({currentWidth, currentHeight,realWidth,realHeight});
// 若要铺满全屏,则按照各自比例缩放
if (this.fullScreen) {
screenWrapper.style.transform = `scale(${widthScale},${heightScale})`;
return false;
}
// 按照宽高最小比例进行缩放
const scale = Math.min(widthScale, heightScale);
this.handleAutoScale(scale);
},
initMutationObserver() {
const screenWrapper = this.screenWrapper;
const observer = (this.observer = new MutationObserver(() => {
this.onResize();
}));
observer.observe(screenWrapper, {
attributes: true,
attributeFilter: ["style"],
attributeOldValue: true,
});
},
clearListener() {
window.removeEventListener("resize", this.onResize);
},
addListener() {
window.addEventListener("resize", this.onResize);
},
clearStyle() {
// console.log("清除");
const screenWrapper = this.screenWrapper;
screenWrapper.parentNode.style.overflow = "auto";
screenWrapper.style = "";
},
async resize() {
if (!this.selfAdaption) {
return;
}
await this.initSize();
this.updateSize();
this.updateScale();
},
},
mounted() {
this.onResize = debounce(() => {
this.resize();
}, this.delay);
this.$nextTick(() => {
if (this.selfAdaption) {
this.resize();
this.addListener();
}
});
},
beforeDestroy() {
this.clearListener();
// this.observer.disconnect()
},
};
//
</script>
<style scoped>
.screen-box {
overflow: hidden;
background-size: 100% 100%;
background: #000;
width: 100vw;
height: 100vh;
}
.screen-wrapper {
transition-property: all;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 500ms;
position: relative;
overflow: hidden;
z-index: 100;
transform-origin: left top;
}
</style>