Merge pull request '需求发布接口对接' (#51) from chenxuelian into dev
Reviewed-on: http://git.hchyun.com/feashow/pupil/pulls/51
This commit is contained in:
@@ -30,7 +30,7 @@
|
|||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="分类" borderBottom>
|
<u-form-item label="分类" borderBottom>
|
||||||
<view class="select-view" @tap="showCategoryPicker = true">
|
<view class="select-view" @tap="showCategoryPicker = true">
|
||||||
<text v-if="needsPublishForm.cate_id">{{needsPublishForm.cate_id}}</text>
|
<text v-if="needsPublishForm.cate_id">{{cateName}}</text>
|
||||||
<text v-else style="color:#CCCCCC;">请选择分类</text>
|
<text v-else style="color:#CCCCCC;">请选择分类</text>
|
||||||
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
|
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
@@ -40,24 +40,24 @@
|
|||||||
</view>
|
</view>
|
||||||
<u-form-item label="产品" borderBottom>
|
<u-form-item label="产品" borderBottom>
|
||||||
<view class="select-view" @tap="showProductPicker = true">
|
<view class="select-view" @tap="showProductPicker = true">
|
||||||
<text v-if="needsPublishForm.pname">{{needsPublishForm.pname}}</text>
|
<text v-if="needsPublishForm.cate_id">{{cateName}}</text>
|
||||||
<text v-else style="color:#CCCCCC;">请选择产品类型</text>
|
<text v-else style="color:#CCCCCC;">请选择产品类型</text>
|
||||||
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
|
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
<u-picker :show="showProductPicker" :columns="productPickerList" @cancel="showProductPicker = false"
|
<u-picker :show="showProductPicker" :columns="productPickerColumn" @cancel="showProductPicker = false"
|
||||||
@confirm="getProductValue"></u-picker>
|
@confirm="getProductValue"></u-picker>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="定位" borderBottom>
|
<u-form-item label="定位" borderBottom>
|
||||||
<view class="select-view" @tap="showPositionPicker = true">
|
<view class="select-view" @tap="selectProductPosition">
|
||||||
<text v-if="needsPublishForm.position">{{needsPublishForm.position}}</text>
|
<text v-if="needsPublishForm.tagids">{{tagName}}</text>
|
||||||
<text v-else style="color:#CCCCCC;">请选择产品定位</text>
|
<text v-else style="color:#CCCCCC;">请选择产品定位</text>
|
||||||
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
|
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
<u-picker :show=showPositionPicker :columns="positionPickerList"
|
<u-picker :show=showPositionPicker :columns="positionPickerColumn"
|
||||||
@cancel="showPositionPicker = false" @confirm="getPositionValue"></u-picker>
|
@cancel="showPositionPicker = false" @confirm="getPositionValue"></u-picker>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<view style="padding: 20rpx 15rpx;background-color: #fff;">
|
<view style="padding: 20rpx 15rpx;background-color: #fff;">
|
||||||
<u-textarea v-model="needsPublishForm.describle" border="surround" placeholder="请输入具体描述(限120字)"
|
<u-textarea v-model="needsPublishForm.desc" border="surround" placeholder="请输入具体描述(限120字)"
|
||||||
:maxlength="120" placeholder-style="color:#CCCCCC"></u-textarea>
|
:maxlength="120" placeholder-style="color:#CCCCCC"></u-textarea>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -121,10 +121,7 @@
|
|||||||
name: '创意发布'
|
name: '创意发布'
|
||||||
}],
|
}],
|
||||||
tabCurrent: 0,
|
tabCurrent: 0,
|
||||||
needsPublishForm: {
|
needsPublishForm: {},
|
||||||
city: null,
|
|
||||||
position: null
|
|
||||||
},
|
|
||||||
formLabelStyle: {
|
formLabelStyle: {
|
||||||
'font-size': '32rpx !important'
|
'font-size': '32rpx !important'
|
||||||
},
|
},
|
||||||
@@ -135,20 +132,24 @@
|
|||||||
seconds: 10,
|
seconds: 10,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
tips: '获取验证码',
|
tips: '获取验证码',
|
||||||
productPickerList: [
|
productPickerList: [],
|
||||||
['烘焙', '零食', '饮料']
|
productPickerColumn: [
|
||||||
|
[]
|
||||||
// {name: '烘焙', val: 'hongbei'}
|
// {name: '烘焙', val: 'hongbei'}
|
||||||
// {name: '零食', val: 'ls'}
|
// {name: '零食', val: 'ls'}
|
||||||
// {name: '饮料', val: 'yl'}
|
// {name: '饮料', val: 'yl'}
|
||||||
],
|
],
|
||||||
positionPickerList: [
|
positionPickerList: [],
|
||||||
['无添加剂', '无添加剂', '无添加剂']
|
positionPickerColumn: [
|
||||||
|
[]
|
||||||
],
|
],
|
||||||
categoryPickerList: [
|
categoryPickerList: [
|
||||||
['类别1', '类别', '类别']
|
['类别1', '类别', '类别']
|
||||||
],
|
],
|
||||||
fileList1: [],
|
fileList1: [],
|
||||||
isLoad: true
|
isLoad: true,
|
||||||
|
cateName: null,
|
||||||
|
tagName: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
@@ -167,12 +168,48 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.isLoad = true
|
this.isLoad = true
|
||||||
|
this.getProductPickerList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
tabChange(data) {
|
tabChange(data) {
|
||||||
this.tabCurrent = data.index
|
this.tabCurrent = data.index
|
||||||
this.needsPublishForm = {}
|
this.needsPublishForm = {}
|
||||||
},
|
},
|
||||||
|
selectProductPosition() {
|
||||||
|
if (this.needsPublishForm.cate_id) {
|
||||||
|
this.showPositionPicker = true
|
||||||
|
} else {
|
||||||
|
this.$toast.warn('请先选择产品类型')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getProductPickerList() {
|
||||||
|
const data = {}
|
||||||
|
const temp = []
|
||||||
|
this.$apiServe.getCategories(data).then(res => {
|
||||||
|
this.productPickerList = res.data.data.map((item, index) => {
|
||||||
|
temp.push(item.name)
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
this.productPickerColumn[0] = [...temp]
|
||||||
|
}).finally(_ => {})
|
||||||
|
},
|
||||||
|
getPositionPickerList() {
|
||||||
|
if(this.needsPublishForm.cate_id) {
|
||||||
|
const data = {
|
||||||
|
pid: this.needsPublishForm.cate_id
|
||||||
|
}
|
||||||
|
this.$apiServe.getTags(data).then(res => {
|
||||||
|
const temp = []
|
||||||
|
this.positionPickerList = res.data.data.map((item, index) => {
|
||||||
|
temp.push(item.name)
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
this.positionPickerColumn[0] = temp
|
||||||
|
}).finally(_ => {})
|
||||||
|
} else {
|
||||||
|
that.$toast.warn('请先选择产品类型')
|
||||||
|
}
|
||||||
|
},
|
||||||
getCityValue(data) {
|
getCityValue(data) {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
this.showCityPicker = false
|
this.showCityPicker = false
|
||||||
@@ -181,11 +218,29 @@
|
|||||||
},
|
},
|
||||||
getProductValue(data) {
|
getProductValue(data) {
|
||||||
this.showProductPicker = false
|
this.showProductPicker = false
|
||||||
this.needsPublishForm.tagids = data.value[0]
|
this.showCategoryPicker = false
|
||||||
|
console.log(data)
|
||||||
|
const obj = this.productPickerList.find(item => {
|
||||||
|
return item.name === data.value[0]
|
||||||
|
})
|
||||||
|
this.cateName = data.value[0]
|
||||||
|
if (obj) {
|
||||||
|
this.needsPublishForm.cate_id = obj.id
|
||||||
|
}
|
||||||
|
this.needsPublishForm.tagids = null
|
||||||
|
this.getPositionPickerList()
|
||||||
},
|
},
|
||||||
getPositionValue(data) {
|
getPositionValue(data) {
|
||||||
this.showPositionPicker = false
|
this.showPositionPicker = false
|
||||||
this.needsPublishForm.position = data.value[0]
|
|
||||||
|
const obj = this.positionPickerList.find(item => {
|
||||||
|
return item.name === data.value[0]
|
||||||
|
})
|
||||||
|
this.tagName = data.value[0]
|
||||||
|
if (obj) {
|
||||||
|
this.needsPublishForm.tagids = obj.id
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
getCategoryValue(data) {
|
getCategoryValue(data) {
|
||||||
this.showCategoryPicker = false
|
this.showCategoryPicker = false
|
||||||
@@ -287,6 +342,14 @@
|
|||||||
this.$toast.warn('请输入正确的手机号')
|
this.$toast.warn('请输入正确的手机号')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
this.needsPublishForm.type = Number(this.tabCurrent + 1)
|
||||||
|
this.needsPublishForm.pub_time = new Date().getTime()
|
||||||
|
const data = {
|
||||||
|
...this.needsPublishForm
|
||||||
|
}
|
||||||
|
apiService.submitIdeasAndNeeds(data).then(res => {
|
||||||
|
this.$toast.success(res.msg)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
reOnLoad() {
|
reOnLoad() {
|
||||||
console.log('----------------true')
|
console.log('----------------true')
|
||||||
|
|||||||
@@ -116,6 +116,32 @@ const service = {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
putWithFormData(url, data, isLogin) {
|
||||||
|
const header = {}
|
||||||
|
header['token'] = uni.getStorageSync('token')
|
||||||
|
header['content-type'] = 'application/x-www-form-urlencoded'
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.request({
|
||||||
|
method: 'put',
|
||||||
|
url: serverHost + url,
|
||||||
|
header: header,
|
||||||
|
success: res => {
|
||||||
|
if (!res.data.flag) {
|
||||||
|
isOutTime(res)
|
||||||
|
reject(res)
|
||||||
|
}
|
||||||
|
resolve(res)
|
||||||
|
},
|
||||||
|
data: data,
|
||||||
|
fail: err => {
|
||||||
|
// 调用接口失败
|
||||||
|
// toast.error(res.data.message)
|
||||||
|
uni.hideLoading()
|
||||||
|
reject(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
delete(url, data, isLogin) {
|
delete(url, data, isLogin) {
|
||||||
const header = {}
|
const header = {}
|
||||||
header['token'] = uni.getStorageSync('token')
|
header['token'] = uni.getStorageSync('token')
|
||||||
@@ -349,6 +375,12 @@ 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))
|
||||||
|
})
|
||||||
|
},
|
||||||
postMobileByMnp(data) {
|
postMobileByMnp(data) {
|
||||||
const url = `/user/getMobileByMnp`
|
const url = `/user/getMobileByMnp`
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user