|
|
@@ -1,7 +1,6 @@
|
|
|
<script setup lang="ts">
|
|
|
-import {parseRole, parseCategory} from "../utils"
|
|
|
+import {parseRole} from "../utils"
|
|
|
import {User, Document, Discount, SwitchButton} from "@element-plus/icons-vue" //图标
|
|
|
-import { ref, computed } from "vue"
|
|
|
import { Search } from "@element-plus/icons-vue"
|
|
|
import {useRouter} from "vue-router";
|
|
|
|
|
|
@@ -9,34 +8,6 @@ const router = useRouter()
|
|
|
|
|
|
const role = sessionStorage.getItem('role') //登录的时候插入的
|
|
|
|
|
|
-const searchValue = ref(null)
|
|
|
-const typeValue = ref(null)
|
|
|
-const priceValue = ref(null)
|
|
|
-const possibleCategories = ['FOOD','CLOTHES','ELECTRONICS','FURNITURE','ENTERTAINMENT', 'SPORTS', 'LUXURY']
|
|
|
-
|
|
|
-const drawer = ref()
|
|
|
-const searchDisabled = computed(() => !(searchValue.value != null || typeValue.value != null || priceValue.value != null))
|
|
|
-
|
|
|
-
|
|
|
-function openSearchBar() {
|
|
|
- drawer.value = true
|
|
|
-}
|
|
|
-
|
|
|
-function closeSearchBar() {
|
|
|
- drawer.value = false
|
|
|
-}
|
|
|
-
|
|
|
-function search() {
|
|
|
- drawer.value = false
|
|
|
- router.push({
|
|
|
- name: "searchResult",
|
|
|
- query: {
|
|
|
- name: searchValue.value,
|
|
|
- category: typeValue.value,
|
|
|
- price: priceValue.value,
|
|
|
- }
|
|
|
- })
|
|
|
-}
|
|
|
|
|
|
//退出登录
|
|
|
function logout() {
|
|
|
@@ -62,46 +33,6 @@ function logout() {
|
|
|
|
|
|
<template>
|
|
|
|
|
|
- <el-drawer
|
|
|
- v-model="drawer"
|
|
|
- direction="ttb"
|
|
|
- >
|
|
|
- <template #default>
|
|
|
- <el-form label-position="top" :inline="true">
|
|
|
-
|
|
|
- <el-form-item label="商品名称">
|
|
|
- <el-input
|
|
|
- v-model="searchValue"
|
|
|
- @keyup.enter.native="search"
|
|
|
- placeholder="不限"
|
|
|
- size="large"
|
|
|
- style="width: 300px"
|
|
|
- >
|
|
|
- </el-input>
|
|
|
-
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="商品品类">
|
|
|
- <el-select v-model="typeValue" placeholder="任意" style="width: 300px" size="large">
|
|
|
- <el-option v-for = "item in possibleCategories" :key="item" :label="parseCategory(item)" :value="item"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="商品最高价格">
|
|
|
- <el-input-number v-model="priceValue" placeholder="不限" size="large" style="width: 300px">
|
|
|
-
|
|
|
- </el-input-number>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
-
|
|
|
- </template>
|
|
|
-
|
|
|
- <template #footer>
|
|
|
- <div style="flex: auto">
|
|
|
- <el-button @click="closeSearchBar">取消</el-button>
|
|
|
- <el-button type="primary" @click="search" :disabled="searchDisabled">搜索</el-button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-drawer>
|
|
|
-
|
|
|
<el-header class="custom-header" height="20">
|
|
|
<el-row :gutter="20">
|
|
|
|
|
|
@@ -117,14 +48,10 @@ function logout() {
|
|
|
|
|
|
<el-col :span="14"></el-col>
|
|
|
|
|
|
-
|
|
|
-<!-- <el-col :span="13" class="search-holder">-->
|
|
|
-
|
|
|
-
|
|
|
-<!-- </el-col>-->
|
|
|
-
|
|
|
<el-col :span="1" class="header-icon">
|
|
|
- <el-icon @click="openSearchBar" :size="35" color="white" style="cursor: pointer" ><Search /></el-icon>
|
|
|
+ <router-link to="/search" v-slot="{navigate}">
|
|
|
+ <el-icon @click="navigate" :size="35" color="white" style="cursor: pointer" ><Search /></el-icon>
|
|
|
+ </router-link>
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="1" class="header-icon">
|