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
2dd90000
Commit
2dd90000
authored
Oct 21, 2023
by
JoyJ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
search by category
parent
a8e989e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
4 deletions
+43
-4
src/Content.svelte
src/Content.svelte
+23
-2
src/components/card.svelte
src/components/card.svelte
+20
-2
No files found.
src/Content.svelte
View file @
2dd90000
...
...
@@ -2,6 +2,7 @@
import Card from './components/card.svelte';
import { SvelteToast, toast } from '@zerodevx/svelte-toast';
import { _env } from './stores';
import { to_number } from 'svelte/internal';
// -----------------------------
let List = [];
...
...
@@ -74,7 +75,7 @@
List = [...List, ...data];
}
function
searchTag
(args) {
function
querySearch
(args) {
let searchInfo = {
url: `${$_env}/query.php?action=get&${args}`,
params: {
...
...
@@ -92,8 +93,28 @@
});
}
function getCategoryIndex(text) {
return categoryList.findIndex((val)=>{
return val == text;
});
}
function onSearch(e) {
searchTag("tag=" + encodeURIComponent(e.detail.text));
console.log("searching");
console.log(e);
let url;
switch(e.detail.type) {
case 'tag':
url = "tag=" + encodeURIComponent(e.detail.text);
console.log(url);
querySearch(url);
break;
case 'category':
url = "category=" + getCategoryIndex(e.detail.text);
console.log(url);
querySearch(url);
break;
}
}
</script>
...
...
src/components/card.svelte
View file @
2dd90000
...
...
@@ -40,6 +40,14 @@
function searchByTag(e) {
console.log(e);
raiseEvent('search', {
type: 'tag',
text: e.target.innerHTML
});
}
function searchByCategory(e) {
console.log(e.target.innerHTML);
raiseEvent('search', {
type: 'category',
text: e.target.innerHTML
});
}
...
...
@@ -52,16 +60,23 @@
src={cover}
alt={title ?? 'default alt'}
style={error ? 'height: 240px; width: 320px;' : ''}
class='common-clickable'
on:error={() => {
cover = '/favicon.ico';
error = true;
}}
on:mousedown={()=>{
window.open($_env + '/' + folder);
}}
/>
</figure>
<div class="card-body">
<h2 class="card-title block">
<h2 class="card-title block
common-clickable
">
<!-- NOTE: 游戏类别 -->
<div class="badge badge-secondary m-auto" style="height: inherit;line-height: inherit;">{language ?? '示例'}</div>
<div
class="badge badge-secondary m-auto"
style="height: inherit;line-height: inherit;"
on:mousedown={searchByCategory}>{language ?? '未知'}</div>
<!-- NOTE: 游戏名称 -->
{title ?? 'default title'}
</h2>
...
...
@@ -99,4 +114,7 @@
transition: background-color 0.5s ease;
background-color: red;
}
.common-clickable {
cursor:pointer;
}
</style>
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