Merge pull request '分类首页样式调整,需求发布接口对接' (#72) from chenxuelian into dev

Reviewed-on: http://git.hchyun.com/feashow/pupil/pulls/72
This commit is contained in:
1171906056
2023-01-31 14:35:57 +00:00
4 changed files with 47 additions and 26 deletions

View File

@@ -88,8 +88,8 @@
let data = res.data.data let data = res.data.data
for (const item of data) { for (const item of data) {
item.pub_time = dateFormatXwDetail(item.pub_time) item.pub_time = dateFormatXwDetail(item.pub_time)
item.images = item.images.split(';') const imagesList = item.images && item.images.length > 0 ? item.images.split(';') : []
item.images = item.images.map(item1 => { item.images = imagesList.map(item1 => {
item1 = uni.getStorageSync('img_url') + '/' + item1 item1 = uni.getStorageSync('img_url') + '/' + item1
return item1 return item1
}) })
@@ -116,9 +116,15 @@
}, },
//修改我的需求 //修改我的需求
editIdeasAndNeeds(item) { editIdeasAndNeeds(item) {
const tabCurrent = this .tabCurrent
uni.removeStorage({ //删除Storage
key:'update_item',
success: () => {
uni.setStorageSync('update_item', item);
uni.reLaunch({ uni.reLaunch({
url: '/pages/ideasAndNeeds/ideasAndNeeds?item=' + JSON.stringify(item) + '&index=' + this url: '/pages/ideasAndNeeds/ideasAndNeeds?item=update_item' + '&index=' + tabCurrent
.tabCurrent })
}
}) })
}, },
//二次确认删除我的需求或创意 //二次确认删除我的需求或创意

View File

@@ -16,7 +16,7 @@
<image :src="item.icon" mode="aspectFit" class="icon" <image :src="item.icon" mode="aspectFit" class="icon"
:style="{border: item.active?'2rpx #14CA65 solid':'0',}" /> :style="{border: item.active?'2rpx #14CA65 solid':'0',}" />
</view> </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" <u-tag v-if="item.active" :text="item.name" bg-color="#14CA65" color="#fff"
borderColor="#14CA65" shape="circle" /> borderColor="#14CA65" shape="circle" />
<text v-else class="no-active">{{item.name}}</text> <text v-else class="no-active">{{item.name}}</text>
@@ -377,7 +377,7 @@
}) })
} else { } else {
this.isAllData = true this.isAllData = true
this.$toast.warn('没有更多数据') this.$toast.warn('暂无数据')
} }
}).finally(_ => {}) }).finally(_ => {})
@@ -411,14 +411,14 @@
} }
.category-view { .category-view {
height: 230rpx; height: fit-content;
background-color: #F6F6F6; background-color: #F6F6F6;
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
.left { .left {
width: calc(100% - 60rpx); width: calc(100% - 60rpx);
padding: 32rpx; padding: 30rpx;
display: flex; display: flex;
overflow: auto; overflow: auto;
@@ -436,15 +436,15 @@
text-align: center; text-align: center;
.icon { .icon {
width: 100rpx; width: 86rpx;
height: 100rpx; height: 86rpx;
padding: 4rpx; padding: 4rpx;
border-radius: 50%; border-radius: 50%;
} }
} }
.name { .name {
width: 156rpx; width: 126px;
text-align: center; text-align: center;
.no-active { .no-active {

View File

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

View File

@@ -126,10 +126,10 @@ const service = {
url: serverHost + url, url: serverHost + url,
header: header, header: header,
success: res => { success: res => {
if (!res.data.flag) { // if (!res.data.flag) {
isOutTime(res) // isOutTime(res)
reject(res) // reject(res)
} // }
resolve(res) resolve(res)
}, },
data: data, data: data,
@@ -205,7 +205,7 @@ const toast = {
} }
} }
const apiService = { const apiService = {
uploadImgUrl: serverHost, uploadImgUrl: serverHost + `/upload/image/`,
imgUrl: serverHost, imgUrl: serverHost,
// login: data => { // login: data => {
// data = Object.assign(data || {}, {}) // data = Object.assign(data || {}, {})
@@ -384,7 +384,10 @@ const apiService = {
}, },
// 提交 // 提交
submitIdeasAndNeeds(data) { submitIdeasAndNeeds(data) {
const url = `/require/release/` let url = `/require/release/`
if (data.id) {
url = `/require/update/`
}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve(service.putWithFormData(url, data)) resolve(service.putWithFormData(url, data))
}) })