跨域搜索

This commit is contained in:
XaoLi717 2024-08-16 14:13:19 +08:00
parent d786ec3701
commit 75292d3f81
5 changed files with 824 additions and 0 deletions

View File

@ -150,6 +150,7 @@ const exportLoading = ref(false) // 导出的加载中
const getList = async () => {
loading.value = true
try {
console.log("queryParams",queryParams)
const data = await Star2Api.getStar2Page(queryParams)
list.value = data.list
total.value = data.total

View File

@ -0,0 +1,134 @@
<template>
<div class="abstract-group">
<el-checkbox-group v-model="abstract" class="abstract-checkbox-group" @change="changeCheckAll"
v-if="props.checkbox && (props.abstractList?.length !== 0)" >
<el-checkbox class="abstract-checkbox" v-for="(item,index) of props.abstractList" :key="index" :label="item">
<abstract-item :abstract="item" :searchSimilar="props.searchSimilar" :showCollect="props.showCollect"
@open-collect="openCollect" :from="props.from" />
</el-checkbox>
</el-checkbox-group>
<div class="abstract-list" v-if="!props.checkbox">
<abstract-item class="abstract" v-for="(item,index) of props.abstractList" :key="index" :abstract="item"
:searchSimilar="props.searchSimilar" :checkbox="props.checkbox" :showCollect="props.showCollect"
@open-collect="openCollect" :from="props.from"/>
</div>
<div class="abstract-checkbox-group-empty" v-if="props.abstractList?.length===0">
<span>暂无数据</span>
</div>
</div>
</template>
<script setup lang="ts">
import AbstractItem from './abxtract-item.vue'
import { defineProps } from 'vue';
import {SearchVO} from "@/api/search/main";
defineOptions({ name: 'AbstractGroup' })
const emit = defineEmits(['changeCheckAll','openCollect'])
const props = defineProps<{
abstractList: Array<SearchVO>,
searchSimilar: Boolean,
checkAll: Boolean,
indeterminate: Boolean,
searchCheckList: Array<any>,
checkbox: {
type: Boolean,
default: true
},
showCollect: {
type: Boolean,
default: false
},
from: String
}>()
let abstract = reactive<any[]>([])
watch(
() => props.checkAll,
() => {
if (props.checkAll) {
abstract.splice(0,abstract.length,...props.abstractList)
} else if (!props.indeterminate) {
abstract.splice(0,abstract.length)
}
}, { immediate: true }
)
const changeCheckAll = (val) => {
if (abstract.length === props.abstractList?.length){
emit('changeCheckAll',true,val)
}else{
emit('changeCheckAll',false,val)
}
}
const openCollect = (data) => {
emit('openCollect', data);
};
onMounted(() => {
if (true) {
abstract.splice(0, abstract.length, ...props.abstractList);
}
if (props.searchCheckList && props.searchCheckList.length > 0)
{
// abstract.value = props.searchCheckList
abstract.splice(0, abstract.length, ...props.searchCheckList);
}
})
</script>
<style scoped lang="scss">
.abstract-group {
.abstract-checkbox-group {
/*padding: 0 4px;*/
.abstract-checkbox {
width: 100%;
border-bottom: 1px solid #ECEEF5;
/*cursor: auto;*/
transition: background-color .3s;
&:hover {
background: #e1f3fb;
}
::v-deep .el-checkbox__input {
position: absolute;
top: 26px;
left: 12px;
}
::v-deep .el-checkbox__label {
padding: 0;
width: 100%;
}
}
}
.abstract-list {
.abstract {
width: 100%;
border-bottom: 1px solid #ECEEF5;
/*cursor: auto;*/
transition: background-color .3s;
&:hover {
background: #f5f7fa;
}
}
}
.abstract-checkbox-group-empty {
text-align: center;
border-bottom: 1px solid #ECEEF5;
border-right: 1px solid #ECEEF5;
border-left: 1px solid #ECEEF5;
> span {
color: #909399;
line-height: 120px;
font-size: 14px;
}
}
}
</style>

View File

@ -0,0 +1,129 @@
<template>
<div class="abstract-group">
123213123123567890
<!-- v-if="props.checkbox && (props.abstractList?.length !== 0)">-->
<el-checkbox-group v-model="abstract" class="abstract-checkbox-group" @change="changeCheckAll"
v-if="true">
<el-checkbox class="abstract-checkbox" v-for="(item,index) of props.abstractList" :key="index" :label="item">
</el-checkbox>
</el-checkbox-group>
</div>
</template>
<script setup lang="ts">
import AbstractItem from './abxtract-item.vue'
import { defineProps } from 'vue';
import {SearchVO} from "@/api/search/search";
defineOptions({ name: 'AbstractGroup' })
const emit = defineEmits(['changeCheckAll','openCollect'])
const props = defineProps<{
abstractList: Array<SearchVO>,
searchSimilar: {
type:boolean,
default: false
},
checkAll: boolean,
indeterminate: boolean,
searchCheckList: Array<any>,
checkbox: {
type: boolean,
default: true
},
showCollect: {
type: boolean,
default: false
},
from: string
}>()
let abstract = reactive<SearchVO[]>([])
watch(
() => props.checkAll,
() => {
if (props.checkAll) {
abstract.splice(0,abstract.length,...props.abstractList)
} else if (!props.indeterminate) {
abstract.splice(0,abstract.length)
}
}, { immediate: true }
)
const changeCheckAll = (val) => {
if (abstract.length === props.abstractList?.length){
emit('changeCheckAll',true,val)
}else{
emit('changeCheckAll',false,val)
}
}
const openCollect = (data) => {
emit('openCollect', data);
};
onMounted(() => {
if (true) {
abstract.splice(0, abstract.length, ...props.abstractList);
}
if (props.searchCheckList && props.searchCheckList.length > 0)
{
// abstract.value = props.searchCheckList
abstract.splice(0, abstract.length, ...props.searchCheckList);
}
})
</script>
<style scoped lang="scss">
.abstract-group {
.abstract-checkbox-group {
/*padding: 0 4px;*/
.abstract-checkbox {
width: 100%;
border-bottom: 1px solid #ECEEF5;
/*cursor: auto;*/
transition: background-color .3s;
&:hover {
background: #e1f3fb;
}
::v-deep .el-checkbox__input {
position: absolute;
top: 26px;
left: 12px;
}
::v-deep .el-checkbox__label {
padding: 0;
width: 100%;
}
}
}
.abstract-list {
.abstract {
width: 100%;
border-bottom: 1px solid #ECEEF5;
/*cursor: auto;*/
transition: background-color .3s;
&:hover {
background: #f5f7fa;
}
}
}
.abstract-checkbox-group-empty {
text-align: center;
border-bottom: 1px solid #ECEEF5;
border-right: 1px solid #ECEEF5;
border-left: 1px solid #ECEEF5;
> span {
color: #909399;
line-height: 120px;
font-size: 14px;
}
}
}
</style>

View File

@ -0,0 +1,280 @@
<template>
<div class="abstract-item" :class="checkbox ? 'abstract-checkbox-item': 'abstract-list-item'"
@click.prevent="goInfo(abstract,from)" >
<div class="abstract-item-header">
<div class="abstract-item-title">
<i class="abstract-item-icon"
v-if="isFileF(abstract.title)"
:class="fileName(abstract.title)"></i>
<span v-html="abstract.title" :title="filterTag(abstract.title).replace(/<[^>]+>/g,'')">
</span>
</div>
<div class="abstract-time">发布日期{{timeFilter(abstract.publishDate)}}</div>
<div class="abstract-item-handle" v-if="showCollect" @click.stop="openCollect(abstract)"><i
class="ic-shoucang1"></i>收藏
</div>
</div>
<div class="abstract-item-info">
<span :title="abstract.author">作者<i>{{abstract.author}}</i></span>
<span v-if="abstract.type" :title="abstract.type">分类<i>{{abstract.type}}</i></span>
</div>
<div class="abstract-item-desc" v-html="abstract.summary"></div>
<div class="abstract-item-footer">
<div class="abstract-item-tag">
<span>标签</span>
<span v-for="(tag,t) of abstract.labels" :key="t" class="tag" v-html="tag"
:title="filterTag(abstract.labels)"></span>
<span v-if="!abstract.labels || abstract.labels.length===0" class="tag">暂无标签</span>
</div>
<div class="abstract-item-num">
<template>
<span @click="outerVisible = true">查看详细信息 *</span>
</template>
<template>
<i></i>
<span>浏览{{abstract.readCount?abstract.readCount:0}}</span>
</template>
<template v-if="!searchSimilar">
<i></i>
<span>评论{{abstract.commentCount?abstract.commentCount:0}}</span>
</template>
</div>
</div>
<div>
<el-dialog
title="知识内容"
v-model="outerVisible"
style="height: 100%;
width: 100%"
>
<view
:list="viewLs"
/>
</el-dialog>
</div>
</div>
</template>
<script setup lang="ts">
import Template from "../../../activiti/index.vue";
import View from "@/views/search/view.vue";
import {computed, defineProps } from "vue";
import { useRouter } from 'vue-router';
import {SearchVO} from "@/api/search/main";
defineOptions({name:'AbstractItem'})
const router = useRouter();
const emit = defineEmits(['open-collect'])
const outerVisible = ref(false)
const viewLs = ref<Object>({})
const disViw = ref(false)
const props = defineProps<{
abstract: SearchVO,
searchSimilar: {
type: Boolean,
default: false
},
checkbox: {
type: Boolean,
default: true
},
showCollect: {
type: Boolean,
default: false
},
from: String
}>()
const filterTag = (val) =>{
return val.join(' ').replace(/<[^>]+>/g, '')
}
const fileName = (file) => {
return file
}
const isFileF = computed((v) => {
console.log(v)
return (v) => {
console.log(v)
return false
}
})
//
const addView = async () => {
viewLs.value = props.abstract
disViw.value = !disViw.value
}
const goInfo = async (row,path) => {
let url: { href: string } | null = null;
if (path === 'document'){
url = router.resolve({
name: 'dmInfo',
query: {
id: row.id
}
})
}else if (row.library.id === '1'){
url = router.resolve({
name: 'atomicView',
query: {
id: row.id
}
})
}
window.open(url?.href,'-blank')
}
const openCollect = async (data) => {
emit('open-collect', data)
}
//
onMounted(() => {
addView();
})
</script>
<style scoped lang="scss">
$--color-primary: #1890ff;
.abstract-checkbox-item {
margin: 19px 9px 0 45px;
}
.abstract-list-item {
padding: 19px 9px 0 11px;
}
.abstract-item {
/*height: 153px;*/
cursor: pointer;
.abstract-item-header {
display: flex;
align-items: center;
margin-bottom: 5px;
.abstract-item-title {
font-size: 16px;
color: #303133;
height: 24px;
line-height: 24px;
font-weight: 400;
white-space: pre-wrap;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
> .abstract-item-icon {
margin-right: 8px;
}
}
.abstract-time {
font-size: 12px;
color: #909399;
margin-left: 20px;
> i {
font-style: normal;
color: #303133;
}
}
.abstract-item-search {
width: 88px;
height: 22px;
border: 1px solid $--color-primary;
border-radius: 2px;
color: $--color-primary;
font-weight: 400;
font-size: 12px;
line-height: 22px;
text-align: center;
cursor: pointer;
margin-left: 15px;
}
.abstract-item-handle {
font-size: 12px;
line-height: 16px;
height: 16px;
color: $--color-primary;
margin-left: 15px;
cursor: pointer;
> i {
margin-right: 3px;
}
}
}
.abstract-item-info {
margin-bottom: 12px;
font-size: 12px;
height: 15px;
line-height: 15px;
white-space: pre-wrap;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
> span {
color: #909399;
margin-right: 30px;
> i {
font-style: normal;
color: #303133;
}
}
}
.abstract-item-desc {
cursor: pointer;
font-size: 14px;
color: #606266;
white-space: pre-wrap;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
margin-bottom: 11px;
}
.abstract-item-footer {
display: flex;
justify-content: space-between;
font-size: 12px;
height: 15px;
line-height: 15px;
color: #909399;
margin-bottom: 19px;
.abstract-item-tag {
white-space: pre-wrap;
overflow: hidden;
text-overflow: ellipsis;
> span.tag {
margin-right: 8px;
}
}
.abstract-item-num {
display: flex;
align-items: center;
> i {
display: inline-block;
width: 1px;
height: 12px;
background-color: #C0C4CC;
margin-right: 8px;
}
}
}
}
</style>

View File

@ -0,0 +1,280 @@
<template>
<div class="abstract-item" :class="checkbox ? 'abstract-checkbox-item': 'abstract-list-item'"
@click.prevent="goInfo(abstract,from)" >
<div class="abstract-item-header">
<div class="abstract-item-title">
<i class="abstract-item-icon"
v-if="isFileF(abstract.title)"
:class="fileName(abstract.title)"></i>
<span v-html="abstract.title" :title="filterTag(abstract.title).replace(/<[^>]+>/g,'')">
</span>
</div>
<div class="abstract-time">发布日期{{abstract.publishDate}}</div>
<div class="abstract-item-handle" v-if="showCollect" @click.stop="openCollect(abstract)"><i
class="ic-shoucang1"></i>收藏
</div>
</div>
<div class="abstract-item-info">
<!-- <span :title="abstract.author">作者<i>{{abstract.author}}</i></span>-->
<!-- <span v-if="abstract.type" :title="abstract.type">分类<i>{{abstract.type}}</i></span>-->
</div>
<div class="abstract-item-desc" v-html="abstract.summary"></div>
<div class="abstract-item-footer">
<div class="abstract-item-tag">
<!-- <span>标签</span>-->
<!-- <span v-for="(tag,t) of abstract.labels" :key="t" class="tag" v-html="tag"-->
<!-- :title="filterTag(abstract.labels)"></span>-->
<!-- <span v-if="!abstract.labels || abstract.labels.length===0" class="tag">暂无标签</span>-->
</div>
<div class="abstract-item-num">
<template>
<span @click="outerVisible = true">查看详细信息 *</span>
</template>
<template>
<i></i>
<span>浏览{{abstract.readCount?abstract.readCount:0}}</span>
</template>
<!-- <template v-if="!searchSimilar">-->
<!-- <i></i>-->
<!-- <span>评论{{abstract.commentCount?abstract.commentCount:0}}</span>-->
<!-- </template>-->
</div>
</div>
<div>
<el-dialog
title="知识内容"
v-model="outerVisible"
style="height: 100%;
width: 100%"
>
<view
:list="viewLs"
/>
</el-dialog>
</div>
</div>
</template>
<script setup lang="ts">
import Template from "../../../activiti/index.vue";
import View from "@/views/search/view.vue";
import {computed, defineProps } from "vue";
import { useRouter } from 'vue-router';
import {SearchVO} from "@/api/search/search";
defineOptions({name:'AbstractItem'})
const router = useRouter();
const emit = defineEmits(['open-collect'])
const outerVisible = ref(false)
const viewLs = ref<Object>({})
const disViw = ref(false)
const props = defineProps<{
abstract: SearchVO,
searchSimilar: {
type: Boolean,
default: false
},
checkbox: {
type: Boolean,
default: true
},
showCollect: {
type: Boolean,
default: false
},
from: String
}>()
const filterTag = (val) =>{
return val.join(' ').replace(/<[^>]+>/g, '')
}
const fileName = (file) => {
return file
}
const isFileF = computed((v) => {
console.log(v)
return (v) => {
console.log(v)
return false
}
})
//
const addView = async () => {
viewLs.value = props.abstract
disViw.value = !disViw.value
}
const goInfo = async (row,path) => {
let url: { href: string } | null = null;
if (path === 'document'){
url = router.resolve({
name: 'dmInfo',
query: {
id: row.id
}
})
}else if (row.library.id === '1'){
url = router.resolve({
name: 'atomicView',
query: {
id: row.id
}
})
}
window.open(url?.href,'-blank')
}
const openCollect = async (data) => {
emit('open-collect', data)
}
//
onMounted(() => {
addView();
})
</script>
<style scoped lang="scss">
$--color-primary: #1890ff;
.abstract-checkbox-item {
margin: 19px 9px 0 45px;
}
.abstract-list-item {
padding: 19px 9px 0 11px;
}
.abstract-item {
/*height: 153px;*/
cursor: pointer;
.abstract-item-header {
display: flex;
align-items: center;
margin-bottom: 5px;
.abstract-item-title {
font-size: 16px;
color: #303133;
height: 24px;
line-height: 24px;
font-weight: 400;
white-space: pre-wrap;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
> .abstract-item-icon {
margin-right: 8px;
}
}
.abstract-time {
font-size: 12px;
color: #909399;
margin-left: 20px;
> i {
font-style: normal;
color: #303133;
}
}
.abstract-item-search {
width: 88px;
height: 22px;
border: 1px solid $--color-primary;
border-radius: 2px;
color: $--color-primary;
font-weight: 400;
font-size: 12px;
line-height: 22px;
text-align: center;
cursor: pointer;
margin-left: 15px;
}
.abstract-item-handle {
font-size: 12px;
line-height: 16px;
height: 16px;
color: $--color-primary;
margin-left: 15px;
cursor: pointer;
> i {
margin-right: 3px;
}
}
}
.abstract-item-info {
margin-bottom: 12px;
font-size: 12px;
height: 15px;
line-height: 15px;
white-space: pre-wrap;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
> span {
color: #909399;
margin-right: 30px;
> i {
font-style: normal;
color: #303133;
}
}
}
.abstract-item-desc {
cursor: pointer;
font-size: 14px;
color: #606266;
white-space: pre-wrap;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
margin-bottom: 11px;
}
.abstract-item-footer {
display: flex;
justify-content: space-between;
font-size: 12px;
height: 15px;
line-height: 15px;
color: #909399;
margin-bottom: 19px;
.abstract-item-tag {
white-space: pre-wrap;
overflow: hidden;
text-overflow: ellipsis;
> span.tag {
margin-right: 8px;
}
}
.abstract-item-num {
display: flex;
align-items: center;
> i {
display: inline-block;
width: 1px;
height: 12px;
background-color: #C0C4CC;
margin-right: 8px;
}
}
}
}
</style>