Merge pull request '分类首页样式调整,需求发布接口对接' (#72) from chenxuelian into dev
Reviewed-on: http://git.hchyun.com/feashow/pupil/pulls/72
This commit is contained in:
@@ -88,8 +88,8 @@
|
||||
let data = res.data.data
|
||||
for (const item of data) {
|
||||
item.pub_time = dateFormatXwDetail(item.pub_time)
|
||||
item.images = item.images.split(';')
|
||||
item.images = item.images.map(item1 => {
|
||||
const imagesList = item.images && item.images.length > 0 ? item.images.split(';') : []
|
||||
item.images = imagesList.map(item1 => {
|
||||
item1 = uni.getStorageSync('img_url') + '/' + item1
|
||||
return item1
|
||||
})
|
||||
@@ -116,9 +116,15 @@
|
||||
},
|
||||
//修改我的需求
|
||||
editIdeasAndNeeds(item) {
|
||||
const tabCurrent = this .tabCurrent
|
||||
uni.removeStorage({ //删除Storage
|
||||
key:'update_item',
|
||||
success: () => {
|
||||
uni.setStorageSync('update_item', item);
|
||||
uni.reLaunch({
|
||||
url: '/pages/ideasAndNeeds/ideasAndNeeds?item=' + JSON.stringify(item) + '&index=' + this
|
||||
.tabCurrent
|
||||
url: '/pages/ideasAndNeeds/ideasAndNeeds?item=update_item' + '&index=' + tabCurrent
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//二次确认删除我的需求或创意
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<image :src="item.icon" mode="aspectFit" class="icon"
|
||||
:style="{border: item.active?'2rpx #14CA65 solid':'0',}" />
|
||||
</view>
|
||||
<view class="name">
|
||||
<view class="name" :style="{width: item.active?'152rpx':'126rpx'}">
|
||||
<u-tag v-if="item.active" :text="item.name" bg-color="#14CA65" color="#fff"
|
||||
borderColor="#14CA65" shape="circle" />
|
||||
<text v-else class="no-active">{{item.name}}</text>
|
||||
@@ -377,7 +377,7 @@
|
||||
})
|
||||
} else {
|
||||
this.isAllData = true
|
||||
this.$toast.warn('没有更多数据了')
|
||||
this.$toast.warn('暂无数据')
|
||||
}
|
||||
|
||||
}).finally(_ => {})
|
||||
@@ -411,14 +411,14 @@
|
||||
}
|
||||
|
||||
.category-view {
|
||||
height: 230rpx;
|
||||
height: fit-content;
|
||||
background-color: #F6F6F6;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
|
||||
.left {
|
||||
width: calc(100% - 60rpx);
|
||||
padding: 32rpx;
|
||||
padding: 30rpx;
|
||||
display: flex;
|
||||
overflow: auto;
|
||||
|
||||
@@ -436,15 +436,15 @@
|
||||
text-align: center;
|
||||
|
||||
.icon {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
width: 86rpx;
|
||||
height: 86rpx;
|
||||
padding: 4rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.name {
|
||||
width: 156rpx;
|
||||
width: 126px;
|
||||
text-align: center;
|
||||
|
||||
.no-active {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -126,10 +126,10 @@ const service = {
|
||||
url: serverHost + url,
|
||||
header: header,
|
||||
success: res => {
|
||||
if (!res.data.flag) {
|
||||
isOutTime(res)
|
||||
reject(res)
|
||||
}
|
||||
// if (!res.data.flag) {
|
||||
// isOutTime(res)
|
||||
// reject(res)
|
||||
// }
|
||||
resolve(res)
|
||||
},
|
||||
data: data,
|
||||
@@ -205,7 +205,7 @@ const toast = {
|
||||
}
|
||||
}
|
||||
const apiService = {
|
||||
uploadImgUrl: serverHost,
|
||||
uploadImgUrl: serverHost + `/upload/image/`,
|
||||
imgUrl: serverHost,
|
||||
// login: data => {
|
||||
// data = Object.assign(data || {}, {})
|
||||
@@ -384,7 +384,10 @@ const apiService = {
|
||||
},
|
||||
// 提交
|
||||
submitIdeasAndNeeds(data) {
|
||||
const url = `/require/release/`
|
||||
let url = `/require/release/`
|
||||
if (data.id) {
|
||||
url = `/require/update/`
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.putWithFormData(url, data))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user