refactoring the route to admin console
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<v-container max-width="1400">
|
||||
<GamePreview v-model="object"></GamePreview>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
object: {},
|
||||
valid: false,
|
||||
rules: {
|
||||
required: v => v ? true : this.l.fieldRequired,
|
||||
requiredFile: v => (v?.length || this.id != 'add') ? true : this.l.fieldRequired
|
||||
},
|
||||
loading: false,
|
||||
panel: [],
|
||||
scenarios: []
|
||||
}
|
||||
},
|
||||
async mounted(){
|
||||
if (this.id && this.id != 'add') {
|
||||
this.object = (await this.$api.game.load(this.id)).data;
|
||||
//this.$api.user.tm('test', 'test', {data: 'test'})
|
||||
}
|
||||
this.scenarios = (await this.$api.scenario.search()).data.data;
|
||||
},
|
||||
watch:{
|
||||
'object.scenario'(v){
|
||||
if (v){
|
||||
this.object.thumb = this.scenarios?.find(s=>s.id == v)?.sceneThumb?.[0];
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
id() {
|
||||
return this.$route.params?.id;
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<route>
|
||||
{
|
||||
meta: {
|
||||
layout: "console"
|
||||
}
|
||||
}
|
||||
</route>
|
||||
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col v-for="(v, i) in items" :key="i" cols="12" xs="6" sm="4" md="3" xl="2" class="position-relative">
|
||||
<router-link :to="`/manage/preview/${v.id}`">
|
||||
<v-img :src="`/asset/thumb/${v.thumb}.webp`"></v-img>
|
||||
</router-link>
|
||||
<div class="d-flex">
|
||||
<span class="flex-grow-1">{{ v.name }}</span>
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
items: []
|
||||
}
|
||||
},
|
||||
|
||||
async created(){
|
||||
this.items = (await this.$api.game.search()).data.data
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<route>
|
||||
{
|
||||
meta: {
|
||||
layout: "console"
|
||||
}
|
||||
}
|
||||
</route>
|
||||
Reference in New Issue
Block a user