|
@@ -1,6 +1,4 @@
|
|
|
-import { onMount, createSignal, For } from "solid-js";
|
|
|
-import { createStore } from "solid-js/store";
|
|
|
-
|
|
|
+import { onMount, createSignal, createEffect, For } from "solid-js";
|
|
|
import utils from "../../../utils/index"
|
|
|
import "../../../assets/style/BigScreenHome.css"
|
|
|
|
|
@@ -9,7 +7,7 @@ function NewMedia(prop) {
|
|
|
function getlist() {
|
|
|
const setli = [];
|
|
|
for (let i = 0; i < Math.floor((prop.height - 42) / 40); i++) {
|
|
|
- const v = ((origin[act()] || {}).data || [])[i];
|
|
|
+ const v = ((prop.list[act()] || {}).data || [])[i];
|
|
|
if (!v) break
|
|
|
setli.push({
|
|
|
userName: v.userName,
|
|
@@ -19,7 +17,6 @@ function NewMedia(prop) {
|
|
|
}
|
|
|
return setli
|
|
|
}
|
|
|
- const [origin] = createStore(prop.list || {})
|
|
|
const [act, setact] = createSignal(0)
|
|
|
const [TableList, setTableList] = createSignal(getlist())
|
|
|
onMount(() => { })
|
|
@@ -30,50 +27,53 @@ function NewMedia(prop) {
|
|
|
function timeoutFun() {
|
|
|
return setTimeout(() => {
|
|
|
if (timeout) clearTimeout(timeout)
|
|
|
- const i = act() + 1 >= origin.length ? 0 : act() + 1;
|
|
|
+ const i = act() + 1 >= prop.list.length ? 0 : act() + 1;
|
|
|
imgClick(i);
|
|
|
timeout = timeoutFun();
|
|
|
}, 3000);
|
|
|
}
|
|
|
|
|
|
timeout = timeoutFun()
|
|
|
- let p = prop.styleCss || {};
|
|
|
- p.width = `${prop.width}px`;
|
|
|
- p.height = `${prop.height + 40}px`;
|
|
|
+ let p = {};
|
|
|
+ createEffect(() => {
|
|
|
+ if (prop.styleCss) p = prop.styleCss;
|
|
|
+ if (prop.width) p.width = `${prop.width}px`;
|
|
|
+ if (prop.height) p.height = `${prop.height + 40}px`;
|
|
|
+ })
|
|
|
return (
|
|
|
<div class="livRang" style={p}>
|
|
|
<div class="head">{prop.title}</div>
|
|
|
- <div style={{"white-space":"nowrap","display":"flex"}}>
|
|
|
- <For each={origin}>{(item, i) => <div class="TabBtn">
|
|
|
- <img onClick={() => imgClick(i())} style={{"width":"100%","vertical-align":"middle","margin-right":"3px"}} src={'/src/assets/img/' + item.name + (act() === i() ? '-o' : '') + '.png'} />
|
|
|
+ <div style={{ "white-space": "nowrap", "display": "flex" }}>
|
|
|
+ <For each={prop.list}>{(item, i) => <div class="TabBtn">
|
|
|
+ <img onClick={() => imgClick(i())} style={{ "width": "100%", "vertical-align": "middle", "margin-right": "3px" }} src={'/src/assets/img/' + item.name + (act() === i() ? '-o' : '') + '.png'} />
|
|
|
{/* <span style="vertical-align: middle;">{item.name}</span> */}
|
|
|
</div>}</For>
|
|
|
</div>
|
|
|
<div class="table" >
|
|
|
- <div class="tr" style={{"background-color":"#03375e"}}>
|
|
|
+ <div class="tr" style={{ "background-color": "#03375e" }}>
|
|
|
<div class='td'>序号</div>
|
|
|
- <div class='td' style={{"flex":"2"}}>部门</div>
|
|
|
- <div class='td' style={{"flex":"2"}}>账号</div>
|
|
|
- <div class='td' style={{"flex":"2"}}>当月阅读量</div>
|
|
|
+ <div class='td' style={{ "flex": "2" }}>部门</div>
|
|
|
+ <div class='td' style={{ "flex": "2" }}>账号</div>
|
|
|
+ <div class='td' style={{ "flex": "2" }}>当月阅读量</div>
|
|
|
</div>
|
|
|
<div style={{
|
|
|
- height:`${prop.height - 82}px`,
|
|
|
+ height: `${prop.height - 82}px`,
|
|
|
overflow: 'hidden'
|
|
|
}}>
|
|
|
<For each={TableList()}>{(item, i) => <div class="tr trColor">
|
|
|
<div class='td'>{i() + 1}</div>
|
|
|
- <div class='td' style={{"flex":"2"}}>
|
|
|
+ <div class='td' style={{ "flex": "2" }}>
|
|
|
{item.depName}
|
|
|
</div>
|
|
|
- <div class='td' style={{"flex":"2"}}>
|
|
|
+ <div class='td' style={{ "flex": "2" }}>
|
|
|
{/* <Show when={maxlen <= item.userName.length}>
|
|
|
<marquee behavior="scroll">{item.userName}</marquee>
|
|
|
</Show>
|
|
|
<Show when={maxlen > item.userName.length}> */}
|
|
|
- {item.userName}
|
|
|
+ {item.userName}
|
|
|
{/* </Show> */}
|
|
|
</div>
|
|
|
- <div class='td' style={{"flex":"2"}}>{utils.formatNumber(item.readCount)}</div>
|
|
|
+ <div class='td' style={{ "flex": "2" }}>{utils.formatNumber(item.readCount)}</div>
|
|
|
</div>}</For>
|
|
|
</div>
|
|
|
</div>
|