Commit afdbe49998f586be17fb30655f7af036a827afbf
1 parent
478fdb52
工会搜索页云测bug修复
Showing
4 changed files
with
65 additions
and
43 deletions
src/components/navSearchBar/navSearchBar.less
| ... | ... | @@ -68,6 +68,16 @@ |
| 68 | 68 | display: none; |
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | + .input[type=search] { | |
| 72 | + -webkit-appearance: textfield; | |
| 73 | + -webkit-box-sizing: content-box; | |
| 74 | + font-family: inherit; | |
| 75 | + font-size: 100%; | |
| 76 | + } | |
| 77 | + .input::-webkit-search-decoration, | |
| 78 | + .input::-webkit-search-cancel-button { | |
| 79 | + display: none; | |
| 80 | + } | |
| 71 | 81 | .text { |
| 72 | 82 | display: flex; |
| 73 | 83 | justify-content: flex-start; | ... | ... |
src/components/navSearchBar/navSearchBar.vue
| ... | ... | @@ -56,15 +56,17 @@ |
| 56 | 56 | doSearch(keyword, e) { |
| 57 | 57 | |
| 58 | 58 | // 判断按下的按键是不是回车(确认) |
| 59 | - if ((keyword && (e.keyCode === 13 || (typeof e.key === "string" && e.key.toLowerCase() === "enter"))) || (!keyword && (e.keyCode === 8 || (typeof e.key === "string" && e.key.toLowerCase() === "backspace")))) { | |
| 59 | + if ((keyword && (e.keyCode === 13 || (typeof e.key === "string" && e.key.toLowerCase() === "enter"))) || (!keyword && (e.keyCode === 8 || (typeof e.key === "string" && e.key.toLowerCase() === "backspace")))) { | |
| 60 | 60 | |
| 61 | - // 判断不是空格字符串 | |
| 62 | - if (keyword.trim()) { | |
| 63 | - this.$emit("doSearch", keyword); | |
| 64 | - } else { | |
| 65 | - this.setKeyword(''); | |
| 66 | - } | |
| 67 | - } | |
| 61 | + // 判断不是空格字符串 | |
| 62 | + if (keyword.trim()) { | |
| 63 | + this.$emit("doSearch", keyword); | |
| 64 | + } else { | |
| 65 | + this.$emit("exceptions"); | |
| 66 | + } | |
| 67 | + } else if ((keyword == '' && (e.keyCode === 13 || (typeof e.key === "string" && e.key.toLowerCase() === "enter"))) || (!keyword && (e.keyCode === 8 || (typeof e.key === "string" && e.key.toLowerCase() === "backspace")))) { | |
| 68 | + this.$emit("exceptions"); | |
| 69 | + } | |
| 68 | 70 | }, |
| 69 | 71 | |
| 70 | 72 | /** | ... | ... |
src/pages/labourUnionSearch/labourUnionSearch.less
| ... | ... | @@ -151,6 +151,11 @@ |
| 151 | 151 | font-weight: bold; |
| 152 | 152 | border: 1px solid #B8B8B8; |
| 153 | 153 | border-radius: 24px; |
| 154 | + max-width: 300px; | |
| 155 | + height: 40px; | |
| 156 | + line-height: 40px; | |
| 157 | + text-overflow: ellipsis; | |
| 158 | + overflow: hidden; | |
| 154 | 159 | &:last-child { |
| 155 | 160 | margin-right: 0; |
| 156 | 161 | } | ... | ... |
src/pages/labourUnionSearch/labourUnionSearch.vue
| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | <div class="nav-container" :style="'padding-top: ' + $parent.top.value + 'px'"> |
| 12 | 12 | |
| 13 | 13 | <!-- 导航栏 --> |
| 14 | - <nav-search-bar ref="navSearchBar" @back="back" @doSearch="doSearch" @clearInput="clearInput" | |
| 14 | + <nav-search-bar ref="navSearchBar" @back="back" @doSearch="doSearch" @clearInput="clearInput" @exceptions="exceptions" | |
| 15 | 15 | :navs="navsSearch"> |
| 16 | 16 | </nav-search-bar> |
| 17 | 17 | </div> |
| ... | ... | @@ -340,46 +340,51 @@ |
| 340 | 340 | * @param {String} keyword [搜索关键字] |
| 341 | 341 | */ |
| 342 | 342 | doSearch(keyword) { |
| 343 | - | |
| 343 | + console.log(keyword); | |
| 344 | 344 | if (this.debug) { |
| 345 | 345 | console.log('doSearch', keyword); |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | // 判断必要参数 |
| 349 | - if (keyword && typeof keyword === 'string' && keyword.trim()) { | |
| 350 | - | |
| 351 | - // 清空列表 | |
| 352 | - this.$set(this, 'lists', []); | |
| 353 | - | |
| 354 | - // 初始化tabs对象 | |
| 355 | - this.setTabs(keyword); | |
| 356 | - | |
| 357 | - /* 记录搜搜历史 开始 */ | |
| 358 | - | |
| 359 | - // 最多8个历史搜索结果 | |
| 360 | - if (this.searchHistoryArr.length >= 8) { | |
| 361 | - | |
| 362 | - // 弹出一个数据 | |
| 363 | - this.searchHistoryArr.pop(); | |
| 364 | - } | |
| 365 | - | |
| 366 | - // 向前插入搜索历史 | |
| 367 | - this.searchHistoryArr.unshift(keyword); | |
| 368 | - | |
| 369 | - // 搜索历史放入Storage中 | |
| 370 | - this.setSearchHistoryArr(keyword); | |
| 371 | - | |
| 372 | - /* 记录搜搜历史 结束 */ | |
| 373 | - | |
| 374 | - // 下一周期执行 | |
| 375 | - this.$nextTick(() => { | |
| 376 | - | |
| 377 | - // 请求搜索接口 | |
| 378 | - this.getLists(this.tabs, this.CALL_STATUS.INIT); | |
| 379 | - }); | |
| 380 | - } | |
| 349 | + if (keyword && typeof keyword === 'string' && keyword.trim()) { | |
| 350 | + | |
| 351 | + // 清空列表 | |
| 352 | + this.$set(this, 'lists', []); | |
| 353 | + | |
| 354 | + // 初始化tabs对象 | |
| 355 | + this.setTabs(keyword); | |
| 356 | + | |
| 357 | + /* 记录搜搜历史 开始 */ | |
| 358 | + | |
| 359 | + // 最多8个历史搜索结果 | |
| 360 | + if (this.searchHistoryArr.length >= 8) { | |
| 361 | + | |
| 362 | + // 弹出一个数据 | |
| 363 | + this.searchHistoryArr.pop(); | |
| 364 | + } | |
| 365 | + | |
| 366 | + // 向前插入搜索历史 | |
| 367 | + this.searchHistoryArr.unshift(keyword); | |
| 368 | + | |
| 369 | + // 搜索历史放入Storage中 | |
| 370 | + this.setSearchHistoryArr(keyword); | |
| 371 | + | |
| 372 | + /* 记录搜搜历史 结束 */ | |
| 373 | + | |
| 374 | + // 下一周期执行 | |
| 375 | + this.$nextTick(() => { | |
| 376 | + | |
| 377 | + // 请求搜索接口 | |
| 378 | + this.getLists(this.tabs, this.CALL_STATUS.INIT); | |
| 379 | + }); | |
| 380 | + } | |
| 381 | 381 | }, |
| 382 | - | |
| 382 | + /** | |
| 383 | + * 搜索异常 | |
| 384 | + */ | |
| 385 | + exceptions(){ | |
| 386 | + Toast("请输入要搜索的商品"); | |
| 387 | + }, | |
| 383 | 388 | /** |
| 384 | 389 | * 清除输入框事件监听 |
| 385 | 390 | */ | ... | ... |