This commit is contained in:
Troplo 2021-01-20 03:33:27 +11:00
parent bc9842c12d
commit 068e931a7d
6 changed files with 152 additions and 3 deletions

View file

@ -123,7 +123,8 @@
"avatar": "My Avatar",
"transactions": "Transactions",
"settings": "Settings",
"logout": "Logout"
"logout": "Logout",
"friends": "Friends"
},
"more": {
"title": "More",
@ -179,6 +180,9 @@
"title": "Modify User",
"text": "Modify user badges"
},
"home": {
"globalWall": "Global Wall"
},
"badges": {
"admin": "Admin",
"bot": "Bot",

View file

@ -76,6 +76,10 @@ const routes = [
name: 'Stats',
component: route('Stats')
},
{ path: '/admin', component: route('Admin'), children: [
{ path: 'dashboard', component: route('AdminDashboard') },
{ path: 'item', component: route('AdminCreateItem') },
] },
{
path: '*',
name: '404',

20
src/views/Admin.vue Normal file
View file

@ -0,0 +1,20 @@
<template>
<div class="columns is-centered">
<div class="column is-2">
<b-menu class="box">
<b-menu-list :label="$t('admin.title')">
<b-menu-item @click="$router.push('/admin/dashboard')" :label="$t('admin.dashboard')"></b-menu-item>
<b-menu-item @click="$router.push('/admin/item')" :label="$t('admin.uploadItem')"></b-menu-item>
</b-menu-list>
<b-menu-list :label="$t('admin.executive.title')">
<b-menu-item :label="$t('admin.executive.soon')"></b-menu-item>
</b-menu-list>
</b-menu>
</div>
<div class="column is-9">
<div class="box">
<router-view></router-view>
</div>
</div>
</div>
</template>

View file

@ -0,0 +1,112 @@
<template>
<main>
<div>
<h1 class="title" v-if="createType === 0">
Uploading a hat
</h1>
<p v-if="createType === 0">Please contact Troplo if you do not have the required assets for uploading this item type.</p>
Name:
<b-input :value="'debug'"
v-model="item.name"
maxlength="30">
</b-input>
Description:
<b-input v-model="item.description" maxlength="150" type="textarea">
</b-input>
Options:<br>
<b-switch v-model="item.limited" v-if="$store.state.user.admin">
Limited Edition
</b-switch>
<div v-if="item.limited && $store.state.user.admin">
Quantity allowed (0 for unlimited):
<b-numberinput v-model="item.quantity"></b-numberinput>
</div>
<br>
<b-switch v-model="item.onSale">
On sale
</b-switch>
<br>
<div v-if="item.onSale">
On sale price:
<b-input v-model="item.onSalePrice" v-if="item.onSale"></b-input>
<br>
</div>
<br>
Price:
<b-input v-model="item.price"></b-input>
<br>
<b-field class="file">
<b-upload v-model="item.file" expanded v-if="createType === 0">
<a class="button is-primary is-fullwidth">
<b-icon icon="upload"></b-icon>
<span>{{ item.file.name || "Upload .PNG of modified template"}}</span>
</a>
</b-upload>
</b-field>
<b-field class="file">
<b-upload v-model="item.fileObj" expanded v-if="createType === 0">
<a class="button is-primary is-fullwidth">
<b-icon icon="upload"></b-icon>
<span>{{ item.fileObj.name || "Upload .OBJ of modified template"}}</span>
</a>
</b-upload>
</b-field>
<b-button v-if="createType === 0" @click="submitItem" :loading="loading">Submit</b-button>
<b-button v-if="createType === 1" @click="submitItem" :loading="loading">Submit</b-button>
<b-button v-if="createType === 2" @click="submitItem" :loading="loading">Submit</b-button>
<b-button v-if="createType === 3" @click="submitItem" :loading="loading">Submit</b-button>
</div>
</main>
</template>
<script>
import AjaxErrorHandler from "../../assets/js/errorHandler";
export default {
name: 'MarketplaceCreate',
data() {
return {
createType: 0,
stage: 1,
loading: false,
item: {
file: '',
fileObj: '',
files: [],
dropFiles: null,
name: 'Item',
limited: false,
onSale: false,
onSalePrice: 0,
quantity: 0,
price: 100,
description: ''
}
}
},
methods: {
submitItem() {
this.loading = true
const data = new FormData();
data.append('name', this.item.name);
data.append('price', this.item.price);
data.append('image', this.item.file);
data.append('fileObj', this.item.fileObj);
data.append('description', this.item.description);
data.append('onSale', this.item.onSale);
data.append('onSalePrice', this.item.onSalePrice);
data.append('limited', this.item.limited);
data.append('quantityAllowed', this.item.quantity);
this.axios.post(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'marketplace/upload/' + this.createType, data)
.then(() => {
this.loading = false
}).catch((e) => {
this.loading = false
AjaxErrorHandler(this.$store)(e)
})
}
}
}
</script>

View file

@ -0,0 +1,5 @@
<template>
<main>
asdsd
</main>
</template>

View file

@ -1,13 +1,17 @@
<template>
<main>
<div class="columns is-centered">
<div class="column is-4">
<div class="column is-4 is-vcentered has-text-centered">
<h1 class="title has-text-centered">{{$store.state.user.username}}</h1>
<div class="box">
<img :src="'https://cdn.kaverti.com/user/avatars/full/' + $store.state.user.avatar + '.png'" :alt="$store.state.user.username + '\'s avatar'" width="50%">
<p>{{$store.state.user.username}}</p>
</div>
<div class="box">
Blog posts go here
</div>
</div>
<div class="column is-6">
<h1 class="title has-text-centered">{{$t('home.globalWall')}}</h1>
<div class="card">
<div class="card-content">
test