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>

View File

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

View File

@ -70,7 +70,6 @@ async function getArticle(page: any) {
cate: '7'
}
const { rows, total } = await externalList(pasr)
console.log('🚀 ~ file: Detail.vue:46 ~ rows:', rows)
newsList.value = rows || []
newLength = total / 10
}
@ -154,9 +153,7 @@ const handleCurrentChange = (e) => {
<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
>
<span style="font-size: 20px; margin-top: -50px">大金空调调达本部HOMEPAGE</span>
<el-button
class=""
style="font-size: 18px; margin-left: 5px"
@ -170,9 +167,7 @@ const handleCurrentChange = (e) => {
</div>
<div class="w300px -mr-1px flex flex-col shrink-0">
<div class="text-20px text-#fff font-600 mt6px">
大金中国调达本部 HOMEPAGE
</div>
<div class="text-20px text-#fff font-600 mt6px">大金中国调达本部 HOMEPAGE</div>
<!-- @dblclick="toggle" -->
<img src="@/assets/images/logo.png" class="w197px h44px mt14px" />
</div>
@ -198,9 +193,7 @@ const handleCurrentChange = (e) => {
<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 @click="push({ name: 'external' })"> 外部首页</n-breadcrumb-item>
<n-breadcrumb-item> {{ type || state.title }}</n-breadcrumb-item>
</n-breadcrumb>
</div>
@ -211,10 +204,7 @@ const handleCurrentChange = (e) => {
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"
/>
<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%"
>
@ -237,10 +227,7 @@ const handleCurrentChange = (e) => {
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' : ''"
>
<span class="no-underline" :style="i.isRead === 2 ? 'color:#0058E5' : ''">
{{ i.title }}
</span>
</div>
@ -279,10 +266,7 @@ const handleCurrentChange = (e) => {
<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)"
>
<div class="box-title flex items-center" @click="toList(item.cate)">
<span class="flex-1">{{ item.name }}</span>
<span></span>
</div>
@ -311,9 +295,7 @@ const handleCurrentChange = (e) => {
>置顶</span
>
<span
:style="
i.isRead === 2 ? 'color:#0058E5;font-weight:bolb' : ''
"
:style="i.isRead === 2 ? 'color:#0058E5;font-weight:bolb' : ''"
:title="i.title"
>{{ i.title }}</span
>
@ -459,7 +441,8 @@ const handleCurrentChange = (e) => {
font-size: 16px !important;
}
span > img {
width: v-bind(imgW);
// width: v-bind(imgW);
width: auto;
object-fit: contain;
}
p > img {

View File

@ -4,11 +4,7 @@ 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()
@ -105,8 +101,7 @@ async function getPageLists(page) {
const handleNeiScoll = () => {
const container = neiScoll.value
if (container) {
const isAtBottom =
container.scrollHeight - container.scrollTop === container.clientHeight
const isAtBottom = container.scrollHeight - container.scrollTop === container.clientHeight
if (isAtBottom) {
if (neiPum < neiLength) {
++neiPum
@ -118,8 +113,7 @@ const handleNeiScoll = () => {
const handlewaiScoll = () => {
const container = waiScoll.value
if (container) {
const isAtBottom =
container.scrollHeight - container.scrollTop === container.clientHeight
const isAtBottom = container.scrollHeight - container.scrollTop === container.clientHeight
if (isAtBottom) {
if (waiPum < waiLength) {
++waiPum
@ -152,10 +146,7 @@ const handlewaiScoll = () => {
<div class="page-side">
<AppBlock class="h-400px">
<div class="box h-full">
<div
class="box-title flex items-center"
@click="push({ name: 'IntelligenceWithin' })"
>
<div class="box-title flex items-center" @click="push({ name: 'IntelligenceWithin' })">
<span class="flex-1">社内情报</span>
<span></span>
</div>
@ -170,16 +161,8 @@ 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"
/>
<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>
@ -193,10 +176,7 @@ const handlewaiScoll = () => {
<div class="page-side">
<AppBlock class="h-400px">
<div class="box h-full">
<div
class="box-title flex items-center"
@click="push({ name: 'IntelligenceOutside' })"
>
<div class="box-title flex items-center" @click="push({ name: 'IntelligenceOutside' })">
<span class="flex-1">社外情报</span>
<span></span>
</div>
@ -212,16 +192,8 @@ const handlewaiScoll = () => {
/> -->
<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"
/>
<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>

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,32 +17,159 @@ 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);
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>
@ -56,24 +185,98 @@ const clickTo=(obj)=>{
<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 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="200" />
<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;
@ -86,7 +289,7 @@ const clickTo=(obj)=>{
.q-wrapper {
border-radius: 18px;
border: 1px solid #E7EBF5;
border: 1px solid #e7ebf5;
box-shadow: inset 1px 2px 12px rgba(14, 86, 221, 0.32);
overflow: auto;
&::after {
@ -102,4 +305,5 @@ const clickTo=(obj)=>{
left: 0;
top: 0;
}
}</style>
}
</style>