2024-06-27 22:39:41 +08:00
|
|
|
import {dicts} from "@/utils/dicts";
|
|
|
|
|
import axios from 'axios'
|
2024-06-29 13:13:59 +08:00
|
|
|
import Vue from 'vue'
|
2024-06-27 22:39:41 +08:00
|
|
|
|
|
|
|
|
window.axios = axios
|
2024-07-01 02:32:42 +08:00
|
|
|
const KENGEE_CDN_BASE = "http://10.0.97.209/presource/datascreen"
|
|
|
|
|
const libs = [
|
|
|
|
|
`${KENGEE_CDN_BASE}/js/pinyin.min.js`,
|
|
|
|
|
`${KENGEE_CDN_BASE}/js/dayjs.min.js`,
|
|
|
|
|
`${KENGEE_CDN_BASE}/js/Tween.js`,
|
2024-07-10 01:58:51 +08:00
|
|
|
`${KENGEE_CDN_BASE}/js/three/three.min.js`,
|
2024-07-01 18:22:37 +08:00
|
|
|
`${KENGEE_CDN_BASE}/js/d3-array.min.js`,
|
2024-07-01 02:32:42 +08:00
|
|
|
`${KENGEE_CDN_BASE}/js/d3-geo.min.js`,
|
2024-07-28 16:36:05 +08:00
|
|
|
'/presource/datascreen/js/ezuikit-flv/ezuikit.js',
|
2024-07-26 15:32:33 +08:00
|
|
|
'/presource/datascreen/js/clappr.min.js',
|
2024-08-05 00:41:42 +08:00
|
|
|
'/presource/datascreen/js/simplebar/simplebar.min.js',
|
|
|
|
|
]
|
|
|
|
|
const css = [
|
|
|
|
|
"/presource/datascreen/js/simplebar/simplebar.css"
|
2024-07-01 02:32:42 +08:00
|
|
|
]
|
|
|
|
|
window.$loadScript = (type = 'js', url, dom = "body") => {
|
|
|
|
|
let flag = false;
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
const head = dom == 'head' ? document.getElementsByTagName('head')[0] : document.body;
|
|
|
|
|
for (let i = 0; i < head.children.length; i++) {
|
|
|
|
|
let ele = head.children[i]
|
|
|
|
|
if ((ele.src || '').indexOf(url) !== -1) {
|
|
|
|
|
flag = true;
|
|
|
|
|
resolve();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag) return;
|
|
|
|
|
let script;
|
|
|
|
|
if (type === 'js') {
|
|
|
|
|
script = document.createElement('script');
|
|
|
|
|
script.type = 'text/javascript';
|
|
|
|
|
script.src = url;
|
|
|
|
|
} else if (type === 'css') {
|
|
|
|
|
script = document.createElement('link');
|
|
|
|
|
script.rel = 'stylesheet';
|
|
|
|
|
script.type = 'text/css';
|
|
|
|
|
script.href = url;
|
|
|
|
|
}
|
|
|
|
|
head.appendChild(script);
|
|
|
|
|
script.onload = function () {
|
|
|
|
|
resolve();
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
};
|
2024-07-02 18:25:08 +08:00
|
|
|
window.$glob = {token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJoLXVzZXItaWQiOiIxODA4MDM2NzI3NzQzNDU1MjMyIiwiaC1yb2xlLWlkIjoiMTgwODAzNjg5NDQxMjUxMzI4MCIsImV4cCI6MTc1MTQ0NDg0MywibmJmIjoxNzE5OTA4ODQzfQ.Wi6wzArP79mFj3XEzSendOfWHJc1mNuSAlAC1W4zMzI"}
|
2024-06-27 22:39:41 +08:00
|
|
|
window.$dicts = dicts
|
|
|
|
|
window.$waitFor = (target, t = 500) => new Promise(resolve => {
|
|
|
|
|
const interval = setInterval(() => {
|
|
|
|
|
if (target) {
|
|
|
|
|
clearInterval(interval)
|
|
|
|
|
resolve(target)
|
|
|
|
|
}
|
|
|
|
|
}, t)
|
|
|
|
|
if (target) {
|
|
|
|
|
clearInterval(interval)
|
|
|
|
|
resolve(target)
|
|
|
|
|
}
|
|
|
|
|
})
|
2024-07-05 17:36:16 +08:00
|
|
|
window.evenRowBGC = (color = "#09265B") => `transparent;background-image: linear-gradient(-45deg, ${color} 0, ${color} 10%, transparent 10%, transparent 50%,${color} 50%, ${color} 60%, transparent 60%, transparent);background-size: 10px 10px;`
|
2024-06-29 13:13:59 +08:00
|
|
|
|
|
|
|
|
Vue.prototype.$marketBoard = Vue.observable({
|
2024-07-15 02:19:48 +08:00
|
|
|
screenId: '5b1849ac-4fc3-451a-844c-3362b47341ef',
|
|
|
|
|
search: {"groupCodeList": [], "currentDate": "20240701", "compareDate": "20240630", "hourNum": "18"}
|
2024-06-29 13:13:59 +08:00
|
|
|
})
|
|
|
|
|
Vue.prototype.$multipleStoreBoard = Vue.observable({
|
2024-07-07 11:27:52 +08:00
|
|
|
search: {"groupCodeList": [], "hourNum": "", type: "1"}
|
2024-06-29 13:13:59 +08:00
|
|
|
})
|
|
|
|
|
Vue.prototype.$storeBoard = Vue.observable({
|
2024-07-08 18:53:50 +08:00
|
|
|
currentDate: "20240705",
|
|
|
|
|
dialog: false,
|
|
|
|
|
aroundStock: [],
|
2024-07-07 22:42:40 +08:00
|
|
|
query: {},
|
2024-06-29 13:13:59 +08:00
|
|
|
search: {}
|
|
|
|
|
})
|
2024-07-25 18:09:46 +08:00
|
|
|
Vue.component("HlsPlayer", {
|
2024-08-23 18:09:52 +08:00
|
|
|
render: (h) => h('div', {style: {width: '100%', height: '100%'}}),
|
2024-07-25 18:09:46 +08:00
|
|
|
props: {
|
2024-07-28 16:36:05 +08:00
|
|
|
id: {default: ""},
|
2024-07-25 18:09:46 +08:00
|
|
|
url: {default: "https://open.ys7.com/v3/openlive/155715496_1_1.m3u8?expire=1747359002&id=712960386311127040&t=c9c6ad362940b1fb4ea7a736cec78980aa9ad1d27d6e3eddf75788c0564e9d7b&ev=100"}
|
|
|
|
|
},
|
2024-07-28 16:36:05 +08:00
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
player: null
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-08-23 18:09:52 +08:00
|
|
|
methods: {
|
|
|
|
|
play(url) {
|
|
|
|
|
const {EzuikitFlv} = window
|
|
|
|
|
if (EzuikitFlv && url && this.$el) {
|
|
|
|
|
const {id} = this.$props
|
|
|
|
|
this.$el.id = id
|
|
|
|
|
this.player = new EzuikitFlv({container: id, url, decoder: "/presource/datascreen/js/ezuikit-flv/decoder.js"})
|
|
|
|
|
this.player.play()
|
|
|
|
|
this.$el.onclick = () => this.player.fullScreen()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
url: {
|
|
|
|
|
handler(url, old) {
|
|
|
|
|
if (old) this.player?.destroy()
|
|
|
|
|
this.play(url)
|
|
|
|
|
}
|
2024-07-25 18:09:46 +08:00
|
|
|
}
|
2024-07-28 16:36:05 +08:00
|
|
|
},
|
2024-08-23 18:09:52 +08:00
|
|
|
mounted() {
|
|
|
|
|
this.play(this.url)
|
|
|
|
|
},
|
2024-07-28 16:36:05 +08:00
|
|
|
beforeDestroy() {
|
|
|
|
|
this.player?.destroy()
|
2024-07-25 18:09:46 +08:00
|
|
|
}
|
|
|
|
|
})
|
2024-08-05 00:41:42 +08:00
|
|
|
Vue.component("scrollTable", {
|
|
|
|
|
props: {
|
|
|
|
|
tableData: {default: () => []},
|
|
|
|
|
columns: {default: () => []},
|
|
|
|
|
config: {default: () => ({})}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
timer: null,
|
|
|
|
|
scroll: null
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
render(h) {
|
|
|
|
|
const {config, tableData, columns} = this.$props
|
|
|
|
|
return h('el-table', {
|
|
|
|
|
props: {
|
|
|
|
|
headerCellClassName: 'tableHeader', cellClassName: 'tableCell', stripe: !0,
|
|
|
|
|
...config, data: tableData, height: '100%'
|
2024-08-05 00:56:50 +08:00
|
|
|
}, class: 'scrollTable',
|
|
|
|
|
on: {
|
|
|
|
|
'cell-click': (row, column, cell, event) => {
|
|
|
|
|
this.$emit("click", row, column, cell, event)
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-08-05 00:41:42 +08:00
|
|
|
},
|
|
|
|
|
columns.map(col => h("tableColumn", {props: {column: col}}))
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
initScroll() {
|
|
|
|
|
const {SimpleBar} = window
|
|
|
|
|
const dom = this.$el.querySelector('.el-table__body-wrapper')
|
|
|
|
|
this.scroll = new SimpleBar(dom)
|
|
|
|
|
dom.addEventListener('mouseover', this.stopAutoScroll)
|
2024-08-22 15:15:52 +08:00
|
|
|
// dom.addEventListener('mouseout', this.autoScroll)
|
2024-08-05 00:41:42 +08:00
|
|
|
// this.scroll.refresh();
|
|
|
|
|
},
|
|
|
|
|
autoScroll() {
|
|
|
|
|
if (this.timer) clearInterval(this.timer)
|
2024-08-05 03:20:14 +08:00
|
|
|
this.$el.querySelector('.simplebar-vertical').style.display = 'none'
|
|
|
|
|
// this.$el.querySelectorAll('.simplebar-scrollbar').map(e => e.display = 'none')
|
2024-08-05 00:41:42 +08:00
|
|
|
this.timer = setInterval(() => {
|
|
|
|
|
const dom = this.$el.querySelector('.simplebar-content-wrapper')
|
|
|
|
|
const max = dom.scrollHeight - dom.clientHeight
|
2024-08-05 03:20:14 +08:00
|
|
|
if (dom.scrollTop + 1 >= max) dom.scrollTop = 0
|
|
|
|
|
else dom.scrollTop += 1
|
|
|
|
|
}, 60)
|
2024-08-05 00:41:42 +08:00
|
|
|
},
|
|
|
|
|
stopAutoScroll() {
|
2024-08-05 03:20:14 +08:00
|
|
|
this.$el.querySelector('.simplebar-vertical').style.display = 'block'
|
2024-08-05 00:41:42 +08:00
|
|
|
if (this.timer) clearInterval(this.timer)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
2024-08-23 18:09:52 +08:00
|
|
|
this.initScroll()
|
2024-08-22 15:15:52 +08:00
|
|
|
// this.autoScroll()
|
2024-08-05 00:41:42 +08:00
|
|
|
},
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
this.stopAutoScroll()
|
|
|
|
|
const dom = this.$el.querySelector('.el-table__body-wrapper')
|
|
|
|
|
dom.removeEventListener("mouseover", this.stopAutoScroll)
|
2024-08-22 15:15:52 +08:00
|
|
|
// dom.removeEventListener("mouseout", this.autoScroll)
|
2024-08-05 00:41:42 +08:00
|
|
|
}
|
|
|
|
|
})
|
2024-06-29 13:30:06 +08:00
|
|
|
Vue.component("tableColumn", {
|
|
|
|
|
props: {
|
|
|
|
|
column: {default: () => ({})}
|
|
|
|
|
},
|
|
|
|
|
render(h) {
|
|
|
|
|
const config = this.$props.column
|
2024-08-05 03:20:14 +08:00
|
|
|
let column = h('el-table-column', {
|
|
|
|
|
props: {...config, label: `${config.label}` || "-"}, scopedSlots: {
|
|
|
|
|
default: ({row}) => {
|
|
|
|
|
return config.custom ? h('div', {
|
|
|
|
|
style: {color: row.preSaleNum > row.stockNum ? 'red' : '#fff'}, class: 'pointer'
|
|
|
|
|
}, '周边库存情况') :
|
2024-08-28 00:57:26 +08:00
|
|
|
h('span', config.format?.(row) ?? row[config.prop] ?? '')
|
2024-06-29 13:30:06 +08:00
|
|
|
}
|
2024-08-05 03:20:14 +08:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (config.children?.length > 0) {
|
|
|
|
|
column = h('el-table-column', {props: {...config, label: `${config.label}` || "-"}},
|
|
|
|
|
config.children.map(col => h("tableColumn", {props: {column: col}}))
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
return column
|
2024-06-29 13:30:06 +08:00
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
2024-06-27 22:39:41 +08:00
|
|
|
export default Promise.all([
|
2024-06-21 11:51:14 +08:00
|
|
|
import("./fetch"),
|
2024-07-01 02:32:42 +08:00
|
|
|
...libs.map(url => $loadScript('js', url)),
|
2024-08-05 00:41:42 +08:00
|
|
|
...css.map(url => $loadScript('css', url))
|
2024-06-21 11:51:14 +08:00
|
|
|
])
|