Commit e79a3721 by liudx

联想bug修改

parent 6f62a753
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
allowClear allowClear
@input="onInput" @input="onInput"
@blur="onBlur" @blur="onBlur"
@focus="onFocus"
> >
<template #addonBefore> <template #addonBefore>
<a-select v-model:value="type" class="type"> <a-select v-model:value="type" class="type">
...@@ -261,7 +262,7 @@ export default { ...@@ -261,7 +262,7 @@ export default {
return { return {
search_result_show: false, search_result_show: false,
zh_CN, zh_CN,
search_result:[], search_result: [],
total: 0, total: 0,
currentPage: 1, currentPage: 1,
keyword: "", keyword: "",
...@@ -580,9 +581,7 @@ export default { ...@@ -580,9 +581,7 @@ export default {
this.search_result = []; this.search_result = [];
this.search_result_show = true; this.search_result_show = true;
this.company_cate = res.data.name_or_legal; this.company_cate = res.data.name_or_legal;
this.search_result = JSON.parse(JSON.stringify(res.data.list)); this.search_result = res.data.list;
// this.search_result = res.data.list;
console.log(this.search_result)
if (this.search_result.length == 0) { if (this.search_result.length == 0) {
this.search_result_show = false; this.search_result_show = false;
} }
...@@ -591,8 +590,25 @@ export default { ...@@ -591,8 +590,25 @@ export default {
} }
}); });
}, },
onBlur(){ onFocus() {
this.search_result_show = false if (this.keyword) {
enterpriseLenovo({ keyword: this.keyword }).then((res) => {
if (res.code == 0) {
this.search_result = [];
this.search_result_show = true;
this.company_cate = res.data.name_or_legal;
this.search_result = res.data.list;
if (this.search_result.length == 0) {
this.search_result_show = false;
}
} else {
this.search_result_show = false;
}
});
}
},
onBlur() {
this.search_result_show = false;
}, },
//从联想结果打开公司页面 //从联想结果打开公司页面
lenovnoCompanyDetails(item) { lenovnoCompanyDetails(item) {
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
placeholder="请输入关键词" placeholder="请输入关键词"
@search="onSearch" @search="onSearch"
@input="onInput(tab_id)" @input="onInput(tab_id)"
@blur="onBlur"
@focus="onFocus(tab_id)"
> >
<template #enterButton> <template #enterButton>
<img <img
...@@ -67,6 +69,9 @@ ...@@ -67,6 +69,9 @@
placeholder="请输入关键词" placeholder="请输入关键词"
@search="onSearch" @search="onSearch"
@input="onInput(tab_id)" @input="onInput(tab_id)"
@blur="onBlur"
@focus="onFocus(tab_id)"
> >
<template #enterButton> <template #enterButton>
<img <img
...@@ -76,7 +81,7 @@ ...@@ -76,7 +81,7 @@
/>搜索 />搜索
</template> </template>
</a-input-search> </a-input-search>
<!-- 联想搜索 --> <!-- 联想搜索结果 -->
<div class="search_result" v-show="search_result_show"> <div class="search_result" v-show="search_result_show">
<div <div
class="search_result_item" class="search_result_item"
...@@ -378,8 +383,8 @@ export default { ...@@ -378,8 +383,8 @@ export default {
// console.log(id) // console.log(id)
this.tab_id = id; this.tab_id = id;
this.search_result_show = false; this.search_result_show = false;
this.search_result = [] this.search_result = [];
this.searchValue = '' this.searchValue = "";
}, },
onSearch() { onSearch() {
if (this.tab_id == "1") { if (this.tab_id == "1") {
...@@ -401,7 +406,7 @@ export default { ...@@ -401,7 +406,7 @@ export default {
//联想搜索 //联想搜索
onInput(tab_id) { onInput(tab_id) {
//专利联想搜索 //专利联想搜索
if (tab_id == 1) { if (tab_id == 1 && this.searchValue) {
patentLenovo({ keyword: this.searchValue }).then((res) => { patentLenovo({ keyword: this.searchValue }).then((res) => {
if (res.code == 0) { if (res.code == 0) {
this.search_result_show = true; this.search_result_show = true;
...@@ -415,7 +420,7 @@ export default { ...@@ -415,7 +420,7 @@ export default {
} }
}); });
// } // }
} else { } else if (tab_id == 2 && this.searchValue) {
this.search_result_show = true; this.search_result_show = true;
enterpriseLenovo({ keyword: this.searchValue }).then((res) => { enterpriseLenovo({ keyword: this.searchValue }).then((res) => {
if (res.code == 0) { if (res.code == 0) {
...@@ -431,6 +436,40 @@ export default { ...@@ -431,6 +436,40 @@ export default {
}); });
} }
}, },
onFocus(tab_id) {
if (tab_id == 1 && this.searchValue) {
patentLenovo({ keyword: this.searchValue }).then((res) => {
if (res.code == 0) {
this.search_result_show = true;
this.patent_cate = res.data.title_or_gkh;
this.search_result = res.data.list;
if (this.search_result.length == 0) {
this.search_result_show = false;
}
} else {
this.search_result_show = false;
}
});
// }
} else if (tab_id == 2 && this.searchValue) {
this.search_result_show = true;
enterpriseLenovo({ keyword: this.searchValue }).then((res) => {
if (res.code == 0) {
this.search_result_show = true;
this.company_cate = res.data.name_or_legal;
this.search_result = res.data.list;
if (this.search_result.length == 0) {
this.search_result_show = false;
}
} else {
this.search_result_show = false;
}
});
}
},
onBlur() {
this.search_result_show = false;
},
}, },
mounted() {}, mounted() {},
created() { created() {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
:bordered="false" :bordered="false"
allowClear allowClear
@input="onInput" @input="onInput"
@focus="onFocus"
@blur="onBlur" @blur="onBlur"
> >
<template #addonBefore> <template #addonBefore>
...@@ -150,11 +151,7 @@ ...@@ -150,11 +151,7 @@
<router-view></router-view> <router-view></router-view>
</template> </template>
<script> <script>
import { import { patents, patentselect, patentLenovo } from "../../utils/indexApi";
patents,
patentselect,
patentLenovo,
} from "../../utils/indexApi";
import dayjs from "dayjs"; import dayjs from "dayjs";
import "dayjs/locale/zh-cn"; import "dayjs/locale/zh-cn";
import zh_CN from "ant-design-vue/lib/locale-provider/zh_CN"; import zh_CN from "ant-design-vue/lib/locale-provider/zh_CN";
...@@ -386,9 +383,26 @@ export default { ...@@ -386,9 +383,26 @@ export default {
} }
}); });
}, },
//
onFocus() {
if (this.keyword) {
patentLenovo({ keyword: this.keyword }).then((res) => {
if (res.code == 0) {
this.search_result_show = true;
this.patent_cate = res.data.title_or_gkh;
this.search_result = res.data.list;
if (this.search_result.length == 0) {
this.search_result_show = false;
}
} else {
this.search_result_show = false;
}
});
}
},
//onBlur //onBlur
onBlur(){ onBlur() {
this.search_result_show = false this.search_result_show = false;
}, },
//从联想结果打开专利页面 //从联想结果打开专利页面
lenovnoPatentDetails(item) { lenovnoPatentDetails(item) {
...@@ -399,7 +413,6 @@ export default { ...@@ -399,7 +413,6 @@ export default {
}, },
}); });
}, },
}, },
watch: { watch: {
type: function (newV, oldV) { type: function (newV, oldV) {
......
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