main
wwl 2024-03-21 09:56:28 +08:00
parent d80d0988d2
commit 9ceffc71f9
6 changed files with 820 additions and 653 deletions

View File

@ -117,12 +117,17 @@ export interface ArticlePageReq {
type?: string
// 分类 1-外部环境 2-竞争对手 3-供方动向 4-大金集团 5-中国据点 6-调达本部 7-news 8-重要通知
cate?: String
position: String
position?: String
keyword?: String
}
export async function getArticlePage(params: ArticlePageReq) {
// return openApiRequest({ url: '/article/getPage', params })
return http.get('/article/getPage', { params })
}
export async function getSearchGlobal(params: ArticlePageReq) {
// return openApiRequest({ url: '/article/getPage', params })
return http.get('/app/search', { params })
}
export async function getArticleList(params: ArticlePageReq) {
// return openApiRequest({ url: '/article/getList', params })

View File

@ -1,27 +1,32 @@
<template>
<input type="text" placeholder="请输入搜索内容" @keydown.enter="keyDown" v-model="search"
class="h-full w-full text-#fff text-18px pl30px pr54px placeholder-#fff" />
<img src="@/assets/images/icon-search.svg" @click="clickThis" class="w22px h22px absolute right-24px top-50% -translate-y-50%" />
<input
type="text"
placeholder="请输入搜索内容"
@keydown.enter="keyDown"
v-model="search"
class="h-full w-full text-#fff text-18px pl30px pr54px placeholder-#fff"
/>
<img
src="@/assets/images/icon-search.svg"
@click="clickThis"
class="w22px h22px absolute right-24px top-50% -translate-y-50%"
/>
</template>
<script setup lang="ts">
import { searchStore } from '@/stores/modules/search'
const searchS = searchStore()
const search = ref('')
const { push } = useRouter()
const keyDown=(e)=>{
if(e.key ==='Enter'&&search.value)
{
searchS.search.content = search.value
push({name:'Search'})
const keyDown = (e) => {
if (e.key === 'Enter' && search.value) {
searchS.setArticle(search.value)
push({ name: 'Search' })
}
}
const clickThis = ()=>{
if(search.value)
{
searchS.search.content = search.value
push({name:'Search'})
const clickThis = () => {
if (search.value) {
searchS.setArticle(search.value)
push({ name: 'Search' })
}
}
</script>
</script>

View File

@ -1,17 +1,15 @@
import { defineStore } from 'pinia'
export const searchStore = defineStore('search', () => {
const search = ref({
content:''
})
function setArticle(data: { content: string }){
search.value = data
}
return { search,setArticle }
const search = ref({
content: '',
time: 0
})
})
function setArticle(data: string) {
search.value.content = data
search.value.time = new Date().getTime()
}
return { search, setArticle }
})

View File

@ -17,44 +17,44 @@ const newId = ref<string>()
const scale = ref(1)
const imgW = ref('auto')
const pageInfo = reactive({
currentPage: 1,
pageSize: 10,
type: '1',
total: 10
currentPage: 1,
pageSize: 10,
type: '1',
total: 10
})
const listData = ref([])
async function setModule(codes: any) {
const moduleCode = codes
await report({ moduleCode })
const moduleCode = codes
await report({ moduleCode })
}
const toDetail = (n: any, item: any) => {
// push(`${route.path}/${item.id}`)
// if(n.isSelect===1){
setModule(item)
push(`/external/info/${n.id}`)
// }
// else{
// message.info("")
// }
// push(`${route.path}/${item.id}`)
// if(n.isSelect===1){
setModule(item)
push(`/external/info/${n.id}`)
// }
// else{
// message.info("")
// }
}
const toList = (nb) => {
if (nb === 7) {
pages.page.cate = '7'
pages.page.title = 'News'
} else {
pages.page.cate = '8'
pages.page.title = '重要通知'
}
replace(`/external/info/${nb === 7 ? 'news' : 'info'}`)
// push({ name: 'DetailInfoList' })
if (nb === 7) {
pages.page.cate = '7'
pages.page.title = 'News'
} else {
pages.page.cate = '8'
pages.page.title = '重要通知'
}
replace(`/external/info/${nb === 7 ? 'news' : 'info'}`)
// push({ name: 'DetailInfoList' })
}
const SideNews = [
{ key: 'IntelligenceWithin', name: 'News', cate: 7, type: 0 },
{ key: 'IntelligenceOutside', name: '重要通知', cate: 8, type: 1 }
{ key: 'IntelligenceWithin', name: 'News', cate: 7, type: 0 },
{ key: 'IntelligenceOutside', name: '重要通知', cate: 8, type: 1 }
]
// News getArticlePage
@ -63,16 +63,15 @@ const newsSoll = ref<HTMLElement | null>(null)
let newLength: number
let newPum = 1
async function getArticle(page: any) {
const pasr = {
pageNum: page,
pageSize: '10',
type: '1',
cate: '7'
}
const { rows, total } = await externalList(pasr)
console.log('🚀 ~ file: Detail.vue:46 ~ rows:', rows)
newsList.value = rows || []
newLength = total / 10
const pasr = {
pageNum: page,
pageSize: '10',
type: '1',
cate: '7'
}
const { rows, total } = await externalList(pasr)
newsList.value = rows || []
newLength = total / 10
}
// getArticlePage
const portantList = ref<any[]>([])
@ -80,395 +79,379 @@ const portant = ref<HTMLElement | null>(null)
let pLenght: number
let prpum = 1
async function getArticleP(page: any) {
const pasr = {
pageNum: page,
pageSize: '10',
type: '1',
cate: '8'
}
const { rows, total } = await externalList(pasr)
portantList.value = rows || []
pLenght = total / 10
const pasr = {
pageNum: page,
pageSize: '10',
type: '1',
cate: '8'
}
const { rows, total } = await externalList(pasr)
portantList.value = rows || []
pLenght = total / 10
}
const state = ref<any>({})
const type = ref('')
watchEffect(() => {
const { id } = route.params as any
if (!id) return
newId.value = id as string
scale.value = id === '701' ? 2 : ['778', '840', '887'].includes(id) ? 1.5 : 1
imgW.value = id !== '1241' ? '100%' : 'auto'
getArticleP(1)
getArticle(1)
getData()
const { id } = route.params as any
if (!id) return
newId.value = id as string
scale.value = id === '701' ? 2 : ['778', '840', '887'].includes(id) ? 1.5 : 1
imgW.value = id !== '1241' ? '100%' : 'auto'
getArticleP(1)
getArticle(1)
getData()
})
async function getData() {
const { id } = route.params
if (!id) return
if (id == 'news' || id == 'info') {
const { rows, total } = await externalList({
pageNum: pageInfo.currentPage,
pageSize: pageInfo.pageSize,
type: pageInfo.type,
cate: id === 'news' ? '7' : '8'
})
type.value = id == 'news' ? 'News' : '重要通知'
pageInfo.total = total
listData.value = rows
return
}
listData.value = []
type.value = ''
const { data } = await externalInfo(id as string)
data.tagColor = data.tag === '紧急' ? '#e60e0e' : '#2cba06'
const { id } = route.params
if (!id) return
if (id == 'news' || id == 'info') {
const { rows, total } = await externalList({
pageNum: pageInfo.currentPage,
pageSize: pageInfo.pageSize,
type: pageInfo.type,
cate: id === 'news' ? '7' : '8'
})
type.value = id == 'news' ? 'News' : '重要通知'
pageInfo.total = total
listData.value = rows
return
}
listData.value = []
type.value = ''
const { data } = await externalInfo(id as string)
data.tagColor = data.tag === '紧急' ? '#e60e0e' : '#2cba06'
data.content = unescapeHTML(data.content)
state.value = data
console.log(state)
data.content = unescapeHTML(data.content)
state.value = data
console.log(state)
}
function unescapeHTML(html: string) {
const doc = new DOMParser().parseFromString(html, 'text/html')
return doc.documentElement.textContent
const doc = new DOMParser().parseFromString(html, 'text/html')
return doc.documentElement.textContent
}
const handleSizeChange = (e) => {
pageInfo.pageSize = e
pageInfo.currentPage = 1
getData()
pageInfo.pageSize = e
pageInfo.currentPage = 1
getData()
}
const handleCurrentChange = (e) => {
pageInfo.currentPage = e
getData()
pageInfo.currentPage = e
getData()
}
</script>
<template>
<div class="page w-1920px h-1080px p30px flex flex-col">
<HomeHead class="top">
<!-- <template #content>
<div class="page w-1920px h-1080px p30px flex flex-col">
<HomeHead class="top">
<!-- <template #content>
<HomeHeadSearch />
</template> -->
</HomeHead>
<div style="width: 400px" class="flex items-end absolute">
<!-- <img src="../images/ͼƬ1.png" alt=""> -->
<div v-if="false">
<span style="font-size: 20px; margin-top: -50px"
>大金空调调达本部HOMEPAGE</span
>
<el-button
class=""
style="font-size: 18px; margin-left: 5px"
type="primary"
round
@click="push({ name: 'external' })"
>
<!-- <img src="../images/fanhui.png" alt=""> -->
返回</el-button
>
</div>
</HomeHead>
<div style="width: 400px" class="flex items-end absolute">
<!-- <img src="../images/ͼƬ1.png" alt=""> -->
<div v-if="false">
<span style="font-size: 20px; margin-top: -50px">大金空调调达本部HOMEPAGE</span>
<el-button
class=""
style="font-size: 18px; margin-left: 5px"
type="primary"
round
@click="push({ name: 'external' })"
>
<!-- <img src="../images/fanhui.png" alt=""> -->
返回</el-button
>
</div>
<div class="w300px -mr-1px flex flex-col shrink-0">
<div class="text-20px text-#fff font-600 mt6px">
大金中国调达本部 HOMEPAGE
</div>
<!-- @dblclick="toggle" -->
<img src="@/assets/images/logo.png" class="w197px h44px mt14px" />
</div>
<!-- class="p-10 bg-[#3870E5] !w-[110px] !w-[48px] rounded-[24px] flex justify-center items-center" -->
<el-button
style="font-size: 18px; margin-left: 5px;background-color;:#3870E5;margin-bottom: 6px;"
type="primary"
round
@click="push({ name: 'external' })"
>
<img src="../images/fanhui.png" class="w-[27px] h-[20px] mr-2" alt="" />
返回
</el-button>
</div>
<div class="w300px -mr-1px flex flex-col shrink-0">
<div class="text-20px text-#fff font-600 mt6px">大金中国调达本部 HOMEPAGE</div>
<!-- @dblclick="toggle" -->
<img src="@/assets/images/logo.png" class="w197px h44px mt14px" />
</div>
<!-- class="p-10 bg-[#3870E5] !w-[110px] !w-[48px] rounded-[24px] flex justify-center items-center" -->
<el-button
style="font-size: 18px; margin-left: 5px;background-color;:#3870E5;margin-bottom: 6px;"
type="primary"
round
@click="push({ name: 'external' })"
>
<img src="../images/fanhui.png" class="w-[27px] h-[20px] mr-2" alt="" />
返回
</el-button>
</div>
<!-- <div class="h-full flex ml30px">
<!-- <div class="h-full flex ml30px">
<div class="font-600 flex items-end mt30px">
<div class="text-36px">详情</div>
<div class="text-18px ml40px mr25px">{{ day }}</div>
<div class="text-18px">{{ week }}</div>
</div>
</div> -->
<div class="main flex-1 rd-32px pt60px mt22px page-wrap">
<div class="absolute text-white top-18px left-30px">
<n-breadcrumb separator=">">
<n-breadcrumb-item @click="push({ name: 'external' })">
外部首页</n-breadcrumb-item
>
<n-breadcrumb-item> {{ type || state.title }}</n-breadcrumb-item>
</n-breadcrumb>
</div>
<!-- <div class="page-wrap h-934px mt24px" style="grid-template-columns: 1fr"> -->
<div class="page-main ml-28px mb-30px">
<AppBlock class="h-full">
<div
class="q-wrapper relative flex-1 text-#142142 flex flex-col bg-#fff p30px pl80px h-full"
v-if="listData.length"
>
<img
src="../images/beijq.png"
class="absolute bottom-0 left-0 right-0 z w-full"
/>
<div
class="mt8px cursor-pointer flex flex-wrap flex-col p15px pl20px text-18px max-w-100%"
>
<div
v-for="i in listData"
:key="i"
class="w-70% mb-20px flex items-center justify-between flex-1"
>
<div
class="truncate flex-1 text-#142142 hover:underline"
@click="push(`/external/info/${i.id}`)"
>
<img
v-if="i.tag === 'New'"
src="../images/NEW@2x.png"
class="h24px mr5px badge-new"
/>
<span
v-if="i.isTop === 'Y'"
class="text-#fff bg-red p5px text-16px rounded-5px mr-5px badge-24"
>置顶</span
>
<span
class="no-underline"
:style="i.isRead === 2 ? 'color:#0058E5' : ''"
>
{{ i.title }}
</span>
</div>
<div class="shrink-0 ml100px w-200px text-#808696">
{{ i.createTime }}
</div>
</div>
</div>
<div class="absolute bottom-20px left-50% translate-x-[-50%] z-11">
<el-pagination
background
v-model:current-page="pageInfo.currentPage"
v-model:page-size="pageInfo.pageSize"
layout="prev, pager, next, total,jumper,->"
:total="pageInfo.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</div>
<div v-else class="overflow-y-auto h-full">
<div class="px46px py40px">
<DetailNews
:title="state.title"
:content="state.content"
:publishTime="state.publishTime"
:tag="state.tag"
:tagColor="state.tagColor"
:source="state.source"
/>
</div>
</div>
</AppBlock>
</div>
<div class="flex-col mr-30px">
<div class="mb-26px" v-for="item in SideNews" :key="item.key">
<AppBlock class="h410px">
<div class="box h-full">
<div
class="box-title flex items-center"
@click="toList(item.cate)"
>
<span class="flex-1">{{ item.name }}</span>
<span></span>
</div>
<!-- hover:bg-[#2c7af7] -->
<div class="box-content overflow-y-auto px22px py-4px">
<div
class="line hover:bg-gray-100 hover:text-white hover:cursor-pointer hover:rounded-[10px]"
v-for="i in [newsList, portantList][item.type]"
:key="i.id"
@click="toDetail(i, 'App_E_News')"
>
<div class="flex flex-col">
<div class="truncate">
<img
v-if="i.tag === 'New'"
src="../images/NEW@2x.png"
class="h35px mr5px badge-new !h-20px"
/>
<!-- <span
<div class="main flex-1 rd-32px pt60px mt22px page-wrap">
<div class="absolute text-white top-18px left-30px">
<n-breadcrumb separator=">">
<n-breadcrumb-item @click="push({ name: 'external' })"> 外部首页</n-breadcrumb-item>
<n-breadcrumb-item> {{ type || state.title }}</n-breadcrumb-item>
</n-breadcrumb>
</div>
<!-- <div class="page-wrap h-934px mt24px" style="grid-template-columns: 1fr"> -->
<div class="page-main ml-28px mb-30px">
<AppBlock class="h-full">
<div
class="q-wrapper relative flex-1 text-#142142 flex flex-col bg-#fff p30px pl80px h-full"
v-if="listData.length"
>
<img src="../images/beijq.png" class="absolute bottom-0 left-0 right-0 z w-full" />
<div
class="mt8px cursor-pointer flex flex-wrap flex-col p15px pl20px text-18px max-w-100%"
>
<div
v-for="i in listData"
:key="i"
class="w-70% mb-20px flex items-center justify-between flex-1"
>
<div
class="truncate flex-1 text-#142142 hover:underline"
@click="push(`/external/info/${i.id}`)"
>
<img
v-if="i.tag === 'New'"
src="../images/NEW@2x.png"
class="h24px mr5px badge-new"
/>
<span
v-if="i.isTop === 'Y'"
class="text-#fff bg-red p5px text-16px rounded-5px mr-5px badge-24"
>置顶</span
>
<span class="no-underline" :style="i.isRead === 2 ? 'color:#0058E5' : ''">
{{ i.title }}
</span>
</div>
<div class="shrink-0 ml100px w-200px text-#808696">
{{ i.createTime }}
</div>
</div>
</div>
<div class="absolute bottom-20px left-50% translate-x-[-50%] z-11">
<el-pagination
background
v-model:current-page="pageInfo.currentPage"
v-model:page-size="pageInfo.pageSize"
layout="prev, pager, next, total,jumper,->"
:total="pageInfo.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</div>
<div v-else class="overflow-y-auto h-full">
<div class="px46px py40px">
<DetailNews
:title="state.title"
:content="state.content"
:publishTime="state.publishTime"
:tag="state.tag"
:tagColor="state.tagColor"
:source="state.source"
/>
</div>
</div>
</AppBlock>
</div>
<div class="flex-col mr-30px">
<div class="mb-26px" v-for="item in SideNews" :key="item.key">
<AppBlock class="h410px">
<div class="box h-full">
<div class="box-title flex items-center" @click="toList(item.cate)">
<span class="flex-1">{{ item.name }}</span>
<span></span>
</div>
<!-- hover:bg-[#2c7af7] -->
<div class="box-content overflow-y-auto px22px py-4px">
<div
class="line hover:bg-gray-100 hover:text-white hover:cursor-pointer hover:rounded-[10px]"
v-for="i in [newsList, portantList][item.type]"
:key="i.id"
@click="toDetail(i, 'App_E_News')"
>
<div class="flex flex-col">
<div class="truncate">
<img
v-if="i.tag === 'New'"
src="../images/NEW@2x.png"
class="h35px mr5px badge-new !h-20px"
/>
<!-- <span
v-if="i.tag === '紧急'"
class="text-#fff bg-[#E60E0E] p5px text-14px rounded-5px mr-5px badge-24"
/> -->
<span
v-if="i.isTop === 'Y'"
class="text-#fff bg-red p5px text-14px rounded-5px mr-5px badge-24"
>置顶</span
>
<span
:style="
i.isRead === 2 ? 'color:#0058E5;font-weight:bolb' : ''
"
:title="i.title"
>{{ i.title }}</span
>
</div>
<span
v-if="i.isTop === 'Y'"
class="text-#fff bg-red p5px text-14px rounded-5px mr-5px badge-24"
>置顶</span
>
<span
:style="i.isRead === 2 ? 'color:#0058E5;font-weight:bolb' : ''"
:title="i.title"
>{{ i.title }}</span
>
</div>
<!-- <div
<!-- <div
class="icons min-w-110px w110px h20px mt15px absolute right-0px top-0 text-black"
> -->
<div class="min-w-110px w110px text-black mb-8px ml-auto">
{{ i.createTime?.substring(0, 10) }}
</div>
</div>
</div>
</div>
</div>
</AppBlock>
</div>
</div>
<!-- </div> -->
</div>
</div>
<div class="min-w-110px w110px text-black mb-8px ml-auto">
{{ i.createTime?.substring(0, 10) }}
</div>
</div>
</div>
</div>
</div>
</AppBlock>
</div>
</div>
<!-- </div> -->
</div>
</div>
</template>
<style scoped lang="less">
.back {
position: absolute;
top: 5px;
left: 5px;
color: #fff;
// z-index: 500;
position: absolute;
top: 5px;
left: 5px;
color: #fff;
// z-index: 500;
// font-weight: bold;
text-align: center;
justify-content: center;
// display: flex;
font-size: 14px;
// font-weight: bold;
text-align: center;
justify-content: center;
// display: flex;
font-size: 14px;
}
.top {
right: 30px;
top: -10px;
right: 30px;
top: -10px;
}
.page {
width: 100%;
height: 100px;
font-family: 'PingFang SC';
user-select: none;
background: 0;
// background-image: url('@/assets/images/bg.jpg');
// background-color: #000;
// background-position: 0 0;
// background-repeat: no-repeat;
// background-size: cover;
color: #fff;
width: 100%;
height: 100px;
font-family: 'PingFang SC';
user-select: none;
background: 0;
// background-image: url('@/assets/images/bg.jpg');
// background-color: #000;
// background-position: 0 0;
// background-repeat: no-repeat;
// background-size: cover;
color: #fff;
line-height: 1;
.page-wrap {
display: grid;
grid-template-columns: 1fr 414px;
grid-template-rows: repeat(2, 1fr);
grid-column-gap: 30px;
grid-row-gap: 30px;
height: 936px;
line-height: 1;
.page-wrap {
display: grid;
grid-template-columns: 1fr 414px;
grid-template-rows: repeat(2, 1fr);
grid-column-gap: 30px;
grid-row-gap: 30px;
height: 936px;
.page-main {
height: 850px;
// padding-bottom: 20px;
// grid-area: 1 / 1 / 3 / 2;
}
.page-side {
margin-right: 30px;
// height: 100%;
// grid-area: 1 / 2 / 2 / 3;
&:last-of-type {
// height: 300px;
// grid-area: 2 / 2 / 3 / 3;
}
}
}
.page-main {
height: 850px;
// padding-bottom: 20px;
// grid-area: 1 / 1 / 3 / 2;
}
.page-side {
margin-right: 30px;
// height: 100%;
// grid-area: 1 / 2 / 2 / 3;
&:last-of-type {
// height: 300px;
// grid-area: 2 / 2 / 3 / 3;
}
}
}
}
.main {
background-image: url('@/assets/images/bg-rs-main.svg');
background-position: 0 0;
background-repeat: repeat-x;
background-size: auto;
background-image: url('@/assets/images/bg-rs-main.svg');
background-position: 0 0;
background-repeat: repeat-x;
background-size: auto;
}
.box {
--title-h: 58px;
--title-h: 58px;
border: 0;
.box-title {
height: var(--title-h);
color: #fff;
background-color: #537deb;
font-size: 18px;
font-weight: 600;
padding: 0 24px;
cursor: pointer;
}
.box-content {
height: 100%;
max-height: calc(100% - var(--title-h));
}
border: 0;
.box-title {
height: var(--title-h);
color: #fff;
background-color: #537deb;
font-size: 18px;
font-weight: 600;
padding: 0 24px;
cursor: pointer;
}
.box-content {
height: 100%;
max-height: calc(100% - var(--title-h));
}
}
.line {
border-bottom: 1px solid #eef3fb;
border-bottom: 1px solid #eef3fb;
}
.badge-24 {
box-sizing: border-box;
height: 24px;
display: inline-block;
line-height: 24px;
padding: 0 5px;
box-sizing: border-box;
height: 24px;
display: inline-block;
line-height: 24px;
padding: 0 5px;
}
.truncate {
max-width: 395px;
min-width: 100px;
overflow: hidden;
padding: 4px 0 4px 6px;
line-height: 24px;
color: black;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 395px;
min-width: 100px;
overflow: hidden;
padding: 4px 0 4px 6px;
line-height: 24px;
color: black;
text-overflow: ellipsis;
white-space: nowrap;
}
::v-deep(.n-breadcrumb-item__link) {
color: #fff !important;
font-size: 18px !important;
font-size: 16px !important;
font-weight: 600 !important;
&:hover {
color: #fff;
}
color: #fff !important;
font-size: 18px !important;
font-size: 16px !important;
font-weight: 600 !important;
&:hover {
color: #fff;
}
}
::v-deep {
.el-pagination {
--el-pagination-border-radius: 8px;
}
.n-breadcrumb-item__separator {
color: #fff !important;
font-size: 16px !important;
}
span > img {
width: v-bind(imgW);
object-fit: contain;
}
p > img {
// width: 100%;
// object-fit: contain;
// transform: scale(1.5);
// width: v-bind(imgW);
transform: scale(v-bind(scale));
transform-origin: top;
}
.el-pagination {
--el-pagination-border-radius: 8px;
}
.n-breadcrumb-item__separator {
color: #fff !important;
font-size: 16px !important;
}
span > img {
// width: v-bind(imgW);
width: auto;
object-fit: contain;
}
p > img {
// width: 100%;
// object-fit: contain;
// transform: scale(1.5);
// width: v-bind(imgW);
transform: scale(v-bind(scale));
transform-origin: top;
}
}
</style>

View File

@ -4,60 +4,56 @@ import AppBlock from '@/components/AppBlock.vue'
import AppNewsBox from '@/components/AppNewsBox.vue'
import Layout from './components/Layout.vue'
import DetailNews from './DetailNews.vue'
import {
getArticleDetail,
getArticlePage,
getManagerDetail
} from '@/api/daikin/base'
import { getArticleDetail, getArticlePage, getManagerDetail } from '@/api/daikin/base'
import { message } from '@/utils/message'
const { push } = useRouter()
const route = useRoute()
const SideNews = [
{ key: 'IntelligenceOutside', name: '社外情报' },
{ key: 'IntelligenceWithin', name: '社内情报' }
{ key: 'IntelligenceOutside', name: '社外情报' },
{ key: 'IntelligenceWithin', name: '社内情报' }
]
const state = ref<any>({})
async function getData() {
const { id, flag } = route.params
console.log(typeof flag)
if (!id) return
if (flag === 'true') {
// &
const { data } = await getManagerDetail(id as string)
data.tagColor = data.tag === '紧急' ? '#e60e0e' : '#2cba06'
data.content = unescapeHTML(data.content)
state.value = data
} else {
const { data } = await getArticleDetail(id as string)
data.tagColor = data.tag === '紧急' ? '#e60e0e' : '#2cba06'
const { id, flag } = route.params
console.log(typeof flag)
if (!id) return
if (flag === 'true') {
// &
const { data } = await getManagerDetail(id as string)
data.tagColor = data.tag === '紧急' ? '#e60e0e' : '#2cba06'
data.content = unescapeHTML(data.content)
state.value = data
} else {
const { data } = await getArticleDetail(id as string)
data.tagColor = data.tag === '紧急' ? '#e60e0e' : '#2cba06'
data.content = unescapeHTML(data.content)
state.value = data
}
data.content = unescapeHTML(data.content)
state.value = data
}
}
function unescapeHTML(html: string) {
const doc = new DOMParser().parseFromString(html, 'text/html')
return doc.documentElement.textContent
const doc = new DOMParser().parseFromString(html, 'text/html')
return doc.documentElement.textContent
}
async function getDatas(id: string) {
if (!id) return
const { data } = await getArticleDetail(id as string)
data.content = unescapeHTML(data.content)
state.value = data
if (!id) return
const { data } = await getArticleDetail(id as string)
data.content = unescapeHTML(data.content)
state.value = data
}
async function toDetail2(n: { id: any }) {
console.log(route, route.path, n.id)
if (n.id === 0) return
if (n.isSelect === 1) {
getDatas(n.id)
} else {
message.info('您没有权限查看!')
}
console.log(route, route.path, n.id)
if (n.id === 0) return
if (n.isSelect === 1) {
getDatas(n.id)
} else {
message.info('您没有权限查看!')
}
}
getData()
@ -67,101 +63,96 @@ getPageLists(1)
const neiScoll = ref<HTMLElement | null>(null)
const waiScoll = ref<HTMLElement | null>(null)
onMounted(() => {
neiScoll.value?.addEventListener('scroll', handleNeiScoll)
waiScoll.value?.addEventListener('scroll', handlewaiScoll)
neiScoll.value?.addEventListener('scroll', handleNeiScoll)
waiScoll.value?.addEventListener('scroll', handlewaiScoll)
})
const listData = ref<any[]>([])
let neiLength: number
let neiPum = 1
async function getPageList(page) {
const pasr = {
pageNum: page,
pageSize: 5,
type: 2,
position: 'recommend'
}
const { rows, total } = await getArticlePage(pasr)
neiLength = total / 6
listData.value.push(...rows)
console.log(listData.value)
const pasr = {
pageNum: page,
pageSize: 5,
type: 2,
position: 'recommend'
}
const { rows, total } = await getArticlePage(pasr)
neiLength = total / 6
listData.value.push(...rows)
console.log(listData.value)
}
const listDatas = ref<any[]>([])
let waiLength: number
let waiPum = 1
async function getPageLists(page) {
const pasr = {
pageNum: page,
pageSize: 5,
type: 1,
position: 'recommend'
}
const { rows, total } = await getArticlePage(pasr)
waiLength = total / 6
listDatas.value.push(...rows)
const pasr = {
pageNum: page,
pageSize: 5,
type: 1,
position: 'recommend'
}
const { rows, total } = await getArticlePage(pasr)
waiLength = total / 6
listDatas.value.push(...rows)
}
const handleNeiScoll = () => {
const container = neiScoll.value
if (container) {
const isAtBottom =
container.scrollHeight - container.scrollTop === container.clientHeight
if (isAtBottom) {
if (neiPum < neiLength) {
++neiPum
getPageList(neiPum)
}
}
}
const container = neiScoll.value
if (container) {
const isAtBottom = container.scrollHeight - container.scrollTop === container.clientHeight
if (isAtBottom) {
if (neiPum < neiLength) {
++neiPum
getPageList(neiPum)
}
}
}
}
const handlewaiScoll = () => {
const container = waiScoll.value
if (container) {
const isAtBottom =
container.scrollHeight - container.scrollTop === container.clientHeight
if (isAtBottom) {
if (waiPum < waiLength) {
++waiPum
getPageList(waiPum)
}
}
}
const container = waiScoll.value
if (container) {
const isAtBottom = container.scrollHeight - container.scrollTop === container.clientHeight
if (isAtBottom) {
if (waiPum < waiLength) {
++waiPum
getPageList(waiPum)
}
}
}
}
</script>
<template>
<Layout>
<div class="page-wrap h-834px">
<div class="page-main">
<AppBlock class="h-full">
<div class="overflow-y-auto h-full">
<div class="px46px py40px">
<DetailNews
:title="state.title"
:content="state.content"
:publishTime="state.publishTime"
:tag="state.tag"
:tagColor="state.tagColor"
:source="state.source"
/>
</div>
</div>
</AppBlock>
</div>
<div class="page-side">
<AppBlock class="h-400px">
<div class="box h-full">
<div
class="box-title flex items-center"
@click="push({ name: 'IntelligenceWithin' })"
>
<span class="flex-1">社内情报</span>
<span></span>
</div>
<div ref="neiScoll" class="box-content overflow-y-auto px22px">
<div class="py13px line" v-for="i in listData" :key="i">
<!-- <AppNewsBox @click="toDetail2(i)"
<Layout>
<div class="page-wrap h-834px">
<div class="page-main">
<AppBlock class="h-full">
<div class="overflow-y-auto h-full">
<div class="px46px py40px">
<DetailNews
:title="state.title"
:content="state.content"
:publishTime="state.publishTime"
:tag="state.tag"
:tagColor="state.tagColor"
:source="state.source"
/>
</div>
</div>
</AppBlock>
</div>
<div class="page-side">
<AppBlock class="h-400px">
<div class="box h-full">
<div class="box-title flex items-center" @click="push({ name: 'IntelligenceWithin' })">
<span class="flex-1">社内情报</span>
<span></span>
</div>
<div ref="neiScoll" class="box-content overflow-y-auto px22px">
<div class="py13px line" v-for="i in listData" :key="i">
<!-- <AppNewsBox @click="toDetail2(i)"
class="!lh-2em"
:labelText="i.tag"
labelColor="#2cba06"
@ -169,40 +160,29 @@ const handlewaiScoll = () => {
:date="i.publishTime"
size="h20px"
/> -->
<div class="flex" @click="toDetail2(i)">
<img
v-if="i.tag === 'New'"
src="../../../assets/images/NEW3.gif"
class="h20px"
/>
<img
v-if="i.tag === '紧急'"
src="../../../assets/images/jj.gif"
class="h20px"
/>
<div class="ml5px leading-4.5 max-w300px overflow-ellipsis">
{{ i.title }}
</div>
</div>
<div class="text-#808696 text-right">{{ i.publishTime }}</div>
</div>
</div>
</div>
</AppBlock>
</div>
<div class="page-side">
<AppBlock class="h-400px">
<div class="box h-full">
<div
class="box-title flex items-center"
@click="push({ name: 'IntelligenceOutside' })"
>
<span class="flex-1">社外情报</span>
<span></span>
</div>
<div ref="waiScoll" class="box-content overflow-y-auto px22px">
<div class="py13px line" v-for="i in listDatas" :key="i">
<!-- <AppNewsBox @click="toDetail2(i)"
<div class="flex" @click="toDetail2(i)">
<img v-if="i.tag === 'New'" src="../../../assets/images/NEW3.gif" class="h20px" />
<img v-if="i.tag === ''" src="../../../assets/images/jj.gif" class="h20px" />
<div class="ml5px leading-4.5 max-w300px overflow-ellipsis">
{{ i.title }}
</div>
</div>
<div class="text-#808696 text-right">{{ i.publishTime }}</div>
</div>
</div>
</div>
</AppBlock>
</div>
<div class="page-side">
<AppBlock class="h-400px">
<div class="box h-full">
<div class="box-title flex items-center" @click="push({ name: 'IntelligenceOutside' })">
<span class="flex-1">社外情报</span>
<span></span>
</div>
<div ref="waiScoll" class="box-content overflow-y-auto px22px">
<div class="py13px line" v-for="i in listDatas" :key="i">
<!-- <AppNewsBox @click="toDetail2(i)"
class="!lh-2em"
:labelText="i.tag"
labelColor="#2cba06"
@ -211,80 +191,72 @@ const handlewaiScoll = () => {
size="h20px"
/> -->
<div class="flex" @click="toDetail2(i)">
<img
v-if="i.tag === 'New'"
src="../../../assets/images/NEW3.gif"
class="h20px"
/>
<img
v-if="i.tag === '紧急'"
src="../../../assets/images/jj.gif"
class="h20px"
/>
<div class="ml5px leading-4.5 max-w300px overflow-ellipsis">
{{ i.title }}
</div>
</div>
<div class="text-#808696 text-right mt8px">
{{ i.publishTime }}
</div>
</div>
</div>
</div>
</AppBlock>
</div>
</div>
</Layout>
<div class="flex" @click="toDetail2(i)">
<img v-if="i.tag === 'New'" src="../../../assets/images/NEW3.gif" class="h20px" />
<img v-if="i.tag === ''" src="../../../assets/images/jj.gif" class="h20px" />
<div class="ml5px leading-4.5 max-w300px overflow-ellipsis">
{{ i.title }}
</div>
</div>
<div class="text-#808696 text-right mt8px">
{{ i.publishTime }}
</div>
</div>
</div>
</div>
</AppBlock>
</div>
</div>
</Layout>
</template>
<style scoped lang="less">
.overflow-ellipsis {
white-space: nowrap; /* 防止换行 */
overflow: hidden; /* 隐藏溢出部分 */
text-overflow: ellipsis; /* 显示省略号 */
white-space: nowrap; /* 防止换行 */
overflow: hidden; /* 隐藏溢出部分 */
text-overflow: ellipsis; /* 显示省略号 */
}
.page-wrap {
display: grid;
grid-template-columns: 1fr 314px;
grid-template-rows: repeat(2, 1fr);
grid-column-gap: 30px;
grid-row-gap: 30px;
display: grid;
grid-template-columns: 1fr 314px;
grid-template-rows: repeat(2, 1fr);
grid-column-gap: 30px;
grid-row-gap: 30px;
.page-main {
height: 830px;
grid-area: 1 / 1 / 3 / 2;
width: 100%;
}
.page-side {
height: 100%;
grid-area: 1 / 2 / 2 / 3;
&:last-of-type {
height: 300px;
grid-area: 2 / 2 / 3 / 3;
}
}
.page-main {
height: 830px;
grid-area: 1 / 1 / 3 / 2;
width: 100%;
}
.page-side {
height: 100%;
grid-area: 1 / 2 / 2 / 3;
&:last-of-type {
height: 300px;
grid-area: 2 / 2 / 3 / 3;
}
}
}
.box {
--title-h: 58px;
--title-h: 58px;
border: 0;
.box-title {
height: var(--title-h);
color: #fff;
background-color: #537deb;
font-size: 18px;
font-weight: 600;
padding: 0 24px;
cursor: pointer;
}
.box-content {
height: 100%;
max-height: calc(100% - var(--title-h));
}
border: 0;
.box-title {
height: var(--title-h);
color: #fff;
background-color: #537deb;
font-size: 18px;
font-weight: 600;
padding: 0 24px;
cursor: pointer;
}
.box-content {
height: 100%;
max-height: calc(100% - var(--title-h));
}
}
.line {
border-bottom: 1px solid #eef3fb;
border-bottom: 1px solid #eef3fb;
}
</style>

View File

@ -3,10 +3,12 @@ import { useUserStore } from '@/stores/modules/user'
import HomeHead from '@/views/home/components/HomeHead.vue'
// import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
import { useDate } from '@/views/home/hooks/useDate'
import { getArticlePage } from '@/api/daikin/base'
import { getArticlePage, getSearchGlobal } from '@/api/daikin/base'
import { noticeld } from '@/stores/modules/noticeId'
import { searchStore } from '@/stores/modules/search'
import { message } from '@/utils/message'
import { NPopover } from 'naive-ui'
const store = noticeld()
const store2 = useUserStore()
const searchS = searchStore()
@ -15,81 +17,282 @@ const { push } = useRouter()
const route = useRoute()
const listData = ref()
const flg =ref()
let keywords =ref()
const flg = ref()
let keywords = ref()
const pageInfo = reactive({
currentPage: 1,
pageSize: 10,
total: 0
})
// App_Article App_Market App_data_platform , App_BCP BCP, App_CSR ,App_Quality ,App_Lab Lab,App_Database DatabBase
const codeType = {
App_Article: '外部情报', //
App_Market: '市况汇率', // fileCommon.fileSize
App_data_platform: '数据平台', // fileCommon.fileSize
App_BCP: 'BCP模块', // fileCommon.fileSize
App_CSR: '碳中和模块', // fileCommon.fileSize
App_Quality: '品质模块', // fileCommon.fileSize
App_Lab: 'Lab模块', // fileCommon.fileSize
App_Database: 'DatabBase模块', // fileCommon.fileSize
App_News: '新闻模块'
}
const loading = ref(true)
async function getSearchList() {
const keyword = keywords.value
const { rows } = await getArticlePage({ pageNum: 1, pageSize: 100, type: 2, position: 'search', keyword } as any);
listData.value = rows
loading.value = true
const keyword = searchS.search.content
// const { rows } = await getArticlePage({ pageNum: 1, pageSize: 100, type: 2, position: 'search', keyword } as any);
const { rows, total } = await getSearchGlobal({
pageNum: pageInfo.currentPage,
pageSize: pageInfo.pageSize,
keyword
} as any).catch((e) => {
loading.value = false
listData.value = []
})
listData.value = rows
setTimeout(() => {
loading.value = false
}, 300)
pageInfo.total = total
}
watchSyncEffect(()=>{
keywords.value = searchS.search.content
// console.log(keywords.value)
getSearchList()
watchEffect(() => {
searchS.search.time
getSearchList(searchS.search.content)
})
onMounted(() => {
getSearchList()
flg.value = store2.user.isReview > 0
console.log(flg.value,store2.user.isReview)
})
const clickTo=(obj)=>{
// console.log(obj)
if(obj.isSelect===1){
push(`${route.path}/${obj.id}`)
}
else{
message.info("您没有权限查看!")
}
const codePath = {
App_Article: {
path: '/intelligence/outside/',
modulePath: '/Home/intelligence'
},
App_Market: {
path: '/Home/market',
modulePath: '/Home/market'
},
App_data_platform: {
path: '/Home/cd',
modulePath: '/Home/cd'
},
App_BCP: {
path: '/Home/bcp',
modulePath: '/Home/bcp'
},
// '',
App_CSR: {
path: '/Home/csr',
modulePath: '/Home/csr'
},
// '',
App_Quality: {
path: '/Home/quality',
modulePath: '/Home/quality'
},
// 'Lab',
App_Lab: {
path: '/Home/diffspace',
modulePath: '/Home/diffspace'
},
// 'DatabBase'
App_Database: {
path: '/DataBase',
modulePath: '/DataBase'
}
}
const clickItem = (item) => {
const { id, filePath, isSelect, moduleCode, fileCommon = {} } = item
console.log('🚀 ~ file: index.vue:104 ~ item:', item)
if (isSelect === 1) {
downloads({ fileCommon, filePath })
} else {
message.info('您没有权限查看!')
}
}
const downloads = (data: any = {}) => {
const { fileCommon, filePath } = data
if ((fileCommon?.fileSize || 0) > 25 * 1024 * 1024) {
message.info('正在下载中,请稍等~')
downloadFile(filePath)
return
}
if (filePath) {
window.open(filePath, '_blank')
} else {
message.info('没有可预览文件!')
}
}
function downloadFile(url: any) {
fetch(url)
.then((response) => response.blob())
.then((blob) => {
const downloadUrl = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = downloadUrl
link.download = getFileNameFromUrl(url)
link.click()
})
}
function getFileNameFromUrl(url: string) {
console.log(
'🚀 ~ file: index.vue:107 ~ getFileNameFromUrl ~ getFileNameFromUrl:',
getFileNameFromUrl
)
const lastSlashIndex = url.lastIndexOf('/')
if (lastSlashIndex !== -1) {
return url.substring(lastSlashIndex + 1)
} else {
return 'Invalid URL'
}
}
const goModule = (item, type) => {
const { moduleCode, id } = item
const { modulePath, path } = codePath[moduleCode]
if (modulePath) {
if (type === 'module') {
push(modulePath)
} else {
push(path + id)
}
}
}
const handleSizeChange = (e) => {
pageInfo.pageSize = e
pageInfo.currentPage = 1
getSearchList()
}
// const handleCurrentChange = (e) => {
// pageInfo.currentPage = e
// getSearchList()
// }
const fileSize = 24 * 1024 * 1024
</script>
<template>
<HomeHead class="top">
<template #content>
<!-- <HomeHeadSearch /> -->
</template>
</HomeHead>
<div class="h-full relative flex flex-col">
<div class="font-600 flex items-end mt30px">
<div class="text-36px">搜索列表</div>
<div class="text-18px ml40px mr25px">{{ day }}</div>
<div class="text-18px">{{ week }}</div>
</div>
<div class="q-wrapper flex-1 mt30px text-#142142 flex flex-col bg-#fff p30px">
<div v-if="listData&&listData.length>0" v-for="i in listData" :key="i"
class="mt8px cursor-pointer flex items-center p15px pl20px text-18px max-w-805px">
<span class="truncate flex-1 w0 text-#142142 hover:underline " @click=" clickTo(i)">{{ i.title }}</span>
<span class="shrink-0 ml38px text-#808696">{{ i.createTime }}</span>
<!-- <span v-if="flg" class="ml20px text-#808696 text-16px">: {{ i.publishName }}</span> -->
</div>
<div v-else class="w-full h-hull">
<el-empty :image-size="200" />
</div>
</div>
<HomeHead class="top">
<template #content>
<!-- <HomeHeadSearch /> -->
</template>
</HomeHead>
<div class="h-full relative flex flex-col">
<div class="font-600 flex items-end mt30px">
<div class="text-36px">搜索列表</div>
<div class="text-18px ml40px mr25px">{{ day }}</div>
<div class="text-18px">{{ week }}</div>
</div>
<div class="q-wrapper flex-1 mt30px text-#142142 flex flex-col bg-#fff p30px">
<div class="h-800px mt-30px relative" v-if="listData && listData.length > 0">
<el-table
v-loading="loading"
:data="listData"
style="width: 100%; margin-bottom: 20px"
row-key="id"
border
default-expand-all
:header-cell-style="{
background: '#2A7BF7',
color: '#fff',
height: '70px',
lineHeight: '60px',
textAlign: 'center',
'font-size': '24px'
}"
:cell-style="{
'text-align': 'center',
'overflow-y': 'auto',
height: '60px'
}"
>
<el-table-column prop="moduleName" label="模块名称" width="150">
<template #default="{ row }">
<span class="text-16px">{{ codeType[row.moduleCode] }}</span>
<!-- <n-popover trigger="hover" placement="top-start">
<template #trigger>
</template>
<span>点击进入 {{ codeType[row.moduleCode] }}</span>
</n-popover> -->
</template>
</el-table-column>
<el-table-column prop="title" label="标题" show-overflow-tooltip> </el-table-column>
<el-table-column label="部门" prop="departName" show-overflow-tooltip width="150" />
<el-table-column prop="userName" label="发布人" show-overflow-tooltip width="150" />
<el-table-column label="发布日期" prop="createTime" show-overflow-tooltip width="220" />
<el-table-column label="操作" width="270">
<template #default="{ row }">
<div class="">
<div class="inline-block">
<el-button
v-if="row.moduleCode === 'App_Article'"
style="color: #000"
@click="goModule(row, path)"
>详情
</el-button>
<template v-else>
<n-popover
v-if="(row.fileCommon?.fileSize || 0) > fileSize"
trigger="hover"
placement="top-start"
>
<template #trigger>
<el-button style="color: #000" @click="clickItem(row)"></el-button>
</template>
<span>该文件超过25MB无法进行预览点击进行下载</span>
</n-popover>
<el-button v-else style="color: #000" @click="clickItem(row)"></el-button>
</template>
</div>
<el-button type="primary" class="ml-16px" @click="goModule(row, 'module')">
进入模块</el-button
>
</div>
</template>
</el-table-column>
</el-table>
<div class="absolute bottom-20px left-50% translate-x-[-50%] z-11">
<el-pagination
background
v-model:current-page="pageInfo.currentPage"
v-model:page-size="pageInfo.pageSize"
layout="prev, pager, next, total,jumper,->"
:total="pageInfo.total"
@current-change="getSearchList"
/>
<!-- @size-change="handleSizeChange" -->
</div>
</div>
<div v-else class="w-full h-hull">
<el-empty :image-size="300" description="搜索结果为空~" />
</div>
</div>
</div>
</template>
<style scoped lang="less">
:deep(.el-empty__description) {
p {
font-size: 20px;
}
}
.top {
position: absolute;
right: 30px;
top: -92px;
position: absolute;
right: 30px;
top: -92px;
}
::-webkit-scrollbar {
width: 1px;
width: 1px;
}
.q-wrapper {
border-radius: 18px;
border: 1px solid #E7EBF5;
box-shadow: inset 1px 2px 12px rgba(14, 86, 221, 0.32);
overflow: auto;
&::after {
border-radius: 18px;
border: 1px solid #e7ebf5;
box-shadow: inset 1px 2px 12px rgba(14, 86, 221, 0.32);
overflow: auto;
&::after {
content: ' ';
background-image: url('@/assets/images/bg-card.svg');
pointer-events: none;
@ -102,4 +305,5 @@ const clickTo=(obj)=>{
left: 0;
top: 0;
}
}</style>
}
</style>