Commit 6e977361 by 张立顺

Merge branch 'release/venus-usedcar-h5/1.0.0' of 192.168.3.233:monorepo/venus in…

…to release/venus-usedcar-h5/1.0.0
2 parents d04b5be0 11d772ee
Pipeline #183 for 6e977361 failed in 0 seconds
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, computed, ref } from "vue"; import { computed, onMounted, ref } from "vue";
import { uploadFile } from "@/utils/upload.js"; import { uploadFile } from "@/utils/upload.js";
import { showToast } from "vant"; import { showToast } from "vant";
const props = defineProps({ const props = defineProps({
item: { item: {
type: Object, type: Object,
default: () => { }, default: () => {},
}, },
}); });
...@@ -50,11 +51,11 @@ async function onFileChange(ev: Event) { ...@@ -50,11 +51,11 @@ async function onFileChange(ev: Event) {
if (!file) return; if (!file) return;
const maxSize10MB = 10 * 1024 * 1024; const maxSize10MB = 10 * 1024 * 1024;
const maxSize100MB = 100 * 1024 * 1024; const maxSize100MB = 100 * 1024 * 1024;
if (props.item.interactionType == 'image_upload' && file.size > maxSize10MB) { if (props.item.interactionType == "image_upload" && file.size > maxSize10MB) {
showToast("文件大小不能超过10MB"); showToast("文件大小不能超过10MB");
return; return;
} }
if (props.item.interactionType == 'video_upload' && file.size > maxSize100MB) { if (props.item.interactionType == "video_upload" && file.size > maxSize100MB) {
showToast("文件大小不能超过100MB"); showToast("文件大小不能超过100MB");
return; return;
} }
...@@ -109,64 +110,95 @@ function previewVideo(url: string) { ...@@ -109,64 +110,95 @@ function previewVideo(url: string) {
</script> </script>
<template> <template>
<div> <div>
<van-overlay :show="uploading" teleport="#vant-portal-host" z-index="2000"> <van-overlay :show="uploading"
<div class="loadingBox"> teleport="#vant-portal-host"
<van-loading color="#1989fa" size="24px" vertical>上传中...</van-loading> z-index="2000">
</div> <div class="loadingBox">
</van-overlay> <van-loading color="#1989fa"
size="24px"
<!-- 图片预览 --> vertical>
<van-image-preview v-model:show="imagePreview" :images="previewImagesList"></van-image-preview> 上传中...
</van-loading>
<!-- 视频预览 --> </div>
<van-image-preview v-model:show="videoShow" :images="sourceUrl" :close-on-click-image="false"> </van-overlay>
<template #image="{ src }">
<video style="width: 100%;" controls> <!-- 图片预览 -->
<source :src="src" /> <van-image-preview v-model:show="imagePreview" :images="previewImagesList"></van-image-preview>
</video>
</template> <!-- 视频预览 -->
</van-image-preview> <van-image-preview v-model:show="videoShow"
:close-on-click-image="false"
<div class="buttonSelect"> :closeable="true"
<div class="title"> :images="sourceUrl">
<div class="titleContent"> <template #image="{ src }">
<span v-if="item.required === 1" class="isRequired">*</span> <video controls style="width: 100%;">
<span>{{ item.nodeName }}</span> <source :src="src" />
</div> </video>
<div v-if="validationRules.maxCount && validationRules.maxCount.length > 1 && item.interactionType == 'image_upload'" </template>
class="titleTip"> </van-image-preview>
有损伤请拍摄图片,无损伤请忽略
</div> <div class="buttonSelect">
</div> <div class="title">
<input ref="fileInputRef" :accept="item.interactionType == 'image_upload' ? 'image/*' : 'video/*'" <div class="titleContent">
class="hidden-input" type="file" @change="onFileChange"> <span v-if="item.required === 1" class="isRequired">*</span>
<div class="uploadPage"> <span>{{ item.nodeName }}</span>
<div v-if="(validationRules.maxCount || 3) > pickerValue.length" class="uploadBox" @click="pickFile"> </div>
<van-icon class="plusBox" color="#999999" name="plus" size="24" /> <div v-if="validationRules.maxCount && validationRules.maxCount.length > 1 && item.interactionType == 'image_upload'"
<div class="uploadTxt"> class="titleTip">
{{ item.interactionType == 'image_upload' ? '添加照片' : '添加视频' }} 有损伤请拍摄图片,无损伤请忽略
</div> </div>
</div> </div>
<div v-for="(url, index) in pickerValue" :key="index" class="uploadBox"> <input ref="fileInputRef"
<!-- 删除按钮 --> :accept="item.interactionType == 'image_upload' ? 'image/*' : 'video/*'"
<div class="deleteBox" @click="handleDelete(url)"> class="hidden-input"
<van-icon color="#999999" name="clear" size="20" /> type="file"
</div> @change="onFileChange">
<!-- 图片 --> <div class="uploadPage">
<van-image v-if="item.interactionType == 'image_upload'" :src="url" class="uploadBoxImg" width="96" <div v-if="(validationRules.maxCount || 3) > pickerValue.length"
height="96" radius="8px" @click="previewImage(url)" /> class="uploadBox"
<!-- 视频 --> @click="pickFile">
<video v-if="item.interactionType == 'video_upload'" :src="url" class="uploadBoxImg" controls> <van-icon class="plusBox"
您的浏览器不支持 video 标签。 color="#999999"
</video> name="plus"
<!-- 点击视频预览 --> size="24" />
<div v-if="item.interactionType == 'video_upload'" class="videoPreviewBox" <div class="uploadTxt">
@click="previewVideo(url)"></div> {{ item.interactionType == 'image_upload' ? '添加照片' : '添加视频' }}
</div> </div>
</div> </div>
</div> <div v-for="(url, index) in pickerValue"
</div> :key="index"
class="uploadBox">
<!-- 删除按钮 -->
<div class="deleteBox" @click="handleDelete(url)">
<van-icon color="#999999"
name="clear"
size="20" />
</div>
<!-- 图片 -->
<van-image v-if="item.interactionType == 'image_upload'"
class="uploadBoxImg"
height="96"
radius="8px"
:src="url"
width="96"
@click="previewImage(url)" />
<!-- 视频 -->
<video v-if="item.interactionType == 'video_upload'"
class="uploadBoxImg"
controls
:src="url">
您的浏览器不支持 video 标签。
</video>
<!-- 点击视频预览 -->
<div v-if="item.interactionType == 'video_upload'"
class="videoPreviewBox"
@click="previewVideo(url)">
</div>
</div>
</div>
</div>
</div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -138,9 +138,29 @@ onActivated(() => { ...@@ -138,9 +138,29 @@ onActivated(() => {
<div class="report-page"> <div class="report-page">
<PageTop> <PageTop>
<div class="search-wrap"> <div class="search-wrap">
<van-search v-model="keyword" <div class="round-search">
placeholder="搜索报告号、车牌号、车型名称" <div class="round-search__content">
shape="round" /> <van-icon class="round-search__leading"
color="#969799"
name="search"
size="16" />
<input v-model="keyword"
autocomplete="off"
class="round-search__input"
enterkeyhint="search"
placeholder="搜索报告号、车牌号、车型名称"
type="search" />
<button v-show="keyword"
aria-label="清除"
class="round-search__clear"
type="button"
@click="keyword = ''">
<van-icon color="#c8c9cc"
name="clear"
size="18" />
</button>
</div>
</div>
</div> </div>
</PageTop> </PageTop>
...@@ -222,17 +242,72 @@ onActivated(() => { ...@@ -222,17 +242,72 @@ onActivated(() => {
.search-wrap { .search-wrap {
padding: 0 12px; padding: 0 12px;
}
:deep(.van-search) { .round-search {
padding: 0; display: flex;
background: transparent; align-items: center;
} box-sizing: border-box;
padding: 0;
background: transparent;
}
:deep(.van-search__content) { .round-search__content {
background: #fff; display: flex;
flex: 1;
align-items: center;
box-sizing: border-box;
height: 34px;
padding: 0 8px 0 12px;
background: #fff;
border-radius: 999px;
}
.round-search__leading {
flex-shrink: 0;
margin-right: 8px;
line-height: 1;
}
.round-search__input {
flex: 1;
width: 0;
height: 34px;
padding: 0;
font-size: 14px;
line-height: 34px;
color: #323233;
background: transparent;
border: 0;
outline: none;
-webkit-appearance: none;
appearance: none;
&::placeholder {
color: #c8c9cc;
} }
} }
.round-search__input::-webkit-search-decoration,
.round-search__input::-webkit-search-cancel-button,
.round-search__input::-webkit-search-results-button,
.round-search__input::-webkit-search-results-decoration {
display: none;
}
.round-search__clear {
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
padding: 0;
margin-left: 4px;
line-height: 1;
cursor: pointer;
background: transparent;
border: 0;
}
.list-wrap { .list-wrap {
flex: 1; flex: 1;
padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
......
...@@ -281,12 +281,31 @@ void onRefresh(); ...@@ -281,12 +281,31 @@ void onRefresh();
<span class="count">·{{ t.count }}</span> <span class="count">·{{ t.count }}</span>
</div> </div>
</div> </div>
<!-- 搜索框(同顶部背景容器) --> <!-- 搜索框(同顶部背景容器,手写替代 van-search) -->
<div class="search-wrap"> <div class="search-wrap">
<van-search v-model="keyword" <div class="round-search">
:left-icon="searchIcon" <div class="round-search__content">
placeholder="搜索车牌号、VIN码、车型名称" <img alt=""
shape="round" /> aria-hidden="true"
class="round-search__icon"
:src="searchIcon" />
<input v-model="keyword"
autocomplete="off"
class="round-search__input"
enterkeyhint="search"
placeholder="搜索车牌号、VIN码、车型名称"
type="search" />
<button v-show="keyword"
aria-label="清除"
class="round-search__clear"
type="button"
@click="keyword = ''">
<van-icon color="#c8c9cc"
name="clear"
size="18" />
</button>
</div>
</div>
</div> </div>
</PageTop> </PageTop>
...@@ -441,17 +460,74 @@ void onRefresh(); ...@@ -441,17 +460,74 @@ void onRefresh();
.search-wrap { .search-wrap {
width: 100%; width: 100%;
padding: 0 12px; padding: 0 12px;
}
:deep(.van-search) { .round-search {
padding: 0; display: flex;
background: transparent; align-items: center;
} box-sizing: border-box;
padding: 0;
background: transparent;
}
.round-search__content {
display: flex;
flex: 1;
align-items: center;
box-sizing: border-box;
height: 34px;
padding: 0 8px 0 12px;
background: #fff;
border-radius: 999px;
}
.round-search__icon {
flex-shrink: 0;
width: 16px;
height: 16px;
margin-right: 8px;
object-fit: contain;
}
:deep(.van-search__content) { .round-search__input {
background: #fff; flex: 1;
width: 0;
height: 34px;
padding: 0;
font-size: 14px;
line-height: 34px;
color: #323233;
background: transparent;
border: 0;
outline: none;
-webkit-appearance: none;
appearance: none;
&::placeholder {
color: #c8c9cc;
} }
} }
.round-search__input::-webkit-search-decoration,
.round-search__input::-webkit-search-cancel-button,
.round-search__input::-webkit-search-results-button,
.round-search__input::-webkit-search-results-decoration {
display: none;
}
.round-search__clear {
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
padding: 0;
margin-left: 4px;
line-height: 1;
cursor: pointer;
background: transparent;
border: 0;
}
.list-wrap { .list-wrap {
flex: 1; flex: 1;
padding: 12px; padding: 12px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!