Merge pull request '需求信息回显' (#67) from chenxuelian into dev

Reviewed-on: http://git.hchyun.com/feashow/pupil/pulls/67
This commit is contained in:
1171906056
2023-01-29 13:26:36 +00:00
2 changed files with 26 additions and 27 deletions

View File

@@ -109,7 +109,7 @@
item.pub_time = dateFormatXwDetail(item.pub_time)
item.images = item.images.split(';')
item.images = item.images.map(item1 => {
item1 = uni.getStorageSync('img_url') + item1
item1 = uni.getStorageSync('img_url') + '/' + item1
return item1
})
}

View File

@@ -150,11 +150,12 @@
isLoad: true,
cateName: null,
tagName: null,
token: null
token: null,
imgUrl: null
}
},
onTabItemTap() {
console.log('----onTabItemTap')
console.log('----onShow')
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
console.log(uni.getStorageSync('loginToken'))
this.isLoad = false
@@ -163,18 +164,35 @@
// })
return
}
this.imgUrl = uni.getStorageSync('img_url')
console.log(this.imgUrl)
this.isLoad = true
this.token = uni.getStorageSync('loginToken')
this.getFormData()
this.tabCurrent = 0
this.fileList1 = []
this.needsPublishForm = {}
},
onLoad(options) {
console.log('---onLoad')
this.imgUrl = uni.getStorageSync('img_url')
//我的发布点击修改回显数据
let publishFormList = JSON.parse(options.item)
this.fileList1 = publishFormList.images
this.needsPublishForm = publishFormList
if(options && options.item) {
console.log(options.item)
try{
let publishFormList = JSON.parse(options.item)
this.fileList1 = publishFormList.images.map(item => {
console.log(item)
return {
url: item
}
})
console.log(this.fileList1)
this.needsPublishForm = publishFormList
} catch(error) {
this.$toast.warn(error)
}
}
if (options.index == 0) {
this.tabCurrent = 0
} else if (options.index == 1) {
@@ -341,26 +359,6 @@
});
})
},
//BlobUrl转blob数据
objectURLToBlob(blodurl) {
return new Promise((resolve, reject) => {
var http = new XMLHttpRequest();
http.open('GET', blodurl, true);
http.responseType = 'blob';
http.onload = function(e) {
if (this.status == 200 || this.status === 0) {
// console.log('blod数据',this.response);
// 在将blod数据转为file
let files = new window.File([this.response], 'file.name', {
type: 'image'
});
// console.log('blod数据转换file',files);
resolve(files);
}
};
http.send();
});
},
submitForm() {
console.log(this.fileList1)
if (!/^1[3456789]\d{9}$/.test(this.needsPublishForm.mobile)) {
@@ -373,7 +371,7 @@
const temp = []
if (this.fileList1.length > 0) {
this.fileList1.map(item => {
temp.push(item.url)
temp.push(item.url.replace(this.imgUrl, ''))
})
}
this.needsPublishForm.images = temp.join(';')
@@ -417,6 +415,7 @@
this.$toast.warn('登录失败请重试')
}
}
}
</script>