hi-ucs/front/src/views/detailsAll/components/LayerService/LayerServiceUsageMode.vue

320 lines
9.9 KiB
Vue
Raw Normal View History

2022-06-22 15:56:33 +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-content">
<p>
<span>服务地址</span>
<span>{{ item.linkValue }}</span>
</p>
<p>
<span>样式服务地址</span>
2022-06-29 10:18:26 +08:00
<span>{{ item.csslnkValue }}</span>
2022-06-22 15:56:33 +08:00
</p>
</div>
</div>
<div class="right">
<div @click="technical()">接口文档</div>
<div @click="technicalNew()">使用手册</div>
</div>
</div>
<div class="content-right">
2022-06-29 10:18:26 +08:00
<div class="content-right-title">
2022-06-30 16:19:57 +08:00
<!-- {{ item.facilitator.values }} -->
{{ item.contact }}
2022-06-29 10:18:26 +08:00
</div>
2022-06-22 15:56:33 +08:00
<div class="content-right-content">
<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 { pinyin } from 'pinyin-pro'
import { ref, defineProps, watch } from 'vue'
let dataFrom = ref({
2022-06-29 10:18:26 +08:00
link: '',
2022-06-22 15:56:33 +08:00
title: '使用方式',
englishTitle: 'USAGE',
content: [
{
title: '组件地址',
link: {
name: '接口地址:',
},
linkValue: '',
2022-06-23 09:44:16 +08:00
csslnkValue: '',
2022-06-22 15:56:33 +08:00
contact: '归属部门',
2022-06-23 09:44:16 +08:00
facilitator: { name: '归属部门:', values: '讯飞科大' },
2022-06-22 15:56:33 +08:00
people: { name: '部门联系人:', value: '李四' },
phone: {
name: '联系人电话:',
value: '12345678901',
},
},
],
})
//数据初始化
const props = defineProps({
dataList: { type: Object, default: null },
})
const flag = ref(true)
if (props.dataList.infoList) {
let obj = props.dataList.infoList.filter(
2022-06-29 10:18:26 +08:00
(item) =>
item.attrType === '技术文档' ||
item.attrType === '服务商' ||
item.attrType === '服务商联系人' ||
2022-06-29 11:31:25 +08:00
item.attrType === '使用手册' ||
item.attrType === '服务地址' ||
item.attrType === '样式服务地址' ||
2022-06-29 10:18:26 +08:00
item.attrType === '服务商联系电话'
2022-06-22 15:56:33 +08:00
)[0]
if (!obj) {
flag.value = false
} else {
// eslint-disable-next-line vue/no-setup-props-destructure
2022-06-29 10:18:26 +08:00
// dataFrom.value.content[0].link.value = props.dataList.apiUrl
dataFrom.value.content[0].facilitator.values = props.dataList.deptName
dataFrom.value.content[0].people.value = props.dataList.deptContacts
dataFrom.value.content[0].phone.value = props.dataList.deptPhone
2022-06-22 15:56:33 +08:00
console.log('dataList', props.dataList)
props.dataList.infoList.map((item) => {
2022-06-29 10:18:26 +08:00
if (item.attrType === '使用手册') {
dataFrom.value.link = item.attrValue || '--'
} else if (item.attrType === '服务地址') {
2022-06-22 15:56:33 +08:00
dataFrom.value.content[0].linkValue = item.attrValue || '--'
2022-06-29 10:18:26 +08:00
} else if (item.attrType === '样式服务地址') {
dataFrom.value.content[0].csslnkValue = item.attrValue || '--'
2022-06-22 15:56:33 +08:00
}
2022-06-29 10:18:26 +08:00
// else if (item.attrType === '服务商联系电话') {
// dataFrom.value.content[0].phone.value = item.deptPhone || '--'
// }
2022-06-22 15:56:33 +08:00
})
}
}
watch(
() => props.dataList,
(val) => {
if (val) {
2022-06-29 10:18:26 +08:00
let obj = val.infoList.filter(
(item) =>
item.attrType === '技术文档' ||
item.attrType === '服务商' ||
item.attrType === '服务商联系人' ||
2022-06-29 11:31:25 +08:00
item.attrType === '使用手册' ||
item.attrType === '服务地址' ||
item.attrType === '样式服务地址' ||
2022-06-29 10:18:26 +08:00
item.attrType === '服务商联系电话'
)[0]
2022-06-22 15:56:33 +08:00
if (!obj) {
flag.value = false
} else {
2022-06-29 10:18:26 +08:00
// dataFrom.value.content[0].link.value = val.apiUrl
dataFrom.value.content[0].facilitator.values = val.deptName
dataFrom.value.content[0].people.value = val.deptContacts
dataFrom.value.content[0].phone.value = val.deptPhone
2022-06-22 15:56:33 +08:00
console.log('dataList', val)
val.infoList.map((item) => {
2022-06-29 10:18:26 +08:00
if (item.attrType === '使用手册') {
dataFrom.value.link = item.attrValue || '--'
} else if (item.attrType === '服务地址') {
2022-06-22 15:56:33 +08:00
dataFrom.value.content[0].linkValue = item.attrValue || '--'
2022-06-29 10:18:26 +08:00
} else if (item.attrType === '样式服务地址') {
dataFrom.value.content[0].csslnkValue = item.attrValue || '--'
2022-06-22 15:56:33 +08:00
}
2022-06-29 10:18:26 +08:00
// 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 || '--'
// }
2022-06-22 15:56:33 +08:00
})
}
}
}
)
function technical() {
// 拼接路径
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')
// console.log('dataFrom.value.link', dataFrom.value.link)
// window.open(
// window.SITE_CONFIG.previewUrl +
// 'hisense_office/onlinePreview?url=' +
// btoa(encodeURI(dataFrom.value.link))
// )
}
function technicalNew() {
// 拼接路径
// 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')
console.log('dataFrom.value.link', dataFrom.value.link)
window.open(
window.SITE_CONFIG.previewUrl +
'hisense_office/onlinePreview?url=' +
btoa(encodeURI(dataFrom.value.link))
)
}
</script>
<style lang="less" scoped>
.usage-mode {
display: flex;
flex-direction: column;
align-items: center;
padding: 0.8rem 0;
.content {
margin-top: 0.3rem;
display: flex;
.content-left {
height: 1.8rem;
width: 6.2rem;
background: linear-gradient(
to right,
rgba(113, 132, 252, 0.4),
rgba(148, 163, 252, 0.4)
);
border-radius: 0.1rem;
margin-right: 0.6rem;
box-shadow: 0rem 0.05rem 0.15rem rgba(82, 106, 255, 0.4);
display: flex;
align-items: center;
padding: 0 0.35rem;
.left {
.content-left-title {
font-size: 0.26rem;
line-height: 0.26rem;
color: #212956;
margin-bottom: 0.2rem;
span:first-child {
margin-right: 0.1rem;
}
}
.content-left-content {
width: 4.2rem;
font-size: 0.2rem;
color: rgba(33, 41, 86, 0.8);
line-height: 0.2rem;
p {
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
// margin-bottom: 0.1rem;
font-size: 20px;
color: #212956;
line-height: 26px;
}
p:last-of-type {
margin-top: 20px;
}
}
}
.right {
div {
height: 0.4rem;
width: 1.3rem;
background: #ffffff;
border-radius: 0.2rem;
color: #526aff;
font-size: 0.2rem;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}
div:first-child {
margin-bottom: 0.2rem;
}
}
}
.content-right {
height: 1.8rem;
width: 6.2rem;
background: linear-gradient(
to right,
rgba(113, 132, 252, 0.4),
rgba(148, 163, 252, 0.4)
);
border-radius: 0.1rem;
box-shadow: 0rem 0.05rem 0.15rem rgba(82, 106, 255, 0.4);
display: flex;
justify-content: space-around;
padding: 0 0.3rem;
flex-direction: column;
justify-content: center;
.content-right-title {
font-size: 0.26rem;
line-height: 0.26rem;
color: #212956;
margin-bottom: 0.15rem;
}
.content-right-content {
display: flex;
font-size: 0.18rem;
color: rgba(33, 41, 86, 0.8);
line-height: 0.2rem;
overflow: hidden;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
flex-direction: row;
margin-top: 0.2rem;
justify-content: space-between;
p {
// width: 1.60rem;
height: 0.2rem;
display: -webkit-box;
// overflow: hidden;
white-space: nowrap;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
margin-right: 0.15rem;
span {
cursor: pointer;
font-size: 20px;
color: #212956;
opacity: 0.8;
}
}
}
}
}
}
</style>