翻页
This commit is contained in:
@@ -5,14 +5,51 @@
|
||||
<z-nav-bar title="中药检索"></z-nav-bar>
|
||||
<view class="contentBox">
|
||||
<view class="grid twoCateList" v-if="twoCateList.length > 0">
|
||||
<u-grid :col="2" border class="u-grid-list">
|
||||
<u-grid-item v-for="(item, index) in twoCateList" :key="item.id"
|
||||
@click="setTwoCateIndex(item, index)">
|
||||
<view :class="['grid-text',false ? 'cur' : '']">{{item.title}}</view>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</view>
|
||||
<!-- <view class="searchList" v-show="showSearchList">
|
||||
<u-grid :col="2" border class="u-grid-list">
|
||||
<u-grid-item v-for="(item, index) in twoCateList" :key="item.id"
|
||||
@click="setTwoCateIndex(item, index)">
|
||||
<view :class="['grid-text',false ? 'cur' : '']">
|
||||
{{item.title}}
|
||||
<b v-if="index==0&&xingweiShow">
|
||||
<u-icon name="arrow-up-fill" color="#666" size="12"></u-icon>
|
||||
</b>
|
||||
<b v-if="index==0&&!xingweiShow">
|
||||
<u-icon name="arrow-down-fill" color="#666" size="12"></u-icon>
|
||||
</b>
|
||||
<b v-if="index==1&&gongxiaoShow">
|
||||
<u-icon name="arrow-up-fill" color="#666" size="12"></u-icon>
|
||||
</b>
|
||||
<b v-if="index==1&&!gongxiaoShow">
|
||||
<u-icon name="arrow-down-fill" color="#666" size="12"></u-icon>
|
||||
</b>
|
||||
</view>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</view>
|
||||
<view class="marYao" @click="xingweiShow = true"
|
||||
v-if="curXingIndex.length>0||curWeiIndex.length>0||curGuijingIndex.length>0">
|
||||
性味:
|
||||
<span v-for="(item, index) in curXingIndex">
|
||||
{{item}}
|
||||
<font>,</font>
|
||||
</span>
|
||||
<span v-for="(item, index) in curWeiIndex">
|
||||
{{item}}
|
||||
<font>,</font>
|
||||
</span>
|
||||
<span v-for="(item, index) in curGuijingIndex">
|
||||
{{item}}
|
||||
<font>,</font>
|
||||
</span>
|
||||
</view>
|
||||
<view class="marYao" @click="gongxiaoShow = true" v-if="curGongxiaoIndex.length>0">
|
||||
功效:
|
||||
<span v-for="(item, index) in curGongxiaoIndex">
|
||||
{{item}}
|
||||
<font v-if="index+1!=curGongxiaoIndex.length">,</font>
|
||||
</span>
|
||||
</view>
|
||||
<!-- <view class="searchList" v-show="showSearchList">
|
||||
<view class="itemBox" v-if="searchList.length > 0">
|
||||
<view class="item" v-for="(item, index) in searchList" :key="index" @click="gotoDetail(item)">
|
||||
{{item.title}}
|
||||
@@ -22,7 +59,7 @@
|
||||
<u-divider text="未找到相关中药哦~"></u-divider>
|
||||
</view>
|
||||
</view> -->
|
||||
<view v-show="!showSearchList">
|
||||
<view v-show="!showSearchList">
|
||||
<!-- <view class="grid twoCateList" v-if="twoCateList.length > 0 && curOneCateIndex == 1">
|
||||
<u-grid :col="3" border class="u-grid-list">
|
||||
<u-grid-item v-for="(item, index) in twoCateList" :key="item.prescriptCategoryId"
|
||||
@@ -43,12 +80,25 @@
|
||||
<view class="titleList">
|
||||
<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;">
|
||||
<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 v-if="status==0" style="text-align: center;padding: 20rpx 0;">
|
||||
<u-loading-icon style="display: inline-block;"></u-loading-icon>
|
||||
<font style='vertical-align: super;margin-left: 10px;font-size: 26rpx;color: #909399;'>
|
||||
努力加载中
|
||||
</font>
|
||||
</view>
|
||||
<view v-if="status==1" style="padding: 20rpx 0;">
|
||||
<u-divider text="全部加载完成"></u-divider>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -59,7 +109,8 @@
|
||||
<u-grid :col="3" border class="u-grid-list">
|
||||
<u-grid-item v-for="(item, index) in xingSelectionList" :key="item.title"
|
||||
@click="setXingIndex(item, index, curXingIndex)">
|
||||
<view :class="['grid-text',curXingIndex.includes(item.title) ? 'cur' : '']">{{item.title}}</view>
|
||||
<view :class="['grid-text',curXingIndex.includes(item.title) ? 'cur' : '']">{{item.title}}
|
||||
</view>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</view>
|
||||
@@ -68,7 +119,8 @@
|
||||
<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>
|
||||
<view :class="['grid-text',curWeiIndex.includes(item.title) ? 'cur' : '']">{{item.title}}
|
||||
</view>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</view>
|
||||
@@ -77,7 +129,9 @@
|
||||
<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>
|
||||
<view :class="['grid-text',curGuijingIndex.includes(item.title) ? 'cur' : '']">
|
||||
{{item.title}}
|
||||
</view>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</view>
|
||||
@@ -85,7 +139,7 @@
|
||||
<!-- 提交 -->
|
||||
<view class="padding-bottom-sm flex padding-lr-sm" style="border-bottom: 1px solid #EEEEEE;">
|
||||
<view>
|
||||
<u-button type="success" @click="goToSearch">查询</u-button>
|
||||
<u-button type="success" @click="goNewSearch">查询</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -98,7 +152,9 @@
|
||||
<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>
|
||||
<view :class="['grid-text',curGongxiaoIndex.includes(item.title) ? 'cur' : '']">
|
||||
{{item.title}}
|
||||
</view>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</view>
|
||||
@@ -106,7 +162,7 @@
|
||||
<!-- 提交 -->
|
||||
<view class="padding-bottom-sm flex padding-lr-sm" style="border-bottom: 1px solid #EEEEEE;">
|
||||
<view>
|
||||
<u-button type="success" @click="goToSearch">查询</u-button>
|
||||
<u-button type="success" @click="goNewSearch">查询</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -130,66 +186,145 @@
|
||||
xingweiShow: false, // 查询条件弹出层,性味
|
||||
gongxiaoShow: false, // 查询条件弹出层,功效
|
||||
sanpinShow: false, // 查询条件弹出层,sanpin
|
||||
xingSelectionList: [
|
||||
{title: "寒"},
|
||||
{title: "凉"},
|
||||
{title: "平"},
|
||||
{title: "温"},
|
||||
{title: "热"},
|
||||
xingSelectionList: [{
|
||||
title: "寒"
|
||||
},
|
||||
{
|
||||
title: "凉"
|
||||
},
|
||||
{
|
||||
title: "平"
|
||||
},
|
||||
{
|
||||
title: "温"
|
||||
},
|
||||
{
|
||||
title: "热"
|
||||
},
|
||||
],
|
||||
weiSelectionList: [
|
||||
{title: "酸"},
|
||||
{title: "涩"},
|
||||
{title: "甘"},
|
||||
{title: "苦"},
|
||||
{title: "辛"},
|
||||
{title: "咸"},
|
||||
{title: "淡"},
|
||||
weiSelectionList: [{
|
||||
title: "酸"
|
||||
},
|
||||
{
|
||||
title: "涩"
|
||||
},
|
||||
{
|
||||
title: "甘"
|
||||
},
|
||||
{
|
||||
title: "苦"
|
||||
},
|
||||
{
|
||||
title: "辛"
|
||||
},
|
||||
{
|
||||
title: "咸"
|
||||
},
|
||||
{
|
||||
title: "淡"
|
||||
},
|
||||
],
|
||||
guijingSelectionList: [
|
||||
{title: "心"},
|
||||
{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: "外用及其他"},
|
||||
gongxiaoSelectionList: [{
|
||||
title: "解表"
|
||||
},
|
||||
{
|
||||
title: "清热"
|
||||
},
|
||||
{
|
||||
title: "泻下"
|
||||
},
|
||||
{
|
||||
title: "祛风湿"
|
||||
},
|
||||
{
|
||||
title: "芳香化湿"
|
||||
},
|
||||
{
|
||||
title: "利水渗湿"
|
||||
},
|
||||
{
|
||||
title: "温里"
|
||||
},
|
||||
{
|
||||
title: "理气"
|
||||
},
|
||||
{
|
||||
title: "消食"
|
||||
},
|
||||
{
|
||||
title: "驱虫"
|
||||
},
|
||||
{
|
||||
title: "止血"
|
||||
},
|
||||
{
|
||||
title: "活血祛瘀"
|
||||
},
|
||||
{
|
||||
title: "化痰止咳平喘"
|
||||
},
|
||||
{
|
||||
title: "安神"
|
||||
},
|
||||
{
|
||||
title: "平肝息风"
|
||||
},
|
||||
{
|
||||
title: "开窍"
|
||||
},
|
||||
{
|
||||
title: "补虚"
|
||||
},
|
||||
{
|
||||
title: "收涩"
|
||||
},
|
||||
{
|
||||
title: "涌吐"
|
||||
},
|
||||
{
|
||||
title: "外用及其他"
|
||||
},
|
||||
],
|
||||
curGongxiaoIndex: [],
|
||||
|
||||
|
||||
searchValue: '',
|
||||
twoCateList: [
|
||||
{title:"性味", id: 1},
|
||||
{title:"功效", id: 2},
|
||||
// {title:"三品", id: 3}
|
||||
], // 二级分类标题
|
||||
twoCateList: [{
|
||||
title: "性味",
|
||||
id: 1
|
||||
},
|
||||
{
|
||||
title: "功效",
|
||||
id: 2
|
||||
},
|
||||
// {title:"三品", id: 3}
|
||||
], // 二级分类标题
|
||||
titleList: [], // 方剂标题
|
||||
curFirstTabIndex: 0, // 20240128需求:在原来一级分类基础上再新加一级分类:方剂检索、药物检索
|
||||
curOneCateIndex: 0, // 当前选中的一级分类
|
||||
@@ -200,11 +335,15 @@
|
||||
searchDisable: false, // 搜索不可用
|
||||
limitShow: false,
|
||||
limitTitle: '提示',
|
||||
limitContent: ''
|
||||
limitContent: '',
|
||||
status: 3,
|
||||
page: 1,
|
||||
totalPage: 1,
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.goToSearch()
|
||||
this.goNewSearch()
|
||||
this.titleList = []
|
||||
// this.getUserInfo()
|
||||
// this.getCateList()
|
||||
|
||||
@@ -212,6 +351,25 @@
|
||||
onHide() {
|
||||
// this.showSearchList = false
|
||||
// this.searchList = []
|
||||
this.page = 1
|
||||
},
|
||||
|
||||
onPullDownRefresh() {
|
||||
console.log('下拉刷新了')
|
||||
// this.contentShow = 1
|
||||
this.page = 1
|
||||
this.goToSearch()
|
||||
uni.stopPullDownRefresh();
|
||||
},
|
||||
onReachBottom() {
|
||||
// this.loadingNow = true
|
||||
console.log('到底了')
|
||||
if (this.page + 1 <= this.totalPage) {
|
||||
this.page++
|
||||
this.goToSearch()
|
||||
} else {
|
||||
this.status = 1
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['userInfo']),
|
||||
@@ -229,22 +387,34 @@
|
||||
// 若不包含,则向数组中添加该值
|
||||
arr.push(item.title);
|
||||
}
|
||||
this.page = 1
|
||||
this.titleList = []
|
||||
this.goToSearch()
|
||||
console.log(arr);
|
||||
},
|
||||
goNewSearch() {
|
||||
this.page = 1
|
||||
this.titleList = []
|
||||
this.goToSearch()
|
||||
this.xingweiShow = false
|
||||
this.gongxiaoShow = false
|
||||
this.sanpinShow = false
|
||||
},
|
||||
|
||||
goToSearch() {
|
||||
$http.request({
|
||||
url: "book/materials/getMaterialsList",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data: {
|
||||
// loadAnimate: 'none', // 请求加载动画
|
||||
"limit": 100,
|
||||
"current": 1,
|
||||
"name":"",
|
||||
"limit": 20,
|
||||
"current": this.page,
|
||||
"name": "",
|
||||
"type": "", // 植物、矿物、动物
|
||||
"effect": this.curGongxiaoIndex.join(','),//功效
|
||||
"effect": this.curGongxiaoIndex.join(','), //功效
|
||||
"taste": this.curWeiIndex.join(','), //味
|
||||
"property": this.curXingIndex.join(','), //性
|
||||
"tropism":this.curGuijingIndex.join(',') //归经
|
||||
"tropism": this.curGuijingIndex.join(',') //归经
|
||||
},
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
@@ -252,11 +422,18 @@
|
||||
}).then(res => {
|
||||
console.log(res, '内容获取成功')
|
||||
if (res.code == 0 && res.result.records.length > 0) {
|
||||
this.titleList = res.result.records
|
||||
|
||||
this.xingweiShow = false
|
||||
this.gongxiaoShow = false
|
||||
this.sanpinShow = false
|
||||
for (var i = 0; i < res.result.records.length; i++) {
|
||||
this.titleList.push(res.result.records[i])
|
||||
}
|
||||
|
||||
this.totalPage = res.result.pages
|
||||
if (this.page == this.totalPage) {
|
||||
this.status = 1
|
||||
} else {
|
||||
this.status = 3
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
this.titleList = []
|
||||
}
|
||||
@@ -265,6 +442,7 @@
|
||||
console.log(e)
|
||||
})
|
||||
},
|
||||
|
||||
gotoCNDetail(item) {
|
||||
uni.navigateTo({
|
||||
url: "./CNMedicineSearchDetail?id=" + item.id
|
||||
@@ -289,17 +467,18 @@
|
||||
setTwoCateIndex(item, index) {
|
||||
let id = item.id
|
||||
this.curTwoCateIndex = index
|
||||
if(id == 1){
|
||||
this.xingweiShow = true
|
||||
this.gongxiaoShow = false
|
||||
this.sanpinShow = false
|
||||
}
|
||||
if(id == 2){
|
||||
this.xingweiShow = false
|
||||
this.gongxiaoShow = true
|
||||
this.sanpinShow = false
|
||||
}
|
||||
if (id == 1) {
|
||||
this.xingweiShow = true
|
||||
this.gongxiaoShow = false
|
||||
this.sanpinShow = false
|
||||
}
|
||||
if (id == 2) {
|
||||
this.xingweiShow = false
|
||||
this.gongxiaoShow = true
|
||||
this.sanpinShow = false
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
onBackPress() {
|
||||
// #ifdef APP-PLUS
|
||||
@@ -342,7 +521,8 @@
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.firstTab{
|
||||
|
||||
.firstTab {
|
||||
text {
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
@@ -361,13 +541,21 @@
|
||||
.grid-text {
|
||||
padding: 16rpx 20rpx;
|
||||
text-align: center;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.grid-text>b {
|
||||
margin-left: 10rpx;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.cur {
|
||||
color: #55aa7f;
|
||||
}
|
||||
|
||||
.u-grid-list{
|
||||
.u-grid-list {
|
||||
// border-top: 0.5px solid #dadbde;
|
||||
// border-bottom: 0.5px solid #dadbde;
|
||||
}
|
||||
@@ -391,6 +579,32 @@
|
||||
border-bottom: 0.5px solid #f8f9fa;
|
||||
}
|
||||
}
|
||||
|
||||
.marYao {
|
||||
background-color: #55aa7f1c;
|
||||
padding: 10rpx 20rpx 10rpx 20rpx;
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 26rpx;
|
||||
color: #225f40;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
span {
|
||||
|
||||
color: #55aa7f;
|
||||
|
||||
font {
|
||||
display: inline-block;
|
||||
margin: 0 5rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.marYao:nth-last-child(1) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -400,42 +614,7 @@
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.search_box {
|
||||
margin: 0 auto;
|
||||
overflow: hidden;
|
||||
align-items: center;
|
||||
width: calc(100% - 10px);
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.search {
|
||||
height: 56upx;
|
||||
display: flex;
|
||||
width: 86%;
|
||||
margin: 0 auto;
|
||||
align-items: center;
|
||||
padding: 0upx 40upx;
|
||||
background-color: #fff;
|
||||
border-radius: 20upx;
|
||||
box-shadow: 0 0px 10px 1px #54a96633;
|
||||
}
|
||||
|
||||
.prompt {
|
||||
color: #838383;
|
||||
font-size: 24rpx;
|
||||
|
||||
}
|
||||
|
||||
.icon_search {
|
||||
background-image: url('@/static/icon/map_ic_search.png');
|
||||
background-position: center center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
width: 36upx;
|
||||
height: 36upx;
|
||||
margin-right: 20upx;
|
||||
}
|
||||
}
|
||||
|
||||
.flexbox {
|
||||
display: flex;
|
||||
@@ -444,8 +623,8 @@
|
||||
.uni-modal .uni-modal__bd {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.limiTy{
|
||||
|
||||
.limiTy {
|
||||
font-size: 28rpx;
|
||||
line-height: 46rpx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user