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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,10 +3,12 @@ import { useUserStore } from '@/stores/modules/user'
import HomeHead from '@/views/home/components/HomeHead.vue' import HomeHead from '@/views/home/components/HomeHead.vue'
// import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue' // import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
import { useDate } from '@/views/home/hooks/useDate' 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 { noticeld } from '@/stores/modules/noticeId'
import { searchStore } from '@/stores/modules/search' import { searchStore } from '@/stores/modules/search'
import { message } from '@/utils/message' import { message } from '@/utils/message'
import { NPopover } from 'naive-ui'
const store = noticeld() const store = noticeld()
const store2 = useUserStore() const store2 = useUserStore()
const searchS = searchStore() const searchS = searchStore()
@ -15,81 +17,282 @@ const { push } = useRouter()
const route = useRoute() const route = useRoute()
const listData = ref() const listData = ref()
const flg =ref() const flg = ref()
let keywords =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() { async function getSearchList() {
const keyword = keywords.value loading.value = true
const { rows } = await getArticlePage({ pageNum: 1, pageSize: 100, type: 2, position: 'search', keyword } as any); const keyword = searchS.search.content
listData.value = rows // 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(()=>{ watchEffect(() => {
keywords.value = searchS.search.content searchS.search.time
// console.log(keywords.value) getSearchList(searchS.search.content)
getSearchList()
}) })
onMounted(() => {
getSearchList() const codePath = {
flg.value = store2.user.isReview > 0 App_Article: {
console.log(flg.value,store2.user.isReview) path: '/intelligence/outside/',
}) modulePath: '/Home/intelligence'
const clickTo=(obj)=>{ },
// console.log(obj) App_Market: {
if(obj.isSelect===1){ path: '/Home/market',
push(`${route.path}/${obj.id}`) modulePath: '/Home/market'
} },
else{ App_data_platform: {
message.info("您没有权限查看!") 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> </script>
<template> <template>
<HomeHead class="top"> <HomeHead class="top">
<template #content> <template #content>
<!-- <HomeHeadSearch /> --> <!-- <HomeHeadSearch /> -->
</template> </template>
</HomeHead> </HomeHead>
<div class="h-full relative flex flex-col"> <div class="h-full relative flex flex-col">
<div class="font-600 flex items-end mt30px"> <div class="font-600 flex items-end mt30px">
<div class="text-36px">搜索列表</div> <div class="text-36px">搜索列表</div>
<div class="text-18px ml40px mr25px">{{ day }}</div> <div class="text-18px ml40px mr25px">{{ day }}</div>
<div class="text-18px">{{ week }}</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>
</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> </template>
<style scoped lang="less"> <style scoped lang="less">
:deep(.el-empty__description) {
p {
font-size: 20px;
}
}
.top { .top {
position: absolute; position: absolute;
right: 30px; right: 30px;
top: -92px; top: -92px;
} }
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 1px; width: 1px;
} }
.q-wrapper { .q-wrapper {
border-radius: 18px; border-radius: 18px;
border: 1px solid #E7EBF5; border: 1px solid #e7ebf5;
box-shadow: inset 1px 2px 12px rgba(14, 86, 221, 0.32); box-shadow: inset 1px 2px 12px rgba(14, 86, 221, 0.32);
overflow: auto; overflow: auto;
&::after { &::after {
content: ' '; content: ' ';
background-image: url('@/assets/images/bg-card.svg'); background-image: url('@/assets/images/bg-card.svg');
pointer-events: none; pointer-events: none;
@ -102,4 +305,5 @@ const clickTo=(obj)=>{
left: 0; left: 0;
top: 0; top: 0;
} }
}</style> }
</style>