Commit b0895a4d authored by zhanglw's avatar zhanglw

搜索跳转

parent 396d2fc5
......@@ -458,8 +458,8 @@ export const HttpReq = {
method: 'get'
})
},
// 产品-查询列表
productGetList: function(params) {
// 产品-硬件查询列表
productGetHardwareList: function(params) {
return request({
url: '/api/bsw/bigScreen/highQualityProducts/productList?' + qs.stringify(params, { indices: false }),
method: 'get'
......
......@@ -47,6 +47,7 @@ export const constantRouterMap = [
{
path: '/product',
meta: { title: '优质产品', noCache: true },
name: 'product',
component: (resolve) => {
return require(['@/views/homepage/product/index'], resolve)
},
......
......@@ -16,7 +16,7 @@ module.exports = {
*/
tokenCookieExpires: 1,
/**
* @description 记住密码状态下的密码在Cookie中存储的天数,默认1天s
* @description 记住密码状态下的密码在Cookie中存储的天数,默认1天
*/
passCookieExpires: 1,
/**
......
......@@ -8,7 +8,7 @@
<el-select v-model="query.area" placeholder="区域" style="width: 100px">
<el-option v-for="item in [{value:undefined,label:'全地区'}, ...dict.area_province]" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-button icon="el-icon-search" class="btn">搜索</el-button>
<el-button icon="el-icon-search" class="btn" @click="search">搜索</el-button>
</div>
<div class="search-keyword">
<span v-for="(item, index) in keywords" :key="index" class="label" @click="keywordClick(item, 'keyword')">{{ item.name }}</span>
......@@ -34,7 +34,11 @@ export default {
dicts: ['product_type', 'area_province'],
data() {
return {
query: {},
query: {
keyword: '',
productType: '',
area: ''
},
keywords: ['曲线记录仪', '液位控制器', '双金属温度计', '位移传感器'],
brands: ['高领传感', '施克', '蓝之宇', '高领传感', '施克', '蓝之宇'],
suppliers: ['上海成渝智能科技发展有限公司', '山东盛茂科技有限公司', '山东天润科技有限公司']
......@@ -52,9 +56,17 @@ export default {
})
},
methods: {
search() {
this.$router.push({
name: 'product',
params: this.query
})
},
keywordClick(item, type) {
if (item.url) {
this.$router.push({ path: item.url })
} else {
this.query.keyword = item.name
}
}
}
......
......@@ -25,12 +25,12 @@
</el-select>
</el-col>
<el-col :span="3">
<el-button icon="el-icon-search" class="btn">搜索</el-button>
<el-button icon="el-icon-search" class="btn" @click="search">搜索</el-button>
</el-col>
</el-row>
</div>
<div class="search-keyword">
<span v-for="(item, index) in keywords" :key="index" class="label" @click="keywordClick(item, 'keyword')">{{ item }}</span>
<span v-for="(item, index) in keywords" :key="index" class="label" @click="keywordClick(item, 'keyword')">{{ item.name }}</span>
</div>
<el-row style="padding-top: 16px">
<el-col :span="2"><div class="area-title">地区选择</div></el-col>
......@@ -191,6 +191,7 @@ import breadcrumb from '../components/breadcrumb'
import homeFooter from '../components/homeFooter'
import inquiryView from '../components/inquiryView'
import floatBtn from '../components/floatBtn'
import { HttpReq } from '@/api/common'
export default {
components: { titleMenus, userLogin, languageSetting, breadcrumb, homeFooter, inquiryView, floatBtn },
......@@ -207,8 +208,10 @@ export default {
type: undefined,
sort: false
},
page: 1,
pageSize: 8,
areaOpts: [],
keywords: ['曲线记录仪', '液位控制器', '双金属温度计', '位移传感器'],
keywords: [],
hardwareList: [
{
isGood: true,
......@@ -349,15 +352,33 @@ export default {
},
mounted() {
this.$nextTick(() => {
console.log(this.$route.params)
HttpReq.webClientApi.homePageGetSearch({
preview: false
}).then((res) => {
this.keywords = res.data.keywords
})
})
},
methods: {
onDictReady(dict) {
this.areaOpts = [{ value: undefined, label: '全部' }, ...dict.area_province]
},
search() {
Object.keys(this.query).length !== 0 && Object.keys(this.query).forEach(item => {
if (this.query[item] === null || this.query[item] === '') this.query[item] = undefined
})
HttpReq.backstageApi.productGetHardwareList({
page: this.page - 1,
pageSize: this.pageSize,
...this.query
}).then((res) => {
this.hardwareList = res.data.data
})
},
keywordClick(item, type) {
this.query.keyword = item
this.query.keyword = item.name
this.search()
},
setQuertType(type) {
if (type === this.query.type) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment