上传下载
This commit is contained in:
@@ -104,7 +104,7 @@ import {
|
||||
// chooseAlbumAndTakePhoto,
|
||||
} from '@/utils/dsbridge'
|
||||
import { insertPositionData, getPositionData } from '@/api/api.js'
|
||||
import { downloadUrl } from '@/settings'
|
||||
import { getImageBlobUrl } from '@/utils/index'
|
||||
import {debounce} from '@/utils/common.js'
|
||||
export default {
|
||||
components: {
|
||||
@@ -143,33 +143,28 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
// 查询打卡记录
|
||||
getHistory(){
|
||||
async getHistory(){
|
||||
this.text1 = []
|
||||
getPositionData({taskId: this.taskId}).then(res => {
|
||||
console.log(res.code , res.data);
|
||||
if(res.code == 0&&res.data){
|
||||
// for (const key in this.formData) {
|
||||
// if (Object.hasOwnProperty.call(this.formData, key)) {
|
||||
// this.formData[key] = res.data[key]
|
||||
// }
|
||||
// }
|
||||
this.formData = res.data
|
||||
if (res.data.fileId) {
|
||||
this.$set(this.text1,0, {
|
||||
fileName: res.data.fileName,
|
||||
fileId: res.data.fileId,
|
||||
url: `${downloadUrl}${res.data.fileId}`
|
||||
})
|
||||
console.log(this.text1);
|
||||
}
|
||||
this.$forceUpdate()
|
||||
this.showSubmit = true
|
||||
}else{
|
||||
this.showSubmit = true
|
||||
this.getLocation()
|
||||
this.getAddress()
|
||||
const res = await getPositionData({taskId: this.taskId})
|
||||
console.log(res.code , res.data);
|
||||
if(res.code == 0&&res.data){
|
||||
this.formData = res.data
|
||||
if (res.data.fileId) {
|
||||
const blobUrl = await getImageBlobUrl(res.data.fileId)
|
||||
this.$set(this.text1,0, {
|
||||
fileName: res.data.fileName,
|
||||
fileId: res.data.fileId,
|
||||
url: blobUrl
|
||||
})
|
||||
console.log(this.text1);
|
||||
}
|
||||
})
|
||||
this.$forceUpdate()
|
||||
this.showSubmit = true
|
||||
}else{
|
||||
this.showSubmit = true
|
||||
this.getLocation()
|
||||
this.getAddress()
|
||||
}
|
||||
},
|
||||
// 获取当前位置
|
||||
getLocation() {
|
||||
|
||||
@@ -301,7 +301,7 @@ import mixin from '@/mixins/mixin'
|
||||
// import { Toast } from 'vant'
|
||||
import { getCode } from '@/api/common.js'
|
||||
import { addEnergyEquip } from '@/api/energyConsumption'
|
||||
import { downloadUrl } from '@/settings'
|
||||
import { getImageBlobUrl } from '@/utils/index'
|
||||
import { Notify } from 'vant';
|
||||
import { getLocationMessage, getPosition, chooseAlbumAndTakePhoto } from '@/utils/dsbridge'
|
||||
import Loading from '@/components/loading'
|
||||
@@ -313,7 +313,6 @@ import {
|
||||
getInfo,
|
||||
uploadFile,
|
||||
changeSaveStateAPI,
|
||||
// downloadFile,
|
||||
duplicateCheck,
|
||||
} from '@/api/api.js'
|
||||
// import { debuglog } from 'util'
|
||||
@@ -841,16 +840,18 @@ export default {
|
||||
return formData
|
||||
},
|
||||
// 上传图片调用原生的方法 获取到绝对路径调用getImageFileFromUrl
|
||||
onUpload () {
|
||||
chooseAlbumAndTakePhoto((data) => {
|
||||
async onUpload () {
|
||||
chooseAlbumAndTakePhoto(async (data) => {
|
||||
// this.saveGreenComeData(data)
|
||||
let d = 'data:image/jpeg;base64,' + data
|
||||
this.fileIamge = d
|
||||
let params = this.base64ToFile(d,new Date().getTime().toString())
|
||||
uploadFile(params).then((res) => {
|
||||
uploadFile(params).then(async (res) => {
|
||||
if (res.code === 0) {
|
||||
const blobUrl = await getImageBlobUrl(res.data.attach_id)
|
||||
this.fileList.push({
|
||||
url:`${downloadUrl}${res.data.attach_id}`
|
||||
url: blobUrl,
|
||||
isImage: true,
|
||||
})
|
||||
this.fileIds.push(res.data.attach_id)
|
||||
}
|
||||
@@ -1228,23 +1229,26 @@ export default {
|
||||
// })
|
||||
// this.form.files.map(path => ({ url: `${downloadUrl}${path}` }))
|
||||
if (res.data.text1) {
|
||||
const url1 = `${downloadUrl}${res.data.text1}`
|
||||
const url1 = await getImageBlobUrl(res.data.text1)
|
||||
this.fileList.push({
|
||||
url: url1,
|
||||
isImage: true,
|
||||
})
|
||||
this.fileIds.push(res.data.text1)
|
||||
}
|
||||
if (res.data.text2) {
|
||||
const url2 = `${downloadUrl}${res.data.text2}`
|
||||
const url2 = await getImageBlobUrl(res.data.text2)
|
||||
this.fileList.push({
|
||||
url: url2,
|
||||
isImage: true,
|
||||
})
|
||||
this.fileIds.push(res.data.text2)
|
||||
}
|
||||
if (res.data.text3) {
|
||||
const url3 = `${downloadUrl}${res.data.text3}`
|
||||
const url3 = await getImageBlobUrl(res.data.text3)
|
||||
this.fileList.push({
|
||||
url: url3,
|
||||
isImage: true,
|
||||
})
|
||||
this.fileIds.push(res.data.text3)
|
||||
}
|
||||
@@ -1789,14 +1793,11 @@ export default {
|
||||
return true
|
||||
},
|
||||
delImg(detail) {
|
||||
let url = ''
|
||||
if(!detail.file) {
|
||||
url = detail.url.split('download/')[1]
|
||||
}
|
||||
const index = this.fileList.findIndex((ele)=> ele == detail)
|
||||
const index2 = this.fileIds.findIndex((ele)=> ele == url)
|
||||
this.fileList.splice(index, 1)
|
||||
this.fileIds.splice(index2, 1)
|
||||
if (index > -1) {
|
||||
this.fileList.splice(index, 1)
|
||||
this.fileIds.splice(index, 1)
|
||||
}
|
||||
// console.log(this.fileList)
|
||||
// console.log(this.fileIds)
|
||||
// return new Promise((resolve, reject) => {
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
import { getCurrentUserEvaluate, getCurrentUserEvaluateAdd } from '@/api/evaluateAndReply'
|
||||
import { Notify } from 'vant'
|
||||
import Loading from '@/components/loading'
|
||||
import { downloadUrl } from '@/settings'
|
||||
import { getImageBlobUrl } from '@/utils/index'
|
||||
import {debounce} from '@/utils/common.js'
|
||||
export default {
|
||||
name: 'userEvaluate',
|
||||
@@ -142,7 +142,7 @@ export default {
|
||||
try {
|
||||
if (res.code == 0) {
|
||||
if (res.data.list.length > 0) {
|
||||
res.data.list.forEach((v) => {
|
||||
for (const v of res.data.list) {
|
||||
if(v.nxzdEvaluateReplyDTOS && v.nxzdEvaluateReplyDTOS.length > 0) {
|
||||
v.show = true
|
||||
v.showTextArea = false
|
||||
@@ -152,9 +152,9 @@ export default {
|
||||
v.message = ''
|
||||
}
|
||||
if(v.image) {
|
||||
v.image = `${downloadUrl}${v.image}`
|
||||
v.image = await getImageBlobUrl(v.image)
|
||||
}
|
||||
})
|
||||
}
|
||||
this.list = res.data.list
|
||||
this.reportLevel = res.data.list[0]
|
||||
this.levelName(this.reportLevel.reportValue)
|
||||
|
||||
Reference in New Issue
Block a user