diff --git a/pages/prescript/prescript.vue b/pages/prescript/prescript.vue index 5ec6a01..a8a8a68 100644 --- a/pages/prescript/prescript.vue +++ b/pages/prescript/prescript.vue @@ -6,56 +6,59 @@ - - - - - - - - {{item.title}} - - - - - - - + + {{item.title}} + + + + + + + + {{item.title}} + + + + + + - - - - {{item.title}} - - - - - - - {{item.title}} - - - - - - - - {{index}} - - {{item1.title}} + + + + + {{item.title}} - - - + + + + + + {{item.title}} + + + + + + + + {{index}} + + {{item1.title}} + + + + + @@ -212,6 +215,9 @@ let id = item.prescriptCategoryId this.curOneCateIndex = index this.curTwoCateIndex = 0 + this.searchValue = '' + this.searchList = [] + this.showSearchList = false if(index!=2){ this.getTowCateList(id) } else { @@ -313,19 +319,23 @@ }, getSearch() { $http.request({ - url: "book/point/searchPointList", + url: "book/prescript/searchPrescript", method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 data: { loadAnimate: 'none', // 请求加载动画 - 'keywords': this.searchValue + 'keywords': this.searchValue, + type: this.curOneCateIndex + 1 }, header: { //默认 无 说明:请求头 'Content-Type': 'application/json' }, }).then(res => { console.log(res, '搜索结果') - if (res.code == 0 && res.points.length > 0) { - this.searchList = res.points + if (res.code == 0 && res.list.length >= 0) { + this.showSearchList = true + this.searchList = res.list + }else{ + this.searchList = [] } }).catch(e => { // this.titleList = [] @@ -339,6 +349,12 @@ // title: '搜索:' + res, // icon: 'none' // }) + if (res == '') { + this.showSearchList = false + this.searchList = [] + } else { + this.getSearch() + } }, input(res) { @@ -350,6 +366,7 @@ } }, clear(res) { + console.log('----clear:', res) // uni.showToast({ // title: 'clear事件,清除值为:', // icon: 'none' @@ -358,20 +375,22 @@ this.showSearchList = false }, blur(res) { - if (res == '') { - this.showSearchList = false - this.searchList = [] - } else { - this.getSearch() - } + // console.log('----blur:', res) + // if (res == '') { + // this.showSearchList = false + // this.searchList = [] + // } else { + // this.getSearch() + // } }, focus(e) { + console.log('----focus:') // uni.showToast({ // title: 'focus事件,输出值为:' + e.value, // icon: 'none' // }) // 等于1 就是有权限 - this.showSearchList = true + // this.showSearchList = true }, // cancel(res) { @@ -471,11 +490,10 @@ .search_box { margin: 0 auto; overflow: hidden; - margin-top: 20rpx; align-items: center; width: calc(100% - 10px); - margin-top: 0; - margin-bottom: 40rpx; + margin-top: 20rpx; + margin-bottom: 20rpx; .search { height: 56upx;