Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Character Figure art #76

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/pr_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
# pull_request:
# branches: [ master ]
workflow_dispatch:

jobs:
build:

Expand Down
75 changes: 51 additions & 24 deletions reader/src/ASTRv2/content/nameline.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
<template>
<div
class="textblock"
@mousemove="showLink = true"
@mouseout="showLink = false"
>
<span :class="{ nameblock: true, figure: line.figure_art }">{{
line.attributes.name
}}</span>
<span
class="contentblock"
v-html="parseContent(line.attributes.content)"
></span>
<div class="textblock" @mousemove="showLink = true" @mouseout="showLink = false">
<n-tooltip trigger="hover" :disabled="!line.figure_art">
<template #trigger>
<span :class="{ nameblock: true, figure: line.figure_art }">{{
line.attributes.name
}}</span>
</template>
<n-image :src="getCharAvgUrl()" width="100" @error="is_in_folder=false"></n-image>
</n-tooltip>

<span class="contentblock" v-html="parseContent(line.attributes.content)"></span>
<n-popover trigger="manual" :show-arrow="false" :show="copied">
<template #trigger>
<n-icon-wrapper
:size="32"
color="#00000000"
icon-color="#7f7f7f"
class="link"
v-show="showLink"
@click="hyperlink2line(line.id)"
>
<n-icon-wrapper :size="32" color="#00000000" icon-color="#7f7f7f" class="link" v-show="showLink"
@click="hyperlink2line(line.id)">
<n-icon size="24">
<LinkOutlined />
</n-icon>
Expand All @@ -33,6 +26,7 @@

<script>
import func from "../func";
import source from "../source";
import { LinkOutlined } from "@vicons/material";

export default {
Expand All @@ -43,6 +37,7 @@ export default {
showLink: false,
currentLang: func.l,
copied: false,
is_in_folder: true,
};
},
// mounted(){
Expand Down Expand Up @@ -96,6 +91,25 @@ export default {
}, 1000);
});
},
getCharAvgUrl() {
// console.log(source.getCharAvgUrl("fexli", this.line.figure_art));
// return source.getCharAvgUrl("fexli", this.line.figure_art);
const match_charId_re = /([\w]+)(#\w+)?(\$?\w+)?/;
const charId = this.line.figure_art.match(match_charId_re)[1];
if (charId) {
// replace the '#' and '$' in figure_art with %23 and %24
let artId = this.line.figure_art.replace("#", "%23").replace("$", "%24");
let url = "";
if(this.is_in_folder)
url = `https://raw.githubusercontent.com/ArknightsAssets/ArknightsAssets/refs/heads/cn/assets/torappu/dynamicassets/avg/characters/${charId}/${artId}.png`;
else
url = `https://raw.githubusercontent.com/ArknightsAssets/ArknightsAssets/refs/heads/cn/assets/torappu/dynamicassets/avg/characters/${artId}.png`;
console.log(url);
return url;
} else {
return "https://r2.m31ns.top/img/icons/404.png";
}
},
},
};
</script>
Expand All @@ -105,6 +119,7 @@ export default {
margin: 4px;
display: flex;
}

.textblock .nameblock {
display: flex;
flex: 1.5 70px;
Expand All @@ -117,29 +132,41 @@ export default {
font-weight: bold;
color: #7f7f7f;
}

.textblock .contentblock {
display: block;
flex: 6 300px;
background-color: unset;

margin: 2px;
}

.textblock .hideName {
color: rgba(0, 0, 0, 0);
}

.textblock .link {
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Generic */
-webkit-user-select: none;
/* Safari */
-moz-user-select: none;
/* Firefox */
-ms-user-select: none;
/* Internet Explorer/Edge */
user-select: none;
/* Generic */

position: absolute;
margin-left: -40px;
padding-right: 40px;
display: flex;
justify-content: center;
}

.textblock .link:hover {
color: yellow !important;
}

.textblock .figure{
text-decoration: underline;
}
</style>
3 changes: 0 additions & 3 deletions reader/src/ASTRv2/menupage/homepage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,9 @@ export default {
console.log(this.latestEvents);
},
async loadFriendLinksData() {
var myHeaders = new Headers();
myHeaders.append("User-Agent", "Apifox/1.0.0 (https://apifox.com)");

var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};

Expand Down
4 changes: 3 additions & 1 deletion reader/src/ASTRv2/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ export default {
return `${IMAGES_SRC_REPOS[repo]}/avatar/ASSISTANT/${charId}.png`;
}
},
getCharAvgUrl(repo, charId){
return `${IMAGES_SRC_REPOS['Aceship']}/avg/characters/${charId}.png`;
},
async getData(server, path) {
try{
return await fetch(`${GAME_DATA_REPOS["m31ns"]}${server}${path}`);
}
catch(e){
return await fetch(`${GAME_DATA_REPOS["github"]}${server}${path}`);
}

}
};