import { onMount, createSignal, createEffect, For } from "solid-js"; import utils from "../../../utils/index" import "../../../assets/style/CommonBigScreenHome.css" import wx from "../../../assets/img/微信.png"; import wxo from "../../../assets/img/微信-o.png"; import ks from "../../../assets/img/快手.png"; import kso from "../../../assets/img/快手-o.png"; import qdxw from "../../../assets/img/起点新闻.png"; import qdxwo from "../../../assets/img/起点新闻-o.png"; import ssp from "../../../assets/img/闪视频.png"; import sspo from "../../../assets/img/闪视频-o.png"; import sxtt from "../../../assets/img/陕西头条.png"; import sxtto from "../../../assets/img/陕西头条-o.png"; import tt from "../../../assets/img/头条.png"; import tto from "../../../assets/img/头条-o.png"; import wb from "../../../assets/img/微博.png"; import wbo from "../../../assets/img/微博-o.png"; import dy from "../../../assets/img/抖音.png"; import dyo from "../../../assets/img/抖音-o.png"; let timeout = undefined; function NewMedia(prop) { function getlist() { const setli = []; for (let i = 0; i < Math.floor((prop.height - 42) / 40); i++) { const v = ((prop.list[act()] || {}).data || [])[i]; if (!v) break setli.push({ userName: v.userName, depName: v.depName, readCount: v.readCount }) } return setli } const [act, setact] = createSignal(0) const [TableList, setTableList] = createSignal(getlist()) onMount(() => { }) function imgClick(index) { setact(index); setTableList(getlist()) } function timeoutFun() { return setTimeout(() => { if (timeout) clearTimeout(timeout) const i = act() + 1 >= prop.list.length ? 0 : act() + 1; imgClick(i); timeout = timeoutFun(); }, 3000); } timeout = timeoutFun() 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`; }) const getimg = (text, isSelect) => { if (text === '微信') return isSelect ? wxo : wx; if (text === '微博') return isSelect ? wbo : wb; if (text === '抖音') return isSelect ? dyo : dy; if (text === '头条') return isSelect ? tto : tt; if (text === '快手') return isSelect ? kso : ks; if (text === '陕西头条') return isSelect ? sxtto : sxtt; if (text === '闪视频') return isSelect ? sspo : ssp; if (text === '起点新闻') return isSelect ? qdxwo : qdxw; } return (
{prop.title}
{(item, i) =>
imgClick(i())} class="tabIcon" src={getimg(item.name, act() === i())} /> {/* {item.name} */}
}
序号
部门
账号
当月阅读量
{(item, i) =>
{i() + 1}
{item.depName}
{/* {item.userName} item.userName.length}> */} {item.userName} {/* */}
{utils.formatNum(item.readCount)}
}
); } export default NewMedia;