中药检索完成

This commit is contained in:
yanwenlong
2024-01-30 23:55:06 +08:00
parent 927aeec7c0
commit 89e438bd3f
5 changed files with 238 additions and 140 deletions

View File

@@ -5,14 +5,14 @@
<z-nav-bar title="中药检索"></z-nav-bar> <z-nav-bar title="中药检索"></z-nav-bar>
<view class="contentBox"> <view class="contentBox">
<view class="grid twoCateList" v-if="twoCateList.length > 0"> <view class="grid twoCateList" v-if="twoCateList.length > 0">
<u-grid :col="3" border class="u-grid-list"> <u-grid :col="2" border class="u-grid-list">
<u-grid-item v-for="(item, index) in twoCateList" :key="item.id" <u-grid-item v-for="(item, index) in twoCateList" :key="item.id"
@click="setTwoCateIndex(item, index)"> @click="setTwoCateIndex(item, index)">
<view :class="['grid-text',curTwoCateIndex == index ? 'cur' : '']">{{item.title}}</view> <view :class="['grid-text',false ? 'cur' : '']">{{item.title}}</view>
</u-grid-item> </u-grid-item>
</u-grid> </u-grid>
</view> </view>
<view class="searchList" v-show="showSearchList"> <!-- <view class="searchList" v-show="showSearchList">
<view class="itemBox" v-if="searchList.length > 0"> <view class="itemBox" v-if="searchList.length > 0">
<view class="item" v-for="(item, index) in searchList" :key="index" @click="gotoDetail(item)"> <view class="item" v-for="(item, index) in searchList" :key="index" @click="gotoDetail(item)">
{{item.title}} {{item.title}}
@@ -21,49 +21,95 @@
<view v-else class=""> <view v-else class="">
<u-divider text="未找到相关中药哦~"></u-divider> <u-divider text="未找到相关中药哦~"></u-divider>
</view> </view>
</view> </view> -->
<view v-show="!showSearchList"> <view v-show="!showSearchList">
<view class="titleList" v-if="curOneCateIndex != 2"> <!-- <view class="grid twoCateList" v-if="twoCateList.length > 0 && curOneCateIndex == 1">
<u-grid :col="1" v-if="titleList.length > 0"> <u-grid :col="3" border class="u-grid-list">
<u-grid-item v-for="(item, index) in titleList" :key="item.prescriptId" <u-grid-item v-for="(item, index) in twoCateList" :key="item.prescriptCategoryId"
@click="gotoDetail(item)" style="align-items: flex-start;border-bottom: 2px solid #fff;"> @click="setTwoCateIndex(item, index)">
<view :class="['titleItem']">{{item.title}}</view> <view :class="['grid-text',curTwoCateIndex == index ? 'cur' : '']">{{item.title}}</view>
</u-grid-item> </u-grid-item>
</u-grid> </u-grid>
<u-divider v-else text="暂无中药数据哦~"></u-divider> </view>
</view> <view class="titleList" v-if="curOneCateIndex == 1">
<view class="titleList" v-else> <u-grid :col="1" v-if="titleList.length > 0">
<u-grid :col="1" v-if="titleList"> <u-grid-item v-for="(item, index) in titleList" :key="item.id"
<u-grid-item v-for="(item, index) in titleList" :key="index"> @click="gotoDetail(item)" style="align-items: flex-start;border-bottom: 2px solid #fff;">
<view :class="['titleItem']">{{index}}</view> <view :class="['titleItem']">{{item.name}}</view>
<u-grid-item v-for="(item1, index1) in item" :key="item1.prescriptId"> </u-grid-item>
<view :class="['JFtitleItem']" @click="gotoDetail(item1)">{{item1.title}}</view> </u-grid>
</u-grid-item> <u-divider v-else text="暂无药物数据哦~"></u-divider>
</u-grid-item> </view> -->
</u-grid> <view class="titleList">
<u-divider v-else text="暂无中药数据哦~"></u-divider> <u-grid :col="1" v-if="titleList.length > 0">
</view> <!-- <view style="font-size: 15px;padding: 5px;color: red;">大家常看的</view> -->
</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>
<u-popup mode="bottom" :show="xingweiShow" :round="10" @close="xingweiShow=false"> <u-popup mode="bottom" :show="xingweiShow" :round="10" @close="xingweiShow=false">
<view class="tanchu"> <view class="CNMedicineSearchPopup">
<view class="dp_title">味选择</view> <view class="dp_title"></view>
<!-- <view class="flexbox"> <view class="grid twoCateList" v-if="xingSelectionList.length > 0">
<i @click="showEmj()" :class="emojiIcon"></i> <u-grid :col="3" border class="u-grid-list">
<editor id="editor" class="ql-container" :placeholder="placeholder" @ready="onEditorReady"></editor> <u-grid-item v-for="(item, index) in xingSelectionList" :key="item.title"
</view> --> @click="setXingIndex(item, index, curXingIndex)">
<view :class="['grid-text',curXingIndex.includes(item.title) ? 'cur' : '']">{{item.title}}</view>
<view style="max-height: 1000rpx;overflow-y: scroll;"> </u-grid-item>
</u-grid>
</view>
<view class="dp_title"></view>
<view class="grid twoCateList" v-if="weiSelectionList.length > 0">
<u-grid :col="3" border class="u-grid-list">
<u-grid-item v-for="(item, index) in weiSelectionList" :key="item.title"
@click="setXingIndex(item, index, curWeiIndex)">
<view :class="['grid-text',curWeiIndex.includes(item.title) ? 'cur' : '']">{{item.title}}</view>
</u-grid-item>
</u-grid>
</view>
<view class="dp_title">归经</view>
<view class="grid twoCateList" v-if="guijingSelectionList.length > 0">
<u-grid :col="3" border class="u-grid-list">
<u-grid-item v-for="(item, index) in guijingSelectionList" :key="item.title"
@click="setXingIndex(item, index, curGuijingIndex)">
<view :class="['grid-text',curGuijingIndex.includes(item.title) ? 'cur' : '']">{{item.title}}</view>
</u-grid-item>
</u-grid>
</view>
<view style="max-height: 1000rpx;overflow-y: scroll;margin-top: 28px;">
<!-- 提交 --> <!-- 提交 -->
<view class="padding-bottom-sm flex padding-lr-sm" style="border-bottom: 1px solid #EEEEEE;"> <view class="padding-bottom-sm flex padding-lr-sm" style="border-bottom: 1px solid #EEEEEE;">
<view> <view>
<u-button type="success" @click="goToSign">查询</u-button> <u-button type="success" @click="goToSearch">查询</u-button>
</view>
</view>
</view>
</view>
</u-popup>
<u-popup mode="bottom" :show="gongxiaoShow" :round="10" @close="gongxiaoShow=false">
<view class="CNMedicineSearchPopup">
<view class="dp_title">功效</view>
<view class="grid twoCateList" v-if="gongxiaoSelectionList.length > 0">
<u-grid :col="3" border class="u-grid-list">
<u-grid-item v-for="(item, index) in gongxiaoSelectionList" :key="item.title"
@click="setXingIndex(item, index, curGongxiaoIndex)">
<view :class="['grid-text',curGongxiaoIndex.includes(item.title) ? 'cur' : '']">{{item.title}}</view>
</u-grid-item>
</u-grid>
</view>
<view style="max-height: 1000rpx;overflow-y: scroll;margin-top: 28px;">
<!-- 提交 -->
<view class="padding-bottom-sm flex padding-lr-sm" style="border-bottom: 1px solid #EEEEEE;">
<view>
<u-button type="success" @click="goToSearch">查询</u-button>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</u-popup> </u-popup>
</view> </view>
@@ -84,13 +130,65 @@
xingweiShow: false, // 查询条件弹出层,性味 xingweiShow: false, // 查询条件弹出层,性味
gongxiaoShow: false, // 查询条件弹出层,功效 gongxiaoShow: false, // 查询条件弹出层,功效
sanpinShow: false, // 查询条件弹出层sanpin sanpinShow: false, // 查询条件弹出层sanpin
xingSelectionList: [
{title: "寒"},
{title: "凉"},
{title: "平"},
{title: "温"},
{title: "热"},
],
weiSelectionList: [
{title: "酸"},
{title: "涩"},
{title: "甘"},
{title: "苦"},
{title: "辛"},
{title: "咸"},
{title: "淡"},
],
guijingSelectionList: [
{title: "心"},
{title: "肝"},
{title: "脾"},
{title: "肺"},
{title: "肾"},
{title: "肠"},
{title: "膀胱"},
{title: "胃"},
],
curXingIndex: [],
curWeiIndex: [],
curGuijingIndex: [],
gongxiaoSelectionList: [
{title: "解表"},
{title: "清热"},
{title: "泻下"},
{title: "祛风湿"},
{title: "芳香化湿"},
{title: "利水渗湿"},
{title: "温里"},
{title: "理气"},
{title: "消食"},
{title: "驱虫"},
{title: "止血"},
{title: "活血祛瘀"},
{title: "化痰止咳平喘"},
{title: "安神"},
{title: "平肝息风"},
{title: "开窍"},
{title: "补虚"},
{title: "收涩"},
{title: "涌吐"},
{title: "外用及其他"},
],
curGongxiaoIndex: [],
searchValue: '', searchValue: '',
twoCateList: [ twoCateList: [
{title:"性味", id: 1}, {title:"性味", id: 1},
{title:"功效", id: 2}, {title:"功效", id: 2},
{title:"三品", id: 3} // {title:"三品", id: 3}
], // 二级分类标题 ], // 二级分类标题
titleList: [], // 方剂标题 titleList: [], // 方剂标题
curFirstTabIndex: 0, // 20240128需求在原来一级分类基础上再新加一级分类方剂检索、药物检索 curFirstTabIndex: 0, // 20240128需求在原来一级分类基础上再新加一级分类方剂检索、药物检索
@@ -106,7 +204,8 @@
} }
}, },
onLoad() { onLoad() {
this.getUserInfo() this.goToSearch()
// this.getUserInfo()
// this.getCateList() // this.getCateList()
}, },
@@ -118,72 +217,46 @@
...mapState(['userInfo']), ...mapState(['userInfo']),
}, },
methods: { methods: {
// 检查是有权限使用搜索功能 setXingIndex(item, index, arr) {
checkDisable() { // let arr = this.curXingIndex
console.log('点击了') if (arr.includes(item.title)) {
}, // 若包含,则从数组中删除该值
// 显示无权限弹窗 var index = arr.indexOf(item.title);
// showNoRights() { if (index > -1) {
// let that = this arr.splice(index, 1);
// uni.showModal({ }
// content: "", } else {
// confirmText: '好的', // 若不包含,则向数组中添加该值
// showCancel: false, arr.push(item.title);
// success: function(res) {
// if (res.confirm) {
// // console.log('用户点击确定');
// that.clear()
// }
// }
// })
// },
// 获取用户详情
getUserInfo() {
// 用户详情
if (this.userInfo.id != undefined) {
this.$http
.post('book/user/info/' + this.userInfo.id)
.then(res => {
this.userMes = res.user
this.getCateList()
console.log(this.userMes, '呼呼')
});
} }
console.log(arr);
}, },
// 方剂详情 goToSearch() {
gotoDetail(item) {
if (this.userMes.prescriptAPower == 0 && this.curOneCateIndex == 0) {
this.limitShow = true
return
}
if (this.userMes.prescriptBPower == 0 && this.curOneCateIndex == 3) {
this.limitShow = true
return
}
// 等于1 就是有权限
uni.navigateTo({
url: "./prescriptDetail?id=" + item.prescriptId
})
},
// 获取方剂名称
getTitles(id) {
$http.request({ $http.request({
url: "book/prescript/prescriptList", url: "book/materials/getMaterialsList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档 method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: { data: {
// loadAnimate: 'none', // 请求加载动画 // loadAnimate: 'none', // 请求加载动画
'prescriptCategoryId': id, "limit": 100,
"limit": 1000, "current": 1,
"page": 1 "name":"",
"type": "", // 植物、矿物、动物
"effect": this.curGongxiaoIndex.join(','),//功效
"taste": this.curWeiIndex.join(','), //味
"property": this.curXingIndex.join(','), //性
"tropism":this.curGuijingIndex.join(',') //归经
}, },
header: { //默认 无 说明:请求头 header: { //默认 无 说明:请求头
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
}).then(res => { }).then(res => {
console.log(res, '内容获取成功') console.log(res, '内容获取成功')
if (res.code == 0 && res.page.records.length > 0) { if (res.code == 0 && res.result.records.length > 0) {
this.titleList = res.page.records this.titleList = res.result.records
this.xingweiShow = false
this.gongxiaoShow = false
this.sanpinShow = false
} else { } else {
this.titleList = [] this.titleList = []
} }
@@ -192,6 +265,27 @@
console.log(e) console.log(e)
}) })
}, },
gotoCNDetail(item) {
uni.navigateTo({
url: "./CNMedicineSearchDetail?id=" + item.id
})
},
// // 方剂详情
// gotoDetail(item) {
// if (this.userMes.prescriptAPower == 0 && this.curOneCateIndex == 0) {
// this.limitShow = true
// return
// }
// if (this.userMes.prescriptBPower == 0 && this.curOneCateIndex == 3) {
// this.limitShow = true
// return
// }
// // 等于1 就是有权限
// uni.navigateTo({
// url: "./prescriptDetail?id=" + item.prescriptId
// })
// },
setTwoCateIndex(item, index) { setTwoCateIndex(item, index) {
let id = item.id let id = item.id
this.curTwoCateIndex = index this.curTwoCateIndex = index
@@ -200,47 +294,11 @@
this.gongxiaoShow = false this.gongxiaoShow = false
this.sanpinShow = false this.sanpinShow = false
} }
}, if(id == 2){
this.xingweiShow = false
getSearch() { this.gongxiaoShow = true
$http.request({ this.sanpinShow = false
url: "book/prescript/searchPrescript", }
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
loadAnimate: 'none', // 请求加载动画
'keywords': this.searchValue,
type: this.curOneCateIndex + 1
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
console.log(res, '搜索结果')
if (res.code == 0 && res.list.length >= 0) {
this.showSearchList = true
this.searchList = res.list
} else {
this.searchList = []
}
}).catch(e => {
// this.titleList = []
this.searchList = []
console.log(e)
})
},
search(res) {
console.log(res, 'res')
// uni.showToast({
// title: '搜索:' + res,
// icon: 'none'
// })
if (res == '') {
this.showSearchList = false
this.searchList = []
} else {
this.getSearch()
}
}, },
}, },
onBackPress() { onBackPress() {
@@ -309,7 +367,10 @@
color: #55aa7f; color: #55aa7f;
} }
// .u-grid-list{border: 0.5px solid #dadbde;} .u-grid-list{
// border-top: 0.5px solid #dadbde;
// border-bottom: 0.5px solid #dadbde;
}
} }
.titleList { .titleList {

View File

@@ -15,7 +15,7 @@
</view> </view>
<view class="contentBox"> <view class="contentBox">
<view class="content"> <view class="content">
<uni-section class="mb-10" titleFontSize="18px" title="拼音" type="line" v-if="prescriptDetail.latinname && prescriptDetail.latinname != ''" > <uni-section class="mb-10" titleFontSize="18px" title="拉丁名" type="line" v-if="prescriptDetail.latinname && prescriptDetail.latinname != ''" >
<view class="item"> <view class="item">
{{prescriptDetail.latinname}} {{prescriptDetail.latinname}}
</view> </view>

View File

@@ -106,14 +106,14 @@ export default {
this.searchList = [] this.searchList = []
this.showSearchList = false this.showSearchList = false
if (index == 1) { // 西药检索 if (index == 1) { // 西药检索
this.getXiYao(1,1) this.getXiYao('抗感染类',1)
} else { // 中药检索 } else { // 中药检索
// this.getTowCateList(id) // this.getTowCateList(id)
this.getCNYao() // book/materials/getMaterialsList this.getCNYao() // book/materials/getMaterialsList
} }
}, },
setTwoCateIndex(item, index) { setTwoCateIndex(item, index) {
let id = item.prescriptCategoryId let id = item.title
this.curTwoCateIndex = index this.curTwoCateIndex = index
this.getXiYao(id,1) this.getXiYao(id,1)
}, },

