2022-06-20 18:38:56 +08:00
|
|
|
|
<!--
|
|
|
|
|
* @Author: hisense.liangjunhua
|
|
|
|
|
* @Date: 2022-06-08 11:56:28
|
|
|
|
|
* @LastEditors: hisense.liangjunhua
|
2022-07-19 15:05:37 +08:00
|
|
|
|
* @LastEditTime: 2022-07-19 15:02:47
|
2022-06-20 18:38:56 +08:00
|
|
|
|
* @Description: 算法详情页头部
|
|
|
|
|
-->
|
|
|
|
|
<template>
|
|
|
|
|
<div class="algorithm-top-details">
|
|
|
|
|
<div class="left">
|
|
|
|
|
<div class="top">
|
2022-06-30 11:42:01 +08:00
|
|
|
|
<a-tooltip placement="top">
|
|
|
|
|
<template #title>{{ props.dataList.name }}</template>
|
|
|
|
|
<span class="name">
|
|
|
|
|
{{ props.dataList.name }}
|
|
|
|
|
</span>
|
|
|
|
|
</a-tooltip>
|
|
|
|
|
<!-- <span class="name">{{ props.dataList.name }}</span> -->
|
2022-06-20 18:38:56 +08:00
|
|
|
|
<div class="label-content">
|
|
|
|
|
<p class="lable-father">
|
2022-07-07 20:35:13 +08:00
|
|
|
|
<span class="label" v-if="props.dataList.type">
|
|
|
|
|
{{ props.dataList.type }}
|
|
|
|
|
</span>
|
2022-07-15 14:12:04 +08:00
|
|
|
|
<span class="label" v-if="componentType">
|
|
|
|
|
{{ componentType }}
|
|
|
|
|
</span>
|
2022-07-07 20:35:13 +08:00
|
|
|
|
<span class="label" v-if="props.dataList.shareType">
|
|
|
|
|
{{ props.dataList.shareType }}
|
|
|
|
|
</span>
|
|
|
|
|
<span class="label" v-if="props.dataList.shareCondition">
|
|
|
|
|
{{ props.dataList.shareCondition }}
|
2022-06-21 11:33:12 +08:00
|
|
|
|
</span>
|
2022-07-15 14:12:04 +08:00
|
|
|
|
<span class="label" v-if="deploymentLocation">
|
|
|
|
|
{{ deploymentLocation }}
|
|
|
|
|
</span>
|
2022-06-20 18:38:56 +08:00
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- <span class="label">免费</span> -->
|
|
|
|
|
</div>
|
|
|
|
|
<div class="main">
|
2022-07-01 11:24:19 +08:00
|
|
|
|
<a-tooltip placement="top">
|
2022-07-06 12:05:05 +08:00
|
|
|
|
<template #title>应用领域:{{ businessArea }}</template>
|
|
|
|
|
<div>应用领域:{{ businessArea }}</div>
|
2022-07-01 11:24:19 +08:00
|
|
|
|
</a-tooltip>
|
|
|
|
|
<a-tooltip placement="top">
|
|
|
|
|
<template #title>{{ props.dataList.description }}</template>
|
|
|
|
|
<div>
|
|
|
|
|
{{ props.dataList.description }}
|
|
|
|
|
</div>
|
|
|
|
|
</a-tooltip>
|
2022-06-20 18:38:56 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="bottom" v-if="props.dataList.id">
|
2022-07-01 14:31:46 +08:00
|
|
|
|
<a-button type="primary" @click="toView()">
|
2022-07-06 12:05:05 +08:00
|
|
|
|
<template #icon>
|
|
|
|
|
<form-outlined />
|
|
|
|
|
</template>
|
2022-06-20 18:38:56 +08:00
|
|
|
|
申请使用
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-button type="primary" @click="addShoppingCart()">
|
2022-12-05 15:40:55 +08:00
|
|
|
|
<!-- <template #icon>
|
2022-07-06 12:05:05 +08:00
|
|
|
|
<shopping-cart-outlined />
|
2022-12-05 15:40:55 +08:00
|
|
|
|
</template> -->
|
|
|
|
|
{{ props.dataList.isInShoppingCart ? '已' : '' }}加入申购车
|
2022-07-01 14:31:46 +08:00
|
|
|
|
</a-button>
|
2022-07-15 17:32:47 +08:00
|
|
|
|
<a-button type="primary" @click="goTOCollection()">
|
2022-07-19 11:13:15 +08:00
|
|
|
|
{{ props.dataList.isCollect == 'true' ? '已' : '' }}收藏
|
2022-07-15 17:32:47 +08:00
|
|
|
|
</a-button>
|
2022-06-20 18:38:56 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="right"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup>
|
2022-07-07 20:35:13 +08:00
|
|
|
|
import { ShoppingCartOutlined } from '@ant-design/icons-vue'
|
|
|
|
|
import { defineProps, ref, watch } from 'vue'
|
2022-07-15 17:32:47 +08:00
|
|
|
|
import { scInsert, scDel } from '@/api/personalCenter'
|
2022-07-07 20:35:13 +08:00
|
|
|
|
import { sgcInsert } from '@/api/home'
|
|
|
|
|
import { useRouter } from 'vue-router'
|
|
|
|
|
import mybus from '@/myplugins/mybus'
|
|
|
|
|
import { message } from 'ant-design-vue'
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
dataList: { type: Object, default: null },
|
2022-07-06 12:05:05 +08:00
|
|
|
|
})
|
2022-07-07 20:35:13 +08:00
|
|
|
|
const router = useRouter()
|
|
|
|
|
const businessArea = ref('')
|
2022-07-15 14:12:04 +08:00
|
|
|
|
const deploymentLocation = ref('') //部署位置
|
|
|
|
|
const componentType = ref('') //组件类型
|
2022-07-07 20:35:13 +08:00
|
|
|
|
// // 加入申购车
|
|
|
|
|
const addShoppingCart = () => {
|
2022-07-25 09:52:23 +08:00
|
|
|
|
if (props.dataList.isInShoppingCart) {
|
|
|
|
|
message.error('已经加入申购车了')
|
|
|
|
|
} else {
|
|
|
|
|
console.log('加入申购车==================>', props.dataList)
|
|
|
|
|
sgcInsert({
|
|
|
|
|
delFlag: '0',
|
|
|
|
|
resourceId: props.dataList.id,
|
|
|
|
|
// userId: userId.value,
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
console.log(res)
|
|
|
|
|
message.success('添加申购车成功!')
|
|
|
|
|
mybus.emit('getSgcNum')
|
|
|
|
|
props.dataList.isInShoppingCart = true
|
|
|
|
|
console.log(
|
|
|
|
|
props.dataList.isInShoppingCart,
|
|
|
|
|
'props.dataList.isInShoppingCart'
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
}
|
2022-06-20 18:38:56 +08:00
|
|
|
|
}
|
2022-07-07 20:35:13 +08:00
|
|
|
|
// // 立即申请
|
|
|
|
|
function toView() {
|
|
|
|
|
// window.open(newpage.href, '_blank')
|
|
|
|
|
console.log('一键申请===================>', props.dataList)
|
|
|
|
|
localStorage.setItem(
|
|
|
|
|
'applyList',
|
|
|
|
|
JSON.stringify([
|
|
|
|
|
{
|
|
|
|
|
arr: [
|
|
|
|
|
{
|
|
|
|
|
delFlag: props.dataList.delFlag,
|
|
|
|
|
description: props.dataList.description,
|
|
|
|
|
resourceId: props.dataList.id,
|
|
|
|
|
resourceName: props.dataList.name,
|
|
|
|
|
time: props.dataList.createDate,
|
|
|
|
|
type: props.dataList.type,
|
|
|
|
|
componentType: '业务组件',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
deptId: props.dataList.deptId,
|
|
|
|
|
deptName: props.dataList.deptName,
|
|
|
|
|
},
|
|
|
|
|
])
|
|
|
|
|
)
|
|
|
|
|
router.push({
|
|
|
|
|
path: '/apply',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 收藏
|
2022-07-15 17:32:47 +08:00
|
|
|
|
const scFlag2 = ref(true)
|
2022-07-07 20:35:13 +08:00
|
|
|
|
const goTOCollection = () => {
|
|
|
|
|
console.log('收藏===================》', props.dataList)
|
2022-07-15 17:32:47 +08:00
|
|
|
|
if (scFlag2.value) {
|
|
|
|
|
scFlag2.value = false
|
2022-07-19 11:13:15 +08:00
|
|
|
|
if (props.dataList.isCollect) {
|
2022-07-15 17:32:47 +08:00
|
|
|
|
scDel([props.dataList.id]).then((res) => {
|
|
|
|
|
if (res.data.msg === 'success') {
|
|
|
|
|
message.success('取消成功')
|
2022-07-19 11:13:15 +08:00
|
|
|
|
// eslint-disable-next-line vue/no-mutating-props
|
2022-07-19 15:05:37 +08:00
|
|
|
|
props.dataList.isCollect = 'false'
|
2022-07-15 17:32:47 +08:00
|
|
|
|
scFlag2.value = true
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
scInsert([
|
|
|
|
|
{
|
|
|
|
|
resourceId: props.dataList.id,
|
|
|
|
|
},
|
|
|
|
|
]).then((res) => {
|
|
|
|
|
if (res.data.msg === 'success') {
|
|
|
|
|
message.success('添加收藏成功!')
|
2022-07-19 11:13:15 +08:00
|
|
|
|
// eslint-disable-next-line vue/no-mutating-props
|
2022-07-19 15:05:37 +08:00
|
|
|
|
props.dataList.isCollect = 'true'
|
2022-07-15 17:32:47 +08:00
|
|
|
|
scFlag2.value = true
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// scInsert([{ resourceId: props.dataList.id }]).then((res) => {
|
|
|
|
|
// console.log(res)
|
|
|
|
|
// message.success('收藏成功')
|
|
|
|
|
// })
|
2022-07-07 20:35:13 +08:00
|
|
|
|
}
|
|
|
|
|
if (props.dataList.infoList) {
|
|
|
|
|
businessArea.value = props.dataList.infoList.filter(
|
|
|
|
|
(val) => val.attrType === '应用领域'
|
|
|
|
|
)[0].attrValue
|
2022-07-16 15:25:49 +08:00
|
|
|
|
let obj = props.dataList.infoList.filter(
|
|
|
|
|
(val) => val.attrType === '组件类型'
|
|
|
|
|
)[0]
|
2022-07-15 14:12:04 +08:00
|
|
|
|
if (
|
|
|
|
|
props.dataList.infoList.filter((val) => val.attrType === '部署位置')[0]
|
|
|
|
|
) {
|
|
|
|
|
deploymentLocation.value = props.dataList.infoList.filter(
|
|
|
|
|
(val) => val.attrType === '部署位置'
|
|
|
|
|
)[0].attrValue
|
|
|
|
|
}
|
2022-07-07 20:35:13 +08:00
|
|
|
|
if (obj) {
|
|
|
|
|
componentType.value = obj.attrValue
|
2022-06-20 18:38:56 +08:00
|
|
|
|
}
|
2022-07-06 12:05:05 +08:00
|
|
|
|
}
|
2022-07-07 20:35:13 +08:00
|
|
|
|
watch(
|
|
|
|
|
() => props.dataList,
|
|
|
|
|
(val) => {
|
|
|
|
|
if (val) {
|
|
|
|
|
businessArea.value = props.dataList.infoList.filter(
|
|
|
|
|
(val) => val.attrType === '应用领域'
|
|
|
|
|
)[0].attrValue
|
|
|
|
|
let obj = props.dataList.infoList.filter(
|
|
|
|
|
(val) => val.attrType === '组件类型'
|
|
|
|
|
)[0]
|
2022-07-15 14:12:04 +08:00
|
|
|
|
if (
|
|
|
|
|
props.dataList.infoList.filter(
|
|
|
|
|
(val) => val.attrType === '部署位置'
|
|
|
|
|
)[0]
|
|
|
|
|
) {
|
|
|
|
|
deploymentLocation.value = props.dataList.infoList.filter(
|
|
|
|
|
(val) => val.attrType === '部署位置'
|
|
|
|
|
)[0].attrValue
|
|
|
|
|
}
|
2022-07-07 20:35:13 +08:00
|
|
|
|
if (obj) {
|
|
|
|
|
componentType.value = obj.attrValue
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
2022-06-20 18:38:56 +08:00
|
|
|
|
</script>
|
|
|
|
|
<style lang="less" scoped>
|
2022-07-07 20:35:13 +08:00
|
|
|
|
.algorithm-top-details {
|
|
|
|
|
height: 6rem;
|
|
|
|
|
padding: 1.8rem 0 0;
|
|
|
|
|
background: url('~@/assets/detailsAll/sf_top_bg.png') no-repeat;
|
|
|
|
|
background-size: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
2022-07-06 12:05:05 +08:00
|
|
|
|
|
2022-07-07 20:35:13 +08:00
|
|
|
|
.left {
|
|
|
|
|
max-width: 7.2rem;
|
|
|
|
|
color: #fff;
|
|
|
|
|
margin-right: 0.8rem;
|
2022-07-06 12:05:05 +08:00
|
|
|
|
|
2022-07-07 20:35:13 +08:00
|
|
|
|
.top {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2022-07-06 12:05:05 +08:00
|
|
|
|
|
2022-07-07 20:35:13 +08:00
|
|
|
|
span {
|
|
|
|
|
font-size: 0.14rem;
|
|
|
|
|
}
|
2022-07-06 12:05:05 +08:00
|
|
|
|
|
2022-07-07 20:35:13 +08:00
|
|
|
|
.name {
|
|
|
|
|
// max-width: 3.3rem;
|
|
|
|
|
// overflow: hidden;
|
|
|
|
|
// text-overflow: ellipsis;
|
|
|
|
|
// white-space: nowrap;
|
|
|
|
|
font-size: 0.4rem;
|
|
|
|
|
margin-right: 0.2rem;
|
2022-07-29 15:27:24 +08:00
|
|
|
|
max-width: 6rem;
|
2022-07-07 20:35:13 +08:00
|
|
|
|
text-overflow: -o-ellipsis-lastline;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
display: -webkit-box;
|
|
|
|
|
-webkit-line-clamp: 1;
|
|
|
|
|
-webkit-box-orient: vertical;
|
2022-07-19 09:42:41 +08:00
|
|
|
|
word-break: break-all;
|
2022-07-07 20:35:13 +08:00
|
|
|
|
}
|
2022-07-06 12:05:05 +08:00
|
|
|
|
|
2022-07-07 20:35:13 +08:00
|
|
|
|
.label-content {
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
2022-07-06 12:05:05 +08:00
|
|
|
|
|
2022-07-07 20:35:13 +08:00
|
|
|
|
.lable-father {
|
|
|
|
|
position: absolute;
|
2022-07-15 14:12:04 +08:00
|
|
|
|
min-width: 5.5rem;
|
|
|
|
|
right: -5.5rem;
|
2022-07-07 20:35:13 +08:00
|
|
|
|
top: 0;
|
|
|
|
|
}
|
2022-07-06 12:05:05 +08:00
|
|
|
|
|
2022-07-07 20:35:13 +08:00
|
|
|
|
.label {
|
|
|
|
|
padding: 0.01rem 0.1rem;
|
|
|
|
|
margin-right: 0.1rem;
|
|
|
|
|
border-radius: 0.13rem;
|
|
|
|
|
background: rgba(255, 255, 255, 0.4);
|
|
|
|
|
}
|
2022-07-06 12:05:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-07-07 20:35:13 +08:00
|
|
|
|
.main {
|
|
|
|
|
margin-top: 0.2rem;
|
|
|
|
|
font-size: 0.18rem;
|
|
|
|
|
line-height: 0.34rem;
|
2022-07-06 12:05:05 +08:00
|
|
|
|
|
2022-07-07 20:35:13 +08:00
|
|
|
|
& > div:nth-of-type(1) {
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
2022-07-06 12:05:05 +08:00
|
|
|
|
|
2022-07-07 20:35:13 +08:00
|
|
|
|
& > div:nth-of-type(2) {
|
|
|
|
|
max-height: 1rem;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
display: -webkit-box;
|
|
|
|
|
-webkit-line-clamp: 3;
|
|
|
|
|
-webkit-box-orient: vertical;
|
2022-07-19 09:42:41 +08:00
|
|
|
|
word-break: break-all;
|
2022-07-07 20:35:13 +08:00
|
|
|
|
}
|
2022-07-06 12:05:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-07-07 20:35:13 +08:00
|
|
|
|
.bottom {
|
2022-07-14 15:12:47 +08:00
|
|
|
|
margin-top: 40px;
|
2022-06-20 18:38:56 +08:00
|
|
|
|
display: flex;
|
2022-07-07 20:35:13 +08:00
|
|
|
|
.ant-btn {
|
2022-07-14 15:12:47 +08:00
|
|
|
|
height: 50px;
|
|
|
|
|
margin-right: 20px;
|
|
|
|
|
background: #ff8b55;
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
font-size: 20px;
|
2022-07-07 20:35:13 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
.ant-btn:nth-of-type(1) {
|
2022-07-14 15:12:47 +08:00
|
|
|
|
width: 180px;
|
2022-07-07 20:35:13 +08:00
|
|
|
|
}
|
|
|
|
|
.ant-btn:nth-of-type(2) {
|
2022-07-14 15:12:47 +08:00
|
|
|
|
width: 220px;
|
2022-07-07 20:35:13 +08:00
|
|
|
|
}
|
|
|
|
|
.ant-btn:nth-of-type(3) {
|
2022-07-14 15:12:47 +08:00
|
|
|
|
width: 145px;
|
2022-07-07 20:35:13 +08:00
|
|
|
|
}
|
2022-06-20 18:38:56 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-07-06 12:05:05 +08:00
|
|
|
|
|
2022-07-07 20:35:13 +08:00
|
|
|
|
.right {
|
|
|
|
|
width: 5.8rem;
|
|
|
|
|
height: 4rem;
|
|
|
|
|
background: url('~@/assets/detailsAll/business/business_right_bg.png')
|
|
|
|
|
no-repeat;
|
|
|
|
|
background-size: 100%;
|
|
|
|
|
margin-top: -0.4rem;
|
|
|
|
|
}
|
2022-07-06 12:05:05 +08:00
|
|
|
|
}
|
2022-06-20 18:38:56 +08:00
|
|
|
|
</style>
|