更新小程序仓库
This commit is contained in:
@@ -0,0 +1,213 @@
|
||||
// pages/search/search.js
|
||||
const app = getApp()
|
||||
import {doctorList} from "../../api/consultExpert"
|
||||
import {hotSearch} from "../../api/common"
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
keyword:'',
|
||||
page:1,
|
||||
pageNumber:10,
|
||||
toggle:false,
|
||||
lock:false,
|
||||
doctorList:[],
|
||||
seachList:[],
|
||||
img_host:'https://oss.prod.applets.igandanyiyuan.com/applet/patient/static',
|
||||
hotList:[]
|
||||
},
|
||||
goSearch(){
|
||||
this.handleSearch(this.data.keyword)
|
||||
},
|
||||
changeIpt(event){
|
||||
this.setData({
|
||||
keyword:event.detail.value
|
||||
})
|
||||
},
|
||||
getIptvalue(event){
|
||||
this.setData({
|
||||
keyword:event.detail.value
|
||||
});
|
||||
this.handleSearch(event.detail.value)
|
||||
},
|
||||
handleSearch(value){
|
||||
if(!value) {
|
||||
wx.showToast({
|
||||
title: '搜索内容不能为空',
|
||||
icon:"none"
|
||||
})
|
||||
return false
|
||||
};
|
||||
let serachList=wx.getStorageSync('serachList');
|
||||
let serachArr=[];
|
||||
if(serachList){
|
||||
serachArr=JSON.parse(serachList);
|
||||
};
|
||||
var index=serachArr.indexOf(value);
|
||||
|
||||
if(index!=-1){
|
||||
serachArr.splice(index,1);
|
||||
};
|
||||
if(serachArr.length>=30){
|
||||
serachArr.pop();
|
||||
};
|
||||
serachArr.unshift(value);
|
||||
wx.setStorageSync('serachList',JSON.stringify(serachArr));
|
||||
this.setData({
|
||||
seachList:serachArr
|
||||
})
|
||||
this.onfresh();
|
||||
},
|
||||
handlehotSearch(){
|
||||
hotSearch({
|
||||
client_type:1,
|
||||
keyword_place:1
|
||||
}).then(data=>{
|
||||
this.setData({
|
||||
hotList:data
|
||||
})
|
||||
})
|
||||
},
|
||||
selectHistroy(event){
|
||||
let value=event.currentTarget.dataset.id;
|
||||
this.setData({
|
||||
keyword:value,
|
||||
toggle:true
|
||||
});
|
||||
this.handleSearch(value)
|
||||
},
|
||||
getSearchList(){
|
||||
let serachList=wx.getStorageSync('serachList');
|
||||
let serachArr=[];
|
||||
if(serachList){
|
||||
serachArr=JSON.parse(serachList);
|
||||
};
|
||||
this.setData({
|
||||
seachList:serachArr
|
||||
})
|
||||
},
|
||||
goBack(){
|
||||
wx.navigateBack({
|
||||
delta: 1,
|
||||
})
|
||||
},
|
||||
goExpertDetail(event){
|
||||
app.method.navigateTo({
|
||||
url: '/pages/expertDetail/expertDetail?doctor_id='+event.currentTarget.dataset.doctorid
|
||||
})
|
||||
},
|
||||
delSearch(){
|
||||
wx.setStorageSync('serachList','');
|
||||
this.getSearchList();
|
||||
wx.showToast({
|
||||
title: '搜索历史已清空',
|
||||
icon:'none'
|
||||
})
|
||||
},
|
||||
getDoctorList(){
|
||||
let {keyword,page,pageNumber}=this.data;
|
||||
doctorList({
|
||||
keyword:keyword,
|
||||
page:page,
|
||||
per_page:pageNumber
|
||||
}).then((res)=>{
|
||||
let {doctorList}=this.data;
|
||||
if(res.data.length==0){
|
||||
this.setData({
|
||||
lock:true
|
||||
});
|
||||
return false;
|
||||
}else{
|
||||
this.setData({
|
||||
toggle:true,
|
||||
doctorList:doctorList.concat(res.data)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
},
|
||||
onfresh(){
|
||||
this.setData({
|
||||
page:1,
|
||||
doctorList:[],
|
||||
lock:false
|
||||
})
|
||||
this.getDoctorList();
|
||||
},
|
||||
lower(e) {
|
||||
let {lock}=this.data;
|
||||
let addPage=this.data.page+1;
|
||||
if(!lock){
|
||||
this.setData({
|
||||
page:addPage
|
||||
});
|
||||
this.getDoctorList();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.getSearchList();
|
||||
this.handlehotSearch();
|
||||
if(options.keyword){
|
||||
this.setData({
|
||||
keyword:options.keyword
|
||||
})
|
||||
}
|
||||
//this.getDoctorList();
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
this.setData({
|
||||
img_host:app.hostConfig().imghost
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
|
||||
})
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"nav":"../../components/nav/nav"
|
||||
},
|
||||
"navigationStyle":"custom",
|
||||
"navigationBarTitleText": "肝胆相照互联网医院"
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<!--pages/search/search.wxml-->
|
||||
<nav navName="搜索"></nav>
|
||||
<wxs src="../../filters/filter.wxs" module="moduleFilter"></wxs>
|
||||
<view class="page">
|
||||
<view class="searchbox">
|
||||
<input type="text" value="{{keyword}}" bindinput="changeIpt" auto-focus focus placeholder="输入姓名或医院查找医生" bindconfirm="getIptvalue" placeholder-class="searchIpt" confirm-type="search" />
|
||||
<image src="{{img_host+'/greenss.png'}}" bindtap="goSearch"></image>
|
||||
</view>
|
||||
<view class="listbox" hidden="{{toggle}}" wx:if="{{hotList.length>0}}">
|
||||
<view class="titlebox">
|
||||
<view class="name">热门搜索</view>
|
||||
</view>
|
||||
<view class="listUl" wx:if="{{hotList.length>0}}">
|
||||
<view class="cell" wx:for="{{hotList}}" wx:key="index" bindtap="selectHistroy" data-id="{{item.keyword_name}}">{{item.keyword_name}} </view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="listbox" wx:if="{{seachList.length>0}}" hidden="{{toggle}}" >
|
||||
<view class="titlebox">
|
||||
<view class="name">搜索历史</view>
|
||||
<image src="{{img_host+'/del.png'}}" class="del" bindtap="delSearch"></image>
|
||||
</view>
|
||||
<view class="listUl">
|
||||
<view class="cell" wx:for="{{seachList}}" wx:for-index="idx" wx:key="idx" bindtap="selectHistroy" data-id="{{item}}"> {{item}} </view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="scrollwraper">
|
||||
<scroll-view scroll-y style="width: 100%;height:100%" lower-threshold="200" bindscrolltolower="lower">
|
||||
<view wx:if="{{doctorList.length>0}}" style="margin:0 30rpx">
|
||||
<view class="viewcell" bindtap="goExpertDetail" wx:for="{{doctorList}}" wx:key="doctor_id" data-doctorid="{{item.doctor_id}}">
|
||||
<view class="left">
|
||||
<image src="{{item.avatar}}" mode="aspectFill" wx:if="{{item.avatar}}"></image>
|
||||
<image src="{{img_host+'/doctor_avatar.png'}}" wx:else></image>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="namebox">
|
||||
<view class="name">{{item.user_name}}</view>
|
||||
<view class="type" wx:if="{{item.hospital.hospital_level_name != '未知'&& item.hospital.hospital_level_name}}">{{item.hospital.hospital_level_name}}</view>
|
||||
<view class="type" wx:if="{{item.multi_point_status == 1 && moduleFilter.formatChufang(item.doctor_inquiry_config)}}">可处方</view>
|
||||
</view>
|
||||
|
||||
<view class="hospital"><text class="doctor_title" wx:if="{{item.doctor_title_name}}">{{item.doctor_title_name}}</text><text>{{item.department_custom_name}}</text></view>
|
||||
<view class="hospital">{{item.hospital.hospital_name}}</view>
|
||||
<view class="goodjob" wx:if="{{item.be_good_at}}">擅长:{{item.be_good_at}}</view>
|
||||
<!-- <view class="diseaseType" wx:for="{{item.doctor_expertise}}" wx:for-item="cell" wx:key="expertise_id">{{cell.expertise_name}}</view> -->
|
||||
<!-- <view class="detail">
|
||||
<view>好评率: <text>{{item.praise_rate}} </text> </view>
|
||||
<view>服务患者数: <text>{{item.served_patients_num}}</text></view>
|
||||
<view>平均回复: <text> {{item.avg_response_time}}</text></view>
|
||||
</view> -->
|
||||
<view class="consultbox">
|
||||
<!-- <view class="price" wx:if="{{item.is_img_welfare_reception==1}}">公益问诊:<text>¥{{item.free_clinic_price}}</text></view>
|
||||
<view class="price" wx:else>专家问诊:<text>¥{{item.price}}</text></view> -->
|
||||
<view class="price" wx:if="{{moduleFilter.formatInquiryType(item.doctor_inquiry_config)==1}}">公益问诊:<text>¥{{item.free_clinic_price}}</text></view>
|
||||
<view class="price" wx:elif="{{moduleFilter.formatInquiryType(item.doctor_inquiry_config)==2}}">专家问诊:<text>¥{{item.price}}</text></view>
|
||||
<view class="price" wx:else></view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="nonedata" wx:elif="{{toggle && doctorList.length==0}}">暂无数据!</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,205 @@
|
||||
/* pages/search/search.wxss */
|
||||
.page{
|
||||
background: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.searchbox {
|
||||
margin:30rpx 30rpx 0;
|
||||
height: 72rpx;
|
||||
display: flex;
|
||||
border-radius: 40rpx;
|
||||
align-items: center;
|
||||
margin-top: 192rpx;
|
||||
background: #FBFBFB;
|
||||
border-radius: 36px;
|
||||
border: 1rpx solid #3CC7C0;
|
||||
}
|
||||
.searchIpt{
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
}
|
||||
.searchbox input {
|
||||
margin-left: 30rpx;
|
||||
flex: 1;
|
||||
font-size: 32rpx;
|
||||
height: 80rpx;
|
||||
}
|
||||
.searchbox image {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
padding:20rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.listUl{
|
||||
margin:30rpx 32rpx 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.listUl .cell{
|
||||
width: 154rpx;
|
||||
padding:0 10rpx;
|
||||
box-sizing: border-box;
|
||||
margin-right: 23rpx;
|
||||
margin-bottom: 30rpx;
|
||||
text-align: center;
|
||||
line-height: 60rpx;
|
||||
height: 60rpx;
|
||||
background: #F4F4F4;
|
||||
border-radius: 30rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
.titlebox{
|
||||
margin:30rpx 32rpx 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.titlebox .del{
|
||||
width:32rpx;
|
||||
height:32rpx;
|
||||
}
|
||||
.titlebox .name{
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.listUl .cell:nth-child(4n){
|
||||
margin-right: 0rpx;
|
||||
}
|
||||
.viewcell{
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
padding:40rpx 30rpx 30rpx;
|
||||
width:100%;
|
||||
border-radius: 10rpx;
|
||||
background-color: #fff;
|
||||
border-bottom: 1rpx solid #E7E7E7;
|
||||
}
|
||||
|
||||
.viewcell .type{
|
||||
height: 32rpx;
|
||||
margin-bottom: 6rpx;
|
||||
line-height: 32rpx;
|
||||
display: flex;
|
||||
white-space: nowrap;
|
||||
align-items: center;
|
||||
margin-left: 18rpx;
|
||||
padding:0rpx 6rpx;
|
||||
background: #ED9C00;
|
||||
border-radius: 4rpx;
|
||||
color: #FFFFFF;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.doctor_title{
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.viewcell .hospital{
|
||||
margin-top: 12rpx;
|
||||
color: #333333;
|
||||
word-break: keep-all;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.goodjob{
|
||||
color: #666666;
|
||||
margin-top: 28rpx;
|
||||
line-height: 42rpx;
|
||||
font-size: 28rpx;
|
||||
word-break: break-all;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2; /* 这里是超出几行省略 */
|
||||
overflow: hidden;
|
||||
}
|
||||
.price{
|
||||
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.price text{
|
||||
margin-left: 5rpx;
|
||||
font-size: 34rpx;
|
||||
color:#EF4F20;
|
||||
}
|
||||
.viewcell .right{
|
||||
flex:1;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
.viewcell image{
|
||||
width:80rpx;
|
||||
height:80rpx;
|
||||
border-radius:50%;
|
||||
}
|
||||
.namebox{
|
||||
display: flex;
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color:#333;
|
||||
align-items: flex-end;
|
||||
}
|
||||
.namebox .position{
|
||||
font-weight: normal;
|
||||
margin-left: 15rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.diseaseType{
|
||||
height: 40rpx;
|
||||
background: #E2FFFE;
|
||||
border-radius: 20rpx;
|
||||
margin-right: 20rpx;
|
||||
border: 1rpx solid #3CC7C0;
|
||||
color: #3CC7C0;
|
||||
font-size: 24rpx;
|
||||
display: inline-flex;
|
||||
text-align: center;
|
||||
padding:0 15rpx;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 20rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.detail{
|
||||
margin-top: 20rpx;
|
||||
display: flex;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.detail view{
|
||||
margin-right:40rpx;
|
||||
}
|
||||
|
||||
.detail view text{
|
||||
font-size: 28rpx;
|
||||
color:#3CC7C0;
|
||||
}
|
||||
.consultbox{
|
||||
height: 60rpx;
|
||||
margin-top: 28rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.consult{
|
||||
height: 60rpx;
|
||||
background: #3CC7C0;
|
||||
border-radius: 30rpx;
|
||||
color: #FFFFFF;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding:0 20rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.wraper{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.scrollwraper{
|
||||
flex: 1;
|
||||
overflow-y: scroll;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
Reference in New Issue
Block a user