111
This commit is contained in:
+241
-41
@@ -9,41 +9,64 @@
|
||||
@query="queryList"
|
||||
>
|
||||
<template #top>
|
||||
<navBar></navBar>
|
||||
<view class="detail">
|
||||
<view class="desc">检索到XX篇文章</view>
|
||||
<view class="desc">检索到X个视频</view>
|
||||
<view class="desc">检索词:陈煜</view>
|
||||
<navBar :searchWord="keyWord" :navName="navName"></navBar>
|
||||
<view class="databox" v-if="hospital_id || doctor_id">
|
||||
<view class="cell">
|
||||
<view class="num">{{ numInfo.article_collect_num }}</view>
|
||||
<view class="name">文章</view>
|
||||
</view>
|
||||
<view class="cell">
|
||||
<view class="num">{{ numInfo.video_collect_num }}</view>
|
||||
<view class="name">视频</view>
|
||||
</view>
|
||||
<view class="cell">
|
||||
<view class="num">{{ numInfo.video_read_num+numInfo.article_read_num }}</view>
|
||||
<view class="name">阅读量</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="detail" v-if="total>0 && !(hospital_id || doctor_id)">
|
||||
<view class="desc" v-if="isArticle">检索到:<text class="red">{{total}}篇文章</text></view>
|
||||
<view class="desc" v-else>检索到:<text class="red">{{total}}个视频</text></view>
|
||||
<view class="desc" v-if="keyWord">检索词:<text class="red">{{ keyWord }}</text></view>
|
||||
</view>
|
||||
<view class="filterbox">
|
||||
<u-dropdown class="u-dropdown">
|
||||
<view class="type" @click="swicthType">{{!isArticle?'文章':'视频'}}<up--image :src="switchImg" width="31rpx" height="31rpx"></up--image></view>
|
||||
<up-dropdown class="u-dropdown" ref="uDropdownRef">
|
||||
<up-dropdown-item
|
||||
v-model="value"
|
||||
title="温度"
|
||||
v-model="order.push_date"
|
||||
title="发布时间"
|
||||
@change="change"
|
||||
:options="options"
|
||||
></up-dropdown-item>
|
||||
</u-dropdown>
|
||||
<up-dropdown-item
|
||||
v-model="order.read_num"
|
||||
title="阅读量"
|
||||
@change="change"
|
||||
:options="options"
|
||||
></up-dropdown-item>
|
||||
</up-dropdown>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
<view class="item" v-for="(item, index) in dataList" :key="index">
|
||||
<view class="title ellipsis">{{ item.title }}</view>
|
||||
<view class="item" v-for="(item, index) in dataList" :key="index" @click="isArticle?goDetail(item.article_id):goDetail(item.video_id)">
|
||||
<view class="title ellipsis">{{isArticle?item.article_title:item.video_title }}</view>
|
||||
<view class="tagsbox">
|
||||
<view class="tag">陈煜</view>
|
||||
<view class="tag" v-for="tag in item.author" :key="tag.author_id">{{ tag.doctor_name }}</view>
|
||||
</view>
|
||||
<view class="deal">
|
||||
<view class="left">
|
||||
<view class="eyebox">
|
||||
<up-icon name="eye" color="#6B7280" size="28rpx"></up-icon>
|
||||
<view class="num">1</view>
|
||||
<view class="num">{{item.read_num }}</view>
|
||||
</view>
|
||||
<view class="collect">
|
||||
<up-icon name="heart" color="#6B7280" size="28rpx"></up-icon>
|
||||
<view class="num">1</view>
|
||||
<view class="num">{{item.collect_num }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="time">
|
||||
<up-icon name="clock" color="#6B7280" size="28rpx"></up-icon>
|
||||
<view class="num">1</view>
|
||||
<view class="num">{{formatdate(item.push_date) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -57,51 +80,225 @@ import navBar from "@/components/navBar/navBar.vue";
|
||||
import list from "@/uni_modules/z-paging/components/z-paging/z-paging";
|
||||
import api from "@/api/api";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import dayjs from "dayjs";
|
||||
import switchImg from "@/static/switch.png";
|
||||
const paging = ref(null);
|
||||
const uDropdownRef=ref(null);
|
||||
const dataList = ref([]);
|
||||
const total = ref(0);
|
||||
const value = ref("");
|
||||
const options = ref([
|
||||
const keyWord = ref("");
|
||||
const page=ref(1);
|
||||
const isArticle=ref(true);
|
||||
const hospital_id=ref('');
|
||||
const hospital_name=ref('');
|
||||
const doctor_id=ref('');
|
||||
const doctor_name=ref('');
|
||||
const numInfo=reactive({});
|
||||
const navName=ref('肝胆相照临床病例库')
|
||||
const options= ref([
|
||||
{
|
||||
label: "去冰",
|
||||
value: 1,
|
||||
label: "正序",
|
||||
value: 'asc',
|
||||
},
|
||||
{
|
||||
label: "加冰",
|
||||
value: 2,
|
||||
label: "倒序",
|
||||
value: 'desc',
|
||||
},
|
||||
]);
|
||||
|
||||
onLoad(() => {});
|
||||
const queryList = (pageNo, pageSize) => {
|
||||
const params = {
|
||||
pageNo: pageNo,
|
||||
pageSize: pageSize,
|
||||
type: 1,
|
||||
const order=reactive({
|
||||
read_num:'',
|
||||
push_date:''
|
||||
})
|
||||
|
||||
onLoad((options) => {
|
||||
if(options.keyWord){
|
||||
keyWord.value = options.keyWord;
|
||||
};
|
||||
// 此处请求仅为演示,请替换为自己项目中的请求
|
||||
api
|
||||
.queryList(params)
|
||||
.then((res) => {
|
||||
// console.log(res)
|
||||
// dataList.value=dataList.value.concat(res.data.list)
|
||||
// 将请求结果通过complete传给z-paging处理,同时也代表请求结束,这一行必须调用
|
||||
paging.value.complete(res.data.list);
|
||||
})
|
||||
.catch((res) => {
|
||||
// 如果请求失败写paging.value.complete(false);
|
||||
// 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
|
||||
// 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可
|
||||
paging.value.complete(false);
|
||||
});
|
||||
if(options.order=='new'){
|
||||
order.push_date='asc'
|
||||
};
|
||||
if(options.order=='read'){
|
||||
order.read_num='desc'
|
||||
};
|
||||
if(options.order=='video'){
|
||||
isArticle.value=false;
|
||||
}
|
||||
if(options.doctor_id){
|
||||
doctor_id.value=options.doctor_id;
|
||||
doctor_name.value=options.doctor_name
|
||||
navName.value= doctor_name.value+'临床病例库'
|
||||
getStaticDoctor(doctor_id.value)
|
||||
}
|
||||
if(options.hospital_id){
|
||||
hospital_id.value=options.hospital_id;
|
||||
hospital_name.value=options.hospital_name;
|
||||
navName.value= hospital_name.value+'临床病例库'
|
||||
getStaticDoctor(hospital_id.value)
|
||||
|
||||
}
|
||||
});
|
||||
const change=(e)=>{
|
||||
paging.value.reload();
|
||||
}
|
||||
const formatdate=(date)=>{
|
||||
return dayjs(date).format('YYYY-MM-DD')
|
||||
}
|
||||
const goDetail=(id)=>{
|
||||
console.log(11111)
|
||||
console.log(id)
|
||||
let type=isArticle.value?'article':'video'
|
||||
uni.navigateTo({
|
||||
url: `/pages/detail/detail?id=${id}&type=${type}`
|
||||
})
|
||||
}
|
||||
const swicthType=()=>{
|
||||
isArticle.value=!isArticle.value;
|
||||
dataList.value=[];
|
||||
order.read_num='';
|
||||
order.push_date='';
|
||||
paging.value.reload();
|
||||
}
|
||||
const searchArticle =(params) => {
|
||||
let searchForm={
|
||||
keyword: keyWord.value,
|
||||
doctor_id:doctor_id.value,
|
||||
hospital_id:hospital_id.value
|
||||
}
|
||||
if(!order.read_num){
|
||||
delete order.read_num
|
||||
}
|
||||
if(!order.push_date){
|
||||
delete order.push_date
|
||||
}
|
||||
if(order.read_num || order.push_date){
|
||||
searchForm.order=order
|
||||
}
|
||||
api.searchArticle({
|
||||
...searchForm,
|
||||
...params
|
||||
}).then((res)=>{
|
||||
paging.value.complete(res.data.data.data);
|
||||
total.value=res.data.data.total;
|
||||
}).catch(err=>{
|
||||
paging.value.complete(false);
|
||||
})
|
||||
}
|
||||
|
||||
const searchVideo = async(params) => {
|
||||
let searchForm={
|
||||
keyword: keyWord.value,
|
||||
}
|
||||
if(!order.read_num){
|
||||
delete order.read_num
|
||||
}
|
||||
if(!order.push_date){
|
||||
delete order.push_date
|
||||
}
|
||||
if(order.read_num || order.push_date){
|
||||
searchForm.order=order
|
||||
}
|
||||
api.searchVideo({
|
||||
...params
|
||||
}).then((res)=>{
|
||||
paging.value.complete(res.data.data.data);
|
||||
total.value=res.data.data.total;
|
||||
}).catch(err=>{
|
||||
paging.value.complete(false);
|
||||
})
|
||||
}
|
||||
const getStaticDoctor=(id)=>{
|
||||
api.getStaticDoctor(id).then((res)=>{
|
||||
let result=res.data.data;
|
||||
Object.assign(numInfo,result);
|
||||
})
|
||||
}
|
||||
const getStaticHospital=(id)=>{
|
||||
api.getStaticHospital(id).then((res)=>{
|
||||
let result=res.data.data;
|
||||
Object.assign(numInfo,result);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const queryList = (pageNo, pageSize) => {
|
||||
console.log(666666);
|
||||
const params = {
|
||||
page: pageNo,
|
||||
page_size: pageSize,
|
||||
};
|
||||
isArticle.value?searchArticle(params):searchVideo(params)
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.databox {
|
||||
height: 162rpx;
|
||||
background: #ffffff;
|
||||
display: flex;
|
||||
margin-bottom: 20rpx;
|
||||
// padding: 0 30rpx;
|
||||
justify-content: space-between;
|
||||
.cell {
|
||||
flex: 1;
|
||||
padding: 35rpx 0;
|
||||
|
||||
text-align: center;
|
||||
|
||||
.num {
|
||||
font-size: 38rpx;
|
||||
color: #3cc7c0;
|
||||
}
|
||||
.name {
|
||||
margin-top: 18rpx;
|
||||
font-size: 28rpx;
|
||||
color: #4b5563;
|
||||
}
|
||||
}
|
||||
}
|
||||
.filterbox{
|
||||
display: flex;
|
||||
height:128rpx;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
.type{
|
||||
position: absolute;
|
||||
left:30rpx;
|
||||
top:24rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: #F3F4F6;
|
||||
border-radius: 15rpx;
|
||||
height: 74rpx;
|
||||
padding:0 25rpx;
|
||||
z-index:2;
|
||||
}
|
||||
}
|
||||
.u-page {
|
||||
:deep(.u-flex) {
|
||||
display: flex;
|
||||
flex-direction:row;
|
||||
overflow: hidden;
|
||||
|
||||
}
|
||||
:deep(.u-dropdown__menu){
|
||||
|
||||
background: #fff;
|
||||
z-index:1;
|
||||
margin-left: 180rpx;
|
||||
|
||||
}
|
||||
:deep(.u-dropdown__menu__item){
|
||||
|
||||
height:74rpx;
|
||||
padding:0 20rpx;
|
||||
background: #F3F4F6;
|
||||
border-radius: 15rpx;
|
||||
flex:none;
|
||||
margin-left: 60rpx;
|
||||
|
||||
}
|
||||
.deal {
|
||||
margin-top: 20rpx;
|
||||
@@ -164,5 +361,8 @@ const queryList = (pageNo, pageSize) => {
|
||||
color: #4b5563;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
.red{
|
||||
color: #FF0000;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user