浏览记录移除, 我的发布列表,修改回显及删除

This commit is contained in:
clay
2023-01-18 17:02:16 +08:00
parent 4b10b9486d
commit 7d0b6274f1
6 changed files with 152 additions and 84 deletions

View File

@@ -4,11 +4,32 @@
<u-tabs :list="tabsList" :scrollable="false" lineColor="#0A994A" color="#969696"
activeStyle="color:#15CA65;font-weight: bold;" :current="tabCurrent" @change="tabChange"></u-tabs>
</view>
<view style="background-color: #fff;">
<view v-if="tabCurrent == 0" style="background-color: #fff;">
<view v-for="(item,index) in needsList" :key="index" class="my_line"
style="padding: 24rpx 19rpx;border-bottom: 1px solid #EEEEEE;">
<text v-if="tabCurrent == 0" class="needs_text">{{item.desc}}</text>
<text v-if="tabCurrent == 1" class="needs_text">{{item.pname}}</text>
<text class="needs_text">{{item.desc}}</text>
<view class="time_line">
<view class="release_time">
<text>{{item.pub_time}}</text>
</view>
<view style="display: flex;">
<view class="btn" @click="editIdeasAndNeeds(item)">
<u-icon name="edit-pen" color="#15CA65" size="20"></u-icon>
<text class="btn_text">修改</text>
</view>
<view class="btn" @click="deleteIdeasAndNeeds(item)">
<u-icon name="trash" color="#15CA65" size="20"></u-icon>
<text class="btn_text">删除</text>
</view>
</view>
</view>
</view>
</view>
<view v-if="tabCurrent == 1" style="background-color: #fff;">
<view v-for="(item,index) in ideasList" :key="index" class="my_line"
style="padding: 24rpx 19rpx;border-bottom: 1px solid #EEEEEE;">
<text class="needs_text">{{item.pname}}</text>
<view class="time_line">
<view class="release_time">
<text>{{item.pub_time}}</text>
@@ -26,15 +47,16 @@
</view>
</view>
</view>
<u-modal :show="showM" :content="content" showCancelButton closeOnClickOverlay="false" @confirm="confirm"
@cancel="cancel">
</u-modal>
<view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view>
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;" v-if="needsList.length==0">
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
v-if="needsList.length==0&&tabCurrent == 0">
暂无更多记录</view>
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
v-if="ideasList.length==0&&tabCurrent == 1">
暂无更多记录</view>
</view>
</template>
@@ -51,40 +73,22 @@
data() {
return {
isLoad: true,
id: '',
showM: false,
// id: '',
// showM: false,
content: '您确定删除吗?',
tabCurrent: 0,
type: '',
desc: '',
pname: '',
pub_time: '',
type: 1,
tabsList: [{
name: '需求发布'
}, {
name: '创意发布'
}],
needsList: [
// {
// id: 1,
// desc: '需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述描述需求描述描...',
// pname: '产品名称产品名称产品名称',
// pub_time: '2022-12-03 09:59',
// }, {
// id: 2,
// desc: '需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述描述需求描述描...',
// pname: '产品名称产品名称产品名称',
// pub_time: '2022-12-03 09:59',
// },
]
needsList: [],
ideasList: []
}
},
onLoad() {
if (this.tabCurrent == 0) {
this.type = 2
} else if (this.tabCurrent == 1) {
this.type = 1
}
console.log(uni.getStorageSync('token'));
this.getIdeasAndNeeds()
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
console.log(uni.getStorageSync('token'))
@@ -99,44 +103,67 @@
methods: {
//获取创意发布
getIdeasAndNeeds() {
console.log('this.type', this.type);
this.$apiServe.getIdeasAndNeeds(this.type).then(res => {
console.log('获取创意发布&需求发布', res.data);
console.log('获取创意发布&需求发布', res.data.data);
let data = res.data.data
for (const item of data) {
item.pub_time = dateFormatXwDetail(pub_time)
this.id = item.id
item.pub_time = dateFormatXwDetail(item.pub_time)
item.images = item.images.split(';')
item.images = item.images.map(item1 => {
item1 = uni.getStorageSync('img_url') + item1
return item1
})
}
if (this.type == 1) {
this.needsList = data
} else if (this.type == 2) {
this.ideasList = data
}
// this.productList = data
}).finally(_ => {
})
},
//切换需求发布和创意发布
tabChange(data) {
this.tabCurrent = data.index
console.log('data.index', data.index);
if (data.index == 0) {
this.type = 1
} else if (data.index == 1) {
this.type = 2
}
this.getIdeasAndNeeds()
},
//修改我的需求或创意
//修改我的需求
editIdeasAndNeeds(item) {
uni.reLaunch({
url: '/pages/ideasAndNeeds/ideasAndNeeds?item=' + JSON.stringify(item) + '&index=' + this.type
url: '/pages/ideasAndNeeds/ideasAndNeeds?item=' + JSON.stringify(item) + '&index=' + this
.tabCurrent
})
},
//删除我的需求或创意
//二次确认删除我的需求或创意
deleteIdeasAndNeeds(item) {
this.showM = true
},
//删除确认按钮
confirm() {
this.showM = false
// this.$apiServe.deleteIdeasAndNeeds(this.id).then(res => {
// console.log('删除发布', res.data);
// // this.needsList.splice(this.needsList.id, 1)
// }).finally(_ => {
var that = this
uni.showModal({
title: '提示',
content: '你确定要删除吗',
success: function(res) {
if (res.confirm) {
that.$apiServe.deleteIdeasAndNeeds(item.id).then(res => {
console.log('删除发布', res);
if (res.data.code == 1) {
that.$toast.warn('删除成功')
}
that.getIdeasAndNeeds()
}).finally(_ => {
// })
},
cancel() {
this.showM = false
})
} else if (res.cancel) {
that.$toast.warn('取消删除')
}
}
})
},
reOnLoad() {
console.log('----------------true')