Commit 4157e9b3 by 杨北旺

添加理赔系统模块上传模块

1 parent 0fe4bc1c
......@@ -59,3 +59,5 @@ fetchConfig(!isMock).then(res => {
render: h => h(App)
})
})
const IMAGE = 'https://img01.glsx.com.cn/weapp/resource/saas/h5/file-uploader/'
window.$imageBase = IMAGE
<template>
<div class="container">
<div class="wrapper">
<template v-for="(item, index) in list">
<div :key="index" class="pannel">
<!-- 菜单项 -->
<div class="header flex_scb" @click="openLine(item, index)">
<span>{{ item.title }}</span>
<van-icon v-if="currentIndex == index" color="#969799" name="arrow-down" />
<van-icon v-else color="#969799" name="arrow" />
</div>
<!-- 内容区域 -->
<div v-if="currentIndex == index" class="main">
<template v-if="item.spectical">
<div v-for="(el, inx) in item.content" :key="inx" class="widget">
<div class="label flex_ss">
<div class="til">{{ el.name }}</div>
<div v-if="el.tip" class="tip">{{ el.tip }}</div>
</div>
<div class="wrap flex_scb">
<div v-for="(ele, idx) in el.images" :key="idx" class="imageBox flex_ccc">
<img class="icon" :src="imageBase + ele.icon" />
<span class="tips">{{ ele.label }}</span>
<div class="opa_upload" @click="toClickUpoload(ele)">
<van-uploader max-count="1" :before-delete="beforeDelete" v-on:click-upload="beforeRead" :before-read="checkRead" :after-read="afterRread"></van-uploader>
</div>
</div>
</div>
</div>
</template>
<template v-else>
<div class="widget flex_ss flex_wrap">
<div v-for="(img, i) in item.content" :key="i" class="image_wrap" :style="{ width: size, height: size }" :class="[{ mar0: (i + 1) % 3 == 0 }]"></div>
<div :style="{ width: size, height: size }" class="upload_area flex_ccc">
<van-icon name="plus" size="20px" color="#999999" />
<span class="text">上传照片</span>
<div class="opa_upload">
<van-uploader max-count="4" :before-delete="beforeDelete" v-on:click-upload="beforeRead" :before-read="checkRead" :after-read="afterRread"></van-uploader>
</div>
</div>
</div>
</template>
</div>
</div>
</template>
</div>
<div class="sumbit_btn flex_ccc">传送图片</div>
</div>
</template>
<script>
export default {
name: 'cliaims',
data() {
return {
imageBase: '',
list: [
{
title: '基本资料',
content: [
{
name: '身份证照片',
tip: '',
images: [
{
prop: 'positive',
url: '',
label: '上传身份证人像面',
icon: 'claims_icon_1.png'
},
{
prop: 'reverse',
url: '',
label: '上传身份证国徽面',
icon: 'claims_icon_2.png'
}
]
},
{
name: '驾驶证',
tip: '',
images: [
{
prop: 'positive',
url: '',
label: '上传驾驶证',
icon: 'claims_icon_3.png'
}
]
},
{
name: '行驶证',
tip: '正本及副证年审合格页面出险时车辆在年审有效期内',
images: [
{
prop: 'positive',
url: '',
label: '上传行驶证',
icon: 'claims_icon_3.png'
}
]
},
{
name: '人车合照',
tip: '须清晰体现车牌、车辆全貌',
images: [
{
prop: 'positive',
url: '',
label: '上传人车合照',
icon: 'claims_icon_4.png'
}
]
},
{
name: '前挡车架号',
tip: '车架号清晰可见',
images: [
{
prop: 'positive',
url: '',
label: '上传前挡车架号',
icon: 'claims_icon_4.png'
}
]
}
],
spectical: true
},
{
title: '定损细节资料',
content: [],
spectical: false
},
{
title: '现场照片',
content: [],
spectical: false
},
{
title: '其他资料',
content: [],
spectical: false
}
],
currentIndex: 0,
size: '102px'
}
},
props: {},
created() {
this.imageBase = window.$imageBase
this.computedWidth()
},
methods: {
computedWidth() {
const screen = window.screen.width
const imageW = (screen - 16 * 4) / 3
this.size = `${imageW}px`
},
openLine(item, index) {
this.currentIndex = index
},
toClickUpoload(current){
console.log(current);
},
beforeRead(e) {},
checkRead(file) {
if (file.size > 1024) {
this.showLoading()
return true
}
return true
},
afterRread(file, e) {
console.log(file)
this.hideLoading()
// this.uploadImage(file)
},
beforeDelete(file, e) {
// this.currentDelImg = file.url
// this.deleteFile()
}
}
}
</script>
<style lang="scss" scoped>
.wrapper {
background: white;
.pannel {
border-top: 2px solid #f8f8f8;
.header {
padding: 13px 21px 13px 16px;
font-size: 18px;
font-weight: 500;
color: #323233;
}
.main {
padding: 16px;
background: #f8f8f8;
.widget {
margin-bottom: 16px;
.label {
margin-bottom: 10px;
.til {
font-size: 16px;
font-weight: 400;
color: #282829;
line-height: 22px;
}
.tip {
font-size: 12px;
font-weight: 400;
color: #999999;
margin-left: 8px;
line-height: 24px;
}
}
.wrap {
.imageBox {
width: 166.5px;
height: 104px;
background: #ffffff;
box-shadow: 0px 3px 10px 0px rgba(197, 202, 213, 0.25);
border-radius: 4px;
position: relative;
.icon {
width: 85px;
height: 56px;
}
.tips {
font-size: 12px;
font-weight: 400;
color: #656566;
line-height: 16px;
margin-top: 9px;
}
}
}
.upload_area {
width: 104px;
height: 104px;
background: rgba(0, 0, 0, 0.04);
border-radius: 4px;
position: relative;
.text {
font-size: 14px;
font-weight: 400;
color: #666666;
line-height: 22px;
margin-top: 10px;
}
}
.image_wrap {
display: inline-block;
border-radius: 4px;
margin-right: 16px;
margin-bottom: 16px;
}
.mar0 {
margin-right: 0;
}
}
.flex_wrap {
display: flex;
flex-wrap: wrap;
}
}
}
}
.sumbit_btn {
width: 69.33%;
height: 40px;
background: #00a77b;
border-radius: 20px;
font-size: 14px;
font-weight: 500;
color: #ffffff;
letter-spacing: 1px;
margin: 20px auto;
}
.opa_upload {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
opacity: 0;
z-index: 1;
}
.flex_scb {
display: flex;
align-items: center;
justify-content: space-between;
}
.flex_ss {
display: flex;
}
.flex_ccc {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
</style>
\ No newline at end of file
<template>
<div class="contaienr">
<div class="upload_box_wrapper">
<cliaims v-if="type == 'claims'"></cliaims>
<!-- <div class="upload_box_wrapper">
<div class="title flex_scb">
<span class="require">*</span>
<span>基础资料</span>
......@@ -20,86 +21,37 @@
</div>
</van-uploader>
</div>
</div>
</div> -->
</div>
</template>
<script>
import { upload } from '@/api'
const baseImg = 'https://img01.glsx.com.cn/weapp/resource/equity-h5-new/mini/'
import cliaims from './components/claims.vue'
export default {
components: {
cliaims
},
data() {
return {
imgBase: baseImg,
fileList: [
{
url: 'http://qcimg01.glsx.com.cn/group1/M00/00/6F/wKgD3mINtxWAV8xYAAF0Ps_hc1c683.png',
isImage: true
}
],
fileList: [],
uploadList: [],
fileURL: {},
loadingFinish: false,
size: '102px'
type: ''
}
},
created() {
this.computedWidth()
},
mounted() {
this.getQuery()
},
mounted() {},
methods: {
getQuery() {
return window.vm.$route.query
},
// 根据手机屏幕宽度计算图片宽度
computedWidth() {
const screen = window.screen.width
const imageW = (screen - (16 * 2 + 10 * 2 + 8 * 3)) / 3
this.size = `${imageW}px`
},
// 获取附件信息
getFileInof(packageCode, contractNo) {
upload.fileInfoApi({ packageCode }).then(res => {
this.uploadList = res.data
this.getFileValue(contractNo, res.data)
})
},
// 获取附件信息的值
getFileValue(contractNo, list) {
upload.fileDataApi({ contractNo }).then(res => {
if (res.code == 0) {
this.fileURL = {}
res.data.forEach(el => {
list.forEach(item => {
if (el.attachmentCode === item.attachmentCode) {
let name = `${item.attachmentCode}`
let newArr = []
el.attachmentFiles.forEach(str => {
let temp = {
url: str,
isImage: true
}
newArr.push(temp)
})
let obj = {
[name]: newArr
}
this.fileURL = Object.assign(this.fileURL, obj)
}
})
})
this.loadingFinish = true
}
})
const { type } = window.vm.$route.query
this.type = type
},
// 获取当前点击的位置
toClickUpoload() {
},
beforeRead(e) {
},
toClickUpoload() {},
beforeRead(e) {},
checkRead(file) {
if (file.size > 1024) {
this.showLoading()
......@@ -117,8 +69,9 @@ export default {
// 上传图片
uploadImage(file) {
const imgFile = file.content
//两种写法
//三种写法
// 1.substring字符串截取 2.split方法截取 比如:let temp = file.name.split('.');temp = temp[temp.length-1]
// 3.[].pop()
let fileName = file.file.name
let index = fileName.lastIndexOf('.')
fileName = fileName.substring(index + 1, fileName.length)
......@@ -138,108 +91,89 @@ export default {
// })
},
// 上传附件
uploadFile(url) {
let para = {
contractNo: this.contractNo,
attachmentCode: this.currentItem.attachmentCode,
attachmentType: this.currentItem.attachmentType,
attachmentFile: url
}
upload.uploadFileApi(para).then(res => {
this.hideLoading()
this.getFileInof(this.packageCode, this.contractNo)
})
},
uploadFile(url) {},
// 删除附件
deleteFile() {
let para = {
contractNo: this.contractNo,
attachmentFile: this.currentDelImg
}
upload.deleteFileApi(para).then(res => {
this.getFileInof(this.packageCode, this.contractNo)
})
}
deleteFile() {}
}
}
</script>
<style lang="scss" scoped>
.flex_ccc {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.flex_scb {
display: flex;
align-items: center;
}
.contaienr {
padding: 10px 16px;
.upload_box_wrapper {
width: 100%;
min-height: 156px;
padding-bottom: 16px;
background: #ffffff;
box-shadow: 0px 4px 8px 0px rgba(224, 224, 224, 0.5);
border-radius: 4px;
margin-bottom: 10px;
.title {
box-sizing: border-box;
padding: 16px 10px;
font-size: 16px;
color: #333333;
font-weight: 600;
.require {
font-size: 16px;
color: #fe4b00;
font-weight: 500;
}
}
.main_pannel {
box-sizing: border-box;
padding: 0 10px;
display: flex;
flex-wrap: wrap;
.box_wrap {
width: 102px;
height: 102px;
background: #f5f6fa;
> p {
font-size: 16px;
color: #999999;
font-weight: 400;
margin-top: 10px;
}
}
.deleteWrap {
position: absolute;
left: 0;
top: 0;
height: 20px;
width: 20px;
z-index: 999;
> img {
height: 20px;
width: 20px;
}
}
}
.main_pannel /deep/ .van-uploader__preview-delete {
left: 0;
width: 20px;
height: 20px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
background: #3975c6;
background-image: url('https://img01.glsx.com.cn/weapp/resource/equity-h5-new/mini/deleteIcon.png');
background-size: 20px 20px;
> i {
display: none;
}
}
}
}
// .flex_ccc {
// display: flex;
// flex-direction: column;
// align-items: center;
// justify-content: center;
// }
// .flex_scb {
// display: flex;
// align-items: center;
// }
// .contaienr {
// padding: 10px 16px;
// .upload_box_wrapper {
// width: 100%;
// min-height: 156px;
// padding-bottom: 16px;
// background: #ffffff;
// box-shadow: 0px 4px 8px 0px rgba(224, 224, 224, 0.5);
// border-radius: 4px;
// margin-bottom: 10px;
// .title {
// box-sizing: border-box;
// padding: 16px 10px;
// font-size: 16px;
// color: #333333;
// font-weight: 600;
// .require {
// font-size: 16px;
// color: #fe4b00;
// font-weight: 500;
// }
// }
// .main_pannel {
// box-sizing: border-box;
// padding: 0 10px;
// display: flex;
// flex-wrap: wrap;
// .box_wrap {
// width: 102px;
// height: 102px;
// background: #f5f6fa;
// > p {
// font-size: 16px;
// color: #999999;
// font-weight: 400;
// margin-top: 10px;
// }
// }
// .deleteWrap {
// position: absolute;
// left: 0;
// top: 0;
// height: 20px;
// width: 20px;
// z-index: 999;
// > img {
// height: 20px;
// width: 20px;
// }
// }
// }
// .main_pannel /deep/ .van-uploader__preview-delete {
// left: 0;
// width: 20px;
// height: 20px;
// border-radius: 50%;
// display: flex;
// align-items: center;
// justify-content: center;
// background: #3975c6;
// background-image: url('https://img01.glsx.com.cn/weapp/resource/equity-h5-new/mini/deleteIcon.png');
// background-size: 20px 20px;
// > i {
// display: none;
// }
// }
// }
// }
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!