<template>
|
<div class="findData_box">
|
<!-- 头部导航栏 -->
|
<van-nav-bar style="background-color:#528abe;">
|
<template #left>
|
<div @click="pageBack" style="display: flex; align-items: center">
|
<van-icon name="arrow-left" size="18" />
|
<span>{{$t('selectPage.index.TR')}}</span>
|
</div>
|
</template>
|
<template #title>
|
<label>{{$t('ebookPage.search.TR')}}</label>
|
</template>
|
<template #right>
|
<div></div>
|
</template>
|
</van-nav-bar>
|
<div class="findData_main">
|
<van-search v-model="m_keyWord" show-action :placeholder="$t('ebookPage.keyWordRule.TR')" @search="onSearch">
|
<template #action>
|
<div @click="onSearch">
|
<span style="color:#36489e">{{$t('ebookPage.search.TR')}}</span>
|
</div>
|
</template>
|
</van-search>
|
<!-- 历史记录列表 -->
|
<div class="history_record" v-if="m_historyKeyWords.length>0">
|
<div class="recode_btn">
|
<span>搜索历史</span>
|
<van-icon name="delete-o" @click="deletedHistoryTag" />
|
</div>
|
<div class="tag_list">
|
<van-tag
|
v-for="(tagItem,index) in m_historyKeyWords"
|
@click="changeTagSearch(tagItem)"
|
:key="index"
|
round
|
type="primary"
|
style="margin-right:5px;"
|
>{{tagItem}}</van-tag>
|
</div>
|
</div>
|
<div class="data_list">
|
<van-cell
|
@click="goPumpDetail(item)"
|
clickable
|
center
|
is-link
|
title-style="color:#528abe"
|
:title="item.Name"
|
:label="item.CatalogName"
|
v-for="(item, index) in m_dataList"
|
:key="index"
|
>
|
<template #icon>
|
<van-image
|
width="80"
|
height="50"
|
:src="item.ThumbnailImage"
|
>
|
</van-image>
|
</template>
|
</van-cell>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import languageMixin from "@/mixin/language.js";
|
|
export default {
|
mixins: [languageMixin],
|
data() {
|
return {
|
m_Title:"",
|
m_keyWord: "", //关键词
|
m_historyKeyWords: [], //历史关键词记录
|
m_dataList: [] //查询出来的列表
|
};
|
},
|
mounted() {
|
this.m_Title = this.getSoftName();
|
document.title = this.m_Title
|
if (this.$cookies.isKey("historyRecord")) {
|
//console.log(this.$cookies.get("historyRecord"),74)
|
this.m_historyKeyWords = this.$cookies.get("historyRecord").split(",");
|
}
|
},
|
methods: {
|
onSearch() {
|
let _this = this;
|
let Toast = _this.$toast;
|
Toast.loading({
|
duration: 0, //为0时 不关闭toast框
|
message: "Loading...",
|
forbidClick: true
|
});
|
_this
|
.$axios({
|
methods: "get",
|
url:
|
_this.$globalConfig.WebApiUrl.MainUrl + "v1/Mobile/FilterByKeyWrd/GetList",
|
params: {
|
KeyWord: _this.m_keyWord,
|
Lang: _this.getCurrentLanguageUrl()
|
}
|
})
|
.then(function(res) {
|
Toast.clear();
|
//console.log(res);
|
let result = res.data;
|
if (result.Code != 0) {
|
Toast.fail(result.Message);
|
return;
|
}
|
if (result.Data) {
|
if (_this.m_historyKeyWords.indexOf(_this.m_keyWord) == -1) {
|
_this.m_historyKeyWords.push(_this.m_keyWord);
|
}
|
|
_this.$cookies.set("historyRecord", _this.m_historyKeyWords);
|
let seriesList = [];
|
result.Data.forEach(item => {
|
let productItem = {
|
ObjectType: item.ObjectType,
|
PumpID: item.PumpID,
|
SeriesID: item.SeriesID,
|
CatalogName: item.CatalogName,
|
Name: item.Name,
|
ThumbnailImage: _this.$globalConfig.WebApiUrl.FileUrl + item.ThumbnailImage,
|
Description: item.Description
|
};
|
seriesList.push(productItem);
|
});
|
_this.m_dataList = seriesList;
|
|
//console.log(Object.entries(_this.m_ShowSeriesList), 80);
|
}
|
})
|
.catch(function(err) {
|
Toast.clear();
|
console.log(err);
|
});
|
},
|
//点击历史记录标签搜索
|
changeTagSearch(name) {
|
this.m_keyWord = name;
|
this.onSearch();
|
},
|
//删除历史记录标签
|
deletedHistoryTag() {
|
this.m_historyKeyWords = [];
|
this.$cookies.remove("historyRecord");
|
},
|
//跳转到详情
|
goPumpDetail(item) {
|
// console.log(item, 204);
|
if (item.ObjectType != 0) {
|
let query = { SID: item.SeriesID, PID: item.PumpID }
|
this.gotoPage("/byParas/Index", query, null);
|
} else if (item.ObjectType == 0) {
|
let query = { ID: item.SeriesID }
|
this.gotoPage("/EBook/SeriesDetailPump", query, null);
|
}
|
},
|
//返回上一页
|
pageBack() {
|
this.$router.go(-1);
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss">
|
.findData_box {
|
width: 100%;
|
height: 100vh;
|
background-color: #fafafa;
|
.findData_main {
|
width: 100%;
|
height: calc(100% - 46px);
|
background-color: #fafafa;
|
.history_record {
|
width: 100%;
|
height: 45px;
|
.recode_btn {
|
width: 96%;
|
height: 30%;
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
padding-top: 5px;
|
padding-left: 10px;
|
span {
|
font-size: 12px;
|
color: #aaaaaa;
|
}
|
}
|
.tag_list {
|
width: 96%;
|
display: flex;
|
height: 70%;
|
align-items: center;
|
padding-left: 10px;
|
}
|
}
|
.data_list {
|
width: 100%;
|
height: calc(100% - 100px);
|
overflow: auto;
|
margin-top: 1px;
|
.van-cell__title,
|
.van-cell__value {
|
display: flex;
|
align-items: flex-start;
|
flex-direction: column;
|
}
|
.van-index-anchor {
|
text-align: left;
|
font-weight: 600;
|
}
|
}
|
}
|
}
|
</style>
|