diff --git a/front/src/views/capacityOnTheShelf/components/PutOnTheShelf.vue b/front/src/views/capacityOnTheShelf/components/PutOnTheShelf.vue
index d6fd6dc8..2af6eee3 100644
--- a/front/src/views/capacityOnTheShelf/components/PutOnTheShelf.vue
+++ b/front/src/views/capacityOnTheShelf/components/PutOnTheShelf.vue
@@ -138,10 +138,18 @@
>
{{ item.name }}
+
@@ -62,7 +62,7 @@
加入申购车
- {{ scFlag ? '已' : '' }}收藏
+ {{ props.dataList.isCollect == 'true' ? '已' : '' }}收藏
@@ -127,40 +127,6 @@
})
}
const componentType = ref('')
- // 收藏
- const scFlag = ref(props.dataList.isCollect)
- const scFlag2 = ref(true)
- const goTOCollection = () => {
- console.log('收藏===================》', props.dataList)
- if (scFlag2.value) {
- scFlag2.value = false
- if (scFlag.value) {
- scDel([props.dataList.id]).then((res) => {
- if (res.data.msg === 'success') {
- message.success('取消成功')
- scFlag.value = false
- scFlag2.value = true
- }
- })
- } else {
- scInsert([
- {
- resourceId: props.dataList.id,
- },
- ]).then((res) => {
- if (res.data.msg === 'success') {
- message.success('添加收藏成功!')
- scFlag.value = true
- scFlag2.value = true
- }
- })
- }
- }
- // scInsert([{ resourceId: props.dataList.id }]).then((res) => {
- // console.log(res)
- // message.success('收藏成功')
- // })
- }
if (props.dataList.infoList) {
applicationArea.value = props.dataList.infoList.filter(
(val) => val.attrType === '应用领域'
@@ -217,12 +183,44 @@
if (obj) {
componentType.value = obj.attrValue
}
- if (val.isCollect) {
- scFlag.value = true
- }
}
}
)
+ // 收藏
+ const scFlag2 = ref(true)
+ const goTOCollection = () => {
+ console.log('收藏===================》', props.dataList)
+ if (scFlag2.value) {
+ scFlag2.value = false
+ if (props.dataList.isCollect == 'true') {
+ scDel([props.dataList.id]).then((res) => {
+ if (res.data.msg === 'success') {
+ message.success('取消成功')
+ // eslint-disable-next-line vue/no-mutating-props
+ props.dataList.isCollect = 'false'
+ scFlag2.value = true
+ }
+ })
+ } else {
+ scInsert([
+ {
+ resourceId: props.dataList.id,
+ },
+ ]).then((res) => {
+ if (res.data.msg === 'success') {
+ message.success('添加收藏成功!')
+ // eslint-disable-next-line vue/no-mutating-props
+ props.dataList.isCollect = 'true'
+ scFlag2.value = true
+ }
+ })
+ }
+ }
+ // scInsert([{ resourceId: props.dataList.id }]).then((res) => {
+ // console.log(res)
+ // message.success('收藏成功')
+ // })
+ }