跳转到内容

网站仍在测试中

沙盒:修订间差异

来自质量人百科
创建页面,内容为“<includeonly> {| ! colspan="2" | '''{{{书名|{{PAGENAME}}}}}''' |- ! 作者 || {{{作者|}}} |- ! 出版社 || {{{出版社|}}} |- ! 出版日期 || {{{出版日期|}}} |- ! ISBN || {{{ISBN|}}} |- ! 分类 || [[分类:{{{分类|未分类图书}}}]] |- ! colspan="2" | '''内容简介''' |- | colspan="2" | {{{简介|}}} |- ! colspan="2" | '''目录''' |- | colspan="2" | {{#if:{{{目录|}}} | {{{目录}}} | <small>(暂无目录信…”
 
无编辑摘要
 
(未显示同一用户的1个中间版本)
第1行: 第1行:
<noinclude>
{{图书百科
|描述=综合图书百科模板,包含详细信息和评分功能
|作者=示例作者
|版本=3.0
|来源=自定义模板
}}
</noinclude>
<includeonly>
<includeonly>
{|
<div class="book-infobox" style="border: 1px solid #{{#if:{{{边框颜色|}}}|{{{边框颜色|ddd}}}|ddd}}; background-color: #{{#if:{{{背景颜色|}}}|{{{背景颜色|f9f9f9}}}|f9f9f9}}; padding: 1em; margin: 0.5em 0;">
! colspan="2" | '''{{{书名|{{PAGENAME}}}}}'''
 
|-
<!-- 图书信息部分 -->
! 作者       || {{{作者|}}}
<div class="book-info" style="display: flex; flex-wrap: wrap;">
|-
  <!-- 封面和基本信息 -->
! 出版社     || {{{出版社|}}}
  <div style="flex: 0 0 200px; margin-right: 1em;">
|-
    {{#if:{{{封面|}}}|
! 出版日期  || {{{出版日期|}}}
    <div style="text-align: center;">
|-
       [[文件:{{{封面}}}|200px|center|{{{标题|{{PAGENAME}}}}}封面{{#if:{{{封面说明|}}}| - {{{封面说明|}}}}}]]
! ISBN      || {{{ISBN|}}}
    </div>
|-
    }}
! 分类      || [[分类:{{{分类|未分类图书}}}]]
   
|-
     <div style="margin-top: 1em; text-align: center;">
! colspan="2" | '''内容简介'''
      {{#if:{{{豆瓣评分|}}}|
|-
      <div style="font-size: 120%; font-weight: bold;">豆瓣评分: {{{豆瓣评分}}}/10</div>
| colspan="2" | {{{简介|}}}
      <div style="height: 20px; background: #f5f5f5; border: 1px solid #ddd; margin: 0.3em 0;">
|-
        <div style="width: {{#expr:{{{豆瓣评分}}}*10}}%; height: 100%; background: #{{#if:{{{评分颜色|}}}|{{{评分颜色|ff9900}}}|ff9900}};"></div>
! colspan="2" | '''目录'''
      </div>
|-
      }}
| colspan="2" |  
     
{{#if:{{{目录|}}}
      {{#if:{{{允许评分|}}}|
  | {{{目录}}}
      <div style="margin-top: 1em;">
   | <small>(暂无目录信息)</small>
        <span style="font-size: 90%;">您的评分:</span><br/>
        <span class="star-rating">
          {{#for:1|1|5|1|
            <a href="{{#if:{{{评分回调|}}}|{{{评分回调}}}/{{PAGENAME}}/{{{1}}}|#}}"
              style="text-decoration: none; color: {{#if:{{{评分|}}}|{{#ifexpr:{{{评分}}}>={{{1}}}|gold|#ccc}}|#ccc}};">★</a>
          }}
        </span>
        <input type="hidden" id="book-rating" value="{{{评分|}}}" />
      </div>
      }}
    </div>
  </div>
 
  <!-- 详细信息表格 -->
  <div style="flex: 1;">
    <h2 style="margin-top: 0; color: #{{#if:{{{标题颜色|}}}|{{{标题颜色|222}}}|222}};">{{{标题|{{PAGENAME}}}}}{{#if:{{{副标题|}}}|: {{{副标题|}}}|}}</h2>
   
    <table style="width: 100%;">
      {{#if:{{{作者|}}}|<tr><th style="width: 80px;">作者</th><td>{{{作者}}}</td></tr>}}
      {{#if:{{{译者|}}}|<tr><th>译者</th><td>{{{译者}}}</td></tr>}}
      {{#if:{{{出版社|}}}|<tr><th>出版社</th><td>{{{出版社}}}</td></tr>}}
      {{#if:{{{出版日期|}}}|<tr><th>出版日期</th><td>{{{出版日期}}}</td></tr>}}
      {{#if:{{{页数|}}}|<tr><th>页数</th><td>{{{页数}}}</td></tr>}}
      {{#if:{{{ISBN|}}}|<tr><th>ISBN</th><td>{{{ISBN}}}</td></tr>}}
      {{#if:{{{定价|}}}|<tr><th>定价</th><td>{{{定价}}}</td></tr>}}
    </table>
   </div>
</div>
 
<!-- 内容简介 -->
{{#if:{{{内容简介|}}}|
<div style="margin-top: 1.5em; padding-top: 1em; border-top: 1px dashed #ccc;">
  <h3>内容简介</h3>
  <div>{{{内容简介}}}</div>
</div>
}}
}}
|}
 
<!-- 作者简介 -->
{{#if:{{{作者简介|}}}|
<div style="margin-top: 1.5em; padding-top: 1em; border-top: 1px dashed #ccc;">
  <h3>作者简介</h3>
  <div>{{{作者简介}}}</div>
</div>
}}
 
<!-- 图书目录 -->
{{#if:{{{图书目录|}}}|
<div style="margin-top: 1.5em; padding-top: 1em; border-top: 1px dashed #ccc;">
  <h3>图书目录</h3>
  <div>{{{图书目录}}}</div>
</div>
}}
 
<!-- 精彩文摘 -->
{{#if:{{{精彩文摘|}}}|
<div style="margin-top: 1.5em; padding-top: 1em; border-top: 1px dashed #ccc;">
  <h3>精彩文摘</h3>
  <blockquote style="font-style: italic; margin-left: 1em; padding-left: 1em; border-left: 3px solid #ccc;">
    {{{精彩文摘}}}
  </blockquote>
</div>
}}
 
<!-- 评分系统JavaScript (需要启用$wgAllowExternalImages和$wgRawHtml) -->
{{#if:{{{允许评分|}}}|
<script>
document.addEventListener('DOMContentLoaded', function() {
  const stars = document.querySelectorAll('.star-rating a');
  const ratingInput = document.getElementById('book-rating');
 
  stars.forEach(star => {
    star.addEventListener('click', function(e) {
      e.preventDefault();
      const rating = this.textContent === '★' ? this.textContent.charCodeAt(0) - 9722 : parseInt(this.textContent);
      ratingInput.value = rating;
     
      // 更新星星显示
      stars.forEach((s, i) => {
        s.style.color = i < rating ? 'gold' : '#ccc';
      });
     
      // 这里可以添加AJAX调用以保存评分
      // 例如: fetch('{{{评分回调}}}', { method: 'POST', body: JSON.stringify({rating: rating}) });
    });
  });
});
</script>
}}
</div>
</includeonly>
</includeonly>
<noinclude>
{{图书百科}}
</noinclude>

2025年6月19日 (四) 22:18的最新版本


沙盒
作者 示例作者
出版社
出版日期
ISBN ISBN缺失
豆瓣评分 暂无评分
               {{#if:|(脚本错误:没有“Formatnum”这个模块。
用户评分
0/10
<div class="rating-bar" style="width:表达式错误:无法识别标点符号“{”。%; background:#ffcc00;">
内容简介
作者简介
图书目录

(暂无目录信息)

精彩文摘

(暂无文摘)