View File

@@ -58,7 +58,7 @@
</view> </view>
</view> </view>
</view> </view>
<view v-show="curFirstTabIndex==1"> <view v-if="curFirstTabIndex==1">
<medicineSearch ref="mSearch"></medicineSearch> <medicineSearch ref="mSearch"></medicineSearch>
</view> </view>
</view> </view>
@@ -223,7 +223,9 @@
// this.setOneCateIndex(id) // this.setOneCateIndex(id)
console.log(this.$refs) console.log(this.$refs)
console.log(this.$refs.mSearch) console.log(this.$refs.mSearch)
this.$refs.mSearch.getCNYao() this.$nextTick(() => {
this.$refs.mSearch.getCNYao()
})
}else{ }else{
this.setOneCateIndex(this.oneCateList[0], 0) this.setOneCateIndex(this.oneCateList[0], 0)
} }

View File

@@ -26,4 +26,39 @@ button::after {
// 主题字体色 // 主题字体色
.themeFontColor { .themeFontColor {
color: $themeColor !important; color: $themeColor !important;
}
// 中药检索弹出层样式
.CNMedicineSearchPopup {
.dp_title {
font-size: 28rpx;
font-weight: 700;
padding: 20rpx 20rpx 0;
}
.twoCateList {
font-size: 28rpx;
margin-top: 20rpx;
.u-border-bottom{
border-bottom-width: 0 !important
}
.u-border-right{
border-right-width: 0 !important
}
.grid-text {
width: 212rpx;
padding: 10rpx;
margin-bottom: 10rpx;
text-align: center;
border: 0.5px solid #dadbde;
}
.cur {
color: #55aa7f;
border: 0.5px solid #55aa7f;
}
.u-grid-list{
// border-top: 0.5px solid #dadbde;
// border-bottom: 0.5px solid #dadbde;
}
}
} }