Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
R
rrpgLink_FrontEnd
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kesaubeeire
rrpgLink_FrontEnd
Commits
ab4fe607
Commit
ab4fe607
authored
Oct 22, 2023
by
KesaubeEire
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 点击 Cover 预览所有图片, 支持 pc 和 手机端.
parent
1106b6ca
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
7 deletions
+79
-7
README.md
README.md
+1
-1
src/Content.svelte
src/Content.svelte
+58
-1
src/components/card.svelte
src/components/card.svelte
+14
-2
src/stores/index.js
src/stores/index.js
+6
-3
No files found.
README.md
View file @
ab4fe607
...
@@ -60,7 +60,7 @@ npm run build:prod
...
@@ -60,7 +60,7 @@ npm run build:prod
-
[x] 请求 php
-
[x] 请求 php
-
[x] 展示基础卡片
-
[x] 展示基础卡片
-
[x] 图片
-
[x] 图片
-
[
] TODO:
点击 Cover 预览所有图片
-
[
x]
点击 Cover 预览所有图片
-
[ ] TODO: 懒加载
-
[ ] TODO: 懒加载
-
[x] 语言
-
[x] 语言
-
[x] TAG
-
[x] TAG
...
...
src/Content.svelte
View file @
ab4fe607
<script>
<script>
import Card from './components/card.svelte';
import Card from './components/card.svelte';
import { SvelteToast, toast } from '@zerodevx/svelte-toast';
import { SvelteToast, toast } from '@zerodevx/svelte-toast';
import { _category, _detailWindow, _env, _tagTrans } from './stores';
import { _category, _detailWindow, _env, _tagTrans
, _detailPics
} from './stores';
import { fade } from 'svelte/transition';
import { fade } from 'svelte/transition';
// -----------------------------
// -----------------------------
...
@@ -226,6 +226,45 @@
...
@@ -226,6 +226,45 @@
<!-- NOTE: svelte 绑定 window -> 关闭详情面板 -->
<!-- NOTE: svelte 绑定 window -> 关闭详情面板 -->
<svelte:window on:keydown|capture={key_closePanels} />
<svelte:window on:keydown|capture={key_closePanels} />
<!-- Open the modal using ID.showModal() method -->
<!-- <button class="btn" onclick="globalModal.showModal()">open modal</button> -->
{#if $_detailWindow}
<dialog id="globalModal" class="modal">
<div class="globalModal max-[1024px]:w-[98vw] max-[1024px]:max-w-[98vw]" transition:fade={{ delay: 200, duration: 1000 }}>
<form method="dialog">
<button class="btn btn-sm round-box btn-ghost absolute right-2 top-2">✕</button>
</form>
<!-- NOTE: Transition -->
{#if $_detailPics.length}
<div class="carousel w-full" style="height: calc(80vh - 4rem - 3rem - 0.5rem);">
{#each $_detailPics as pic, index}
<div id={pic + index} class="carousel-item w-full">
<img src={pic} class="w-full object-contain" alt={pic} />
</div>
{/each}
</div>
<div class="flex justify-center w-full gap-2 overflow-x-auto max-[1024px]:justify-start" style="height: 4rem;">
{#each $_detailPics as pic, index}
<a href={'#' + pic + index} class="btn btn-xs flex flex-col h-16">
<div><img src={pic} class="w-10" alt={pic} /></div>
<div>{index}</div>
</a>
{/each}
</div>
{:else}
<!-- NOTE: loading -->
<div class="h-full w-full flex justify-center items-center">
<span class="loading loading-infinity loading-lg" />
</div>
{/if}
</div>
<form method="dialog" class="modal-backdrop">
<button>close</button>
</form>
</dialog>
{/if}
{#if List.length}
{#if List.length}
<div class="cardContainer flex flex-wrap justify-evenly gap-4 my-3" transition:fade={{ delay: 0, duration: 300 }}>
<div class="cardContainer flex flex-wrap justify-evenly gap-4 my-3" transition:fade={{ delay: 0, duration: 300 }}>
{#each List as item}
{#each List as item}
...
@@ -249,3 +288,21 @@
...
@@ -249,3 +288,21 @@
<!-- <Card raw_tags="|示例1|示例2|" /> -->
<!-- <Card raw_tags="|示例1|示例2|" /> -->
</div>
</div>
{/if}
{/if}
<style>
/* NOTE: 对 Modal 的究极魔改, 很不容易. */
.globalModal {
@apply modal-box;
height: 80vh;
width: 70vw;
max-width: 70vw;
}
@media (max-width: 1024px) {
.globalModal {
height: 80vh;
width: 96vw;
max-width: 96vw;
}
}
</style>
src/components/card.svelte
View file @
ab4fe607
<script>
<script>
import { toast } from '@zerodevx/svelte-toast';
import { toast } from '@zerodevx/svelte-toast';
import { _tagTrans } from '../stores';
import { _
detailPics, _detailWindow, _
tagTrans } from '../stores';
/**父属性: 主标题*/
/**父属性: 主标题*/
export let title;
export let title;
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
// 图片错误 trigger
// 图片错误 trigger
let _picError = false;
let _picError = false;
/**
TODO: 显示
所有缩略图*/
/**
点击图片显示该游戏
所有缩略图*/
function getInfoPics() {
function getInfoPics() {
console.log(folder);
console.log(folder);
...
@@ -49,6 +49,17 @@
...
@@ -49,6 +49,17 @@
.then(data => {
.then(data => {
console.log(title, data);
console.log(title, data);
// window.open(folder + '/rpg_info/' + data[1]);
// window.open(folder + '/rpg_info/' + data[1]);
// NOTE: 这里同样用了点笨方法, 以后有机会改进再说吧, 优先级不高
// console.log(pics);
$_detailWindow = true;
$_detailPics = [];
setTimeout(() => {
$_detailPics = data.map(pic => folder + '/rpg_info/' + pic);
// 延迟切换到第一张
location.replace(`#${$_detailPics[0]}0`);
}, 500);
});
});
}
}
...
@@ -80,6 +91,7 @@
...
@@ -80,6 +91,7 @@
style={_picError ? 'height: 240px; width: 320px;' : ''}
style={_picError ? 'height: 240px; width: 320px;' : ''}
on:error={picErrorHandler}
on:error={picErrorHandler}
on:click={getInfoPics}
on:click={getInfoPics}
onclick="globalModal.showModal()"
on:keypress={() => {}}
on:keypress={() => {}}
/>
/>
</figure>
</figure>
...
...
src/stores/index.js
View file @
ab4fe607
...
@@ -33,10 +33,10 @@ function persistStore(key, startValue) {
...
@@ -33,10 +33,10 @@ function persistStore(key, startValue) {
}
}
// 变量 -------------------------------------
// 变量 -------------------------------------
/** 主题 */
/**
永久持久化:
主题 */
export
const
_theme
=
persistStore
(
'
_theme
'
,
"
light
"
);
export
const
_theme
=
persistStore
(
'
_theme
'
,
"
light
"
);
/** 环境变量 */
/**
永久持久化:
环境变量 */
export
const
_env
=
persistStore
(
'
_env
'
,
""
);
export
const
_env
=
persistStore
(
'
_env
'
,
""
);
/** 定时持久化: 分类 */
/** 定时持久化: 分类 */
...
@@ -46,4 +46,7 @@ export const _category = persistStore('_category', {});
...
@@ -46,4 +46,7 @@ export const _category = persistStore('_category', {});
export
const
_tagTrans
=
persistStore
(
'
_tagTrans
'
,
{});
export
const
_tagTrans
=
persistStore
(
'
_tagTrans
'
,
{});
/** trigger: 详情图片显示窗口 */
/** trigger: 详情图片显示窗口 */
export
const
_detailWindow
=
writable
(
false
);
export
const
_detailWindow
=
writable
(
false
);
\ No newline at end of file
/** 刷新后消失: 详情图片显示窗口 */
export
const
_detailPics
=
writable
([]);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment