系统上线运行问题修改
This commit is contained in:
parent
c06bc5fbbd
commit
79b9349598
|
|
@ -110,6 +110,7 @@ export const constantRoutes = [
|
|||
component: () =>
|
||||
import('@/views/publicService/productCenter/index.vue'),
|
||||
name: 'ProductCenter',
|
||||
meta: { showSearch: true } // 需要搜索框
|
||||
},
|
||||
|
||||
// 产品中心 ---- 查看详情页面
|
||||
|
|
@ -120,6 +121,7 @@ export const constantRoutes = [
|
|||
'@/views/publicService/productCenter/product-detail.vue'
|
||||
),
|
||||
name: 'ProductDetail',
|
||||
meta: { showSearch: false } // 不需要搜索框
|
||||
},
|
||||
// 产品中心 ---- 查看案例页面
|
||||
{
|
||||
|
|
@ -129,6 +131,7 @@ export const constantRoutes = [
|
|||
'@/views/publicService/productCenter/product-case-list.vue'
|
||||
),
|
||||
name: 'ProductCaseList',
|
||||
meta: { showSearch: false } // 不需要搜索框
|
||||
},
|
||||
// 公共组件
|
||||
{
|
||||
|
|
@ -136,6 +139,7 @@ export const constantRoutes = [
|
|||
component: () =>
|
||||
import('@/views/publicService/commonCom/index.vue'),
|
||||
name: 'CommonCom',
|
||||
meta: { showSearch: true } // 需要搜索框
|
||||
},
|
||||
// 宣传物料
|
||||
{
|
||||
|
|
@ -143,6 +147,7 @@ export const constantRoutes = [
|
|||
component: () =>
|
||||
import('@/views/publicService/proMaterials/index.vue'),
|
||||
name: 'ProMaterials',
|
||||
meta: { showSearch: true } // 需要搜索框
|
||||
},
|
||||
// 文档中心
|
||||
{
|
||||
|
|
@ -150,6 +155,7 @@ export const constantRoutes = [
|
|||
component: () =>
|
||||
import('@/views/publicService/docCenter/index.vue'),
|
||||
name: 'DocCenter',
|
||||
meta: { showSearch: true } // 需要搜索框
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
<div class="header_new">
|
||||
<div class="header-content">
|
||||
<div class="header-left">
|
||||
<!-- <div class="logo-section" @click="handleLogoClick">-->
|
||||
<div class="logo-section" >
|
||||
<!-- <div class="logo-section" @click="handleLogoClick">-->
|
||||
<div class="logo-section">
|
||||
<img
|
||||
src="../../../assets/logo/logo.png"
|
||||
alt="Logo"
|
||||
|
|
@ -21,19 +21,32 @@
|
|||
@click="handleNavClick(item)"
|
||||
:class="{ active: activeNav === item.routePath }"
|
||||
>
|
||||
<img :src="item.icon" :alt="item.label" class="nav-icon" />
|
||||
<img :src="item.icon" :alt="item.label" class="nav-icon"/>
|
||||
<span class="nav-text">{{ item.label }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="showRightSection" class="header-right"> </div>
|
||||
<div v-if="showRightSection" class="header-right">
|
||||
<div v-if="showSearch" class="search-box">
|
||||
<input
|
||||
v-model="internalSearchKeyword"
|
||||
type="text"
|
||||
placeholder="输入关键词搜索"
|
||||
class="search-input"
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
<button class="search-btn" @click="handleSearch">
|
||||
<i class="el-icon-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-dropdown
|
||||
trigger="hover"
|
||||
class="avatar-container right-menu-item hover-effect"
|
||||
>
|
||||
<div class="avatar-wrapper">
|
||||
<img :src="avatar" class="user-avatar" />
|
||||
<img :src="avatar" class="user-avatar"/>
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item @click.native="handleLogoClick">
|
||||
|
|
@ -49,8 +62,9 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import {mapGetters} from 'vuex'
|
||||
import {getPermissions} from "../../../utils/auth";
|
||||
|
||||
export default {
|
||||
name: 'NavBar',
|
||||
props: {
|
||||
|
|
@ -129,7 +143,7 @@ export default {
|
|||
// activeNav: 'ProductCenter', // 默认选中产品中心
|
||||
userAvatarUrl: this.userAvatar,
|
||||
internalSearchKeyword: this.searchKeyword,
|
||||
permissions:getPermissions(),
|
||||
permissions: getPermissions(),
|
||||
navItems: [
|
||||
{
|
||||
label: '产品中心',
|
||||
|
|
@ -164,6 +178,10 @@ export default {
|
|||
userAvatar(newVal) {
|
||||
this.userAvatarUrl = newVal
|
||||
},
|
||||
internalSearchKeyword(newVal) {
|
||||
// 当搜索关键词变化时,实时通知父组件
|
||||
this.$emit('update:searchKeyword', newVal)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleNavClick(item) {
|
||||
|
|
@ -173,16 +191,17 @@ export default {
|
|||
})
|
||||
},
|
||||
handleSearch() {
|
||||
// 修复搜索功能,直接使用internalSearchKeyword
|
||||
this.$emit('update:searchKeyword', this.internalSearchKeyword)
|
||||
this.$emit('search', this.internalSearchKeyword)
|
||||
console.log('执行搜索:', this.internalSearchKeyword)
|
||||
|
||||
// 发送搜索事件给父组件
|
||||
this.$emit('search', this.internalSearchKeyword.trim())
|
||||
},
|
||||
|
||||
// 跳转后台
|
||||
handleLogoClick() {
|
||||
if(this.permissions.includes(2) ){
|
||||
if (this.permissions.includes(2)) {
|
||||
this.$router.push('/')
|
||||
}else{
|
||||
} else {
|
||||
// 提示没有权限
|
||||
this.$message.error('没有后台权限,请联系管理员')
|
||||
}
|
||||
|
|
@ -203,7 +222,8 @@ export default {
|
|||
: '/index'
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
.catch(() => {
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
<template>
|
||||
<div class="platform-container">
|
||||
<!-- 使用导航栏组件 -->
|
||||
<NavBar />
|
||||
<NavBar
|
||||
@search="handleSearch"
|
||||
:searchKeyword.sync="searchKeyword"
|
||||
:showSearch="showSearch"
|
||||
/>
|
||||
|
||||
<div class="main-content-1">
|
||||
<!-- 主体内容 -->
|
||||
<router-view />
|
||||
<router-view :search-keyword="searchKeyword"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -19,6 +23,29 @@ export default {
|
|||
components: {
|
||||
NavBar,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
searchKeyword: '' // 搜索关键词
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 根据路由元信息控制搜索框显示
|
||||
showSearch() {
|
||||
// 检查当前路由的元信息
|
||||
return this.$route.meta.showSearch !== false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 处理搜索事件
|
||||
handleSearch(keyword) {
|
||||
console.log('接收到搜索关键词:', keyword)
|
||||
this.searchKeyword = keyword
|
||||
|
||||
// 可以在这里添加全局搜索逻辑
|
||||
// 例如触发当前页面的搜索方法
|
||||
this.$refs.currentView?.search(keyword)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@
|
|||
|
||||
<div
|
||||
class="primary-btn"
|
||||
|
||||
@click="handleDownload(item)"
|
||||
>
|
||||
下 载
|
||||
|
|
@ -77,6 +76,7 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<DialogModel
|
||||
:dialogConfig="dialogConfig"
|
||||
@closeDialogOuter="handleCloseDialogOuter"
|
||||
|
|
@ -105,8 +105,6 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -124,6 +122,12 @@ export default {
|
|||
DialogModel,
|
||||
},
|
||||
dicts: ['tb_product_type'],
|
||||
props: {
|
||||
searchKeyword: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
downloading: false, // 添加下载状态标识
|
||||
|
|
@ -189,37 +193,6 @@ export default {
|
|||
}, 300);
|
||||
},
|
||||
|
||||
// 统一的筛选方法
|
||||
// updateFilteredList() {
|
||||
// let filtered = this.proMaterialsListAll;
|
||||
//
|
||||
// // 应用分类筛选
|
||||
// if (this.activeTypeValue !== 'all') {
|
||||
// filtered = filtered.filter(item => item.typeId === Number(this.activeTypeValue));
|
||||
// }
|
||||
//
|
||||
// // 应用类型筛选
|
||||
// if (this.selectedTypes.length > 0) {
|
||||
// filtered = filtered.filter(item =>
|
||||
// this.selectedTypes.includes(item.fileType.toString())
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// this.showProMaterialsDuctList = filtered;
|
||||
// },
|
||||
// 统一的筛选方法
|
||||
updateFilteredList() {
|
||||
this.currentPage = 1;
|
||||
// 添加防抖
|
||||
if (this.requestTimeout) {
|
||||
clearTimeout(this.requestTimeout);
|
||||
}
|
||||
this.requestTimeout = setTimeout(() => {
|
||||
this.getProductCenterListInScreenFun();
|
||||
}, 300);
|
||||
},
|
||||
|
||||
|
||||
// 获取产品卡片宽度
|
||||
getItemWidth() {
|
||||
this.itemWidth = (this.$refs.servicesGrid?.clientWidth - 120) / 4
|
||||
|
|
@ -245,7 +218,6 @@ export default {
|
|||
}
|
||||
},
|
||||
// 下载
|
||||
// 下载
|
||||
async handleDownload(service) {
|
||||
|
||||
// 防止重复点击
|
||||
|
|
@ -319,7 +291,6 @@ export default {
|
|||
}
|
||||
|
||||
this.executeGetProductList();
|
||||
|
||||
},
|
||||
|
||||
// 实际执行获取列表的方法
|
||||
|
|
@ -334,7 +305,9 @@ export default {
|
|||
pageNum: this.currentPage,
|
||||
pageSize: this.pageSize,
|
||||
typeId: this.activeTypeValue !== 'all' ? this.activeTypeValue : undefined,
|
||||
fileType: fileType
|
||||
fileType: fileType,
|
||||
// 添加搜索关键词参数
|
||||
name: this.searchKeyword || undefined
|
||||
};
|
||||
|
||||
const res = await getMaterialListAPI(requestParams);
|
||||
|
|
@ -419,9 +392,22 @@ export default {
|
|||
}, 300);
|
||||
},
|
||||
|
||||
// 根据搜索关键词过滤物料列表(前端过滤备用方法)
|
||||
filterMaterialsByKeyword(materials, keyword) {
|
||||
if (!keyword) return materials
|
||||
|
||||
const lowerKeyword = keyword.toLowerCase()
|
||||
return materials.filter(item =>
|
||||
// 在物料名称、描述等字段中搜索
|
||||
(item.name && item.name.toLowerCase().includes(lowerKeyword)) ||
|
||||
(item.description && item.description.toLowerCase().includes(lowerKeyword)) ||
|
||||
(item.version && item.version.toLowerCase().includes(lowerKeyword)) ||
|
||||
(item.typeName && item.typeName.toLowerCase().includes(lowerKeyword))
|
||||
)
|
||||
}
|
||||
},
|
||||
|
||||
// 监听分类变化
|
||||
// 监听分类变化和搜索关键词变化
|
||||
watch: {
|
||||
activeTypeValue() {
|
||||
this.currentPage = 1;
|
||||
|
|
@ -433,6 +419,29 @@ export default {
|
|||
this.getProductCenterListInScreenFun();
|
||||
}, 300);
|
||||
},
|
||||
|
||||
// 监听搜索关键词变化
|
||||
searchKeyword(newVal) {
|
||||
this.currentPage = 1;
|
||||
// 添加防抖
|
||||
if (this.requestTimeout) {
|
||||
clearTimeout(this.requestTimeout);
|
||||
}
|
||||
this.requestTimeout = setTimeout(() => {
|
||||
this.getProductCenterListInScreenFun();
|
||||
}, 300);
|
||||
},
|
||||
|
||||
selectedTypes() {
|
||||
this.currentPage = 1;
|
||||
// 添加防抖
|
||||
if (this.requestTimeout) {
|
||||
clearTimeout(this.requestTimeout);
|
||||
}
|
||||
this.requestTimeout = setTimeout(() => {
|
||||
this.getProductCenterListInScreenFun();
|
||||
}, 300);
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.requestTimeout) {
|
||||
|
|
|
|||
|
|
@ -58,6 +58,12 @@ import { getProductCenterListAPI } from '@/api/publicService/productCenter'
|
|||
export default {
|
||||
name: 'ProductCenter',
|
||||
dicts: ['tb_product_type'],
|
||||
props: {
|
||||
searchKeyword: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeTypeValue: 'all', // 当前激活的分类
|
||||
|
|
@ -157,19 +163,54 @@ export default {
|
|||
this.productListAll = res.data
|
||||
this.showProductList = this.productListAll
|
||||
},
|
||||
},
|
||||
|
||||
// 监听分类变化
|
||||
watch: {
|
||||
activeTypeValue(newVal) {
|
||||
if (newVal === 'all') {
|
||||
this.showProductList = this.productListAll
|
||||
} else {
|
||||
this.showProductList = this.productListAll.filter(
|
||||
(item) => item.typeId === newVal,
|
||||
// 根据搜索关键词过滤产品列表
|
||||
filterProductsByKeyword(products, keyword) {
|
||||
if (!keyword) return products
|
||||
|
||||
const lowerKeyword = keyword.toLowerCase()
|
||||
return products.filter(item =>
|
||||
// 在产品名称、描述等字段中搜索
|
||||
(item.name && item.name.toLowerCase().includes(lowerKeyword)) ||
|
||||
(item.description && item.description.toLowerCase().includes(lowerKeyword)) ||
|
||||
(item.typeName && item.typeName.toLowerCase().includes(lowerKeyword))
|
||||
)
|
||||
}
|
||||
},
|
||||
|
||||
// 监听分类变化和搜索关键词变化
|
||||
watch: {
|
||||
activeTypeValue(newVal) {
|
||||
let filteredProducts = []
|
||||
|
||||
if (newVal === 'all') {
|
||||
filteredProducts = this.productListAll
|
||||
} else {
|
||||
filteredProducts = this.productListAll.filter(
|
||||
(item) => item.typeId === newVal,
|
||||
)
|
||||
}
|
||||
|
||||
// 应用搜索过滤
|
||||
this.showProductList = this.filterProductsByKeyword(filteredProducts, this.searchKeyword)
|
||||
},
|
||||
|
||||
// 监听搜索关键词变化
|
||||
searchKeyword(newVal) {
|
||||
let filteredProducts = []
|
||||
|
||||
// 先根据分类过滤
|
||||
if (this.activeTypeValue === 'all') {
|
||||
filteredProducts = this.productListAll
|
||||
} else {
|
||||
filteredProducts = this.productListAll.filter(
|
||||
(item) => item.typeId === this.activeTypeValue,
|
||||
)
|
||||
}
|
||||
|
||||
// 再根据搜索关键词过滤
|
||||
this.showProductList = this.filterProductsByKeyword(filteredProducts, newVal)
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
@ -391,8 +432,6 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
.category-item {
|
||||
|
|
|
|||
Loading…
Reference in New Issue