Skip to content

Commit

Permalink
add: main page flag card
Browse files Browse the repository at this point in the history
  • Loading branch information
wuhan005 committed Feb 17, 2020
1 parent 85cbcce commit 213ca0e
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/GameBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<v-list-item-content>
<v-list-item-title v-text="gameBox.Title"/>
<v-list-item-subtitle>{{gameBox.IP}}:{{gameBox.Port}}</v-list-item-subtitle>
<v-list-item-subtitle>{{gameBox.Score}} 分</v-list-item-subtitle>
<v-list-item-subtitle>{{utils.FormatFloat(gameBox.Score)}} 分</v-list-item-subtitle>
</v-list-item-content>

<v-list-item-action>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<v-divider/>
<v-card-actions>
<v-list-item>
#{{ info.Rank }} / {{ info.Score }} 分
#{{ info.Rank }} / {{ utils.FormatFloat(info.Score) }} 分
</v-list-item>
<v-btn text/>
</v-card-actions>
Expand Down
44 changes: 44 additions & 0 deletions src/components/SubmitFlag.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<template>
<v-card class="mx-auto">
<v-card-title>提交 Flag</v-card-title>
<v-card-text>
<h2>POST <code style="background-color: #1c1c1c">/flag</code></h2><br>
<p>Content-Type: application/json</p>
<p>Header:<pre>Authorization: {{info.Token}}</pre></p>
<p>Body:</p>
<code class="pa-3" style="width: 100%; background-color: #1c1c1c; color: rgba(255, 255, 255, 0.7);">{"flag": "your_flag_here"}</code>
<br><br>
<v-divider></v-divider>
<br>
<p>
<code class="pa-3" style="width: 100%; background-color: #1c1c1c; color: rgba(255, 255, 255, 0.7);">curl -X POST {{utils.baseURL}}/flag -H 'Authorization: {{info.Token}}' -d '{ "flag": "your_flag_here" }'</code>
</p>
</v-card-text>
</v-card>
</template>

<script>
export default {
name: "SubmitFlag",
data: () => ({
info: null
}),
mounted() {
this.getInfo()
},
methods:{
getInfo(){
this.utils.GET("/team/info").then(res => {
this.info = res
})
}
}
}
</script>

<style scoped>
</style>
4 changes: 4 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ export default {
})
},

FormatFloat: (number) => {
return number.toFixed(2)
},

FormatGoTime: (timeString) => {
return new Date(timeString.split('+')[0].replace('T', ' '))
},
Expand Down
16 changes: 13 additions & 3 deletions src/views/Main.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<template>
<v-container>


<!-- 时间 -->
<v-card class="mx-auto" max-width="600" color="transparent" flat>
<Timer/>
Expand All @@ -12,6 +10,17 @@
<!-- 靶机信息 -->
<Info/>
</v-col>
<v-col cols="12" md="8">
<v-card class="mx-auto">
<v-card-title></v-card-title>
<v-card-text>

</v-card-text>
</v-card>

<br>
<SubmitFlag/>
</v-col>
</v-row>

</v-container>
Expand All @@ -20,10 +29,11 @@
<script>
import Timer from "../components/Timer";
import Info from "../components/Info";
import SubmitFlag from "../components/SubmitFlag";
export default {
name: "Main",
components: {Info, Timer}
components: {SubmitFlag, Info, Timer}
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion src/views/Rank.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<tr v-for="(item, key) in this.rankList" :key="item.ID">
<td>{{key + 1}}</td>
<td>{{item.TeamName}}</td>
<td>{{item.Score}}</td>
<td>{{utils.FormatFloat(item.Score)}}</td>
<td v-bind:key="index" v-for="(gameBox, index) in item.GameBoxStatus">
<v-icon color="green lighten-2" v-if="!gameBox.IsDown && !gameBox.IsAttacked">mdi-check-circle
</v-icon>
Expand Down

0 comments on commit 213ca0e

Please sign in to comment.