Browse Source

refactor(download): 更新下载链接和样式

- 将下载链接的结构调整为更语义化的HTML
- 添加hover效果以改善用户体验
- 确保下载链接在新标签页中打开以提高可用性
master
peijunlei 2 weeks ago
parent
commit
79be460477
  1. 8
      public/themes/dist_static/static/css/download.css
  2. 13
      public/themes/website/1/zh/demo/download.html
  3. 4
      public/themes/website/1/zh/demo/single_search.html

8
public/themes/dist_static/static/css/download.css

@ -141,7 +141,6 @@
padding: 1.5rem 2rem; padding: 1.5rem 2rem;
border-radius: 1rem; border-radius: 1rem;
background: rgba(175, 181, 185, 0.15); background: rgba(175, 181, 185, 0.15);
text-decoration: none;
color: var(--color-text); color: var(--color-text);
transition: background 0.25s ease, transform 0.25s ease; transition: background 0.25s ease, transform 0.25s ease;
} }
@ -156,6 +155,11 @@
align-items: center; align-items: center;
gap: 1rem; gap: 1rem;
min-width: 0; min-width: 0;
text-decoration: none;
color: inherit;
}
.d-item__main:hover .d-item__name {
color: var(--color-primary);
} }
.d-item__pdf { .d-item__pdf {
display: block; display: block;
@ -168,6 +172,7 @@
font-size: var(--font-20); font-size: var(--font-20);
font-weight: 400; font-weight: 400;
line-height: var(--font-28); line-height: var(--font-28);
transition: color var(--duration-fast) var(--easing);
} }
.d-item__action { .d-item__action {
display: inline-flex; display: inline-flex;
@ -179,6 +184,7 @@
font-weight: 400; font-weight: 400;
line-height: var(--font-24); line-height: var(--font-24);
color: var(--color-text); color: var(--color-text);
text-decoration: none;
transition: color var(--duration-fast) var(--easing); transition: color var(--duration-fast) var(--easing);
} }
.d-item__action img { .d-item__action img {

13
public/themes/website/1/zh/demo/download.html

@ -105,16 +105,17 @@
</div> </div>
<div class="d-list"> <div class="d-list">
{hcTaglib:contentPage mainField="*" subField="*" name="hc_content" limit="12" item="vo"} {hcTaglib:contentPage mainField="*" subField="*" name="hc_content" limit="12" item="vo"}
<a class="d-item" href="{$vo.thumbnail.url ?? ''}" download="{$vo.title}">
<div class="d-item__main">
{php}$dl_file = $vo['url'] ?? ($vo['thumbnail']['url'] ?? '');{/php}
<div class="d-item">
<a class="d-item__main" href="{$dl_file}" target="_blank" rel="noopener" title="预览">
<img class="d-item__pdf" src="data:image/svg+xml,%3csvg%20viewBox='0%200%2032%2032'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='32.000000'%20height='32.000000'%20fill='none'%3e%3crect%20id='PDF%201'%20width='32.000000'%20height='32.000000'%20x='0.000000'%20y='0.000000'%20/%3e%3cpath%20id='矢量%20508'%20d='M28.1766%2028.9602C28.1766%2029.3602%2028.0164%2029.7441%2027.7285%2030.032C27.4402%2030.3199%2027.0566%2030.4801%2026.6562%2030.4801L5.32852%2030.4801C4.92852%2030.4801%204.52852%2030.3199%204.25664%2030.032C3.96875%2029.7437%203.80859%2029.3602%203.80859%2028.9602L3.80859%201.51992C3.80859%201.11992%203.96836%200.719922%204.25664%200.448047C4.52852%200.160156%204.92891%200%205.32852%200L18.4168%200C18.8168%200%2019.2168%200.160156%2019.5047%200.448047L27.7445%208.68828C28.0324%208.97617%2028.1926%209.36016%2028.1926%209.77617L28.1926%2028.9602L28.1766%2028.9602Z'%20fill='rgb(235,236,240)'%20fill-rule='nonzero'%20/%3e%3cpath%20id='矢量%20509'%20d='M28.1766%2028.96L28.1766%2030.4799C28.1766%2030.8799%2028.0164%2031.2799%2027.7285%2031.5518C27.4402%2031.84%2027.0566%2031.9998%2026.6562%2031.9998L5.32852%2031.9998C4.48047%2031.9998%203.80859%2031.3119%203.80859%2030.4799L3.80859%2028.96C3.80859%2029.36%203.96836%2029.7439%204.25664%2030.0318C4.54453%2030.3197%204.92852%2030.4799%205.32852%2030.4799L26.6566%2030.4799C27.5047%2030.4799%2028.1766%2029.792%2028.1766%2028.96L28.1766%2028.96Z'%20fill='rgb(193,199,208)'%20fill-rule='nonzero'%20/%3e%3cpath%20id='矢量%20510'%20d='M3.80781%2016.7682L3.80781%2013.7119L0.751953%2016.7682L3.80781%2016.7682ZM28.1758%2016.7682L28.2078%2013.7119L31.2477%2016.7682L28.1758%2016.7682L28.1758%2016.7682Z'%20fill='rgb(211,0,0)'%20fill-rule='nonzero'%20/%3e%3cpath%20id='矢量%20511'%20d='M28.1762%209.77617L28.1762%209.98398L19.9359%209.98398C19.0879%209.98398%2018.416%209.29609%2018.416%208.46406L18.416%200C18.816%200%2019.216%200.160156%2019.5039%200.448047L27.7602%208.68828C28.032%208.97617%2028.1922%209.36016%2028.1762%209.77617Z'%20fill='rgb(193,199,208)'%20fill-rule='nonzero'%20/%3e%3cpath%20id='矢量%20512'%20d='M15.7164%2019.0972L14.4629%2019.0972L14.4629%2023.5655L15.6941%2023.5655C17.0926%2023.5655%2017.8484%2022.7776%2017.8484%2021.2577C17.8484%2019.9351%2017.157%2019.1147%2015.7164%2019.0972ZM8.59219%2019.0995L6.79883%2019.0995L6.79883%2020.9983L8.59219%2020.9983C9.32695%2020.9983%209.79141%2020.7464%209.79141%2020.0362C9.79141%2019.4573%209.43555%2019.0995%208.59219%2019.0995L8.59219%2019.0995Z'%20fill='rgb(255,29,29)'%20fill-rule='nonzero'%20/%3e%3cpath%20id='矢量%20513'%20d='M0.767578%2016.7681L0.767578%2024.3681C0.767578%2024.7841%200.927344%2025.1681%201.21562%2025.456C1.4875%2025.7442%201.8875%2025.904%202.2875%2025.904L29.7117%2025.904C30.5438%2025.904%2031.2316%2025.2321%2031.2316%2024.3841L31.2316%2016.7681L0.767578%2016.7681ZM8.72617%2022.3454L6.79844%2022.3454L6.79844%2024.9103L5.05469%2024.9103L5.05469%2017.7618L8.75352%2017.7618C10.4156%2017.7618%2011.5207%2018.6021%2011.5207%2020.0087C11.5207%2021.4153%2010.4797%2022.3454%208.72617%2022.3454L8.72617%2022.3454ZM15.9223%2024.9103L12.7277%2024.9103L12.7277%2017.7618L15.959%2017.7618C18.3676%2017.7618%2019.6855%2019.3251%2019.6855%2021.211C19.6855%2023.4993%2018.0027%2024.9103%2015.9223%2024.9103ZM26.9953%2019.1419L22.8473%2019.1419L22.8473%2020.7677L26.7164%2020.7677L26.7164%2022.1579L22.8473%2022.1579L22.8473%2024.9099L21.1125%2024.9099L21.1125%2017.7614L26.9953%2017.7614L26.9953%2019.1415L26.9953%2019.1419Z'%20fill='rgb(239,67,53)'%20fill-rule='nonzero'%20/%3e%3cpath%20id='矢量%20514'%20d='M8.75313%2017.7617L5.05469%2017.7617L5.05469%2024.9102L6.79844%2024.9102L6.79844%2022.3453L8.72617%2022.3453C10.4797%2022.3453%2011.5207%2021.4703%2011.5207%2020.0086C11.5207%2018.5469%2010.4156%2017.7617%208.75352%2017.7617L8.75313%2017.7617ZM8.59141%2020.9984L6.79805%2020.9984L6.79805%2019.0996L8.59141%2019.0996C9.43477%2019.0996%209.79063%2019.4574%209.79063%2020.0363C9.79063%2020.7461%209.32578%2020.9984%208.59141%2020.9984L8.59141%2020.9984ZM15.959%2017.7617L12.7277%2017.7617L12.7277%2024.9102L15.9223%2024.9102C18.0027%2024.9102%2019.6855%2023.4992%2019.6855%2021.2109C19.6855%2019.325%2018.368%2017.7617%2015.959%2017.7617ZM15.6934%2023.5656L14.4621%2023.5656L14.4621%2019.0973L15.7156%2019.0973C17.1559%2019.1152%2017.8477%2019.9355%2017.8477%2021.2578C17.8477%2022.7777%2017.0918%2023.5656%2015.6934%2023.5656ZM21.1125%2024.9102L22.8473%2024.9102L22.8473%2022.1582L26.7164%2022.1582L26.7164%2020.768L22.8473%2020.768L22.8473%2019.1422L26.9953%2019.1422L26.9953%2017.7617L21.1125%2017.7617L21.1125%2024.9102Z'%20fill='rgb(255,255,255)'%20fill-rule='nonzero'%20/%3e%3c/svg%3e" alt="" width="32" height="32" /> <img class="d-item__pdf" src="data:image/svg+xml,%3csvg%20viewBox='0%200%2032%2032'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='32.000000'%20height='32.000000'%20fill='none'%3e%3crect%20id='PDF%201'%20width='32.000000'%20height='32.000000'%20x='0.000000'%20y='0.000000'%20/%3e%3cpath%20id='矢量%20508'%20d='M28.1766%2028.9602C28.1766%2029.3602%2028.0164%2029.7441%2027.7285%2030.032C27.4402%2030.3199%2027.0566%2030.4801%2026.6562%2030.4801L5.32852%2030.4801C4.92852%2030.4801%204.52852%2030.3199%204.25664%2030.032C3.96875%2029.7437%203.80859%2029.3602%203.80859%2028.9602L3.80859%201.51992C3.80859%201.11992%203.96836%200.719922%204.25664%200.448047C4.52852%200.160156%204.92891%200%205.32852%200L18.4168%200C18.8168%200%2019.2168%200.160156%2019.5047%200.448047L27.7445%208.68828C28.0324%208.97617%2028.1926%209.36016%2028.1926%209.77617L28.1926%2028.9602L28.1766%2028.9602Z'%20fill='rgb(235,236,240)'%20fill-rule='nonzero'%20/%3e%3cpath%20id='矢量%20509'%20d='M28.1766%2028.96L28.1766%2030.4799C28.1766%2030.8799%2028.0164%2031.2799%2027.7285%2031.5518C27.4402%2031.84%2027.0566%2031.9998%2026.6562%2031.9998L5.32852%2031.9998C4.48047%2031.9998%203.80859%2031.3119%203.80859%2030.4799L3.80859%2028.96C3.80859%2029.36%203.96836%2029.7439%204.25664%2030.0318C4.54453%2030.3197%204.92852%2030.4799%205.32852%2030.4799L26.6566%2030.4799C27.5047%2030.4799%2028.1766%2029.792%2028.1766%2028.96L28.1766%2028.96Z'%20fill='rgb(193,199,208)'%20fill-rule='nonzero'%20/%3e%3cpath%20id='矢量%20510'%20d='M3.80781%2016.7682L3.80781%2013.7119L0.751953%2016.7682L3.80781%2016.7682ZM28.1758%2016.7682L28.2078%2013.7119L31.2477%2016.7682L28.1758%2016.7682L28.1758%2016.7682Z'%20fill='rgb(211,0,0)'%20fill-rule='nonzero'%20/%3e%3cpath%20id='矢量%20511'%20d='M28.1762%209.77617L28.1762%209.98398L19.9359%209.98398C19.0879%209.98398%2018.416%209.29609%2018.416%208.46406L18.416%200C18.816%200%2019.216%200.160156%2019.5039%200.448047L27.7602%208.68828C28.032%208.97617%2028.1922%209.36016%2028.1762%209.77617Z'%20fill='rgb(193,199,208)'%20fill-rule='nonzero'%20/%3e%3cpath%20id='矢量%20512'%20d='M15.7164%2019.0972L14.4629%2019.0972L14.4629%2023.5655L15.6941%2023.5655C17.0926%2023.5655%2017.8484%2022.7776%2017.8484%2021.2577C17.8484%2019.9351%2017.157%2019.1147%2015.7164%2019.0972ZM8.59219%2019.0995L6.79883%2019.0995L6.79883%2020.9983L8.59219%2020.9983C9.32695%2020.9983%209.79141%2020.7464%209.79141%2020.0362C9.79141%2019.4573%209.43555%2019.0995%208.59219%2019.0995L8.59219%2019.0995Z'%20fill='rgb(255,29,29)'%20fill-rule='nonzero'%20/%3e%3cpath%20id='矢量%20513'%20d='M0.767578%2016.7681L0.767578%2024.3681C0.767578%2024.7841%200.927344%2025.1681%201.21562%2025.456C1.4875%2025.7442%201.8875%2025.904%202.2875%2025.904L29.7117%2025.904C30.5438%2025.904%2031.2316%2025.2321%2031.2316%2024.3841L31.2316%2016.7681L0.767578%2016.7681ZM8.72617%2022.3454L6.79844%2022.3454L6.79844%2024.9103L5.05469%2024.9103L5.05469%2017.7618L8.75352%2017.7618C10.4156%2017.7618%2011.5207%2018.6021%2011.5207%2020.0087C11.5207%2021.4153%2010.4797%2022.3454%208.72617%2022.3454L8.72617%2022.3454ZM15.9223%2024.9103L12.7277%2024.9103L12.7277%2017.7618L15.959%2017.7618C18.3676%2017.7618%2019.6855%2019.3251%2019.6855%2021.211C19.6855%2023.4993%2018.0027%2024.9103%2015.9223%2024.9103ZM26.9953%2019.1419L22.8473%2019.1419L22.8473%2020.7677L26.7164%2020.7677L26.7164%2022.1579L22.8473%2022.1579L22.8473%2024.9099L21.1125%2024.9099L21.1125%2017.7614L26.9953%2017.7614L26.9953%2019.1415L26.9953%2019.1419Z'%20fill='rgb(239,67,53)'%20fill-rule='nonzero'%20/%3e%3cpath%20id='矢量%20514'%20d='M8.75313%2017.7617L5.05469%2017.7617L5.05469%2024.9102L6.79844%2024.9102L6.79844%2022.3453L8.72617%2022.3453C10.4797%2022.3453%2011.5207%2021.4703%2011.5207%2020.0086C11.5207%2018.5469%2010.4156%2017.7617%208.75352%2017.7617L8.75313%2017.7617ZM8.59141%2020.9984L6.79805%2020.9984L6.79805%2019.0996L8.59141%2019.0996C9.43477%2019.0996%209.79063%2019.4574%209.79063%2020.0363C9.79063%2020.7461%209.32578%2020.9984%208.59141%2020.9984L8.59141%2020.9984ZM15.959%2017.7617L12.7277%2017.7617L12.7277%2024.9102L15.9223%2024.9102C18.0027%2024.9102%2019.6855%2023.4992%2019.6855%2021.2109C19.6855%2019.325%2018.368%2017.7617%2015.959%2017.7617ZM15.6934%2023.5656L14.4621%2023.5656L14.4621%2019.0973L15.7156%2019.0973C17.1559%2019.1152%2017.8477%2019.9355%2017.8477%2021.2578C17.8477%2022.7777%2017.0918%2023.5656%2015.6934%2023.5656ZM21.1125%2024.9102L22.8473%2024.9102L22.8473%2022.1582L26.7164%2022.1582L26.7164%2020.768L22.8473%2020.768L22.8473%2019.1422L26.9953%2019.1422L26.9953%2017.7617L21.1125%2017.7617L21.1125%2024.9102Z'%20fill='rgb(255,255,255)'%20fill-rule='nonzero'%20/%3e%3c/svg%3e" alt="" width="32" height="32" />
<span class="d-item__name">{$vo.title}</span> <span class="d-item__name">{$vo.title}</span>
</div>
<span class="d-item__action">
</a>
<a class="d-item__action" href="{$dl_file}" download="{$vo.title}">
<img src="data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='24.000000'%20height='24.000000'%20fill='none'%3e%3crect%20id='容器%20520'%20width='24.000000'%20height='24.000000'%20x='0.000000'%20y='0.000000'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20/%3e%3cg%20id='download--02'%3e%3cpath%20id='矢量%20486'%20d='M16.6667%209.33301L22%209.33301L22%2021.9997L2%2021.9997L2%209.33301L7.33333%209.33301'%20fill-rule='nonzero'%20stroke='rgb(46,53,58)'%20stroke-linejoin='round'%20stroke-width='1.500000'%20/%3e%3cpath%20id='矢量%20487'%20d='M16%2014L12%2018L8%2014M12%202L12%2018'%20fill-rule='nonzero'%20stroke='rgb(239,67,53)'%20stroke-width='1.500000'%20/%3e%3c/g%3e%3c/svg%3e" alt="" width="24" height="24" /> <img src="data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='24.000000'%20height='24.000000'%20fill='none'%3e%3crect%20id='容器%20520'%20width='24.000000'%20height='24.000000'%20x='0.000000'%20y='0.000000'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20/%3e%3cg%20id='download--02'%3e%3cpath%20id='矢量%20486'%20d='M16.6667%209.33301L22%209.33301L22%2021.9997L2%2021.9997L2%209.33301L7.33333%209.33301'%20fill-rule='nonzero'%20stroke='rgb(46,53,58)'%20stroke-linejoin='round'%20stroke-width='1.500000'%20/%3e%3cpath%20id='矢量%20487'%20d='M16%2014L12%2018L8%2014M12%202L12%2018'%20fill-rule='nonzero'%20stroke='rgb(239,67,53)'%20stroke-width='1.500000'%20/%3e%3c/g%3e%3c/svg%3e" alt="" width="24" height="24" />
<span>立即下载</span> <span>立即下载</span>
</span>
</a>
</a>
</div>
{/hcTaglib:contentPage} {/hcTaglib:contentPage}
</div> </div>

4
public/themes/website/1/zh/demo/single_search.html

@ -160,7 +160,7 @@
</span> </span>
</button> </button>
{elseif $sr_kind == 'download' /} {elseif $sr_kind == 'download' /}
<a class="sr-item__media" href="{$sr_file}" download="{$sr_title}">
<a class="sr-item__media" href="{$sr_file}" target="_blank" rel="noopener" title="预览">
<img src="{$sr_thumb}" alt="" width="300" height="200" loading="lazy" /> <img src="{$sr_thumb}" alt="" width="300" height="200" loading="lazy" />
</a> </a>
{elseif $sr_kind == 'announce' /} {elseif $sr_kind == 'announce' /}
@ -201,7 +201,7 @@
{if $sr_kind == 'video'} {if $sr_kind == 'video'}
{$sr_title} {$sr_title}
{elseif $sr_kind == 'download' /} {elseif $sr_kind == 'download' /}
<a href="{$sr_file}" download="{$sr_title}">{$sr_title}</a>
<a href="{$sr_file}" target="_blank" rel="noopener" title="预览">{$sr_title}</a>
{elseif $sr_kind == 'announce' /} {elseif $sr_kind == 'announce' /}
<a href="{$sr_file}" target="_blank" rel="noopener">{$sr_title}</a> <a href="{$sr_file}" target="_blank" rel="noopener">{$sr_title}</a>
{else /} {else /}

Loading…
Cancel
Save