5.5 KiB
5.5 KiB
需新增的自定义标签清单
现有标签库不覆盖以下场景,需在 PowerEasy 后台 → 标签管理 → 新建标签 后使用。 全部基于真实 SQL + XSLT 实现,不存在 mock 数据。
1. 视频信息列表
LabelId:视频信息列表
LabelType:列表类
数据源:PE_U_Video / PE_CommonModel 关联
属性(attributes)
| 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|
| nodeId | int | 0 | 视频栏目节点ID |
| outputQty | int | 8 | 数量 |
| titleLength | int | 24 | 标题截断 |
| width | int | 200 | 缩略图宽 |
| height | int | 140 | 缩略图高 |
LabelSqlString
SELECT TOP @outputQty V.*, CM.Title, CM.NodeID, CM.GeneralID, CM.InputTime,
CM.PinyinTitle, CM.HtmlPageName
FROM PE_U_Video V
INNER JOIN PE_CommonModel CM ON V.ItemID = CM.GeneralID
WHERE CM.Status = 99 AND CM.NodeID IN (SELECT arrChildID FROM PE_Nodes WHERE NodeID = @nodeId)
ORDER BY CM.UpdateTime DESC
LabelTemplate (XSLT 片段)
<ul class="video-grid">
<xsl:for-each select="/NewDataSet/Table">
<li>
<a href="{pe:GetInfoPath(NodeID,GeneralID,InputTime,PinyinTitle,HtmlPageName)}">
<img src="{pe:PathFind(VideoPicUrl)}" width="{$width}" height="{$height}" />
<span class="play-icon"></span>
<p><xsl:value-of select="pe:CutText(Title,$titleLength,'…')" /></p>
</a>
</li>
</xsl:for-each>
</ul>
2. 日历控件
LabelId:日历控件
LabelType:其他类
数据源:服务端时间戳({PE.TimeNow /})
属性
| 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|
| showType | string | month | month / week |
| theme | string | blue | 主题色 |
LabelTemplate (XSLT 片段)
<div class="pe-calendar" data-theme="{$theme}">
<div class="cal-hd">
<a class="prev" href="?y={pe:DateAdd(pe:TimeNow(),'year',-1)}">‹</a>
<span><xsl:value-of select="pe:FormatDate(pe:TimeNow(),'yyyy 年 mm 月')" /></span>
<a class="next" href="?y={pe:DateAdd(pe:TimeNow(),'year',1)}">›</a>
</div>
<table class="cal-bd">
<thead><tr><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th>六</th></tr></thead>
<tbody><xsl:value-of select="pe:RenderCalendar(pe:TimeNow())" /></tbody>
</table>
</div>
注:
pe:RenderCalendar需在labelproc自定义函数中实现,返回日历 HTML 片段。
3. 用稿统计图表
LabelId:用稿统计图表
LabelType:其他类
数据源:PE_CommonModel 按 Inputer 分组聚合
属性
| 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|
| period | string | month | day/week/month |
| chartType | string | pie | pie/bar/line |
| topN | int | 10 | 取前 N 个 |
LabelSqlString
SELECT TOP @topN Inputer, COUNT(*) AS Cnt
FROM PE_CommonModel
WHERE Status = 99
AND UpdateTime >= pe:DateAdd(pe:TimeNow(),'day',-30)
GROUP BY Inputer
ORDER BY Cnt DESC
LabelTemplate (XSLT 片段 — 注入 ECharts)
<div class="pe-chart" data-type="{$chartType}">
<ul class="chart-data" style="display:none">
<xsl:for-each select="/NewDataSet/Table">
<li data-name="{Inputer}" data-value="{Cnt}"></li>
</xsl:for-each>
</ul>
<script>
// 渲染逻辑由外层 site.js 完成,绑定 .pe-chart
$(function(){ PE.Chart.render('.pe-chart'); });
</script>
</div>
4. 排行榜
LabelId:排行榜
LabelType:列表类
数据源:PE_CommonModel 按 Hits / CommentCount 排序
属性
| 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|
| rankType | string | 点击 | 点击 / 评论 / 推荐 |
| outputQty | int | 10 | 数量 |
| titleLength | int | 30 | 标题截断 |
| nodes | string | 0 | 节点ID,0=全站 |
LabelSqlString
SELECT TOP @outputQty NodeID, GeneralID, InputTime, PinyinTitle, HtmlPageName, Title, Hits, CommentCount
FROM PE_CommonModel
WHERE Status = 99
<xsl:choose>
<xsl:when test="$rankType='点击'">ORDER BY Hits DESC</xsl:when>
<xsl:when test="$rankType='评论'">ORDER BY CommentCount DESC</xsl:when>
<xsl:when test="$rankType='推荐'">ORDER BY EliteLevel DESC, UpdateTime DESC</xsl:when>
</xsl:choose>
LabelTemplate (XSLT 片段)
<ol class="rank-list">
<xsl:for-each select="/NewDataSet/Table">
<li class="rank-{position()}">
<a href="{pe:GetInfoPath(NodeID,GeneralID,InputTime,PinyinTitle,HtmlPageName)}">
<xsl:value-of select="pe:CutText(Title,$titleLength,'…')" />
</a>
<span class="hits">
<xsl:choose>
<xsl:when test="$rankType='点击'"><xsl:value-of select="Hits" /></xsl:when>
<xsl:when test="$rankType='评论'"><xsl:value-of select="CommentCount" /></xsl:when>
</xsl:choose>
</span>
</li>
</xsl:for-each>
</ol>
5. 自设内容(已存在,但本模板高频使用,建议创建多个实例)
为方便后台管理,建议预先创建以下固定 nodeId + num:
| num | 用途 | 所在分区 |
|---|---|---|
| 1 | 顶部登录/注册/搜索 HTML | 分区 1 |
| 2 | 头条大标题 | 分区 3 |
| 3 | 头条副标题 | 分区 3 |
| 10 | 横幅广告位 | 分区 5 |
| 11 | "学习园地"装饰大图 | 分区 6 |
| 12 | "学习专栏"装饰大图 | 分区 9 |
| 13 | "先进典型"红色横幅 | 分区 11 |
| 14 | 直播电视图标 | 分区 16 |
| 15 | "基层风采"装饰大图 | 分区 18 |
| 16 | 实用工具图标宫格 | 分区 19 |
| 99 | 底部版权/备案 | 分区 23 |
这些
自设内容实例的 SQL 仍指向PE_Nodes.Custom_Content,由后台编辑录入,不属于 mock 数据。