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">
import { onMounted, computed, ref } from "vue";
import { computed, onMounted, ref } from "vue";
import { uploadFile } from "@/utils/upload.js";
import { showToast } from "vant";
const props = defineProps({
item: {
type: Object,
default: () => { },
default: () => {},
},
});
......@@ -50,11 +51,11 @@ async function onFileChange(ev: Event) {
if (!file) return;
const maxSize10MB = 10 * 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");
return;
}
if (props.item.interactionType == 'video_upload' && file.size > maxSize100MB) {
if (props.item.interactionType == "video_upload" && file.size > maxSize100MB) {
showToast("文件大小不能超过100MB");
return;
}
......@@ -109,64 +110,95 @@ function previewVideo(url: string) {
</script>
<template>
<div>
<van-overlay :show="uploading" teleport="#vant-portal-host" z-index="2000">
<div class="loadingBox">
<van-loading color="#1989fa" size="24px" vertical>上传中...</van-loading>
</div>
</van-overlay>
<!-- 图片预览 -->
<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">
<template #image="{ src }">
<video style="width: 100%;" controls>
<source :src="src" />
</video>
</template>
</van-image-preview>
<div class="buttonSelect">
<div class="title">
<div class="titleContent">
<span v-if="item.required === 1" class="isRequired">*</span>
<span>{{ item.nodeName }}</span>
</div>
<div v-if="validationRules.maxCount && validationRules.maxCount.length > 1 && item.interactionType == 'image_upload'"
class="titleTip">
有损伤请拍摄图片,无损伤请忽略
</div>
</div>
<input ref="fileInputRef" :accept="item.interactionType == 'image_upload' ? 'image/*' : 'video/*'"
class="hidden-input" type="file" @change="onFileChange">
<div class="uploadPage">
<div v-if="(validationRules.maxCount || 3) > pickerValue.length" class="uploadBox" @click="pickFile">
<van-icon class="plusBox" color="#999999" name="plus" size="24" />
<div class="uploadTxt">
{{ item.interactionType == 'image_upload' ? '添加照片' : '添加视频' }}
</div>
</div>
<div v-for="(url, index) in pickerValue" :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'" :src="url" class="uploadBoxImg" width="96"
height="96" radius="8px" @click="previewImage(url)" />
<!-- 视频 -->
<video v-if="item.interactionType == 'video_upload'" :src="url" class="uploadBoxImg" controls>
您的浏览器不支持 video 标签。
</video>
<!-- 点击视频预览 -->
<div v-if="item.interactionType == 'video_upload'" class="videoPreviewBox"
@click="previewVideo(url)"></div>
</div>
</div>
</div>
</div>
<div>
<van-overlay :show="uploading"
teleport="#vant-portal-host"
z-index="2000">
<div class="loadingBox">
<van-loading color="#1989fa"
size="24px"
vertical>
上传中...
</van-loading>
</div>
</van-overlay>
<!-- 图片预览 -->
<van-image-preview v-model:show="imagePreview" :images="previewImagesList"></van-image-preview>
<!-- 视频预览 -->
<van-image-preview v-model:show="videoShow"
:close-on-click-image="false"
:closeable="true"
:images="sourceUrl">
<template #image="{ src }">
<video controls style="width: 100%;">
<source :src="src" />
</video>
</template>
</van-image-preview>
<div class="buttonSelect">
<div class="title">
<div class="titleContent">
<span v-if="item.required === 1" class="isRequired">*</span>
<span>{{ item.nodeName }}</span>
</div>
<div v-if="validationRules.maxCount && validationRules.maxCount.length > 1 && item.interactionType == 'image_upload'"
class="titleTip">
有损伤请拍摄图片,无损伤请忽略
</div>
</div>
<input ref="fileInputRef"
:accept="item.interactionType == 'image_upload' ? 'image/*' : 'video/*'"
class="hidden-input"
type="file"
@change="onFileChange">
<div class="uploadPage">
<div v-if="(validationRules.maxCount || 3) > pickerValue.length"
class="uploadBox"
@click="pickFile">
<van-icon class="plusBox"
color="#999999"
name="plus"
size="24" />
<div class="uploadTxt">
{{ item.interactionType == 'image_upload' ? '添加照片' : '添加视频' }}
</div>
</div>
<div v-for="(url, index) in pickerValue"
: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>
<style lang="scss" scoped>
......
......@@ -138,9 +138,29 @@ onActivated(() => {
<div class="report-page">
<PageTop>
<div class="search-wrap">
<van-search v-model="keyword"
placeholder="搜索报告号、车牌号、车型名称"
shape="round" />
<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="搜索报告号、车牌号、车型名称"
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>
</PageTop>
......@@ -222,17 +242,72 @@ onActivated(() => {
.search-wrap {
padding: 0 12px;
}
:deep(.van-search) {
padding: 0;
background: transparent;
}
.round-search {
display: flex;
align-items: center;
box-sizing: border-box;
padding: 0;
background: transparent;
}
:deep(.van-search__content) {
background: #fff;
.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__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 {
flex: 1;
padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
......
......@@ -281,12 +281,31 @@ void onRefresh();
<span class="count">·{{ t.count }}</span>
</div>
</div>
<!-- 搜索框(同顶部背景容器) -->
<!-- 搜索框(同顶部背景容器,手写替代 van-search) -->
<div class="search-wrap">
<van-search v-model="keyword"
:left-icon="searchIcon"
placeholder="搜索车牌号、VIN码、车型名称"
shape="round" />
<div class="round-search">
<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码、车型名称"
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>
</PageTop>
......@@ -441,17 +460,74 @@ void onRefresh();
.search-wrap {
width: 100%;
padding: 0 12px;
}
:deep(.van-search) {
padding: 0;
background: transparent;
}
.round-search {
display: flex;
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) {
background: #fff;
.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 {
flex: 1;
padding: 12px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!