371 lines
7.7 KiB
Vue
371 lines
7.7 KiB
Vue
|
|
<template>
|
|||
|
|
<div class="alert-handle-page">
|
|||
|
|
<!-- 顶部导航栏 -->
|
|||
|
|
<div class="nav-bar">
|
|||
|
|
<van-icon name="arrow-left" class="nav-back" @click="goBack" />
|
|||
|
|
<div class="nav-title">{{ pageTitle }}</div>
|
|||
|
|
<div class="nav-placeholder"></div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<!-- 现场情况 -->
|
|||
|
|
<div class="section-card">
|
|||
|
|
<div class="section-title">现场情况</div>
|
|||
|
|
|
|||
|
|
<!-- 拍照和录视频按钮 -->
|
|||
|
|
<div class="action-buttons">
|
|||
|
|
<div class="action-btn" @click="handleTakePhoto">
|
|||
|
|
<van-icon name="photograph" class="action-icon" />
|
|||
|
|
<span>拍照</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="action-btn" @click="handleTakeVideo">
|
|||
|
|
<van-icon name="video-o" class="action-icon" />
|
|||
|
|
<span>录视频</span>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<!-- 照片预览 -->
|
|||
|
|
<div v-if="photos.length > 0" class="preview-section">
|
|||
|
|
<div class="preview-label">已拍照片:</div>
|
|||
|
|
<div class="photo-grid">
|
|||
|
|
<div v-for="(photo, index) in photos" :key="index" class="photo-item">
|
|||
|
|
<van-image :src="photo" fit="cover" class="photo-img">
|
|||
|
|
<template v-slot:loading>
|
|||
|
|
<van-loading type="spinner" size="20" />
|
|||
|
|
</template>
|
|||
|
|
</van-image>
|
|||
|
|
<van-icon name="close" class="photo-delete" @click="deletePhoto(index)" />
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<!-- 视频预览 -->
|
|||
|
|
<div v-if="videos.length > 0" class="preview-section">
|
|||
|
|
<div class="preview-label">已录视频:</div>
|
|||
|
|
<div class="video-list">
|
|||
|
|
<div v-for="(video, index) in videos" :key="index" class="video-item">
|
|||
|
|
<van-icon name="video-o" class="video-icon" />
|
|||
|
|
<span class="video-name">视频 {{ index + 1 }}</span>
|
|||
|
|
<span class="video-delete" @click="deleteVideo(index)">删除</span>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<!-- 反馈内容 -->
|
|||
|
|
<div class="section-card">
|
|||
|
|
<div class="section-title">反馈内容</div>
|
|||
|
|
<van-field
|
|||
|
|
v-model="feedbackText"
|
|||
|
|
type="textarea"
|
|||
|
|
placeholder="请输入现场处理情况和反馈内容..."
|
|||
|
|
rows="5"
|
|||
|
|
autosize
|
|||
|
|
maxlength="500"
|
|||
|
|
show-word-limit
|
|||
|
|
class="feedback-input"
|
|||
|
|
/>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<!-- 底部保存按钮 -->
|
|||
|
|
<div class="submit-bar">
|
|||
|
|
<van-button block round type="primary" class="submit-btn" @click="handleSave">
|
|||
|
|
保存
|
|||
|
|
</van-button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<script setup>
|
|||
|
|
import { ref, computed } from "vue";
|
|||
|
|
import { useRouter, useRoute } from "vue-router";
|
|||
|
|
import { Toast } from "vant";
|
|||
|
|
|
|||
|
|
const router = useRouter();
|
|||
|
|
const route = useRoute();
|
|||
|
|
|
|||
|
|
// 获取URL参数
|
|||
|
|
const alertId = route.query.id;
|
|||
|
|
const status = route.query.status;
|
|||
|
|
|
|||
|
|
// 页面标题
|
|||
|
|
const pageTitle = computed(() => {
|
|||
|
|
return status === "执行中" ? "立即反馈" : "立即处理";
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 表单数据
|
|||
|
|
const feedbackText = ref("");
|
|||
|
|
const photos = ref([]);
|
|||
|
|
const videos = ref([]);
|
|||
|
|
|
|||
|
|
// 返回
|
|||
|
|
function goBack() {
|
|||
|
|
router.back();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 拍照
|
|||
|
|
function handleTakePhoto() {
|
|||
|
|
try {
|
|||
|
|
if (window.bridge && window.bridge.pZ) {
|
|||
|
|
window.bridge.pZ("photo");
|
|||
|
|
} else {
|
|||
|
|
// H5 环境模拟
|
|||
|
|
const mockPhoto = "https://picsum.photos/400/300?random=" + Date.now();
|
|||
|
|
photos.value.push(mockPhoto);
|
|||
|
|
}
|
|||
|
|
} catch (err) {
|
|||
|
|
console.error("拍照失败:", err);
|
|||
|
|
Toast("请使用APP进行拍照");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 录视频
|
|||
|
|
function handleTakeVideo() {
|
|||
|
|
Toast("视频录制功能开发中...");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 删除照片
|
|||
|
|
function deletePhoto(index) {
|
|||
|
|
photos.value.splice(index, 1);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 删除视频
|
|||
|
|
function deleteVideo(index) {
|
|||
|
|
videos.value.splice(index, 1);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 保存反馈
|
|||
|
|
async function handleSave() {
|
|||
|
|
if (photos.value.length === 0 && videos.value.length === 0 && !feedbackText.value) {
|
|||
|
|
Toast("请至少上传照片或填写反馈内容");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
try {
|
|||
|
|
Toast.loading({
|
|||
|
|
message: "提交中...",
|
|||
|
|
forbidClick: true,
|
|||
|
|
duration: 0,
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 模拟提交
|
|||
|
|
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|||
|
|
|
|||
|
|
Toast.clear();
|
|||
|
|
Toast.success("保存成功!");
|
|||
|
|
setTimeout(() => {
|
|||
|
|
router.back();
|
|||
|
|
}, 1000);
|
|||
|
|
} catch (error) {
|
|||
|
|
Toast.clear();
|
|||
|
|
Toast.fail("保存失败,请重试");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 接收原生APP返回的图片
|
|||
|
|
function setimagebase64(base64) {
|
|||
|
|
photos.value.push(`data:image/jpeg;base64,${base64}`);
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
<style lang="scss" scoped>
|
|||
|
|
// 通用样式规范
|
|||
|
|
$primary-color: #2563eb;
|
|||
|
|
$primary-dark: #1d4ed8;
|
|||
|
|
$card-radius: 20px;
|
|||
|
|
$btn-radius: 16px;
|
|||
|
|
$card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|||
|
|
$text-gray: #64748b;
|
|||
|
|
$text-dark: #1e293b;
|
|||
|
|
$bg-gray: #f1f5f9;
|
|||
|
|
|
|||
|
|
.alert-handle-page {
|
|||
|
|
min-height: 100vh;
|
|||
|
|
background: $bg-gray;
|
|||
|
|
padding-bottom: 80px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.nav-bar {
|
|||
|
|
position: sticky;
|
|||
|
|
top: 0;
|
|||
|
|
z-index: 100;
|
|||
|
|
display: flex;
|
|||
|
|
align-items: center;
|
|||
|
|
justify-content: space-between;
|
|||
|
|
background: white;
|
|||
|
|
border-bottom: 1px solid #e2e8f0;
|
|||
|
|
padding: 12px 16px;
|
|||
|
|
|
|||
|
|
.nav-back {
|
|||
|
|
font-size: 24px;
|
|||
|
|
color: $text-dark;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.nav-title {
|
|||
|
|
font-size: 17px;
|
|||
|
|
font-weight: 600;
|
|||
|
|
color: $text-dark;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.nav-placeholder {
|
|||
|
|
width: 24px;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.section-card {
|
|||
|
|
background: white;
|
|||
|
|
border-radius: $card-radius;
|
|||
|
|
padding: 20px;
|
|||
|
|
margin: 16px;
|
|||
|
|
box-shadow: $card-shadow;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.section-title {
|
|||
|
|
font-size: 16px;
|
|||
|
|
font-weight: 600;
|
|||
|
|
color: $text-dark;
|
|||
|
|
margin-bottom: 20px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.action-buttons {
|
|||
|
|
display: flex;
|
|||
|
|
gap: 16px;
|
|||
|
|
margin-bottom: 20px;
|
|||
|
|
|
|||
|
|
.action-btn {
|
|||
|
|
flex: 1;
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: column;
|
|||
|
|
align-items: center;
|
|||
|
|
justify-content: center;
|
|||
|
|
padding: 20px;
|
|||
|
|
border: 2px solid $primary-color;
|
|||
|
|
border-radius: $btn-radius;
|
|||
|
|
color: $primary-color;
|
|||
|
|
transition: all 0.2s;
|
|||
|
|
cursor: pointer;
|
|||
|
|
|
|||
|
|
&:active {
|
|||
|
|
background: #eff6ff;
|
|||
|
|
transform: scale(0.98);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.action-icon {
|
|||
|
|
font-size: 32px;
|
|||
|
|
margin-bottom: 10px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
span {
|
|||
|
|
font-size: 14px;
|
|||
|
|
font-weight: 500;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.preview-section {
|
|||
|
|
margin-top: 20px;
|
|||
|
|
|
|||
|
|
.preview-label {
|
|||
|
|
font-size: 14px;
|
|||
|
|
color: $text-gray;
|
|||
|
|
margin-bottom: 12px;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.photo-grid {
|
|||
|
|
display: grid;
|
|||
|
|
grid-template-columns: repeat(3, 1fr);
|
|||
|
|
gap: 12px;
|
|||
|
|
|
|||
|
|
.photo-item {
|
|||
|
|
position: relative;
|
|||
|
|
aspect-ratio: 1;
|
|||
|
|
border-radius: 12px;
|
|||
|
|
overflow: hidden;
|
|||
|
|
|
|||
|
|
.photo-img {
|
|||
|
|
width: 100%;
|
|||
|
|
height: 100%;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.photo-delete {
|
|||
|
|
position: absolute;
|
|||
|
|
top: 6px;
|
|||
|
|
right: 6px;
|
|||
|
|
font-size: 18px;
|
|||
|
|
color: white;
|
|||
|
|
background: rgba(0, 0, 0, 0.5);
|
|||
|
|
border-radius: 50%;
|
|||
|
|
padding: 4px;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.video-list {
|
|||
|
|
.video-item {
|
|||
|
|
display: flex;
|
|||
|
|
align-items: center;
|
|||
|
|
padding: 14px;
|
|||
|
|
background: $bg-gray;
|
|||
|
|
border-radius: 12px;
|
|||
|
|
margin-bottom: 10px;
|
|||
|
|
|
|||
|
|
&:last-child {
|
|||
|
|
margin-bottom: 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.video-icon {
|
|||
|
|
font-size: 22px;
|
|||
|
|
color: $primary-color;
|
|||
|
|
margin-right: 12px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.video-name {
|
|||
|
|
flex: 1;
|
|||
|
|
font-size: 14px;
|
|||
|
|
color: $text-dark;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.video-delete {
|
|||
|
|
font-size: 14px;
|
|||
|
|
color: #ef4444;
|
|||
|
|
cursor: pointer;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.feedback-input {
|
|||
|
|
padding: 16px;
|
|||
|
|
background: $bg-gray;
|
|||
|
|
border-radius: 16px;
|
|||
|
|
|
|||
|
|
:deep(.van-field__control) {
|
|||
|
|
font-size: 14px;
|
|||
|
|
color: $text-dark;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
:deep(.van-field__word-limit) {
|
|||
|
|
text-align: right;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.submit-bar {
|
|||
|
|
position: fixed;
|
|||
|
|
bottom: 0;
|
|||
|
|
left: 0;
|
|||
|
|
right: 0;
|
|||
|
|
background: white;
|
|||
|
|
border-top: 1px solid #e2e8f0;
|
|||
|
|
padding: 12px 16px;
|
|||
|
|
padding-bottom: calc(12px + env(safe-area-inset-bottom));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.submit-btn {
|
|||
|
|
height: 48px;
|
|||
|
|
font-size: 16px;
|
|||
|
|
font-weight: 600;
|
|||
|
|
background: linear-gradient(135deg, $primary-color 0%, $primary-dark 100%);
|
|||
|
|
border: none;
|
|||
|
|
border-radius: $btn-radius;
|
|||
|
|
box-shadow: 0 4px 12px rgba($primary-color, 0.3);
|
|||
|
|
}
|
|||
|
|
</style>
|