Commit b7efbf80d32173e085996f116cffe50161b159b2
1 parent
d9bf55ae
购好物+工会页面,云测Bug处理~
Showing
3 changed files
with
47 additions
and
29 deletions
src/components/searchBar/searchBar.less
src/pages/labourUnion/labourUnion.vue
| ... | ... | @@ -49,7 +49,7 @@ |
| 49 | 49 | <div class="buttons-box"> |
| 50 | 50 | <div class="btn btn-active" @click="toOrderList"> |
| 51 | 51 | <div class="text">购买记录</div> |
| 52 | - <img src="static/img/icon_arrow_right_color.png" class="icon" mode="aspectFill" /> | |
| 52 | + <img src="/static/img/icon_arrow_right_color.png" class="icon" mode="aspectFill" /> | |
| 53 | 53 | </div> |
| 54 | 54 | </div> |
| 55 | 55 | </div> | ... | ... |
src/pages/labourUnionSearch/labourUnionSearch.vue
| ... | ... | @@ -51,7 +51,7 @@ |
| 51 | 51 | </template> |
| 52 | 52 | |
| 53 | 53 | <!-- 没有搜索数据 --> |
| 54 | - <template v-else-if="tabs && tabs.keyword"> | |
| 54 | + <template v-else-if="tabs && tabs.keyword && initialized"> | |
| 55 | 55 | |
| 56 | 56 | <!-- 未找到您搜索的内容 --> |
| 57 | 57 | <div class="no-data"> |
| ... | ... | @@ -131,6 +131,7 @@ |
| 131 | 131 | navsSearch: null, // 导航栏对象 |
| 132 | 132 | searchHistoryArr: [], // 搜索历史记录数组 |
| 133 | 133 | tabs: {}, // tabsBar数据对象 |
| 134 | + initialized: false, // 已初始化过标识,默认false | |
| 134 | 135 | interface: 'goodsSearch', // 列表页接口名称 |
| 135 | 136 | lists: [] // 列表数据 |
| 136 | 137 | } |
| ... | ... | @@ -304,6 +305,9 @@ |
| 304 | 305 | // 获取数据列表失败 |
| 305 | 306 | Toast('获取数据列表失败'); |
| 306 | 307 | } |
| 308 | + | |
| 309 | + // 设置已初始化过 | |
| 310 | + this.$set(this, 'initialized', true); | |
| 307 | 311 | }, |
| 308 | 312 | |
| 309 | 313 | /** |
| ... | ... | @@ -340,51 +344,58 @@ |
| 340 | 344 | * @param {String} keyword [搜索关键字] |
| 341 | 345 | */ |
| 342 | 346 | doSearch(keyword) { |
| 343 | - console.log(keyword); | |
| 347 | + | |
| 344 | 348 | if (this.debug) { |
| 345 | 349 | console.log('doSearch', keyword); |
| 346 | 350 | } |
| 347 | 351 | |
| 348 | 352 | // 判断必要参数 |
| 349 | - if (keyword && typeof keyword === 'string' && keyword.trim()) { | |
| 353 | + if (keyword && typeof keyword === 'string' && keyword.trim()) { | |
| 350 | 354 | |
| 351 | - // 清空列表 | |
| 352 | - this.$set(this, 'lists', []); | |
| 355 | + // 清空列表 | |
| 356 | + this.$set(this, 'lists', []); | |
| 353 | 357 | |
| 354 | - // 初始化tabs对象 | |
| 355 | - this.setTabs(keyword); | |
| 358 | + // 初始化tabs对象 | |
| 359 | + this.setTabs(keyword); | |
| 356 | 360 | |
| 357 | - /* 记录搜搜历史 开始 */ | |
| 361 | + /* 记录搜搜历史 开始 */ | |
| 358 | 362 | |
| 359 | - // 最多8个历史搜索结果 | |
| 360 | - if (this.searchHistoryArr.length >= 8) { | |
| 363 | + // 最多8个历史搜索结果 | |
| 364 | + if (this.searchHistoryArr.length >= 8) { | |
| 361 | 365 | |
| 362 | - // 弹出一个数据 | |
| 363 | - this.searchHistoryArr.pop(); | |
| 364 | - } | |
| 366 | + // 弹出一个数据 | |
| 367 | + this.searchHistoryArr.pop(); | |
| 368 | + } | |
| 365 | 369 | |
| 366 | - // 向前插入搜索历史 | |
| 367 | - this.searchHistoryArr.unshift(keyword); | |
| 370 | + // 向前插入搜索历史 | |
| 371 | + this.searchHistoryArr.unshift(keyword); | |
| 368 | 372 | |
| 369 | - // 搜索历史放入Storage中 | |
| 370 | - this.setSearchHistoryArr(keyword); | |
| 373 | + // 搜索历史放入Storage中 | |
| 374 | + this.setSearchHistoryArr(keyword); | |
| 371 | 375 | |
| 372 | - /* 记录搜搜历史 结束 */ | |
| 376 | + /* 记录搜搜历史 结束 */ | |
| 373 | 377 | |
| 374 | - // 下一周期执行 | |
| 375 | - this.$nextTick(() => { | |
| 378 | + // 下一周期执行 | |
| 379 | + this.$nextTick(() => { | |
| 376 | 380 | |
| 377 | - // 请求搜索接口 | |
| 378 | - this.getLists(this.tabs, this.CALL_STATUS.INIT); | |
| 379 | - }); | |
| 380 | - } | |
| 381 | + // 请求搜索接口 | |
| 382 | + this.getLists(this.tabs, this.CALL_STATUS.INIT); | |
| 383 | + }); | |
| 384 | + } | |
| 381 | 385 | }, |
| 382 | - /** | |
| 386 | + | |
| 387 | + /** | |
| 383 | 388 | * 搜索异常 |
| 384 | 389 | */ |
| 385 | - exceptions(){ | |
| 386 | - Toast("请输入要搜索的商品"); | |
| 387 | - }, | |
| 390 | + exceptions() { | |
| 391 | + | |
| 392 | + // 提示 | |
| 393 | + Toast("请输入要搜索的商品"); | |
| 394 | + | |
| 395 | + // 设置未初始化过 | |
| 396 | + this.$set(this, 'initialized', false); | |
| 397 | + }, | |
| 398 | + | |
| 388 | 399 | /** |
| 389 | 400 | * 清除输入框事件监听 |
| 390 | 401 | */ |
| ... | ... | @@ -399,6 +410,9 @@ |
| 399 | 410 | |
| 400 | 411 | // 初始化tabs对象 |
| 401 | 412 | this.setTabs(); |
| 413 | + | |
| 414 | + // 设置未初始化过 | |
| 415 | + this.$set(this, 'initialized', false); | |
| 402 | 416 | }, |
| 403 | 417 | |
| 404 | 418 | /** | ... | ... |