前端:首页、分类,增加跳转到搜索
This commit is contained in:
parent
b98e21e157
commit
2ddf0e30d1
@ -28,12 +28,12 @@ export default {
|
|||||||
[Search.name]:Search,
|
[Search.name]:Search,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
// keyword: String,
|
keyword: String,
|
||||||
// onSearch: Function,
|
// onSearch: Function,
|
||||||
},
|
},
|
||||||
data(){
|
data(){
|
||||||
return{
|
return{
|
||||||
value:'',
|
value: this.keyword,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
@ -88,7 +88,7 @@ const routes = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/user/coupon',
|
path: '/user/coupon',
|
||||||
component: () => import('../page/user/coupon/list'),
|
component: () => import('../page/coupon/list'),
|
||||||
meta: {
|
meta: {
|
||||||
title: '我的优惠券',
|
title: '我的优惠券',
|
||||||
requireAuth: true,
|
requireAuth: true,
|
||||||
@ -99,7 +99,7 @@ const routes = [
|
|||||||
component: () => import('../page/user/order/list'),
|
component: () => import('../page/user/order/list'),
|
||||||
meta: {
|
meta: {
|
||||||
title: '我的订单'
|
title: '我的订单'
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/user/order/:id',
|
path: '/user/order/:id',
|
||||||
@ -154,6 +154,7 @@ const routes = [
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: '/product/search',
|
||||||
path: '/product/search',
|
path: '/product/search',
|
||||||
component: () => import('../page/product/search'),
|
component: () => import('../page/product/search'),
|
||||||
meta: {
|
meta: {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<van-search
|
<van-search
|
||||||
v-model="value"
|
v-model="keyword"
|
||||||
placeholder="请输入搜索关键词"
|
placeholder="请输入搜索关键词"
|
||||||
show-action
|
show-action
|
||||||
@search="onSearch"
|
@search="onSearch"
|
||||||
@ -92,7 +92,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
value: "",
|
keyword: "",
|
||||||
rootCategories: [],
|
rootCategories: [],
|
||||||
childCategories: [],
|
childCategories: [],
|
||||||
activeKey: 0,
|
activeKey: 0,
|
||||||
@ -105,7 +105,10 @@ export default {
|
|||||||
onSearch() {
|
onSearch() {
|
||||||
// debugger;
|
// debugger;
|
||||||
// GetAddressById(1);
|
// GetAddressById(1);
|
||||||
console.log(this.value);
|
// console.log(this.value);
|
||||||
|
this.$router.push(
|
||||||
|
{name: '/product/search', params: {keyword: this.keyword}}
|
||||||
|
)
|
||||||
},
|
},
|
||||||
onClick(key) {
|
onClick(key) {
|
||||||
// debugger;
|
// debugger;
|
||||||
|
@ -152,8 +152,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { GetCoupon,ExchangeCoupon } from "../../../api/user.js";
|
import { ExchangeCoupon } from "../../api/user.js";
|
||||||
import { getCouponPage } from "../../../api/promotion.js";
|
import { getCouponPage } from "../../api/promotion.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
@ -1,11 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :style="'background-color:'+((page.BackgroundColor==undefined||page.BackgroundColor=='')?'#fff':page.BackgroundColor)">
|
<div :style="'background-color:'+((page.BackgroundColor==undefined||page.BackgroundColor=='')?'#fff':page.BackgroundColor)">
|
||||||
<div :style="'height:'+topheight+'px'" ></div>
|
<!-- <div :style="'height:'+topheight+'px'" ></div>-->
|
||||||
|
|
||||||
<!-- TODO 搜索框 -->
|
<!-- TODO 搜索框 -->
|
||||||
<!-- <search v-if="item.Code=='Search'" :data="item.ParameterDictionary" v-on:settopheight="settopheight($event)" ></search>-->
|
<!-- <search v-if="item.Code=='Search'" :data="item.ParameterDictionary" v-on:settopheight="settopheight($event)" ></search>-->
|
||||||
|
|
||||||
<van-swipe :autoplay="3000" indicator-color="white" height="160">
|
<van-search
|
||||||
|
v-model="keyword"
|
||||||
|
placeholder="请输入搜索关键词"
|
||||||
|
show-action
|
||||||
|
@search="onSearch">
|
||||||
|
<div slot="action" @click="onSearch">搜索</div>
|
||||||
|
</van-search>
|
||||||
|
|
||||||
|
<van-swipe :autoplay="3000" indicator-color="white" :height="160">
|
||||||
<van-swipe-item v-for="(banner, index) in banners" :key="index" >
|
<van-swipe-item v-for="(banner, index) in banners" :key="index" >
|
||||||
<a :href="banner.url">
|
<a :href="banner.url">
|
||||||
<img :src="banner.picUrl" height="100%" width="100%" >
|
<img :src="banner.picUrl" height="100%" width="100%" >
|
||||||
@ -55,13 +63,14 @@
|
|||||||
import pageLine from "../../components/page/line.vue";
|
import pageLine from "../../components/page/line.vue";
|
||||||
import pageText from "../../components/page/text.vue";
|
import pageText from "../../components/page/text.vue";
|
||||||
import notice from "../../components/page/notice.vue";
|
import notice from "../../components/page/notice.vue";
|
||||||
import search from "../../components/page/search.vue";
|
// import search from "../../components/page/search.vue";
|
||||||
import pageTitle from "../../components/page/title.vue";
|
import pageTitle from "../../components/page/title.vue";
|
||||||
import cube from "../../components/page/cube.vue";
|
import cube from "../../components/page/cube.vue";
|
||||||
import imageAd from "../../components/page/imageAd.vue";
|
import imageAd from "../../components/page/imageAd.vue";
|
||||||
import imageText from "../../components/page/imageText.vue";
|
import imageText from "../../components/page/imageText.vue";
|
||||||
import product from "../../components/page/product.vue";
|
import product from "../../components/page/product.vue";
|
||||||
import {getBannerList, getProductRecommendList} from '../../api/promotion.js';
|
import {getBannerList, getProductRecommendList} from '../../api/promotion.js';
|
||||||
|
import {Search} from "vant";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name:"page",
|
name:"page",
|
||||||
@ -70,17 +79,21 @@
|
|||||||
pageLine,
|
pageLine,
|
||||||
pageText,
|
pageText,
|
||||||
notice,
|
notice,
|
||||||
search,
|
// search,
|
||||||
pageTitle,
|
pageTitle,
|
||||||
cube,
|
cube,
|
||||||
[imageAd.name]:imageAd,
|
[imageAd.name]:imageAd,
|
||||||
imageText,
|
imageText,
|
||||||
product
|
product,
|
||||||
|
[Search.name]: Search
|
||||||
},
|
},
|
||||||
data:function(){
|
data:function(){
|
||||||
return{
|
return{
|
||||||
topheight:0,
|
topheight:0,
|
||||||
page:{},
|
page:{},
|
||||||
|
|
||||||
|
keyword: '', // 搜索关键词
|
||||||
|
|
||||||
banners: [], // Banner 列表
|
banners: [], // Banner 列表
|
||||||
productRecommends: [], // 推荐商品列表
|
productRecommends: [], // 推荐商品列表
|
||||||
}
|
}
|
||||||
@ -111,11 +124,17 @@
|
|||||||
// debugger;
|
// debugger;
|
||||||
// console.log(event);
|
// console.log(event);
|
||||||
// },
|
// },
|
||||||
settopheight:function(value){
|
// settopheight:function(value){
|
||||||
this.topheight=value;
|
// this.topheight=value;
|
||||||
},
|
// },
|
||||||
showProduct(product){
|
showProduct(product){
|
||||||
this.$router.push('/product/'+product.id);
|
this.$router.push('/product/'+product.id);
|
||||||
|
},
|
||||||
|
onSearch: function () {
|
||||||
|
// debugger;
|
||||||
|
this.$router.push(
|
||||||
|
{name: '/product/search', params: {keyword: this.keyword}}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="product-list">
|
<div class="product-list">
|
||||||
<searchtop @onSearch="onSearch" />
|
<searchtop :keyword="keyword" @onSearch="onSearch" />
|
||||||
<div class="filterbar">
|
<div class="filterbar">
|
||||||
<ul :class="filterSort?'show':''">
|
<ul :class="filterSort?'show':''">
|
||||||
<li :class="filterIndex===0?'selected':''" v-on:click="onFilterBar(0)"><span>{{filterIndex==11?'价格最低':(filterIndex==12?'价格最高':'综合')}}</span><van-icon name="arrow" class="down" /></li>
|
<li :class="filterIndex===0?'selected':''" v-on:click="onFilterBar(0)"><span>{{filterIndex==11?'价格最低':(filterIndex==12?'价格最高':'综合')}}</span><van-icon name="arrow" class="down" /></li>
|
||||||
@ -192,7 +192,7 @@ export default {
|
|||||||
loading: false,
|
loading: false,
|
||||||
finished: false,
|
finished: false,
|
||||||
|
|
||||||
keyword: "",
|
keyword: this.$route.params.keyword,
|
||||||
|
|
||||||
filterIndex: 0,
|
filterIndex: 0,
|
||||||
filterSort: false, // 是否展示几个【排序】
|
filterSort: false, // 是否展示几个【排序】
|
||||||
@ -277,11 +277,13 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
// debugger;
|
||||||
// 进入下一页
|
// 进入下一页
|
||||||
let page = this.page + 1;
|
let page = this.page + 1;
|
||||||
getProductPage({
|
getProductPage({
|
||||||
pageNo: page,
|
pageNo: page,
|
||||||
pageSize: this.pageSize,
|
pageSize: this.pageSize,
|
||||||
|
keyword: this.keyword,
|
||||||
}).then(data => {
|
}).then(data => {
|
||||||
this.handleData(page, data);
|
this.handleData(page, data);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user