hi-ucs/front/src/views/detailsAll/components/Algorithm/AlgorithmUsageMode.vue

314 lines
9.6 KiB
Vue
Raw Normal View History

2022-06-14 09:32:49 +08:00
<template>
<!-- 使用方式 -->
<div class="usage-mode" v-if="flag">
<div class="tltle">
<DetalsTitle
:title="dataFrom.title"
:type="dataFrom.englishTitle"
></DetalsTitle>
</div>
<div class="content" v-for="item in dataFrom.content" :key="item.title">
<div class="content-left">
<div class="left">
<div class="content-left-title">
<span>{{ item.title }}</span>
<span>{{ item.titleSon }}</span>
</div>
<div class="content-left-content">
<p>
<span>{{ item.link.name }}</span>
2022-07-06 11:58:13 +08:00
<a-tooltip>
<template #title>{{ item.link.value }}</template>
<span>{{ item.link.value }}</span>
</a-tooltip>
2022-06-14 09:32:49 +08:00
</p>
<p>
<span>{{ item.postMethod.name }}</span>
<span>{{ item.postMethod.value }}</span>
</p>
</div>
</div>
<div class="right">
<div @click="technical()">技术文档</div>
2022-06-30 18:18:10 +08:00
<!-- <div>新手指引</div> -->
2022-06-14 09:32:49 +08:00
</div>
</div>
<div class="content-right">
<div class="content-right-title">{{ item.contact }}</div>
<div class="content-right-content">
<p>
<span>{{ item.facilitator.name }}</span>
<a-tooltip>
<template #title>{{ item.facilitator.value }}</template>
<span>{{ item.facilitator.value }}</span>
</a-tooltip>
</p>
<p>
<span>{{ item.people.name }}</span>
<a-tooltip>
<template #title>{{ item.people.value }}</template>
<span>{{ item.people.value }}</span>
</a-tooltip>
</p>
<p>
<span>{{ item.phone.name }}</span>
<a-tooltip>
<template #title>{{ item.phone.value }}</template>
<span>{{ item.phone.value }}</span>
</a-tooltip>
</p>
</div>
</div>
</div>
</div>
</template>
<script setup>
import DetalsTitle from '@/views/detailsAll/components/DetalsTitle'
import { message } from 'ant-design-vue'
2022-06-16 13:59:02 +08:00
import { pinyin } from 'pinyin-pro'
2022-06-14 09:32:49 +08:00
import { ref, defineProps, watch } from 'vue'
let dataFrom = ref({
title: '使用方式',
englishTitle: 'USAGE',
content: [
{
title: '技术对接',
titleSon: '调用接口',
link: {
2022-07-06 11:58:13 +08:00
name: '服务接口:',
value: '',
2022-06-14 09:32:49 +08:00
},
postMethod: {
name: '请求方式:',
value: '',
2022-06-14 09:32:49 +08:00
},
contact: '联系厂商',
2022-06-14 09:32:49 +08:00
facilitator: { name: '服务商:', value: '科大讯飞' },
people: { name: '联系人:', value: '李四' },
phone: {
name: '联系电话:',
value: '12345678901',
},
},
],
link: '',
})
//数据初始化
const props = defineProps({
dataList: { type: Object, default: null },
})
const flag = ref(true)
if (props.dataList.infoList) {
let obj = props.dataList.infoList.filter(
2022-07-01 19:48:49 +08:00
(item) =>
item.attrType === '技术文档' ||
item.attrType === '服务商' ||
item.attrType === '服务商联系人' ||
item.attrType === '服务商联系电话'
2022-06-14 09:32:49 +08:00
)[0]
if (!obj) {
flag.value = false
} else {
// eslint-disable-next-line vue/no-setup-props-destructure
dataFrom.value.content[0].link.value = props.dataList.apiUrl
// eslint-disable-next-line vue/no-setup-props-destructure
dataFrom.value.content[0].postMethod.value = props.dataList.apiMethodType
console.log('dataList', props.dataList)
props.dataList.infoList.map((item) => {
if (item.attrType === '使用方式') {
dataFrom.value.content[0].titleSon = item.attrValue
} else if (item.attrType === '服务商') {
dataFrom.value.content[0].facilitator.value = item.attrValue || '--'
} else if (item.attrType === '服务商联系人') {
dataFrom.value.content[0].people.value = item.attrValue || '--'
} else if (item.attrType === '服务商联系电话') {
dataFrom.value.content[0].phone.value = item.attrValue || '--'
}
// } else if (item.attrType === '技术文档') {
// dataFrom.value.link = item.attrValue || '--'
// }
else if (item.attrType === '服务接口') {
dataFrom.value.content[0].link.value = item.attrValue || '--'
2022-06-14 09:32:49 +08:00
}
})
}
}
watch(
() => props.dataList,
(val) => {
if (val) {
2022-07-01 19:48:49 +08:00
let obj = val.infoList.filter(
(item) =>
item.attrType === '技术文档' ||
item.attrType === '服务商' ||
item.attrType === '服务商联系人' ||
item.attrType === '服务商联系电话'
)[0]
2022-06-14 09:32:49 +08:00
if (!obj) {
flag.value = false
} else {
dataFrom.value.content[0].link.value = val.apiUrl
dataFrom.value.content[0].postMethod.value = val.apiMethodType
console.log('dataList', val)
val.infoList.map((item) => {
if (item.attrType === '使用方式') {
dataFrom.value.content[0].titleSon = item.attrValue
} else if (item.attrType === '服务商') {
dataFrom.value.content[0].facilitator.value =
item.attrValue || '--'
} else if (item.attrType === '服务商联系人') {
dataFrom.value.content[0].people.value = item.attrValue || '--'
} else if (item.attrType === '服务商联系电话') {
dataFrom.value.content[0].phone.value = item.attrValue || '--'
}
// else if (item.attrType === '技术文档') {
// dataFrom.value.link = item.attrValue || '--'
// }
else if (item.attrType === '服务接口') {
dataFrom.value.content[0].link.value = item.attrValue || '--'
2022-06-14 09:32:49 +08:00
}
})
}
}
}
)
function technical() {
2022-06-16 13:59:02 +08:00
// 拼接路径
2022-07-01 18:23:43 +08:00
// const type = pinyin(props.dataList.type, {
// pattern: 'initial',
// }).replace(/\s*/g, '')
// // 打开文档
// const id = props.dataList.id
// window.open(window.SITE_CONFIG.frontUrl + type + '/' + id + '.md', '_blank')
2022-06-16 13:59:02 +08:00
// console.log('dataFrom.value.link', dataFrom.value.link)
2022-07-01 18:23:43 +08:00
let obj = props.dataList.infoList.filter(
(item) => item.attrType === '技术文档'
)[0]
// console.log('dataFrom.value.link', obj.attrValue)
if (obj) {
window.open(
window.SITE_CONFIG.previewUrl +
'hisense_office/onlinePreview?url=' +
btoa(encodeURI(obj.attrValue))
)
} else {
message.config({
top: '100px', // 距离顶部的位置
})
message.error('暂无上传技术文档')
}
2022-06-14 09:32:49 +08:00
}
</script>
<style lang="less" scoped>
.usage-mode {
display: flex;
flex-direction: column;
align-items: center;
padding: 80px 0;
.content {
margin-top: 30px;
display: flex;
.content-left {
height: 150px;
width: 620px;
background: linear-gradient(to right, #7184fc, #94a3fc);
border-radius: 10px;
margin-right: 60px;
box-shadow: 0px 5px 15px rgba(82, 106, 255, 0.4);
display: flex;
align-items: center;
padding: 0 35px;
.left {
.content-left-title {
font-size: 26px;
line-height: 26px;
color: #212956;
margin-bottom: 20px;
span:first-child {
margin-right: 10px;
}
}
.content-left-content {
width: 420px;
font-size: 20px;
color: rgba(33, 41, 86, 0.8);
line-height: 20px;
p {
overflow: hidden;
2022-07-06 11:58:13 +08:00
text-overflow: ellipsis;
white-space: nowrap;
2022-06-14 09:32:49 +08:00
margin-bottom: 10px;
}
}
}
.right {
div {
height: 40px;
width: 130px;
background: #ffffff;
border-radius: 20px;
color: #526aff;
font-size: 20px;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}
div:first-child {
margin-bottom: 20px;
}
}
}
.content-right {
height: 150px;
width: 620px;
background: linear-gradient(
to right,
rgba(113, 132, 252, 0.4),
rgba(148, 163, 252, 0.4)
);
border-radius: 10px;
box-shadow: 0px 5px 15px rgba(82, 106, 255, 0.4);
display: flex;
flex-direction: column;
justify-content: center;
padding: 0 30px;
.content-right-title {
font-size: 26px;
line-height: 26px;
color: #212956;
margin-bottom: 25px;
}
.content-right-content {
display: flex;
font-size: 18px;
color: rgba(33, 41, 86, 0.8);
line-height: 20px;
overflow: hidden;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
margin-bottom: 10px;
p {
// width: 160px;
height: 20px;
2022-07-06 11:58:13 +08:00
overflow: hidden;
text-overflow: ellipsis;
2022-06-14 09:32:49 +08:00
white-space: nowrap;
margin-right: 15px;
span {
2022-07-06 11:58:13 +08:00
display: inline-block;
max-width: 1.2rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
2022-06-14 09:32:49 +08:00
cursor: pointer;
}
}
}
}
}
}
</style>