Commit 18ed042e authored by 李晓兵's avatar 李晓兵

'附件上传'

parent 0dc28319
...@@ -9,7 +9,7 @@ module.exports = merge(prodEnv, { ...@@ -9,7 +9,7 @@ module.exports = merge(prodEnv, {
isMobilePlatform: false, isMobilePlatform: false,
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/interface"', rootPath: '"http://180.104.121.66:8088/r/api"',
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"',
......
...@@ -6,7 +6,7 @@ module.exports = { ...@@ -6,7 +6,7 @@ module.exports = {
isMobilePlatform: true, isMobilePlatform: true,
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/interface"', rootPath: '"http://180.104.121.66:8088/r/api"',
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"',
......
...@@ -98,7 +98,7 @@ export default { ...@@ -98,7 +98,7 @@ export default {
}, },
created () { created () {
let vm = this let vm = this
let url = process.env.loginPath + 'appadmin' let url = process.env.loginPath + 'admin'
let param = {} let param = {}
vm.$post(url, param).then(function (res) { vm.$post(url, param).then(function (res) {
window.localStorage.setItem('access_token', res.access_token) window.localStorage.setItem('access_token', res.access_token)
......
...@@ -95,7 +95,7 @@ export default { ...@@ -95,7 +95,7 @@ export default {
}, },
created () { created () {
let vm = this let vm = this
let url = process.env.loginPath + 'appadmin' let url = process.env.loginPath + 'admin'
let param = {} let param = {}
vm.$post(url, param).then(function (res) { vm.$post(url, param).then(function (res) {
window.localStorage.setItem('access_token', res.access_token) window.localStorage.setItem('access_token', res.access_token)
......
...@@ -193,28 +193,22 @@ ...@@ -193,28 +193,22 @@
</item> </item>
</list-item> </list-item>
</div> </div>
<div class="userInfo">资产信息</div> <div v-if="cddItemList.length" class="userInfo">资产信息</div>
<div class="card"> <div v-for="(list, index) in cddItemList" :key="index" class="card">
<span>房产证件</span> <span>{{ list.description }}</span>
<div class="img-content"> <div class="img-content">
<div class="card-upload"> <!--待上传图片列表-->
<img src="@/assets/userBind/camera.png" > <div v-for="(list, index) in upload_list" :key="index">
<img :src="list.picture" >
</div> </div>
</div> <!--从服务器上下载的图片-->
</div> <div v-for="item in dowload_list" class="card-upload">
<div class="card"> <div v-for="(pic, index) in item" :key="index">
<span>车辆证件</span> <img :src="item.url" >
<div class="img-content"> </div>
<div class="card-upload">
<img src="@/assets/userBind/camera.png" >
</div> </div>
</div> <div class="card-upload" @click="imgUploadShow(list.check_id)">
</div> <img src="@/assets/userBind/camera.png" class="upload-btn">
<div class="card">
<span>其他资产证件</span>
<div class="img-content">
<div class="card-upload">
<img src="@/assets/userBind/camera.png" >
</div> </div>
</div> </div>
</div> </div>
...@@ -307,7 +301,8 @@ export default { ...@@ -307,7 +301,8 @@ export default {
from: false, from: false,
cityList: [], cityList: [],
provinceList: [], provinceList: [],
upload_list: [], upload_list: [], // 上传图片列表
dowload_list: [], // 下载图片列表
typeList: [], typeList: [],
backList: [], backList: [],
bankList: [], bankList: [],
...@@ -355,6 +350,7 @@ export default { ...@@ -355,6 +350,7 @@ export default {
idCardFront: '', // 身份证正面图片 idCardFront: '', // 身份证正面图片
idCardBack: '', // 身份证反面图片 idCardBack: '', // 身份证反面图片
bankImg: '', // 银行卡图片 bankImg: '', // 银行卡图片
cddItemList: [], // 资料清单列表
} }
}, },
watch: { watch: {
...@@ -406,7 +402,7 @@ export default { ...@@ -406,7 +402,7 @@ export default {
} }
}, },
beforeRouteEnter (to, from, next) { beforeRouteEnter (to, from, next) {
if (from.fullPath === '/tab/my-info') { // 绑定查询入口 if (from.fullPath === '/tab/my-info') { // 绑定查询入口
next(vm => { next(vm => {
vm.basicInfoQuery() vm.basicInfoQuery()
vm.from = true vm.from = true
...@@ -435,9 +431,28 @@ export default { ...@@ -435,9 +431,28 @@ export default {
}) })
}, },
async verified () { async verified () {
let bpId = await this.saveWord() // let bpId = await this.saveWord()
this.getBankInfo() // this.getBankInfo()
// 查询资料清单 // 查询资料清单
this.loadItemList()
},
loadItemList () {
let vm = this
let url = process.env.basePath + 'prj_cdd_check_list'
let param = {
master: {
'document_id': 7928,
'document_table': 'HLS_BP_MASTER',
'tab_group': 'HLS_NP',
},
}
// vm.hlsPopup.showLoading('请稍候')
vm.hlsHttp.post(url, param).then(function (res) {
// vm.hlsPopup.hideLoading()
if (res.result === 'S') {
vm.cddItemList = [...res.lists]
}
})
}, },
async saveProtocol () { async saveProtocol () {
let vm = this let vm = this
...@@ -501,7 +516,119 @@ export default { ...@@ -501,7 +516,119 @@ export default {
return bpId return bpId
} }
}, },
/* uploadIdCardFront () { // 图片上传入口
imgUploadShow(check_id){
let vm = this
hlsPopup.showActionSheet({
titleText: '请选择照片',
buttonArray: ['拍照', '从相册取'],
callback: index => {
if (index === 0) {
vm.imgUploadOpenCamera(check_id)
} else {
vm.imgUploadTakePicture(check_id)
}
},
})
},
imgUploadOpenCamera(check_id){
let vm = this
let obj = {
'pkvalue': 7928,
'source_type': 'HLS_BP_MASTER',
'check_id': check_id,
'picture': '',
'filePath': '',
'attachment_id': '',
'user_id':1
}
let cameraoptions = {
quality: 100,
}
obj.picture = 'http://img1.gtimg.com/auto/pics/hv1/148/233/2219/144350038.jpg'
obj.filePath = 'http://img1.gtimg.com/auto/pics/hv1/148/233/2219/144350038.jpg'
let list = []
list.push(obj)
vm.save_picture(list)
/*let success = function (imgdata) {
obj.picture = imgdata
obj.filePath = imgdata
let list = []
list.push(obj)
// vm.upload_list.push(obj)
// 拍完一张立马执行保存图片逻辑
}
let error = function () {
}
hlsUtil.openCamera(cameraoptions, success, error)*/
},
imgUploadTakePicture(){
let vm = this
let cameraoptions = {
quality: 100,
}
let success = function (imgUrl) {
for (let i = 0; i < imgUrl.length; i++) {
let obj = {
'pkvalue': 7928,
'source_type': 'HLS_BP_MASTER',
'check_id': check_id,
'picture': '',
'filePath': '',
'attachment_id': '',
'user_id':1
}
obj.picture = imgUrl[i]
obj.file_path = imgUrl[i]
// push到上传列表中 通知前台数据发生改变
vm.upload_list.push(obj)
}
}
let error = function () {
}
vm.hlsUtil.takePicture(cameraoptions, success, error)
},
// 图片保存
save_picture (list) {
debugger
let vm = this
if (list.length) {
// hlsPopup.showLoading('图片上传请稍候')
var alreadyUploadNum = 0
var attLength = 0
var recordUploadInterval = setInterval(function () {
if (alreadyUploadNum === attLength) {
clearInterval(recordUploadInterval)
hlsPopup.hideLoading()
hlsPopup.showLongCenter('图片上传成功')
}
}, 500)
for (var i = 0; i < list.length; i++) {
let uploadSuccess = function (res) {
if (res.result === 'S') {
alreadyUploadNum++
for (var j = 0; j < list.length; j++) {
if (list[j].filePath === res.response.filePath) {
list[j].attachment_id = res.response.attachment_id
vm.upload_list.push(list[j])
break
}
}
} else {
hlsPopup.hideLoading()
}
}
if (!list[i].attachment_id) {
attLength++
hlsUtil.fileUploadSvc(list[i], uploadSuccess)
}
}
} else {
hlsPopup.hideLoading()
}
},
/* uploadIdCardFront () {
let vm = this let vm = this
let url = process.env.basePath + 'attachment_upload' let url = process.env.basePath + 'attachment_upload'
let param = { let param = {
...@@ -516,7 +643,7 @@ export default { ...@@ -516,7 +643,7 @@ export default {
console.log(res.response.attachment_id) console.log(res.response.attachment_id)
} }
}) })
},*/ }, */
ocrShow (ocrType, type) { ocrShow (ocrType, type) {
let vm = this let vm = this
hlsPopup.showActionSheet({ hlsPopup.showActionSheet({
...@@ -594,7 +721,7 @@ export default { ...@@ -594,7 +721,7 @@ export default {
hlsUtil.baiduOcr(fileUrl, url, function (res) { hlsUtil.baiduOcr(fileUrl, url, function (res) {
hlsPopup.hideLoading() hlsPopup.hideLoading()
let result = res.result.result let result = res.result.result
vm.bank.bank_account_num = result.bank_card_number vm.bank.bank_account_num = result.bank_card_number.replace(/\s*/g, '')
vm.bank.bank_full_name = result.bank_name vm.bank.bank_full_name = result.bank_name
vm.bank.bank_card_type = result.bank_card_type vm.bank.bank_card_type = result.bank_card_type
}) })
...@@ -943,7 +1070,7 @@ export default { ...@@ -943,7 +1070,7 @@ export default {
}, },
} }
</script> </script>
<style lang="less"> <style lang="less">
#base-info1 { #base-info1 {
font-family: PingFangSC-Regular; font-family: PingFangSC-Regular;
input::placeholder { input::placeholder {
...@@ -1072,6 +1199,10 @@ export default { ...@@ -1072,6 +1199,10 @@ export default {
margin-left: 12px; margin-left: 12px;
// float: left; // float: left;
img { img {
width: 88px;
height: 88px;
}
.upload-btn{
width: 24px; width: 24px;
height: 24px; height: 24px;
} }
......
...@@ -370,22 +370,22 @@ export default { ...@@ -370,22 +370,22 @@ export default {
* @param success * @param success
*/ */
fileUploadSvc: function (file, success) { fileUploadSvc: function (file, success) {
let path = file.filePath debugger
let path = file.file_path
let name = path.substr(path.lastIndexOf('/') + 1) let name = path.substr(path.lastIndexOf('/') + 1)
let url = encodeURI(process.env.rootPath + '/app/fileUploadSvc?sysName=HLS_APP&apiName=attachment_upload') let url = encodeURI(process.env.rootPath + '/app/fileUploadSvc?sysName=XCMG_DEV&apiName=attachment_upload')
let options = new FileUploadOptions() // eslint-disable-line let options = new FileUploadOptions() // eslint-disable-line
options.fileKey = 'file' options.fileKey = 'file'
options.headers = { options.headers = {
'Authorization': 'Bearer ' + window.localStorage.access_token, 'Authorization': 'Bearer ' + window.localStorage.access_token,
} }
options.params = { options.params = {
'source_type': file.table_name, 'source_type': file.source_type,
'pkvalue': file.table_pk_value, 'pkvalue': file.pkvalue,
'user_id': window.localStorage.user_id, 'user_id': file.user_id,
'check_id': file.check_id,
'access_token': window.localStorage.access_token, 'access_token': window.localStorage.access_token,
'filePath': path, 'filePath': path,
'timestamp': file.timestamp,
'sequence': file.sequence,
} }
options.fileName = name options.fileName = name
options.mimeType = 'multipart/form-date' options.mimeType = 'multipart/form-date'
......
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