分类首页样式调整,需求发布接口对接

This commit is contained in:
”chenxuelian“
2023-01-31 22:35:12 +08:00
parent e4faef661c
commit 22d4ab414a
4 changed files with 47 additions and 26 deletions

View File

@@ -168,21 +168,21 @@
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')
console.log(options.item)
this.imgUrl = uni.getStorageSync('img_url')
//我的发布点击修改回显数据
if(options && options.item) {
console.log(options.item)
if(options && options.item && uni.getStorageSync(options.item)) {
try{
let publishFormList = JSON.parse(options.item)
let publishFormList = uni.getStorageSync(options.item)
console.log(publishFormList.images)
this.fileList1 = publishFormList.images.map(item => {
console.log(item)
console.log(this.imgUrl)
return {
url: item
}
@@ -200,6 +200,9 @@
}
// this.getProductPickerList()
},
onShow() {
this.getFormData()
},
methods: {
tabChange(data) {
this.tabCurrent = data.index
@@ -342,8 +345,12 @@
// let a = apiService.postImage(data).then(res => {
// console.log(res)
// })
console.log('--345')
console.log(url)
console.log(this.token)
console.log(apiService.uploadImgUrl)
let a = uni.uploadFile({
url: apiService.uploadImgUrl, // 仅为示例,非真实的接口地址
url: apiService.uploadImgUrl,
filePath: url,
name: 'file',
header: {
@@ -352,6 +359,7 @@
},
success: (res) => {
setTimeout(() => {
console.log('---355')
console.log(JSON.parse(res.data).data.url)
resolve(JSON.parse(res.data).data.url)
}, 1000)
@@ -371,7 +379,8 @@
const temp = []
if (this.fileList1.length > 0) {
this.fileList1.map(item => {
temp.push(item.url.replace(this.imgUrl, ''))
const url = item.url
temp.push(url.replace(this.imgUrl+'/', ''))
})
}
this.needsPublishForm.images = temp.join(';')
@@ -390,10 +399,13 @@
pub_time: null,
...this.needsPublishForm
}
console.log(data)
apiService.submitIdeasAndNeeds(data).then(res => {
this.$toast.warn('发布成功')
this.$toast.success('提交成功')
console.log('esf=', res);
// this.$toast.success(res.data.msg)
}).catch(error => {
this.$toast.warn(error)
})
},
reOnLoad() {