update:add ci cd files ==> do not edit those file
This commit is contained in:
@@ -0,0 +1,265 @@
|
||||
<template>
|
||||
<div>
|
||||
<CustomSubHeader>
|
||||
<CBreadcrumb class="border-0 mb-0">{{ title }}</CBreadcrumb>
|
||||
<CButton size="sm" color="primary" class="mr-auto" :to="{name: 'admin'}">برگشت به صفحه قبل</CButton>
|
||||
<!-- <CButton v-else size="sm" color="success" class="mr-1" @click="update">بروزرسانی</CButton>-->
|
||||
</CustomSubHeader>
|
||||
<CRow>
|
||||
<CCol lg="6">
|
||||
<CCard>
|
||||
<CCardHeader><h4>کاور صفحه درباره ما</h4></CCardHeader>
|
||||
<CCardBody>
|
||||
<!-- <h2>کاور صفحه درباره ما</h2>-->
|
||||
<!-- <el-divider></el-divider>-->
|
||||
<el-upload :show-file-list="false" :action="`/api/admin/setting/aboutUS`" class="avatar-uploader"
|
||||
name="file"
|
||||
:headers="{'Authorization' : `Bearer ${$auth.user.token}`}"
|
||||
:on-success="fileUploadSuccess"
|
||||
:on-progress="handleProcess" :on-error="fileUploadError">
|
||||
<img v-if="setting.aboutUS && !setting.aboutUS.includes('undefined')" :src="setting.aboutUS" class="avatar" alt="">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
</el-upload>
|
||||
<p class="mt-3 text-muted text-center">
|
||||
عکس 600*1920 باشد. در غیر این صورت اتوماتیک بریده می شود.
|
||||
</p>
|
||||
<p class="text-danger text-center" v-if="validation.aboutUS">{{ validation.aboutUS.msg }}</p>
|
||||
</CCardBody>
|
||||
</CCard>
|
||||
</CCol>
|
||||
<CCol lg="6">
|
||||
<CCard>
|
||||
<CCardHeader><h4>کاور صفحه فعالیت ها</h4></CCardHeader>
|
||||
<CCardBody>
|
||||
<!-- <h2>کاور صفحه فعالیت ها</h2>-->
|
||||
<!-- <el-divider></el-divider>-->
|
||||
<el-upload :show-file-list="false" :action="`/api/admin/setting/activity`" class="avatar-uploader"
|
||||
name="file"
|
||||
:headers="{'Authorization' : `Bearer ${$auth.user.token}`}"
|
||||
:on-success="fileUploadSuccess"
|
||||
:on-progress="handleProcess" :on-error="fileUploadError">
|
||||
<img v-if="setting.activity && !setting.activity.includes('undefined')" :src="setting.activity" class="avatar" alt="">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
</el-upload>
|
||||
<p class="mt-3 text-muted text-center">
|
||||
عکس 600*1920 باشد. در غیر این صورت اتوماتیک بریده می شود.
|
||||
</p>
|
||||
<p class="text-danger text-center" v-if="validation.activity">{{ validation.activity.msg }}</p>
|
||||
</CCardBody>
|
||||
</CCard>
|
||||
</CCol>
|
||||
<CCol lg="6">
|
||||
<CCard>
|
||||
<CCardHeader><h4>کاور صفحه پروژه ها</h4></CCardHeader>
|
||||
<CCardBody>
|
||||
<!-- <h2>کاور صفحه پروژه ها</h2>-->
|
||||
<!-- <el-divider></el-divider>-->
|
||||
<el-upload :show-file-list="false" :action="`/api/admin/setting/projects`" class="avatar-uploader"
|
||||
name="file"
|
||||
:headers="{'Authorization' : `Bearer ${$auth.user.token}`}"
|
||||
:on-success="fileUploadSuccess"
|
||||
:on-progress="handleProcess" :on-error="fileUploadError">
|
||||
<img v-if="setting.projects && !setting.projects.includes('undefined')" :src="setting.projects" class="avatar" alt="">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
</el-upload>
|
||||
<p class="mt-3 text-muted text-center">
|
||||
عکس 600*1920 باشد. در غیر این صورت اتوماتیک بریده می شود.
|
||||
</p>
|
||||
<p class="text-danger text-center" v-if="validation.projects">{{ validation.projects.msg }}</p>
|
||||
</CCardBody>
|
||||
</CCard>
|
||||
</CCol>
|
||||
<CCol lg="6">
|
||||
<CCard>
|
||||
<CCardHeader><h4>کاور صفحه گالری</h4></CCardHeader>
|
||||
<CCardBody>
|
||||
<!-- <h2>کاور صفحه گالری</h2>-->
|
||||
<!-- <el-divider></el-divider>-->
|
||||
<el-upload :show-file-list="false" :action="`/api/admin/setting/gallery`" class="avatar-uploader"
|
||||
name="file"
|
||||
:headers="{'Authorization' : `Bearer ${$auth.user.token}`}"
|
||||
:on-success="fileUploadSuccess"
|
||||
:on-progress="handleProcess" :on-error="fileUploadError">
|
||||
<img v-if="setting.gallery && !setting.gallery.includes('undefined')" :src="setting.gallery" class="avatar" alt="">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
</el-upload>
|
||||
<p class="mt-3 text-muted text-center">
|
||||
عکس 600*1920 باشد. در غیر این صورت اتوماتیک بریده می شود.
|
||||
</p>
|
||||
<p class="text-danger text-center" v-if="validation.gallery">{{ validation.gallery.msg }}</p>
|
||||
</CCardBody>
|
||||
</CCard>
|
||||
</CCol>
|
||||
<CCol lg="6">
|
||||
<CCard>
|
||||
<CCardHeader><h4>کاور صفحه کاتالوگ</h4></CCardHeader>
|
||||
<CCardBody>
|
||||
<!-- <h2>کاور صفحه کاتالوگ</h2>-->
|
||||
<!-- <el-divider></el-divider>-->
|
||||
<el-upload :show-file-list="false" :action="`/api/admin/setting/catalog`" class="avatar-uploader"
|
||||
name="file"
|
||||
:headers="{'Authorization' : `Bearer ${$auth.user.token}`}"
|
||||
:on-success="fileUploadSuccess"
|
||||
:on-progress="handleProcess" :on-error="fileUploadError">
|
||||
<img v-if="setting.catalog && !setting.catalog.includes('undefined')" :src="setting.catalog" class="avatar" alt="">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
</el-upload>
|
||||
<p class="mt-3 text-muted text-center">
|
||||
عکس 600*1920 باشد. در غیر این صورت اتوماتیک بریده می شود.
|
||||
</p>
|
||||
<p class="text-danger text-center" v-if="validation.catalog">{{ validation.catalog.msg }}</p>
|
||||
</CCardBody>
|
||||
</CCard>
|
||||
</CCol>
|
||||
<CCol lg="6">
|
||||
<CCard>
|
||||
<CCardHeader><h4>کاور صفحه رویداد</h4></CCardHeader>
|
||||
<CCardBody>
|
||||
<!-- <h2>کاور صفحه رویداد</h2>-->
|
||||
<!-- <el-divider></el-divider>-->
|
||||
<el-upload :show-file-list="false" :action="`/api/admin/setting/blogs`" class="avatar-uploader"
|
||||
name="file"
|
||||
:headers="{'Authorization' : `Bearer ${$auth.user.token}`}"
|
||||
:on-success="fileUploadSuccess"
|
||||
:on-progress="handleProcess" :on-error="fileUploadError">
|
||||
<img v-if="setting.blogs && !setting.blogs.includes('undefined')" :src="setting.blogs" class="avatar" alt="">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
</el-upload>
|
||||
<p class="mt-3 text-muted text-center">
|
||||
عکس 600*1920 باشد. در غیر این صورت اتوماتیک بریده می شود.
|
||||
</p>
|
||||
<p class="text-danger text-center" v-if="validation.blogs">{{ validation.blogs.msg }}</p>
|
||||
</CCardBody>
|
||||
</CCard>
|
||||
</CCol>
|
||||
</CRow>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
setting: null,
|
||||
loading: false,
|
||||
validation: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
return this.$route.params.team === 'new' ? 'افزودن عضو جدید' : 'مشاهده اطلاعات شخص'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
preview() {
|
||||
this.team.image = URL.createObjectURL(event.target.files[0])
|
||||
},
|
||||
post() {
|
||||
this.validation = {}
|
||||
|
||||
const data = new FormData()
|
||||
data.append('index', this.team.index)
|
||||
|
||||
data.append('fa_first_name', this.team.locale.fa.first_name)
|
||||
data.append('en_first_name', this.team.locale.en.first_name)
|
||||
|
||||
data.append('fa_last_name', this.team.locale.fa.last_name)
|
||||
data.append('en_last_name', this.team.locale.en.last_name)
|
||||
|
||||
data.append('fa_position', this.team.locale.fa.position)
|
||||
data.append('en_position', this.team.locale.en.position)
|
||||
|
||||
data.append('image', this.$refs.image.files[0])
|
||||
|
||||
this.$axios.post(`/api/admin/team`, data, this.axiosConfig)
|
||||
.then(response => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: 'عضو با موفقیت ایجاد شد.'
|
||||
})
|
||||
this.$router.push({name: 'admin-team'})
|
||||
})
|
||||
.catch(err => {
|
||||
if (err.response.status === 401) {
|
||||
return this.$message({
|
||||
type: 'error',
|
||||
message: 'لطفا دوباره وارد سیستم شوید.'
|
||||
})
|
||||
}
|
||||
if (err.response.status === 422) {
|
||||
this.validation = err.response.data.validation
|
||||
return this.$message({
|
||||
type: 'warning',
|
||||
message: 'پارامتر ها رو بررسی و دوباره تلاش کنید'
|
||||
})
|
||||
} else console.log(err.response.data)
|
||||
})
|
||||
},
|
||||
update() {
|
||||
this.validation = {}
|
||||
const data = new FormData()
|
||||
data.append('index', this.team.index)
|
||||
|
||||
data.append('fa_first_name', this.team.locale.fa.first_name)
|
||||
data.append('en_first_name', this.team.locale.en.first_name)
|
||||
|
||||
data.append('fa_last_name', this.team.locale.fa.last_name)
|
||||
data.append('en_last_name', this.team.locale.en.last_name)
|
||||
|
||||
data.append('fa_position', this.team.locale.fa.position)
|
||||
data.append('en_position', this.team.locale.en.position)
|
||||
|
||||
if (this.$refs.image.files[0]) data.append('image', this.$refs.image.files[0])
|
||||
|
||||
this.$axios.put(`/api/admin/team/${this.team._id}`, data, this.axiosConfig)
|
||||
.then(response => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: 'اطلاعات بروزرسانی شد.'
|
||||
})
|
||||
this.$refs.image.value = null
|
||||
this.$nuxt.refresh()
|
||||
})
|
||||
.catch(err => {
|
||||
if (err.response.status === 401) {
|
||||
return this.$message({
|
||||
type: 'error',
|
||||
message: 'لطفا دوباره وارد سیستم شوید.'
|
||||
})
|
||||
}
|
||||
if (err.response.status === 422) this.validation = err.response.data.validation
|
||||
else console.log(err.response.data)
|
||||
})
|
||||
},
|
||||
fileUploadSuccess(res, file, fileList) {
|
||||
this.loading = false;
|
||||
this.$nuxt.refresh();
|
||||
},
|
||||
handleProcess(err, file, fileList) {
|
||||
this.loading = true;
|
||||
},
|
||||
fileUploadError(err, file, fileList) {
|
||||
this.validation = JSON.parse(err.message).validation;
|
||||
},
|
||||
},
|
||||
head() {
|
||||
return {
|
||||
title: this.title
|
||||
}
|
||||
},
|
||||
layout: 'admin',
|
||||
async asyncData({$axios, params, error}) {
|
||||
try {
|
||||
const setting = await $axios.$get(`/api/admin/setting`)
|
||||
|
||||
return {
|
||||
setting
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
error({status: 404, message: 'page not found'})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user