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;
} }
...@@ -110,9 +111,15 @@ function previewVideo(url: string) { ...@@ -110,9 +111,15 @@ function previewVideo(url: string) {
<template> <template>
<div> <div>
<van-overlay :show="uploading" teleport="#vant-portal-host" z-index="2000"> <van-overlay :show="uploading"
teleport="#vant-portal-host"
z-index="2000">
<div class="loadingBox"> <div class="loadingBox">
<van-loading color="#1989fa" size="24px" vertical>上传中...</van-loading> <van-loading color="#1989fa"
size="24px"
vertical>
上传中...
</van-loading>
</div> </div>
</van-overlay> </van-overlay>
...@@ -120,9 +127,12 @@ function previewVideo(url: string) { ...@@ -120,9 +127,12 @@ function previewVideo(url: string) {
<van-image-preview v-model:show="imagePreview" :images="previewImagesList"></van-image-preview> <van-image-preview v-model:show="imagePreview" :images="previewImagesList"></van-image-preview>
<!-- 视频预览 --> <!-- 视频预览 -->
<van-image-preview v-model:show="videoShow" :images="sourceUrl" :close-on-click-image="false"> <van-image-preview v-model:show="videoShow"
:close-on-click-image="false"
:closeable="true"
:images="sourceUrl">
<template #image="{ src }"> <template #image="{ src }">
<video style="width: 100%;" controls> <video controls style="width: 100%;">
<source :src="src" /> <source :src="src" />
</video> </video>
</template> </template>
...@@ -139,30 +149,52 @@ function previewVideo(url: string) { ...@@ -139,30 +149,52 @@ function previewVideo(url: string) {
有损伤请拍摄图片,无损伤请忽略 有损伤请拍摄图片,无损伤请忽略
</div> </div>
</div> </div>
<input ref="fileInputRef" :accept="item.interactionType == 'image_upload' ? 'image/*' : 'video/*'" <input ref="fileInputRef"
class="hidden-input" type="file" @change="onFileChange"> :accept="item.interactionType == 'image_upload' ? 'image/*' : 'video/*'"
class="hidden-input"
type="file"
@change="onFileChange">
<div class="uploadPage"> <div class="uploadPage">
<div v-if="(validationRules.maxCount || 3) > pickerValue.length" class="uploadBox" @click="pickFile"> <div v-if="(validationRules.maxCount || 3) > pickerValue.length"
<van-icon class="plusBox" color="#999999" name="plus" size="24" /> class="uploadBox"
@click="pickFile">
<van-icon class="plusBox"
color="#999999"
name="plus"
size="24" />
<div class="uploadTxt"> <div class="uploadTxt">
{{ item.interactionType == 'image_upload' ? '添加照片' : '添加视频' }} {{ item.interactionType == 'image_upload' ? '添加照片' : '添加视频' }}
</div> </div>
</div> </div>
<div v-for="(url, index) in pickerValue" :key="index" class="uploadBox"> <div v-for="(url, index) in pickerValue"
:key="index"
class="uploadBox">
<!-- 删除按钮 --> <!-- 删除按钮 -->
<div class="deleteBox" @click="handleDelete(url)"> <div class="deleteBox" @click="handleDelete(url)">
<van-icon color="#999999" name="clear" size="20" /> <van-icon color="#999999"
name="clear"
size="20" />
</div> </div>
<!-- 图片 --> <!-- 图片 -->
<van-image v-if="item.interactionType == 'image_upload'" :src="url" class="uploadBoxImg" width="96" <van-image v-if="item.interactionType == 'image_upload'"
height="96" radius="8px" @click="previewImage(url)" /> class="uploadBoxImg"
height="96"
radius="8px"
:src="url"
width="96"
@click="previewImage(url)" />
<!-- 视频 --> <!-- 视频 -->
<video v-if="item.interactionType == 'video_upload'" :src="url" class="uploadBoxImg" controls> <video v-if="item.interactionType == 'video_upload'"
class="uploadBoxImg"
controls
:src="url">
您的浏览器不支持 video 标签。 您的浏览器不支持 video 标签。
</video> </video>
<!-- 点击视频预览 --> <!-- 点击视频预览 -->
<div v-if="item.interactionType == 'video_upload'" class="videoPreviewBox" <div v-if="item.interactionType == 'video_upload'"
@click="previewVideo(url)"></div> class="videoPreviewBox"
@click="previewVideo(url)">
</div>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -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">
<div class="round-search__content">
<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="搜索报告号、车牌号、车型名称" placeholder="搜索报告号、车牌号、车型名称"
shape="round" /> 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 {
display: flex;
align-items: center;
box-sizing: border-box;
padding: 0; padding: 0;
background: transparent; background: transparent;
} }
:deep(.van-search__content) { .round-search__content {
display: flex;
flex: 1;
align-items: center;
box-sizing: border-box;
height: 34px;
padding: 0 8px 0 12px;
background: #fff; 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">
<img alt=""
aria-hidden="true"
class="round-search__icon"
:src="searchIcon" />
<input v-model="keyword"
autocomplete="off"
class="round-search__input"
enterkeyhint="search"
placeholder="搜索车牌号、VIN码、车型名称" placeholder="搜索车牌号、VIN码、车型名称"
shape="round" /> 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 {
display: flex;
align-items: center;
box-sizing: border-box;
padding: 0; padding: 0;
background: transparent; background: transparent;
} }
:deep(.van-search__content) { .round-search__content {
display: flex;
flex: 1;
align-items: center;
box-sizing: border-box;
height: 34px;
padding: 0 8px 0 12px;
background: #fff; background: #fff;
border-radius: 999px;
}
.round-search__icon {
flex-shrink: 0;
width: 16px;
height: 16px;
margin-right: 8px;
object-fit: contain;
}
.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; padding: 12px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!