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