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

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

@@ -29,13 +29,15 @@
</view>
</view>
</view>
<u-button v-if="type==1" type="success" text="移除" color="#0EBB5B" @click="showModal()"></u-button>
<u-button v-if="type==2" type="success" text="取消收藏" color="#0EBB5B" @click="showModal()"></u-button>
<u-button v-if="type==1" type="success" text="移除" color="#0EBB5B" @click="deleteProduct(item)">
</u-button>
<u-button v-if="type==2" type="success" text="取消收藏" color="#0EBB5B" @click="deleteProduct(item)">
</u-button>
</u-grid-item>
</u-grid>
<u-modal :show="showM" :content="content" showCancelButton closeOnClickOverlay="false" @confirm="confirm"
<!-- <u-modal :show="showM" :content="content" showCancelButton closeOnClickOverlay="false" @confirm="confirm"
@cancel="cancel">
</u-modal>
</u-modal> -->
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
v-if="type==1&&productList.length==0">
暂无更多浏览记录</view>
@@ -57,7 +59,7 @@
imgUrl: '',
tagsArray: [],
productList: [],
showM: false,
// showM: false,
content: '您确定移除吗?',
productList: []
}
@@ -83,26 +85,31 @@
item.tags = this.tagsArray[0]
item.create_time = dateFormatHistory(item.create_time)
}
// console.log('获取历史记录', res.data);
this.productId = data.id
// console.log('获取历史记录', data);
this.productList = data
}).finally(_ => {
})
},
//移除按钮
showModal() {
this.showM = true
},
confirm() {
this.showM = false
this.$apiServe.deleteHistoryOrCollection(this.productId).then(res => {
// console.log('删除历史记录或收藏', res.data);
this.productList.splice(this.productId, 1)
}).finally(_ => {})
},
cancel() {
this.showM = false
deleteProduct(item) {
var that = this
uni.showModal({
title: '提示',
content: '你确定要删除吗',
success: function(res) {
if (res.confirm) {
that.$apiServe.deleteHistoryOrCollection(item.id).then(res => {
if (res.data.code == 1) {
that.$toast.warn('删除成功')
}
that.getHistoryOrCollection()
}).finally(_ => {})
} else if (res.cancel) {
that.$toast.warn('取消删除')
}
}
})
}
}
}