BUG修改

This commit is contained in:
a0049873 2022-07-19 11:08:32 +08:00
parent 7c63022fc5
commit dbe0edfcd7
1 changed files with 37 additions and 39 deletions

View File

@ -2,7 +2,7 @@
* @Author: hisense.liangjunhua * @Author: hisense.liangjunhua
* @Date: 2022-06-08 11:56:28 * @Date: 2022-06-08 11:56:28
* @LastEditors: hisense.liangjunhua * @LastEditors: hisense.liangjunhua
* @LastEditTime: 2022-07-15 17:30:19 * @LastEditTime: 2022-07-19 11:07:46
* @Description: 算法详情页头部 * @Description: 算法详情页头部
--> -->
<template> <template>
@ -62,7 +62,7 @@
加入申购车 加入申购车
</a-button> </a-button>
<a-button type="primary" @click="goTOCollection()"> <a-button type="primary" @click="goTOCollection()">
{{ scFlag ? '已' : '' }}收藏 {{ props.dataList.isCollect == 'true' ? '已' : '' }}收藏
</a-button> </a-button>
</div> </div>
</div> </div>
@ -127,40 +127,6 @@
}) })
} }
const componentType = ref('') 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) { if (props.dataList.infoList) {
applicationArea.value = props.dataList.infoList.filter( applicationArea.value = props.dataList.infoList.filter(
(val) => val.attrType === '应用领域' (val) => val.attrType === '应用领域'
@ -217,12 +183,44 @@
if (obj) { if (obj) {
componentType.value = obj.attrValue 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('')
// })
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.algorithm-top-details { .algorithm-top-details {