样式二搜索修改

menu_style
jinna 7 months ago
parent 9d06607ebb
commit 59361e4f97
  1. 4
      src/page/index/tags.vue
  2. 8
      src/page/index/top/index.vue
  3. 1
      src/page/index/top/top-search.vue
  4. 18
      src/router/views/index.js
  5. 178
      src/views/wel/search.vue

@ -42,9 +42,9 @@
<el-icon style="font-size:20px;padding-top:5px;padding-right:5px"><More /></el-icon> <el-icon style="font-size:20px;padding-top:5px;padding-right:5px"><More /></el-icon>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item @click="openSearch" <!-- <el-dropdown-item @click="openSearch"
><i class="icon-fangda" /> {{ $t('tagsView.search') }}</el-dropdown-item ><i class="icon-fangda" /> {{ $t('tagsView.search') }}</el-dropdown-item
> > -->
<el-dropdown-item @click="closeOthersTags" <el-dropdown-item @click="closeOthersTags"
><i class="icon-fangkuai1" /> {{ $t('tagsView.closeOthers') }} ><i class="icon-fangkuai1" /> {{ $t('tagsView.closeOthers') }}
</el-dropdown-item> </el-dropdown-item>

@ -13,12 +13,13 @@
<div class="top-bar__title" :class="setting.styleRadio == '1' ? 'bar__title_fff' : setting.styleRadio == '3' ? 'bar_title_third' : ''"> <div class="top-bar__title" :class="setting.styleRadio == '1' ? 'bar__title_fff' : setting.styleRadio == '3' ? 'bar_title_third' : ''">
<top-menu ref="topMenu" <top-menu ref="topMenu"
v-if="setting.menu && (setting.styleRadio == '3' || setting.styleRadio == '4')"></top-menu> v-if="setting.menu && (setting.styleRadio == '3' || setting.styleRadio == '4')"></top-menu>
<top-search class="top-bar__item" v-if="setting.search" :style="{left:(setting.styleRadio == '3' || setting.styleRadio == '6') && '225px',width:(setting.styleRadio == '3' || setting.styleRadio == '6') && '260px !important',color:(setting.styleRadio == '3' || setting.styleRadio == '6') && '#c0c4cc'}"></top-search> <top-search class="top-bar__item" v-if="setting.search && setting.styleRadio != '2' && setting.styleRadio != '1'" :style="{left:(setting.styleRadio == '3' || setting.styleRadio == '6') && '225px',width:(setting.styleRadio == '3' || setting.styleRadio == '6') && '260px !important',color:(setting.styleRadio == '3' || setting.styleRadio == '6') && '#c0c4cc'}"></top-search>
</div> </div>
<div class="top-bar__right" :class="setting.styleRadio == '3' || setting.styleRadio == '6' ? 'top-bar__right_third' : ''"> <div class="top-bar__right" :class="setting.styleRadio == '3' || setting.styleRadio == '6' ? 'top-bar__right_third' : ''">
<!-- <div v-if="setting.color" class="top-bar__item"> <!-- <div v-if="setting.color" class="top-bar__item">
<top-color></top-color> <top-color></top-color>
</div> --> </div> -->
<el-icon style="width: 16px;cursor: pointer;" @click="openSearch" v-if="setting.search && setting.styleRadio == '2'"><Search /></el-icon>
<div v-show="!setting.theme" class="top-bar__item"> <div v-show="!setting.theme" class="top-bar__item">
<top-theme></top-theme> <top-theme></top-theme>
</div> </div>
@ -237,6 +238,11 @@ export default {
]), ]),
}, },
methods: { methods: {
openSearch() {
// this.$store.commit('SET_IS_SEARCH', true);
console.log('route--------------------',this.$router)
this.$router.push('/wel/search')
},
init() { init() {
getUerDetailInfo().then(res => { getUerDetailInfo().then(res => {
// //

@ -3,6 +3,7 @@
class="top-search" class="top-search"
:class="setting.styleRadio == 3 || setting.styleRadio == 6 ? 'search_radio' : ''" :class="setting.styleRadio == 3 || setting.styleRadio == 6 ? 'search_radio' : ''"
popper-class="my-autocomplete" popper-class="my-autocomplete"
placeholder="请输入搜索菜单名称"
v-model="value" v-model="value"
:fetch-suggestions="querySearch" :fetch-suggestions="querySearch"
:placeholder="$t('search')" :placeholder="$t('search')"

@ -17,6 +17,15 @@ export default [
}, },
component: () => import(/* webpackChunkName: "views" */ '@/views/wel/index.vue'), component: () => import(/* webpackChunkName: "views" */ '@/views/wel/index.vue'),
}, },
{
path: 'search',
// name: '首页',
name: '搜索',
meta: {
i18n: 'dashboard',
},
component: () => import(/* webpackChunkName: "views" */ '@/views/wel/search.vue'),
},
{ {
path: 'dashboard', path: 'dashboard',
name: '控制台', name: '控制台',
@ -26,6 +35,15 @@ export default [
}, },
component: () => import(/* webpackChunkName: "views" */ '@/views/wel/dashboard.vue'), component: () => import(/* webpackChunkName: "views" */ '@/views/wel/dashboard.vue'),
}, },
// {
// path: 'search',
// name: '菜单搜索',
// meta: {
// i18n: 'search',
// menu: false,
// },
// component: () => import(/* webpackChunkName: "views" */ '@/views/wel/search.vue'),
// }
], ],
}, },
{ {

@ -0,0 +1,178 @@
<template>
<div class="avue-searchs" @click.self="handleEsc">
<div class="avue-searchs__title">菜单搜索</div>
<div class="avue-searchs__content">
<div class="avue-searchs__form">
<el-input :placeholder="$t('search')" v-model="value" @keydown.esc="handleEsc">
<template #append>
<el-button icon="el-icon-search"></el-button>
</template>
</el-input>
<p>
<el-tag>你可以使用快捷键esc 关闭</el-tag>
</p>
</div>
<div class="avue-searchs__list">
<el-scrollbar class="avue-searchs__scrollbar">
<div
class="avue-searchs__item"
v-for="(item, index) in menus"
:key="index"
@click="handleSelect(item)"
>
<i :class="[item[iconKey], 'avue-searchs__item-icon']"></i>
<span class="avue-searchs__item-title">{{ item[labelKey] }}</span>
<div class="avue-searchs__item-path">
{{ item[pathKey] }}
</div>
</div>
</el-scrollbar>
</div>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
export default {
data() {
return {
value: '',
menus: [],
menuList: [],
};
},
created() {
this.getMenuList();
},
watch: {
value() {
this.querySearch();
},
menu() {
this.getMenuList();
},
},
computed: {
labelKey() {
return this.website.menu.label;
},
pathKey() {
return this.website.menu.path;
},
iconKey() {
return this.website.menu.icon;
},
childrenKey() {
return this.website.menu.children;
},
...mapGetters(['menu']),
},
methods: {
handleEsc() {
this.$store.commit('SET_IS_SEARCH', false);
},
getMenuList() {
const findMenu = list => {
for (let i = 0; i < list.length; i++) {
const ele = Object.assign({}, list[i]);
if (this.validatenull(ele[this.childrenKey])) {
this.menuList.push(ele);
} else {
findMenu(ele[this.childrenKey]);
}
}
};
this.menuList = [];
findMenu(this.menu);
this.menus = this.menuList;
},
querySearch() {
var restaurants = this.menuList;
var queryString = this.value;
this.menus = queryString ? this.menuList.filter(this.createFilter(queryString)) : restaurants;
},
createFilter(queryString) {
return restaurant => {
return restaurant[this.labelKey].toLowerCase().indexOf(queryString.toLowerCase()) === 0;
};
},
handleSelect(item) {
this.value = '';
this.$router.push({
path: item[this.pathKey],
query: item.query,
});
},
},
};
</script>
<style lang="scss" scoped>
.avue-searchs {
padding-top: 50px;
width: 100%;
height: 100%;
background-color: #fff;
z-index: 1024;
&__title {
margin-bottom: 60px;
text-align: center;
font-size: 42px;
font-weight: bold;
letter-spacing: 2px;
text-indent: 2px;
}
&__form {
margin: 0 auto 50px auto;
width: 50%;
text-align: center;
p {
margin-top: 20px;
}
}
&__scrollbar {
height: 400px;
}
&__list {
box-sizing: border-box;
padding: 20px 30px;
margin: 0 auto;
width: 70%;
border-radius: 4px;
border: 1px solid #ebeef5;
background-color: #fff;
overflow: hidden;
color: #303133;
transition: 0.3s;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
&__item {
padding: 5px 0;
border-bottom: 1px dashed #eee;
&-icon {
margin-right: 5px;
font-size: 18px;
}
&-title {
font-size: 20px;
font-weight: 500;
color: #333;
}
&-path {
line-height: 30px;
color: #666;
}
}
}
</style>
Loading…
Cancel
Save