Commit d40d3c04 authored by xiaoye's avatar xiaoye

update 222picUrl

parent fc93bfe5
...@@ -8,13 +8,15 @@ ...@@ -8,13 +8,15 @@
spacing = '0px' spacing = '0px'
padding = '0px' padding = '0px'
> >
<!-- <view <view class = 'list'>
class = 'button' <view
v-show = 'deck.main.length > 0 || deck.side.length > 0' class = 'button'
@click = 'deck.download()' v-show = 'deck.main.length > 0 || deck.side.length > 0'
> @click = 'deck.download()'
<uni-icons type = 'download'></uni-icons> >
</view> --> <uni-icons type = 'download'></uni-icons>
</view>
</view>
<uni-card class = 'deck' :title = "deck.main.length > 0 ? '主卡组' : '暂无主卡组'"> <uni-card class = 'deck' :title = "deck.main.length > 0 ? '主卡组' : '暂无主卡组'">
<cover-image class = 'deck_cards' v-for = '(i, v) in deck.main' :src = 'getImg(i)' @error = 'changeImg.main(v)'></cover-image> <cover-image class = 'deck_cards' v-for = '(i, v) in deck.main' :src = 'getImg(i)' @error = 'changeImg.main(v)'></cover-image>
</uni-card> </uni-card>
...@@ -32,24 +34,42 @@ ...@@ -32,24 +34,42 @@
import Participant from '../script/participant.ts'; import Participant from '../script/participant.ts';
import Download from '../script/download.js'; import Download from '../script/download.js';
const getImg = (i : number) => { interface CardPic {
return i == 0 || Math.floor(Math.log10(Math.abs(i))) < 8 ? `https://cdn.233.momobako.com/ygopro/pics/${i}.jpg!half` : `https://cdn02.moecube.com:444/ygopro-super-pre/data/pics/${i}.jpg` code : number,
ot : number
}
let url = reactive({
diy222 : 'https://cdn02.moecube.com:444/ygopro-222DIY/contents/expansions/pics',
});
const getImg = (i : CardPic) : string => {
switch (i.ot) {
case (Const.ot.Basic) :
return Math.floor(Math.log10(Math.abs(i.code))) < 8 ? `https://cdn.233.momobako.com/ygopro/pics/${i.code}.jpg!half` : `https://cdn02.moecube.com:444/ygopro-super-pre/data/pics/${i.code}.jpg`;
case (Const.ot.CustomJpg) :
return `${url.diy222}/${i.code}.jpg`;
case (Const.ot.CustomPng) :
return `${url.diy222}/${i.code}.png`;
default :
return 'https://cdn.233.momobako.com/ygopro/pics/0.jpg!half';
}
}; };
const changeImg = { const changeImg = {
main : (v : number) : void => { main : (v : number) : void => {
deck.main[v] = 0; deck.main[v].ot += 1;
}, },
side : (v : number) : void => { side : (v : number) : void => {
deck.side[v] = 0; deck.side[v].ot += 1;
} }
}; };
let deck = reactive({ let deck = reactive({
participant : undefined as Participant | undefined, participant : undefined as Participant | undefined,
chk : false, chk : false,
main : [] as Array<number>, main : [] as Array<CardPic>,
side : [] as Array<number>, side : [] as Array<CardPic>,
blob : undefined as Blob | undefined, blob : undefined as Blob | undefined,
init : async (i : { init : async (i : {
participant : Participant, participant : Participant,
...@@ -67,8 +87,8 @@ ...@@ -67,8 +87,8 @@
deck.participant = undefined; deck.participant = undefined;
await (new Promise(resolve => setTimeout(resolve, 500))); await (new Promise(resolve => setTimeout(resolve, 500)));
} }
deck.main = i.main; deck.main.push(...i.main.map(code => ({ code, ot: Const.ot.Basic })));
deck.side = i.side; deck.side.push(...i.side.map(code => ({ code, ot: Const.ot.Basic })));
deck.blob = i.blob; deck.blob = i.blob;
deck.participant = participant; deck.participant = participant;
}, },
...@@ -119,4 +139,8 @@ ...@@ -119,4 +139,8 @@
background-color: #e6e6e6; background-color: #e6e6e6;
} }
} }
.list {
display: grid;
justify-items: center;
}
</style> </style>
\ No newline at end of file
...@@ -12,6 +12,12 @@ class ConstData { ...@@ -12,6 +12,12 @@ class ConstData {
showTournament = 'showTournament'; showTournament = 'showTournament';
updateRounds = 'updateRounds'; updateRounds = 'updateRounds';
newTournament = 'newTournament'; newTournament = 'newTournament';
ot = {
Basic : 0,
CustomJpg : 1,
CustomPng : 2,
None : 3
}
pic = { pic = {
hajimi : ` hajimi : `
<pre> :==+++=-. <pre> :==+++=-.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment