Последняя версия с сервера прошлого разработчика
This commit is contained in:
171
resources/js/Pages/Image/Create.vue
Executable file
171
resources/js/Pages/Image/Create.vue
Executable file
@@ -0,0 +1,171 @@
|
||||
<template>
|
||||
<meta-head title="Загрузить изображение"></meta-head>
|
||||
<div class="mt-16 container mx-auto px-2 md:px-6 2xl:px-28 buttons-filter-line">
|
||||
<form class=" bg-indigo-200 shadow-classic rounded-md p-5" @submit.prevent="submit">
|
||||
<div class="mb-4 flex items-center text-gray-light text-lg font-medium">
|
||||
<link-back class="default block hover:underline">
|
||||
Вернуться
|
||||
</link-back>
|
||||
<span class="px-3">/</span>
|
||||
<h1 class="text-gray">
|
||||
Загрузка изображения
|
||||
</h1>
|
||||
</div>
|
||||
<div class="space-y-5">
|
||||
<div class="flex flex-col">
|
||||
<text-input v-model="form.title" :error="form.errors.title"
|
||||
type="text" class="focus:ring-4 focus:ring-offset-1 focus:ring-orange focus:ring-opacity-20 focus:ring-offset-orange focus:border-transparent text-gray border border-indigo-300 bg-indigo-200 rounded-md placeholder-gray-light"
|
||||
label="Название"
|
||||
/>
|
||||
<warning-text />
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<textarea-input v-model="form.body" :error="form.errors.body"
|
||||
class="focus:ring-4 focus:ring-offset-1 focus:ring-orange focus:ring-opacity-20 focus:ring-offset-orange focus:border-transparent text-gray border border-indigo-300 bg-indigo-200 rounded-md" cols="30"
|
||||
rows="4" label="Описание"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<file-input-multiple
|
||||
v-model="form.photos"
|
||||
accept="image/png, image/jpeg, image/jpg"
|
||||
:error="form.errors.photos"
|
||||
label="Выбрать изображения"
|
||||
/>
|
||||
</div>
|
||||
<div class="text-gray-light">
|
||||
<TagInput v-model="form.tags" />
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-gray-light text-lg mb-2">
|
||||
Тип контента
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-4">
|
||||
<div class="flex items-center">
|
||||
<input id="feed-paid-1" v-model="form.is_paid"
|
||||
value="0" type="radio"
|
||||
class="h-5 w-5 text-orange border-gray-light focus:ring-transparent focus:ring-offset-transparent"
|
||||
>
|
||||
<label for="feed-paid-1" class="select-none ml-3 text-gray">Бесплатный</label>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<input id="feed-paid-2" v-model="form.is_paid"
|
||||
value="1" type="radio"
|
||||
class="h-5 w-5 text-orange border-gray-light focus:ring-transparent focus:ring-offset-transparent"
|
||||
>
|
||||
<label for="feed-paid-2" class="select-none ml-3 text-gray">Эксклюзивный</label>
|
||||
</div>
|
||||
<div v-if="authUser.private" class="flex items-center">
|
||||
<input id="feed-paid-3" v-model="form.is_paid"
|
||||
value="2" type="radio"
|
||||
class="h-5 w-5 text-orange border-gray-light focus:ring-transparent focus:ring-offset-transparent"
|
||||
>
|
||||
<label for="feed-paid-3" class="select-none ml-3 text-gray">Доступен по личной подписке</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="flex items-center">
|
||||
<input id="is_adult_feed" v-model="form.is_adult"
|
||||
type="checkbox"
|
||||
class="h-5 w-5 text-orange border-gray-light focus:ring-transparent focus:ring-offset-transparent"
|
||||
>
|
||||
<label for="is_adult_feed" class="select-none ml-3 text-gray">Контент для взрослых</label>
|
||||
</div> -->
|
||||
|
||||
|
||||
<div v-if="form.is_paid == 1" class="space-y-5">
|
||||
<div class="flex flex-col">
|
||||
<text-input v-model="form.price" :error="form.errors.price"
|
||||
type="number" class="focus:ring-4 focus:ring-offset-1 focus:ring-orange focus:ring-opacity-20 focus:ring-offset-orange focus:border-transparent text-gray border border-indigo-300 bg-indigo-200 rounded-md placeholder-gray-light"
|
||||
label="Цена"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<file-input-multiple
|
||||
v-model="form.photos_paid"
|
||||
:error="form.errors.photos_paid"
|
||||
accept="image/png, image/jpeg, image/jpg"
|
||||
label="Выбрать изображения"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-12 flex flex-wrap -my-1 -mx-3">
|
||||
<progress
|
||||
v-if="form.progress"
|
||||
class="mx-3 my-1 w-full"
|
||||
:value="form.progress.percentage"
|
||||
max="100"
|
||||
>
|
||||
{{ form.progress.percentage }}%
|
||||
</progress>
|
||||
|
||||
<loading-button :loading="form.processing" class="mx-3 my-1 transition shadow-none hover:shadow-classic2 inline-flex items-center px-8 py-3 justify-center text-base rounded-md text-white bg-orange focus:outline-none"
|
||||
type="submit"
|
||||
>
|
||||
Создать
|
||||
</loading-button>
|
||||
<link-back class="mx-3 my-1 transition shadow-none hover:shadow-classic inline-flex items-center px-8 py-3 justify-center text-base rounded-md text-white bg-indigo-300 focus:outline-none">
|
||||
Отменить
|
||||
</link-back>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, computed } from 'vue'
|
||||
import { useForm, usePage } from '@inertiajs/inertia-vue3'
|
||||
|
||||
import Layout from '@/Shared/Layout.vue'
|
||||
import MetaHead from '@/Shared/MetaHead.vue'
|
||||
import TextInput from '@/Shared/Form/TextInput.vue'
|
||||
import FileInputMultiple from '@/Shared/Form/FileInputMultiple.vue'
|
||||
import TextareaInput from '@/Shared/Form/TextareaInput.vue'
|
||||
import TagInput from '@/Shared/Form/TagInput.vue'
|
||||
import LoadingButton from '@/Shared/Form/LoadingButton.vue'
|
||||
import LinkBack from '@/Shared/Misc/LinkBack.vue'
|
||||
import WarningText from '@/Shared/Misc/WarningText.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
MetaHead,
|
||||
TextInput,
|
||||
FileInputMultiple,
|
||||
LoadingButton,
|
||||
TextareaInput,
|
||||
LinkBack,
|
||||
TagInput,
|
||||
WarningText,
|
||||
},
|
||||
layout: Layout,
|
||||
|
||||
setup() {
|
||||
// let isFeedPaid = ref(0)
|
||||
// let openPaidBlock = ref(0)
|
||||
|
||||
const form = useForm({
|
||||
title: null,
|
||||
body: null,
|
||||
price: null,
|
||||
photos: null,
|
||||
photos_paid: null,
|
||||
tags: [],
|
||||
is_paid: 0,
|
||||
})
|
||||
|
||||
// watch(isFeedPaid, (value) => {
|
||||
// openPaidBlock.value = value
|
||||
// form.is_paid = value
|
||||
// })
|
||||
|
||||
const authUser = computed(() => usePage().props.value.auth.user)
|
||||
|
||||
const submit = () => {
|
||||
form.post(route('images.store'))
|
||||
}
|
||||
|
||||
return { form, submit, authUser }
|
||||
},
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user