中药检索

This commit is contained in:
yanwenlong
2024-01-30 00:23:14 +08:00
parent d2d9681738
commit 927aeec7c0
5 changed files with 634 additions and 14 deletions

View File

@@ -5,9 +5,8 @@
<text :class="[curOneCateIndex == index ? 'cur' : '']" @click="setOneCateIndex(item,index)"
v-for="(item, index) in ywTabList" :key="item.prescriptCategoryId">{{item.title}}</text>
</view>
<view class="search_box" v-if="oneCateList.length > 0 && curOneCateIndex == 0">
<u-search @click="checkDisable" placeholder="请输入药物名" @focus="focus" @clear="clear" v-model="searchValue"
@input="input" @blur="blur" @search="search" @custom="search"></u-search>
<view class="search_box" v-if="oneCateList.length > 0 && curOneCateIndex == 0" @click="checkDisable">
<u-search placeholder="请输入药物名"></u-search>
</view>
<view class="searchList" v-show="showSearchList">
<view class="itemBox" v-if="searchList.length > 0">
@@ -37,17 +36,16 @@
</u-grid>
<u-divider v-else text="暂无药物数据哦~"></u-divider>
</view>
<!-- <view class="titleList" v-else>
<u-grid :col="1" v-if="titleList">
<u-grid-item v-for="(item, index) in titleList" :key="index">
<view :class="['titleItem']">{{index}}</view>
<u-grid-item v-for="(item1, index1) in item" :key="item1.id">
<view :class="['JFtitleItem']" @click="gotoDetail(item1)">{{item1.title}}</view>
</u-grid-item>
<view class="titleList" v-else>
<u-grid :col="1" v-if="titleList.length > 0">
<view style="font-size: 15px;padding: 5px;color: red;">大家常看的</view>
<u-grid-item v-for="(item, index) in titleList" :key="item.id"
@click="gotoCNDetail(item)" style="align-items: flex-start;border-bottom: 2px solid #fff;">
<view :class="['titleItem']">{{item.name}}</view>
</u-grid-item>
</u-grid>
<u-divider v-else text="暂无药物数据哦~"></u-divider>
</view> -->
</view>
</view>
</view>
</template>
@@ -96,9 +94,12 @@ export default {
limitContent: ''
}
},
// onLoad() {
// this.getCNYao()
// },
methods: {
setOneCateIndex(item, index) {
let id = item.prescriptCategoryId
// let id = item.prescriptCategoryId
this.curOneCateIndex = index
this.curTwoCateIndex = 0
this.searchValue = ''
@@ -108,6 +109,7 @@ export default {
this.getXiYao(1,1)
} else { // 中药检索
// this.getTowCateList(id)
this.getCNYao() // book/materials/getMaterialsList
}
},
setTwoCateIndex(item, index) {
@@ -152,6 +154,48 @@ export default {
url: "./medicineSearchDetail?id=" + item.id
})
},
// 获取中药
getCNYao(id, type) {
$http.request({
url: "book/materials/getMaterialsList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
// loadAnimate: 'none', // 请求加载动画
"limit": 10,
"current": 1,
"name":"",
"type": "", // 植物、矿物、动物
"effect": "",//功效
"taste": "", //味
"property": "", //性
"tropism":"" //归经
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
console.log(res, '内容获取成功')
if (res.code == 0 && res.result.records.length > 0) {
this.titleList = res.result.records
} else {
this.titleList = []
}
}).catch(e => {
this.titleList = []
console.log(e)
})
},
gotoCNDetail(item) {
console.log('2222')
uni.navigateTo({
url: "./CNMedicineSearchDetail?id=" + item.id
})
},
checkDisable(){
uni.navigateTo({
url: "./CNMedicineSearch"
})
}
}
};
</script>