BUG修改

This commit is contained in:
a0049873 2022-07-19 11:13:15 +08:00
parent dbe0edfcd7
commit a52966d68a
4 changed files with 28 additions and 36 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:26 * @LastEditTime: 2022-07-19 11:09:23
* @Description: 算法详情页头部 * @Description: 算法详情页头部
--> -->
<template> <template>
@ -64,7 +64,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>
@ -144,17 +144,17 @@
} }
// //
const scFlag = ref(props.dataList.isCollect)
const scFlag2 = ref(true) const scFlag2 = ref(true)
const goTOCollection = () => { const goTOCollection = () => {
console.log('收藏===================》', props.dataList) console.log('收藏===================》', props.dataList)
if (scFlag2.value) { if (scFlag2.value) {
scFlag2.value = false scFlag2.value = false
if (scFlag.value) { if (props.dataList.isCollect) {
scDel([props.dataList.id]).then((res) => { scDel([props.dataList.id]).then((res) => {
if (res.data.msg === 'success') { if (res.data.msg === 'success') {
message.success('取消成功') message.success('取消成功')
scFlag.value = false // eslint-disable-next-line vue/no-mutating-props
props.dataList.isCollect = false
scFlag2.value = true scFlag2.value = true
} }
}) })
@ -166,7 +166,8 @@
]).then((res) => { ]).then((res) => {
if (res.data.msg === 'success') { if (res.data.msg === 'success') {
message.success('添加收藏成功!') message.success('添加收藏成功!')
scFlag.value = true // eslint-disable-next-line vue/no-mutating-props
props.dataList.isCollect = true
scFlag2.value = true scFlag2.value = true
} }
}) })
@ -191,9 +192,6 @@
applicationArea.value = props.dataList.infoList.filter( applicationArea.value = props.dataList.infoList.filter(
(val) => val.attrType === '应用领域' (val) => val.attrType === '应用领域'
)[0].attrValue )[0].attrValue
if (val.isCollect) {
scFlag.value = true
}
} }
} }
) )

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:31:32 * @LastEditTime: 2022-07-19 11:09:52
* @Description: 算法详情页头部 * @Description: 算法详情页头部
--> -->
<template> <template>
@ -63,7 +63,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,17 +127,17 @@
}) })
} }
// //
const scFlag = ref(props.dataList.isCollect)
const scFlag2 = ref(true) const scFlag2 = ref(true)
const goTOCollection = () => { const goTOCollection = () => {
console.log('收藏===================》', props.dataList) console.log('收藏===================》', props.dataList)
if (scFlag2.value) { if (scFlag2.value) {
scFlag2.value = false scFlag2.value = false
if (scFlag.value) { if (props.dataList.isCollect) {
scDel([props.dataList.id]).then((res) => { scDel([props.dataList.id]).then((res) => {
if (res.data.msg === 'success') { if (res.data.msg === 'success') {
message.success('取消成功') message.success('取消成功')
scFlag.value = false // eslint-disable-next-line vue/no-mutating-props
props.dataList.isCollect = false
scFlag2.value = true scFlag2.value = true
} }
}) })
@ -149,7 +149,8 @@
]).then((res) => { ]).then((res) => {
if (res.data.msg === 'success') { if (res.data.msg === 'success') {
message.success('添加收藏成功!') message.success('添加收藏成功!')
scFlag.value = true // eslint-disable-next-line vue/no-mutating-props
props.dataList.isCollect = true
scFlag2.value = true scFlag2.value = true
} }
}) })
@ -200,9 +201,6 @@
if (obj) { if (obj) {
componentType.value = obj.attrValue componentType.value = obj.attrValue
} }
if (val.isCollect) {
scFlag.value = true
}
} }
} }
) )

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:32:08 * @LastEditTime: 2022-07-19 11:10:06
* @Description: 开发组件详情页头部 * @Description: 开发组件详情页头部
--> -->
<template> <template>
@ -59,7 +59,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>
@ -122,17 +122,17 @@
}) })
} }
// //
const scFlag = ref(props.dataList.isCollect)
const scFlag2 = ref(true) const scFlag2 = ref(true)
const goTOCollection = () => { const goTOCollection = () => {
console.log('收藏===================》', props.dataList) console.log('收藏===================》', props.dataList)
if (scFlag2.value) { if (scFlag2.value) {
scFlag2.value = false scFlag2.value = false
if (scFlag.value) { if (props.dataList.isCollect) {
scDel([props.dataList.id]).then((res) => { scDel([props.dataList.id]).then((res) => {
if (res.data.msg === 'success') { if (res.data.msg === 'success') {
message.success('取消成功') message.success('取消成功')
scFlag.value = false // eslint-disable-next-line vue/no-mutating-props
props.dataList.isCollect = false
scFlag2.value = true scFlag2.value = true
} }
}) })
@ -144,7 +144,8 @@
]).then((res) => { ]).then((res) => {
if (res.data.msg === 'success') { if (res.data.msg === 'success') {
message.success('添加收藏成功!') message.success('添加收藏成功!')
scFlag.value = true // eslint-disable-next-line vue/no-mutating-props
props.dataList.isCollect = true
scFlag2.value = true scFlag2.value = true
} }
}) })
@ -206,9 +207,6 @@
if (obj) { if (obj) {
componentType.value = obj.attrValue componentType.value = obj.attrValue
} }
if (val.isCollect) {
scFlag.value = true
}
} }
} }
) )

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:32:31 * @LastEditTime: 2022-07-19 11:10:20
* @Description: 算法详情页头部 * @Description: 算法详情页头部
--> -->
<template> <template>
@ -59,7 +59,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>
@ -122,17 +122,17 @@
}) })
} }
// //
const scFlag = ref(props.dataList.isCollect)
const scFlag2 = ref(true) const scFlag2 = ref(true)
const goTOCollection = () => { const goTOCollection = () => {
console.log('收藏===================》', props.dataList) console.log('收藏===================》', props.dataList)
if (scFlag2.value) { if (scFlag2.value) {
scFlag2.value = false scFlag2.value = false
if (scFlag.value) { if (props.dataList.isCollect) {
scDel([props.dataList.id]).then((res) => { scDel([props.dataList.id]).then((res) => {
if (res.data.msg === 'success') { if (res.data.msg === 'success') {
message.success('取消成功') message.success('取消成功')
scFlag.value = false // eslint-disable-next-line vue/no-mutating-props
props.dataList.isCollect = false
scFlag2.value = true scFlag2.value = true
} }
}) })
@ -144,7 +144,8 @@
]).then((res) => { ]).then((res) => {
if (res.data.msg === 'success') { if (res.data.msg === 'success') {
message.success('添加收藏成功!') message.success('添加收藏成功!')
scFlag.value = true // eslint-disable-next-line vue/no-mutating-props
props.dataList.isCollect = true
scFlag2.value = true scFlag2.value = true
} }
}) })
@ -199,9 +200,6 @@
if (obj) { if (obj) {
componentType.value = obj.attrValue componentType.value = obj.attrValue
} }
if (val.isCollect) {
scFlag.value = true
}
} }
} }
) )