Merge pull request 'chenxuelian' (#62) from chenxuelian into dev

Reviewed-on: http://git.hchyun.com/feashow/pupil/pulls/62
This commit is contained in:
1171906056
2023-01-28 13:36:55 +00:00
2 changed files with 47 additions and 22 deletions

View File

@@ -143,9 +143,7 @@
positionPickerColumn: [ positionPickerColumn: [
[] []
], ],
categoryPickerList: [ categoryPickerList: [],
['类别1', '类别', '类别']
],
fileList1: [ fileList1: [
// uploads/images/20230117/202301172309397deda1543.jpg // uploads/images/20230117/202301172309397deda1543.jpg
], ],
@@ -155,16 +153,8 @@
token: null token: null
} }
}, },
onLoad(options) { onTabItemTap() {
//我的发布点击修改回显数据 console.log('----onTabItemTap')
let publishFormList = JSON.parse(options.item)
this.fileList1 = publishFormList.images
this.needsPublishForm = publishFormList
if (options.index == 0) {
this.tabCurrent = 0
} else if (options.index == 1) {
this.tabCurrent = 1
}
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) { if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
console.log(uni.getStorageSync('token')) console.log(uni.getStorageSync('token'))
this.isLoad = false this.isLoad = false
@@ -176,6 +166,20 @@
this.isLoad = true this.isLoad = true
this.token = uni.getStorageSync('token') this.token = uni.getStorageSync('token')
this.getFormData() this.getFormData()
this.fileList1 = []
this.needsPublishForm = {}
},
onLoad(options) {
console.log('---onLoad')
//我的发布点击修改回显数据
let publishFormList = JSON.parse(options.item)
this.fileList1 = publishFormList.images
this.needsPublishForm = publishFormList
if (options.index == 0) {
this.tabCurrent = 0
} else if (options.index == 1) {
this.tabCurrent = 1
}
// this.getProductPickerList() // this.getProductPickerList()
}, },
methods: { methods: {
@@ -358,17 +362,37 @@
}); });
}, },
submitForm() { submitForm() {
console.log(this.fileList1)
if (!/^1[3456789]\d{9}$/.test(this.needsPublishForm.mobile)) { if (!/^1[3456789]\d{9}$/.test(this.needsPublishForm.mobile)) {
this.$toast.warn('请输入正确的手机号') this.$toast.warn('请输入正确的手机号')
return false return false
} }
this.needsPublishForm.type = Number(this.tabCurrent + 1) this.needsPublishForm.type = Number(this.tabCurrent + 1)
this.needsPublishForm.pub_time = new Date().getTime() this.needsPublishForm.pub_time = this.needsPublishForm.pub_time ? this.needsPublishForm.pub_time : new Date().getTime()
const temp = []
if(this.fileList1.length > 0) {
this.fileList1.map(item => {
temp.push(item.url)
})
}
this.needsPublishForm.images = temp.join(';')
const data = { const data = {
type: null,
name: null,
pname: null,
area_code: null,
area_name: null,
images: null,
mobile: null,
class: null,
product: null,
loc: null,
desc: null,
pub_time: null,
...this.needsPublishForm ...this.needsPublishForm
} }
apiService.submitIdeasAndNeeds(data).then(res => { apiService.submitIdeasAndNeeds(data).then(res => {
this.$toast.success(res.msg) this.$toast.success(res.data.msg)
}) })
}, },
reOnLoad() { reOnLoad() {
@@ -383,6 +407,7 @@
} }
this.token = uni.getStorageSync('token') this.token = uni.getStorageSync('token')
this.isLoad = true this.isLoad = true
this.getFormData()
}, },
failToLoad() { failToLoad() {
console.log('----------------false') console.log('----------------false')

View File

@@ -326,13 +326,6 @@ const apiService = {
resolve(service.get(url)) resolve(service.get(url))
}) })
}, },
//修改个人信息
getUser() {
const url = `/center/userinfo`
return new Promise((resolve, reject) => {
resolve(service.get(url))
})
},
// 获取首页分类Tag // 获取首页分类Tag
getTags(data) { getTags(data) {
const url = `/home/tags` const url = `/home/tags`
@@ -382,6 +375,13 @@ const apiService = {
resolve(service.post(url, data)) resolve(service.post(url, data))
}) })
}, },
// 提交
submitIdeasAndNeeds(data) {
const url = `/require/release/`
return new Promise((resolve, reject) => {
resolve(service.putWithFormData(url, data))
})
},
getIdeasAndNeedsFormdata(data) { getIdeasAndNeedsFormdata(data) {
const url = `/require/formdata/` const url = `/require/formdata/`
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {