Commit 7350ef47 authored by xiaoye's avatar xiaoye

增加图床设置

parent 8e4ea77a
Pipeline #38469 passed with stages
in 6 minutes and 9 seconds
......@@ -86,6 +86,8 @@
</uni-list-item>
</uni-list>
</uni-card>
<br>
<uni-easyinput type = 'text' placeholder = '卡图图床(例:https://example.com/api/)' v-model = 'create.pics'/>
<br>
<view class = 'button' @click = 'create.clear()'>
<view>
......@@ -114,6 +116,7 @@
let create = reactive({
name : '',
description : '',
pics : '',
visibility : {
select : '',
range : [
......@@ -181,7 +184,7 @@
const collaborators = create.collaborators.map(user => user.id);
const id = await Tabulator.Tournament.Create(Mycard.token, {
name: create.name,
description: create.description,
description: `${create.description}${create.pics ? `\n卡图地址:${create.pics}` : ''}`,
rule: create.rule.select,
ruleSettings: create.rule.settings,
visibility: create.visibility.select,
......
......@@ -71,6 +71,8 @@
</uni-list-item>
</uni-list>
</uni-card>
<br>
<uni-easyinput type = 'text' placeholder = '卡图图床(例:https://example.com/api/)' v-model = 'tournament.pics'/>
<br>
<view class = 'button' @click = 'tournament.update()'>
<view>
......
......@@ -40,7 +40,8 @@
}
let url = reactive({
diy222 : 'https://cdn02.moecube.com:444/ygopro-222DIY/contents/expansions/pics',
diy222 : 'https://cdn02.moecube.com:444/ygopro-222DIY/contents/expansions/pics/',
custom : ''
});
const getImg = (i : CardPic) : string => {
......@@ -48,9 +49,9 @@
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`;
return `${url.custom.length > 0 ? `${url.custom}${url.custom.endsWith('/') ? '' : '/'}` : url.diy222}${i.code}.jpg`;
case (Const.ot.CustomPng) :
return `${url.diy222}/${i.code}.png`;
return `${url.custom.length > 0 ? `${url.custom}${url.custom.endsWith('/') ? '' : '/'}` : url.diy222}${i.code}.png`;
default :
return 'https://cdn.233.momobako.com/ygopro/pics/0.jpg!half';
}
......@@ -76,6 +77,7 @@
main : Array<number>,
side : Array<number>,
blob : Blob,
url : string
}) : Promise<void> => {
if (deck.chk) return;
const participant = i.participant ?? undefined;
......@@ -91,6 +93,7 @@
deck.side.push(...i.side.map(code => ({ code, ot: Const.ot.Basic })));
deck.blob = i.blob;
deck.participant = participant;
url.custom = i.url;
},
off : async () : Promise<void> => {
deck.chk = true;
......@@ -100,6 +103,7 @@
deck.side = [];
deck.chk = false;
deck.blob = undefined;
url.custom = '';
},
clickClear : (e) : void => {
let element = e.target;
......
......@@ -298,6 +298,7 @@
this : undefined as undefined | Tournament,
name : '',
description : '',
pics : '',
visibility : {
select : '',
range : [
......@@ -327,6 +328,7 @@
tournament.this = t;
tournament.name = t.name;
tournament.description = t.description;
tournament.pics = t.pics;
tournament.visibility.select = t.visibility;
tournament.rule.select = t.rule;
tournament.rule.settings = Object.assign({}, t.ruleSettings);
......@@ -344,6 +346,7 @@
tournament.this = undefined;
tournament.name = '';
tournament.description = '';
tournament.pics = '';
tournament.visibility.select = '';
tournament.rule.select = '';
tournament.rule.settings = {} as ruleSettings;
......@@ -357,7 +360,7 @@
const collaborators = tournament.collaborators.map(user => user.id);
emitter.emit(Const.updateTournament, {
name: tournament.name,
description: tournament.description,
description: `${tournament.description}${tournament.pics ? `\n卡图地址:${tournament.pics}` : ''}`,
visibility: tournament.visibility.select,
collaborators : collaborators,
rule : tournament.this?.status == 'Ready' ? tournament.rule.select : undefined,
......
......@@ -626,7 +626,8 @@
participant : i,
main : i.getDeck().main,
side : i.getDeck().side,
blob : i.Blob()
blob : i.Blob(),
url : tournament.this?.pics ?? ''
})
}
},
......
......@@ -5,6 +5,7 @@ class Tournament {
id : number;
name : string;
description : string;
pics : string;
rule : string;
ruleSettings : {
rounds : number;
......@@ -22,7 +23,9 @@ class Tournament {
constructor(obj : TournamentObject) {
this.name = obj.name;
this.description = obj.description;
const description = obj.description.split('\n卡图地址:');
this.description = description[0];
this.pics = description[1] ?? '';
this.visibility = obj.visibility;
this.collaborators = obj.collaborators;
this.rule = obj.rule;
......
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