|
|
@@ -1,57 +1,74 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <b-card-code title="新增活動">
|
|
|
- <b-form @submit.prevent>
|
|
|
+ <form-wizard color="#7367F0" :title="null" :subtitle="null" layout="vertical" finish-button-text="Submit"
|
|
|
+ back-button-text="Previous" class="wizard-vertical mb-3" @on-complete="formSubmitted">
|
|
|
+
|
|
|
+ <tab-content title="新增活動">
|
|
|
+
|
|
|
+ <b-form @submit.prevent>
|
|
|
+ <b-row>
|
|
|
+ <b-col cols="12">
|
|
|
+ <b-form-group label="活動名稱" label-for="activity-name" label-cols-md="4">
|
|
|
+ <b-form-input v-model="activity_name" id="activity-name" placeholder="活動名稱" />
|
|
|
+ </b-form-group>
|
|
|
+ </b-col>
|
|
|
+ <b-col cols="12">
|
|
|
+ <b-form-group label="活動時間" label-for="date" label-cols-md="4">
|
|
|
+ <b-form-input v-model="date" id="date" type="date" placeholder="活動時間" />
|
|
|
+ </b-form-group>
|
|
|
+ </b-col>
|
|
|
+ <b-col cols="12">
|
|
|
+ <b-form-group label="活動地點" label-for="place" label-cols-md="4">
|
|
|
+ <b-form-input v-model="place" id="place" placeholder="活動地點" />
|
|
|
+ </b-form-group>
|
|
|
+ </b-col>
|
|
|
+ <b-col cols="12">
|
|
|
+ <b-form-group label="報名截止時間" label-for="deadline" label-cols-md="4">
|
|
|
+ <b-form-input v-model="deadline" id="deadline" type="time" placeholder="報名截止時間" />
|
|
|
+ </b-form-group>
|
|
|
+ </b-col>
|
|
|
+
|
|
|
+ <!-- submit and reset -->
|
|
|
+ <b-col offset-md="4">
|
|
|
+ <b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" type="submit" variant="primary"
|
|
|
+ class="mr-1" @click="postData">
|
|
|
+ 送出
|
|
|
+ </b-button>
|
|
|
+ <b-button v-ripple.400="'rgba(186, 191, 199, 0.15)'" type="reset"
|
|
|
+ variant="outline-secondary">
|
|
|
+ 取消
|
|
|
+ </b-button>
|
|
|
+ </b-col>
|
|
|
+ </b-row>
|
|
|
+ </b-form>
|
|
|
+
|
|
|
+ </tab-content>
|
|
|
+
|
|
|
+ <tab-content title="匯入獎項列表">
|
|
|
<b-row>
|
|
|
- <b-col cols="12">
|
|
|
- <b-form-group label="活動名稱" label-for="activity-name" label-cols-md="4">
|
|
|
- <b-form-input v-model="activity_name" id="activity-name" placeholder="活動名稱" />
|
|
|
- </b-form-group>
|
|
|
- </b-col>
|
|
|
- <b-col cols="12">
|
|
|
- <b-form-group label="活動時間" label-for="date" label-cols-md="4">
|
|
|
- <b-form-input v-model="date" id="date" type="date" placeholder="活動時間" />
|
|
|
- </b-form-group>
|
|
|
- </b-col>
|
|
|
- <b-col cols="12">
|
|
|
- <b-form-group label="活動地點" label-for="place" label-cols-md="4">
|
|
|
- <b-form-input v-model="place" id="place" placeholder="活動地點" />
|
|
|
- </b-form-group>
|
|
|
- </b-col>
|
|
|
- <b-col cols="12">
|
|
|
- <b-form-group label="報名截止時間" label-for="deadline" label-cols-md="4">
|
|
|
- <b-form-input v-model="deadline" id="deadline" type="time" placeholder="報名截止時間" />
|
|
|
- </b-form-group>
|
|
|
+ <b-col>
|
|
|
+ <b-card title="匯入獎項列表">
|
|
|
+ <b-form-file ref="prizeList" placeholder="請將檔案拉至此處或是點擊欄位選擇檔案"
|
|
|
+ drop-placeholder="Drop file here..." accept=".xls, .xlsx, .csv"
|
|
|
+ @change="importFile($event, 'prize')"></b-form-file>
|
|
|
+ </b-card>
|
|
|
</b-col>
|
|
|
+ </b-row>
|
|
|
+ </tab-content>
|
|
|
|
|
|
- <!-- submit and reset -->
|
|
|
- <b-col offset-md="4">
|
|
|
- <b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" type="submit" variant="primary"
|
|
|
- class="mr-1" @click="postData">
|
|
|
- 送出
|
|
|
- </b-button>
|
|
|
- <b-button v-ripple.400="'rgba(186, 191, 199, 0.15)'" type="reset" variant="outline-secondary">
|
|
|
- 取消
|
|
|
- </b-button>
|
|
|
+ <tab-content title="匯入來賓列表">
|
|
|
+ <b-row>
|
|
|
+ <b-col>
|
|
|
+ <b-card title="匯入來賓列表">
|
|
|
+ <b-form-file ref="guestList" placeholder="請將檔案拉至此處或是點擊欄位選擇檔案"
|
|
|
+ drop-placeholder="Drop file here..." accept=".xls, .xlsx, .csv"
|
|
|
+ @change="importFile($event, 'guest')"></b-form-file>
|
|
|
+ </b-card>
|
|
|
</b-col>
|
|
|
</b-row>
|
|
|
- </b-form>
|
|
|
- </b-card-code>
|
|
|
-
|
|
|
- <b-row>
|
|
|
- <b-col md="6" lg="6">
|
|
|
- <b-card title="匯入獎項列表" class="mb-6">
|
|
|
- <b-form-file ref="prizeList" placeholder="請將檔案拉至此處或是點擊欄位選擇檔案" drop-placeholder="Drop file here..."
|
|
|
- accept=".xls, .xlsx, .csv" @change="importFile($event, 'prize')"></b-form-file>
|
|
|
- </b-card>
|
|
|
- </b-col>
|
|
|
- <b-col md="6" lg="6">
|
|
|
- <b-card title="匯入來賓列表" class="mb-6">
|
|
|
- <b-form-file ref="guestList" placeholder="請將檔案拉至此處或是點擊欄位選擇檔案" drop-placeholder="Drop file here..."
|
|
|
- accept=".xls, .xlsx, .csv" @change="importFile($event, 'guest')"></b-form-file>
|
|
|
- </b-card>
|
|
|
- </b-col>
|
|
|
- </b-row>
|
|
|
+ </tab-content>
|
|
|
+
|
|
|
+ </form-wizard>
|
|
|
|
|
|
<b-modal ref="confirm-modal" title="成功設定活動" centered ok-only ok-title="確認">
|
|
|
<b-card-text>
|
|
|
@@ -61,22 +78,28 @@
|
|
|
|
|
|
<b-modal ref="insert-success-modal" title="成功上傳" ok-only ok-title="確認">
|
|
|
<b-card-text>
|
|
|
- 成功上傳資料。
|
|
|
+ 上傳資料成功。
|
|
|
</b-card-text>
|
|
|
</b-modal>
|
|
|
- <!-- <div class="redirect-back">
|
|
|
- <b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" variant="primary" class="btn-icon" :to="{ name: 'activityList' }">
|
|
|
- 返回頁面
|
|
|
- </b-button>
|
|
|
- </div> -->
|
|
|
+
|
|
|
+ <b-modal ref="insert-fail-modal" title="沒有中獎" ok-only ok-title="確認">
|
|
|
+ <b-card-text>
|
|
|
+ 上傳資料失敗,{{ errorText }}。
|
|
|
+ </b-card-text>
|
|
|
+ </b-modal>
|
|
|
+
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { FormWizard, TabContent } from 'vue-form-wizard'
|
|
|
+import vSelect from 'vue-select'
|
|
|
+import 'vue-form-wizard/dist/vue-form-wizard.min.css'
|
|
|
+import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
|
|
|
import BCardCode from '@core/components/b-card-code'
|
|
|
import {
|
|
|
- BRow, BCol, BFormGroup, BFormInput, BFormCheckbox, BForm, BButton, BFormFile, BModal, BCardText, BCard
|
|
|
+ BRow, BCol, BFormGroup, BFormInput, BFormCheckbox, BForm, BButton, BFormFile, BModal, BCardText, BCard,
|
|
|
} from 'bootstrap-vue'
|
|
|
import Ripple from 'vue-ripple-directive'
|
|
|
import useJwt from '@/auth/jwt/useJwt'
|
|
|
@@ -85,6 +108,8 @@ import { getUserData } from '@/auth/utils'
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
+ FormWizard,
|
|
|
+ TabContent,
|
|
|
BCardCode,
|
|
|
BRow,
|
|
|
BCol,
|
|
|
@@ -97,6 +122,8 @@ export default {
|
|
|
BModal,
|
|
|
BCardText,
|
|
|
BCard,
|
|
|
+ vSelect,
|
|
|
+ ToastificationContent,
|
|
|
},
|
|
|
directives: {
|
|
|
Ripple,
|
|
|
@@ -108,7 +135,8 @@ export default {
|
|
|
date: '',
|
|
|
place: '',
|
|
|
deadline: '',
|
|
|
- successText: '',
|
|
|
+ isSuccess: false,
|
|
|
+ errorText: '',
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -134,23 +162,36 @@ export default {
|
|
|
formData.append('option', option);
|
|
|
formData.append('activity_id', this.$route.params.activity_id);
|
|
|
useJwt.postData('/api/activity/uploadFile', formData).then(response => {
|
|
|
- console.log(response.data);
|
|
|
- this.successText = response.data.success;
|
|
|
- this.$refs['insert-success-modal'].toggle();
|
|
|
- this.$refs[refOption].reset();
|
|
|
+ this.isSuccess = response.data.isSuccess;
|
|
|
+ if (this.isSuccess == true) {
|
|
|
+ this.$refs['insert-success-modal'].toggle();
|
|
|
+ this.$refs[refOption].reset();
|
|
|
+ } else if (this.isSuccess == false) {
|
|
|
+ console.log('issuccess false')
|
|
|
+ this.errorText = '匯入Excel檔案錯誤';
|
|
|
+ this.$refs['insert-fail-modal'].toggle();
|
|
|
+ }
|
|
|
}).catch(error => {
|
|
|
- console.log(error);
|
|
|
+ console.log('error: ' + error);
|
|
|
+ this.errorText = error;
|
|
|
+ this.$refs['insert-fail-modal'].toggle();
|
|
|
});
|
|
|
},
|
|
|
+ formSubmitted() {
|
|
|
+ this.$toast({
|
|
|
+ component: ToastificationContent,
|
|
|
+ props: {
|
|
|
+ title: '資料成功上傳',
|
|
|
+ icon: 'EditIcon',
|
|
|
+ variant: 'success',
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style>
|
|
|
-.redirect-back {
|
|
|
- position: fixed;
|
|
|
- bottom: 5%;
|
|
|
- right: 30px;
|
|
|
- z-index: 99;
|
|
|
-}
|
|
|
+<style lang="scss">
|
|
|
+@import '~@resources/scss/vue/libs/vue-wizard.scss';
|
|
|
+@import '~@resources/scss/vue/libs/vue-select.scss';
|
|
|
</style>
|