| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <div>
- <div class="bg-white shadow-md rounded-lg p-6">
- <h2 class="text-xl font-semibold text-gray-900 mb-4">上传试卷照片</h2>
- <form wire:submit.prevent="handleSubmit">
- {{-- 图片上传 --}}
- <div class="mb-6">
- <label class="block text-sm font-medium text-gray-700 mb-2">
- 试卷图片 <span class="text-red-500">*</span>
- </label>
- <div class="mt-1 flex justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-md hover:border-gray-400 transition-colors">
- <div class="space-y-1 text-center">
- <svg class="mx-auto h-12 w-12 text-gray-400" stroke="currentColor" fill="none" viewBox="0 0 48 48">
- <path d="M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
- </svg>
- <div class="flex text-sm text-gray-600">
- <label for="file-upload" class="relative cursor-pointer bg-white rounded-md font-medium text-blue-600 hover:text-blue-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-blue-500">
- <span>点击上传</span>
- <input id="file-upload" name="file-upload" type="file" class="sr-only" multiple accept="image/*" wire:model="uploadedImages">
- </label>
- <p class="pl-1">或拖拽文件到此处</p>
- </div>
- <p class="text-xs text-gray-500">支持 PNG、JPG、JPEG 格式,最多 10 张图片</p>
- </div>
- </div>
- {{-- 预览图片 --}}
- @if(count($uploadedImages) > 0)
- <div class="mt-4 grid grid-cols-2 md:grid-cols-4 gap-4">
- @foreach($uploadedImages as $index => $image)
- <div class="relative">
- <img src="{{ $image->temporaryUrl() }}" alt="预览" class="h-24 w-full object-cover rounded-md">
- <button type="button" wire:click="removeImage({{ $index }})" class="absolute top-1 right-1 bg-red-500 text-white rounded-full w-6 h-6 flex items-center justify-center text-xs hover:bg-red-600">
- ×
- </button>
- </div>
- @endforeach
- </div>
- @endif
- </div>
- {{-- 提交按钮 --}}
- <div class="flex justify-end space-x-3">
- <button type="button" wire:click="resetForm" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors">
- 重置
- </button>
- <button type="submit" wire:loading.attr="disabled" class="px-6 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed">
- @if($mode === 'chatgpt')
- <span wire:loading.remove>开始 GPT 识别</span>
- <span wire:loading>分析中...</span>
- @else
- <span wire:loading.remove>开始 OCR 识别</span>
- <span wire:loading>上传中...</span>
- @endif
- </button>
- </div>
- </form>
- </div>
- </div>
|