feat: launch PK testing application
Verify mini program and deploy preview / verify-deploy (push) Failing after 32s
Verify mini program and deploy preview / verify-deploy (push) Failing after 32s
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
.top{display:flex;justify-content:space-between}.progress{height:10rpx;margin:20rpx 0 46rpx;overflow:hidden;border-radius:99rpx;background:#eadfd7}.progress view{height:100%;background:#ff6b35}.title{margin-bottom:34rpx;font-size:54rpx;font-weight:900}.pair{position:relative}.choice{position:relative;min-height:350rpx;margin-bottom:24rpx;padding:34rpx;box-sizing:border-box;border-radius:38rpx;color:#fff}.a{background:#ff6b35;transform:rotate(-1deg)}.b{background:#2766df;transform:rotate(1deg)}.letter{display:block;width:54rpx;height:54rpx;line-height:54rpx;text-align:center;border:2rpx solid rgba(255,255,255,.6);border-radius:50%;font-weight:900}.emoji{position:absolute;right:30rpx;top:20rpx;font-size:92rpx}.name{display:block;margin-top:65rpx;font-size:62rpx;font-weight:900}.hint{position:absolute;left:34rpx;bottom:30rpx;opacity:.7}.vs{position:absolute;z-index:2;left:50%;top:50%;width:82rpx;height:82rpx;line-height:82rpx;text-align:center;transform:translate(-50%,-50%) rotate(-8deg);border:5rpx solid #25211f;border-radius:50%;background:#fff;font-weight:900}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
var api=require('../../utils/api'),bracket=require('../../utils/bracket');
|
||||
Page({
|
||||
data:{loading:true,left:null,right:null,round:1,progress:0,completed:0,total:47},
|
||||
onLoad:function(){var self=this;api.request('/api/v1/tests/rice').then(function(test){self.test=test;self.state=bracket.create(test.candidates);self.refresh();self.setData({loading:false,total:test.candidates.length-1});}).catch(function(error){self.setData({loading:false,error:error.message});});},
|
||||
refresh:function(){var pair=bracket.current(this.state);this.setData({left:pair&&pair[0],right:pair&&pair[1],round:this.state.round,completed:this.state.decisions.length,progress:Math.round(this.state.decisions.length/this.data.total*100)});},
|
||||
choose:function(event){if(this.busy)return;this.busy=true;var winner=event.currentTarget.dataset.side==='left'?this.data.left:this.data.right,finished=bracket.choose(this.state,winner);if(finished)this.complete();else{this.refresh();this.busy=false;}},
|
||||
complete:function(){var self=this,champion=this.state.pool[0],final=this.state.decisions[this.state.decisions.length-1],runner=final.left_id===champion.id?final.right_id:final.left_id;api.ensureLogin().then(function(){return api.request('/api/v1/tests/rice/runs',{method:'POST',data:{app_key:'rice',champion_id:champion.id,runner_up_id:runner,ranking_ids:bracket.ranking(self.state),decisions:self.state.decisions}});}).then(function(result){xhs.setStorageSync('rice_last_result',result);xhs.redirectTo({url:'/pages/result/result?id='+result.id});}).catch(function(error){self.busy=false;xhs.showModal({title:'保存失败',content:error.message||'请重试',showCancel:false});});}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
{ "navigationBarTitleText": "饭类擂台" }
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<view class="page arena"><view xhs:if="{{loading}}" class="empty">正在抽签…</view><view xhs:elif="{{error}}" class="empty">{{error}}</view><block xhs:else><view class="top"><text>第 {{round}} 轮</text><text class="muted">{{completed}} / {{total}}</text></view><view class="progress"><view style="width:{{progress}}%"></view></view><view class="title">只能留下一碗饭。</view><view class="pair"><view class="choice a" data-side="left" bindtap="choose"><text class="letter">A</text><text class="emoji">🍚</text><text class="name">{{left.name}}</text><text class="hint">选它晋级 ↗</text></view><view class="vs">VS</view><view class="choice b" data-side="right" bindtap="choose"><text class="letter">B</text><text class="emoji">🍚</text><text class="name">{{right.name}}</text><text class="hint">选它晋级 ↗</text></view></view></block></view>
|
||||
|
||||
Reference in New Issue
Block a user