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