Commit 6a11cdd1 authored by 李晓兵's avatar 李晓兵

'附件上传'

parent a2703204
...@@ -10,6 +10,7 @@ module.exports = merge(prodEnv, { ...@@ -10,6 +10,7 @@ module.exports = merge(prodEnv, {
loginPath: '"http://180.104.121.66:8088/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=admin&password=" ', loginPath: '"http://180.104.121.66:8088/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=admin&password=" ',
basePath: '"http://180.104.121.66:8088/r/api/interface?sysName=XCMG_DEV&apiName="', basePath: '"http://180.104.121.66:8088/r/api/interface?sysName=XCMG_DEV&apiName="',
rootPath: '"http://180.104.121.66:8088/r/api"', rootPath: '"http://180.104.121.66:8088/r/api"',
filePath: '"http://180.104.121.66:8088/r/api/app/fileViewSvc?sysName=XCMG_DEV&apiName=file_view&"',
ocrPath:'"http://180.104.121.66:8088/r/api"', ocrPath:'"http://180.104.121.66:8088/r/api"',
file_url: '"http://hlsapp.hand-china.com/file/"', file_url: '"http://hlsapp.hand-china.com/file/"',
appId: '"com.hls.easy.car"', appId: '"com.hls.easy.car"',
......
...@@ -7,6 +7,7 @@ module.exports = { ...@@ -7,6 +7,7 @@ module.exports = {
loginPath: '"http://180.104.121.66:8088/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=admin&password=" ', loginPath: '"http://180.104.121.66:8088/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=admin&password=" ',
basePath: '"http://180.104.121.66:8088/r/api/interface?sysName=XCMG_DEV&apiName="', basePath: '"http://180.104.121.66:8088/r/api/interface?sysName=XCMG_DEV&apiName="',
rootPath: '"http://180.104.121.66:8088/r/api"', rootPath: '"http://180.104.121.66:8088/r/api"',
filePath: '"http://180.104.121.66:8088/r/api/app/fileViewSvc?sysName=XCMG_DEV&apiName=file_view&"',
ocrPath:'"http://180.104.121.66:8088/r/api"', ocrPath:'"http://180.104.121.66:8088/r/api"',
file_url: '"http://hlsapp.hand-china.com/file/"', file_url: '"http://hlsapp.hand-china.com/file/"',
appId: '"com.hls.easy.car"', appId: '"com.hls.easy.car"',
......
...@@ -198,13 +198,19 @@ ...@@ -198,13 +198,19 @@
<span>{{ list.description }}</span> <span>{{ list.description }}</span>
<div class="img-content"> <div class="img-content">
<!--待上传图片列表--> <!--待上传图片列表-->
<div v-for="(list, index) in upload_list" :key="index"> <div v-for="(item, index) in upload_list" v-if="item.check_id==list.check_id" :key="index" class="card-upload">
<img :src="list.picture" > <img :src="item.picture" >
<div class="close" @click="delete_pic(item.attachment_id)">
<img src="@/assets/userBind/deleteIcon.png">
</div>
</div> </div>
<!--从服务器上下载的图片--> <!--从服务器上下载的图片-->
<div v-for="item in dowload_list" class="card-upload"> <div v-for="item in dowload_list" >
<div v-for="(pic, index) in item" :key="index"> <div v-for="(pic, index) in item" :key="index" v-if="pic.check_id==list.check_id" class="card-upload">
<img :src="item.url" > <img :src="pic.url" >
<div class="close" @click="delete_pic(pic.attachment_id)">
<img src="@/assets/userBind/deleteIcon.png">
</div>
</div> </div>
</div> </div>
<div class="card-upload" @click="imgUploadShow(list.check_id)"> <div class="card-upload" @click="imgUploadShow(list.check_id)">
...@@ -431,19 +437,21 @@ export default { ...@@ -431,19 +437,21 @@ export default {
} }
}) })
}, },
load_picture(check_id){ load_picture (check_id, index) {
debugger
let vm = this let vm = this
let url = process.env.basePath + 'attachment_list_query' let url = process.env.basePath + 'attachment_list_query' + '&index' + index // 附件查询
let param = { let param = {
check_id: check_id, check_id: check_id,
} }
hlsPopup.showLoading('请稍候') hlsPopup.showLoading('请稍候')
vm.$post(url, param).then(function (res) { vm.$post(url, param).then(function (res) {
vm.hlsPopup.hideLoading() vm.hlsPopup.hideLoading()
console.log('%%%%%%%%%%%%' + res)
if (res.result === 'S') { if (res.result === 'S') {
console.log('**********' + res.lists) res.lists.forEach(item => {
item['url'] = process.env.filePath + 'attachment_id=' + item.attachment_id + '&access_token=' + window.localStorage.access_token
})
vm.dowload_list.push(res.lists)
console.log(JSON.stringify(vm.dowload_list))
} else { } else {
hlsPopup.showLongCenter(res.message) hlsPopup.showLongCenter(res.message)
} }
...@@ -471,8 +479,8 @@ export default { ...@@ -471,8 +479,8 @@ export default {
if (res.result === 'S') { if (res.result === 'S') {
vm.cddItemList = [...res.lists] vm.cddItemList = [...res.lists]
// 查询图片 // 查询图片
vm.cddItemList.forEach(item => { vm.cddItemList.forEach((item, index) => {
vm.load_picture(item.check_id) vm.load_picture(item.check_id, index)
}) })
} }
}) })
...@@ -540,7 +548,7 @@ export default { ...@@ -540,7 +548,7 @@ export default {
} }
}, },
// 图片上传入口 // 图片上传入口
imgUploadShow(check_id){ imgUploadShow (check_id) {
let vm = this let vm = this
hlsPopup.showActionSheet({ hlsPopup.showActionSheet({
titleText: '请选择照片', titleText: '请选择照片',
...@@ -554,7 +562,7 @@ export default { ...@@ -554,7 +562,7 @@ export default {
}, },
}) })
}, },
imgUploadOpenCamera(check_id){ imgUploadOpenCamera (check_id) {
let vm = this let vm = this
let obj = { let obj = {
'pkvalue': check_id, 'pkvalue': check_id,
...@@ -562,7 +570,7 @@ export default { ...@@ -562,7 +570,7 @@ export default {
'picture': '', 'picture': '',
'filePath': '', 'filePath': '',
'attachment_id': '', 'attachment_id': '',
'user_id':1 'user_id': 1,
} }
let cameraoptions = { let cameraoptions = {
quality: 100, quality: 100,
...@@ -580,12 +588,13 @@ export default { ...@@ -580,12 +588,13 @@ export default {
} }
hlsUtil.openCamera(cameraoptions, success, error) hlsUtil.openCamera(cameraoptions, success, error)
}, },
imgUploadTakePicture(check_id){ imgUploadTakePicture (check_id) {
let vm = this let vm = this
let cameraoptions = { let cameraoptions = {
quality: 100, quality: 100,
} }
let success = function (imgUrl) { let success = function (imgUrl) {
var list = []
for (let i = 0; i < imgUrl.length; i++) { for (let i = 0; i < imgUrl.length; i++) {
let obj = { let obj = {
'pkvalue': check_id, 'pkvalue': check_id,
...@@ -593,11 +602,10 @@ export default { ...@@ -593,11 +602,10 @@ export default {
'picture': '', 'picture': '',
'filePath': '', 'filePath': '',
'attachment_id': '', 'attachment_id': '',
'user_id':1 'user_id': 1,
} }
obj.picture = imgUrl[i] obj.picture = imgUrl[i]
obj.filePath = imgUrl[i] obj.filePath = imgUrl[i]
var list = []
list.push(obj) list.push(obj)
} }
// 拍完一张立马执行保存图片逻辑 // 拍完一张立马执行保存图片逻辑
...@@ -609,7 +617,7 @@ export default { ...@@ -609,7 +617,7 @@ export default {
}, },
// 图片保存 // 图片保存
save_picture (list) { save_picture (list) {
alert('图片待上传数组 ' + JSON.stringify(list)) alert('图片待上传数组 ' + JSON.stringify(list))
let vm = this let vm = this
if (list.length) { if (list.length) {
// hlsPopup.showLoading('图片上传请稍候') // hlsPopup.showLoading('图片上传请稍候')
...@@ -625,7 +633,7 @@ export default { ...@@ -625,7 +633,7 @@ export default {
for (var i = 0; i < list.length; i++) { for (var i = 0; i < list.length; i++) {
let uploadSuccess = function (res) { let uploadSuccess = function (res) {
if (res.result === 'S') { if (res.result === 'S') {
alert('返回结果 '+ JSON.stringify(res.response)) alert('返回结果 ' + JSON.stringify(res.response))
alreadyUploadNum++ alreadyUploadNum++
for (var j = 0; j < list.length; j++) { for (var j = 0; j < list.length; j++) {
if (list[j].filePath === res.response.filePath) { if (list[j].filePath === res.response.filePath) {
...@@ -647,6 +655,24 @@ export default { ...@@ -647,6 +655,24 @@ export default {
hlsPopup.hideLoading() hlsPopup.hideLoading()
} }
}, },
// 删除图片
delete_pic(attachment_id){
hlsPopup.showLongCenter('接口还没写')
/*let vm = this
let url = process.env.basePath + 'attachment_list_query'
let param = {
attachment_id: attachment_id,
}
hlsPopup.showLoading('请稍候')
vm.$post(url, param).then(function (res) {
vm.hlsPopup.hideLoading()
if (res.result === 'S') {
} else {
hlsPopup.showLongCenter(res.message)
}
})*/
},
/* uploadIdCardFront () { /* uploadIdCardFront () {
let vm = this let vm = this
let url = process.env.basePath + 'attachment_upload' let url = process.env.basePath + 'attachment_upload'
...@@ -1217,7 +1243,17 @@ export default { ...@@ -1217,7 +1243,17 @@ export default {
align-items: center; align-items: center;
margin-top: 12px; margin-top: 12px;
margin-left: 12px; margin-left: 12px;
// float: left; float: left;
.close {
position: absolute;
color: #F96F68;
margin-top: -45px;
margin-left: 40px;
img{
width: 14px;
height: 14px;
}
}
img { img {
width: 88px; width: 88px;
height: 88px; height: 88px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment