Skip to content

Commit

Permalink
code upolad fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
saman-re committed Mar 28, 2021
1 parent c22a7b5 commit 8ca6031
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
7 changes: 3 additions & 4 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,9 @@ export const SUBMIT_CODE = {
// };

export const submitLargeCode = (axios, data) => {
//old_url:"'https://analysaur.ir/api/storage/file/'"
return axios.$post('/team/submission', data, {
headers: {
'content-type': 'multipart/form-data',
'content-type': 'multipart/form-data'
},
});
};
Expand All @@ -194,14 +193,14 @@ export const submitLargeCode = (axios, data) => {
//todo Check in code !
//Change Hesam
export const viewSubmissions = axios => {
return axios.$get('/challenge/submission/submissions');
return axios.$get('/team/submissions');
};

export const CHANGE_FINAL_SUBMISSION = {
name: 'CHANGE_FINAL_SUBMISSION',
method: 'put',
slug: 'id',
url: '/challenge/submission/change_final',
url: '/team/submission',
};

//games
Expand Down
3 changes: 2 additions & 1 deletion components/dashboard/submission/CodeSubmission.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ export default {
// };
this.loading = true;
// let { data } = await inst(config);
let { data } = await submitLargeCode(this.$axios, formData);
let data = await submitLargeCode(this.$axios, formData);
this.loading = false;
console.log(data);
if (data.status_code) {
if (data.status_code === 200) {
this.$toast.success('فایل با موفقیت آپلود شد.');
Expand Down
25 changes: 13 additions & 12 deletions components/dashboard/submission/SubmissionsList.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<template>
<div>
<v-data-table
:value="selected"
:headers="headers"
:items="submissions"
:page.sync="page"
Expand All @@ -14,7 +13,7 @@
@page-count="pageCount = $event"
>
<template v-slot:item.is_final="{ item }">
<v-btn icon :disabled="!canChangeSubmission" @click="changeFinal(item)">
<v-btn icon @click="changeFinal(item)">
<v-icon>
{{ item.is_final ? 'mdi-checkbox-marked' : 'mdi-checkbox-blank-outline' }}
</v-icon>
Expand All @@ -27,7 +26,7 @@
<language-icon :language="item.language" />
</template>
<template v-slot:item.user="{ item }">
{{ item.user.profile.firstname_fa + ' ' + item.user.profile.lastname_fa }}
<!-- {{ item.user.profile.firstname_fa + ' ' + item.user.profile.lastname_fa }} -->
</template>
<template v-slot:item.submit_time="{ item }">
<date-time-formatter :date="item.submit_time" />
Expand All @@ -48,19 +47,20 @@ import LanguageIcon from './LanguageIcon'
import { CHANGE_FINAL_SUBMISSION } from '../../../api'
import { mapState } from 'vuex'
import DateTimeFormatter from '../../DateTimeFormatter'
import {viewSubmissions} from "~/api/index";
export default {
components: { DateTimeFormatter, LanguageIcon, SubmissionStatus },
props: {
submissions: {
type: Array,
},
// props: {
// submissions: {
// type: Array,
// },
// },
async fetch(){
let data = await viewSubmissions(this.$axios)
console.log(data);
this.submissions=data.submissions
},
computed: {
...mapState({
selected: state => state.team.finalSubmission,
canChangeSubmission: state => state.games.challenge.can_change_submission,
}),
headers() {
return [
{
Expand All @@ -82,6 +82,7 @@ export default {
page: 1,
pageCount: 0,
itemsPerPage: 5,
submissions:[]
}
},
methods: {
Expand Down
3 changes: 1 addition & 2 deletions pages/dashboard/submissions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@
<script>
import SectionHeader from "~/components/SectionHeader";
import dashboardPageValidate from '../../mixins/dashboardPageValidate'
import DashboardPage from '../../components/dashboard/DashboardPage'
import CodeSubmission from '../../components/dashboard/submission/CodeSubmission'
import SubmissionsList from '../../components/dashboard/submission/SubmissionsList'
import { mapState } from 'vuex'
export default {
components: { CodeSubmission, DashboardPage, SubmissionsList,SectionHeader },
components: { CodeSubmission,SubmissionsList,SectionHeader },
layout: 'dashboard',
// mixins: [dashboardPageValidate('submissions')],
transition: 'fade-transition',
Expand Down

0 comments on commit 8ca6031

Please sign in to comment.