跳转到内容

最近在弄物品数据库,不定期更新!有任何反馈欢迎私信站长B站或站长的qq1131370599

模板:角色信息:修订间差异

来自异环信息站
Mikosword留言 | 贡献
无编辑摘要
Mikosword留言 | 贡献
无编辑摘要
 
(未显示同一用户的31个中间版本)
第1行: 第1行:
====================================================================
模板名称: 人物信息 (无扩展依赖版)
说明: 无需 ParserFunctions 扩展,完全依靠前端 JS 控制显示隐藏。
使用方法: {{人物信息|参数1=值1|参数2=值2|...}}
参数: 姓名, 性别, 配音, 能力, 所属势力, 图片1~图片6, 标签1~标签6
====================================================================
-->
<includeonly>
<includeonly>
<div class="ci-wrapper" style="max-width:720px;margin:0 auto;font-family:system-ui,'Microsoft YaHei',sans-serif;">
<div class="ci-wrapper">
    <style>
        .ci-wrapper * { box-sizing: border-box; }
        .ci-wrapper .ci-container {
            border: 1px solid #e0e0e0;
            border-radius: 12px;
            padding: 20px 24px 24px 24px;
            background: #fafafa;
            box-shadow: 0 2px 8px rgba(0,0,0,0.06);
        }
        /* 图片区 */
        .ci-wrapper .ci-image-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
        .ci-wrapper .ci-tab-btn {
            padding: 6px 18px; border: 1px solid #d0d0d0; border-radius: 20px;
            background: #f5f5f5; color: #555; font-size: 14px; cursor: pointer;
            transition: all 0.2s; user-select: none; font-weight: 500;
        }
        .ci-wrapper .ci-tab-btn.active { background: #2c3e50; border-color: #2c3e50; color: #fff; }
        .ci-wrapper .ci-image-display {
            border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden;
            background: #fff; min-height: 120px; display: flex;
            align-items: center; justify-content: center; position: relative;
        }
        .ci-wrapper .ci-img-item { display: none; width: 100%; text-align: center; padding: 8px; }
        .ci-wrapper .ci-img-item.active { display: block; }
        .ci-wrapper .ci-img-item img {
            max-width: 100%; max-height: 400px; height: auto;
            display: block; margin: 0 auto; border-radius: 4px;
        }
        .ci-wrapper .ci-no-image { color: #aaa; font-size: 15px; padding: 30px 0; display: block; }
        /* 表格区 */
        .ci-wrapper .ci-info-table {
            width: 100%; border-collapse: collapse;
            border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden;
            background: #fff; margin-top: 18px;
        }
        .ci-wrapper .ci-info-table tr { border-bottom: 1px solid #f0f0f0; }
        .ci-wrapper .ci-info-table tr:last-child { border-bottom: none; }
        .ci-wrapper .ci-info-table td {
            padding: 12px 16px; vertical-align: top; line-height: 1.6;
            font-size: 15px; word-break: break-word;
        }
        .ci-wrapper .ci-info-table .ci-label {
            width: 20%; min-width: 80px; background: #f7f7f7;
            font-weight: 600; color: #333; text-align: center;
            border-right: 1px solid #eee; vertical-align: middle;
        }
        .ci-wrapper .ci-info-table .ci-value { width: 80%; color: #222; background: #fff; }
        .ci-wrapper .ci-empty-row td { color: #bbb; font-style: italic; text-align: center; background: #fafafa; }
        @media (max-width: 600px) {
            .ci-wrapper .ci-container { padding: 14px 12px; }
            .ci-wrapper .ci-info-table td { padding: 10px 12px; font-size: 14px; }
            .ci-wrapper .ci-info-table .ci-label { min-width: 60px; font-size: 13px; }
        }
    </style>
 
     <div class="ci-container">
     <div class="ci-container">
         <!-- ========== 图片区域 ========== -->
         <!-- 图片切换区域 -->
         <div class="ci-image-section">
         <div class="ci-image-section">
            <div class="ci-image-tabs" id="ci-tabs-{{PAGEID}}">
<!-- --><div class="ci-image-tabs"><span class="ci-tab-btn" data-ci-index="0">{{{标签1|图1}}}</span><span class="ci-tab-btn" data-ci-index="1">{{{标签2|图2}}}</span><span class="ci-tab-btn" data-ci-index="2">{{{标签3|图3}}}</span></div>
                <button class="ci-tab-btn" data-ci-index="0">{{{标签1|图1}}}</button>
                <button class="ci-tab-btn" data-ci-index="1">{{{标签2|图2}}}</button>
                <button class="ci-tab-btn" data-ci-index="2">{{{标签3|图3}}}</button>
                <button class="ci-tab-btn" data-ci-index="3">{{{标签4|图4}}}</button>
                <button class="ci-tab-btn" data-ci-index="4">{{{标签5|图5}}}</button>
                <button class="ci-tab-btn" data-ci-index="5">{{{标签6|图6}}}</button>
            </div>
             <div class="ci-image-display">
             <div class="ci-image-display">
                 <div class="ci-img-item" data-ci-index="0"><img src="{{{图片1|}}}" alt="人物图片" loading="lazy" /></div>
                 <div class="ci-img-item" data-ci-index="0">{{{图片1|}}}</div>
                 <div class="ci-img-item" data-ci-index="1"><img src="{{{图片2|}}}" alt="人物图片" loading="lazy" /></div>
                 <div class="ci-img-item" data-ci-index="1">{{{图片2|}}}</div>
                 <div class="ci-img-item" data-ci-index="2"><img src="{{{图片3|}}}" alt="人物图片" loading="lazy" /></div>
                 <div class="ci-img-item" data-ci-index="2">{{{图片3|}}}</div>
                <div class="ci-img-item" data-ci-index="3"><img src="{{{图片4|}}}" alt="人物图片" loading="lazy" /></div>
                 <div class="ci-no-image">暂未上传</div>
                <div class="ci-img-item" data-ci-index="4"><img src="{{{图片5|}}}" alt="人物图片" loading="lazy" /></div>
                <div class="ci-img-item" data-ci-index="5"><img src="{{{图片6|}}}" alt="人物图片" loading="lazy" /></div>
                 <div class="ci-no-image">📷 暂无图片</div>
             </div>
             </div>
         </div>
         </div><table class="ci-infotemp-table">
 
            {{#if:{{{姓名|}}}|<tr class="ci-row"><td class="ci-label">姓名</td><td class="ci-value">{{{姓名}}}</td></tr>}}
        <!-- ========== 信息表格 ========== -->
            {{#if:{{{性别|}}}|<tr class="ci-row"><td class="ci-label">性别</td><td class="ci-value">{{{性别}}}</td></tr>}}
        <table class="ci-info-table">
            {{#if:{{{中文配音|}}}|<tr class="ci-row"><td class="ci-label">中文配音</td><td class="ci-value">{{{中文配音}}}</td></tr>}}
             <tr class="ci-row"><td class="ci-label">姓名</td><td class="ci-value">{{{姓名|}}}</td></tr>
            {{#if:{{{日文配音|}}}|<tr class="ci-row"><td class="ci-label">日文配音</td><td class="ci-value">{{{日文配音}}}</td></tr>}}
             <tr class="ci-row"><td class="ci-label">性别</td><td class="ci-value">{{{性别|}}}</td></tr>
            {{#if:{{{韩文配音|}}}|<tr class="ci-row"><td class="ci-label">韩文配音</td><td class="ci-value">{{{韩文配音}}}</td></tr>}}
             <tr class="ci-row"><td class="ci-label">配音</td><td class="ci-value">{{{配音|}}}</td></tr>
            {{#if:{{{英文配音|}}}|<tr class="ci-row"><td class="ci-label">英文配音</td><td class="ci-value">{{{英文配音}}}</td></tr>}}
             <tr class="ci-row"><td class="ci-label">能力</td><td class="ci-value">{{{能力|}}}</td></tr>
            {{#if:{{{属性|}}}|<tr class="ci-row"><td class="ci-label">属性</td><td class="ci-value">{{{属性}}}</td></tr>}}
             <tr class="ci-row"><td class="ci-label">所属势力</td><td class="ci-value">{{{所属势力|}}}</td></tr>
            {{#if:{{{弧盘|}}}|<tr class="ci-row"><td class="ci-label">弧盘适配</td><td class="ci-value">{{{弧盘}}}</td></tr>}}
            {{#if:{{{定位|}}}|<tr class="ci-row"><td class="ci-label">战斗定位</td><td class="ci-value">{{{定位}}}</td></tr>}}
             {{#if:{{{版本|}}}|<tr class="ci-row"><td class="ci-label">实装版本</td><td class="ci-value">{{{版本}}}</td></tr>}}
             {{#if:{{{能力|}}}|<tr class="ci-row"><td class="ci-label">异能</td><td class="ci-value">{{{能力}}}</td></tr>}}
             {{#if:{{{契约|}}}|<tr class="ci-row"><td class="ci-label">契约</td><td class="ci-value">{{{契约}}}</td></tr>}}
             {{#if:{{{生日|}}}|<tr class="ci-row"><td class="ci-label">生日</td><td class="ci-value">{{{生日}}}</td></tr>}}
             {{#if:{{{所属|}}}|<tr class="ci-row"><td class="ci-label">所属</td><td class="ci-value">{{{所属}}}</td></tr>}}
            {{#ifeq:{{#if:{{{姓名|}}}|1|0}}{{#if:{{{性别|}}}|1|0}}{{#if:{{{中文配音|}}}|1|0}}{{#if:{{{日文配音|}}}|1|0}}{{#if:{{{韩文配音|}}}|1|0}}{{#if:{{{英文配音|}}}|1|0}}{{#if:{{{属性|}}}|1|0}}{{#if:{{{弧盘|}}}|1|0}}{{#if:{{{定位|}}}|1|0}}{{#if:{{{版本|}}}|1|0}}{{#if:{{{能力|}}}|1|0}}{{#if:{{{契约|}}}|1|0}}{{#if:{{{生日|}}}|1|0}}{{#if:{{{所属|}}}|1|0}}|00000000000000
            |<tr class="ci-empty-row"><td colspan="2">暂无信息</td></tr>
            }}
         </table>
         </table>
     </div>
     </div>
    <!-- ========== 纯前端控制脚本 ========== -->
    <script>
    (function() {
        // 使用 IIFE 隔离作用域
        var container = document.querySelector('.ci-wrapper .ci-container');
        if (!container) return;
        // 1. 处理图片显示与选项卡
        var tabs = container.querySelectorAll('.ci-tab-btn');
        var items = container.querySelectorAll('.ci-img-item');
        var noImageDiv = container.querySelector('.ci-no-image');
        var hasImage = false;
        // 收集有效的图片
        var validItems = [];
        items.forEach(function(item, index) {
            var img = item.querySelector('img');
            var src = img ? img.getAttribute('src') : '';
            // 如果图片链接为空或者只是占位符,视为无效
            if (src && src.trim() !== '') {
                hasImage = true;
                validItems.push(index);
                item.style.display = 'block'; // 暂时显示,后续由 active 控制
            } else {
                item.style.display = 'none';
                if (tabs[index]) tabs[index].style.display = 'none';
            }
        });
        // 如果没有有效图片,显示占位,隐藏选项卡容器
        if (!hasImage) {
            if (noImageDiv) noImageDiv.style.display = 'block';
            var tabContainer = container.querySelector('.ci-image-tabs');
            if (tabContainer) tabContainer.style.display = 'none';
            // 隐藏所有图片项
            items.forEach(function(item) { item.style.display = 'none'; });
        } else {
            if (noImageDiv) noImageDiv.style.display = 'none';
            // 默认激活第一个有效图片
            var firstValid = validItems[0];
            if (firstValid !== undefined) {
                // 激活对应的图片和选项卡
                items.forEach(function(item, idx) {
                    if (idx === firstValid) {
                        item.style.display = 'block';
                        item.classList.add('active');
                    } else {
                        item.style.display = 'none';
                        item.classList.remove('active');
                    }
                });
                tabs.forEach(function(tab, idx) {
                    if (idx === firstValid) {
                        tab.classList.add('active');
                    } else {
                        tab.classList.remove('active');
                    }
                });
            }
            // 绑定点击切换事件
            tabs.forEach(function(tab) {
                tab.addEventListener('click', function(e) {
                    var index = parseInt(this.getAttribute('data-ci-index'), 10);
                    if (isNaN(index)) return;
                    // 只切换有效的图片
                    var targetItem = null;
                    items.forEach(function(item) {
                        var idx = parseInt(item.getAttribute('data-ci-index'), 10);
                        if (idx === index) {
                            targetItem = item;
                        }
                    });
                    if (!targetItem || targetItem.style.display === 'none') return;
                    // 更新选项卡样式
                    tabs.forEach(function(t) { t.classList.remove('active'); });
                    this.classList.add('active');
                    // 更新图片显示
                    items.forEach(function(item) {
                        item.classList.remove('active');
                        item.style.display = 'none';
                    });
                    targetItem.style.display = 'block';
                    targetItem.classList.add('active');
                });
            });
        }
        // 2. 处理表格空行隐藏
        var rows = container.querySelectorAll('.ci-info-table .ci-row');
        var allEmpty = true;
        rows.forEach(function(row) {
            var valueTd = row.querySelector('.ci-value');
            if (valueTd) {
                var text = valueTd.textContent.trim();
                if (text === '') {
                    row.style.display = 'none'; // 空行隐藏
                } else {
                    allEmpty = false;
                }
            }
        });
        // 如果所有信息都为空,在表格末尾追加一行提示
        if (allEmpty) {
            var table = container.querySelector('.ci-info-table');
            if (table) {
                var tr = document.createElement('tr');
                tr.className = 'ci-empty-row';
                var td = document.createElement('td');
                td.setAttribute('colspan', '2');
                td.textContent = '暂无人物信息';
                td.style.textAlign = 'center';
                td.style.color = '#999';
                td.style.padding = '16px';
                tr.appendChild(td);
                table.appendChild(tr);
            }
        }
    })();
    </script>
</div>
</div>
</includeonly>
</includeonly>
<noinclude>
<noinclude>
<!-- 模板文档 -->
...
</noinclude>

2026年9月8日 (二) 14:53的最新版本


...

粤ICP备2026112474号-1  |  公安备案图标 粤公网安备44030002015967号
本站所有内容及素材均来自苏州幻塔Hotta Studio旗下游戏《异环》