337 lines
7.3 KiB
Vue
337 lines
7.3 KiB
Vue
<template>
|
||
<view class="u-page">
|
||
<z-paging
|
||
ref="paging"
|
||
inside-more
|
||
loading-more-no-more-text="咱也是有底线的!"
|
||
:auto-show-back-to-top="true"
|
||
v-model="dataList"
|
||
@query="queryList"
|
||
>
|
||
<template #top>
|
||
<navBarSearch :searchWord="keyWord" :navName="navName" @changeWord="changeWord"></navBarSearch>
|
||
<view class="detail" v-if="isSearch">
|
||
<view class="desc" >检索到:<text class="red">{{total}}篇</text></view>
|
||
|
||
<view class="desc" v-if="keyWord">检索词:<text class="red">{{ keyWord }}</text></view>
|
||
</view>
|
||
<view class="filterbox">
|
||
<!-- <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="type1"
|
||
:title="type1==0?'收藏':'浏览'"
|
||
@change="changetype1"
|
||
:options="options"
|
||
></up-dropdown-item>
|
||
<up-dropdown-item
|
||
v-model="type2"
|
||
:title="title2"
|
||
@change="changetype2"
|
||
:options="options1"
|
||
></up-dropdown-item>
|
||
</up-dropdown>
|
||
|
||
</view>
|
||
</template>
|
||
<view class="item" v-for="(item, index) in dataList" @click="goDetail(item.data.id)" :key="item.collect_id">
|
||
<view class="title ellipsis-two-lines">{{item.data.title}}</view>
|
||
<view class="tagsbox">
|
||
<view class="tag" v-for="tag in item.data.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">{{item.data.read_num }}</view>
|
||
</view>
|
||
<view class="collect">
|
||
<up-icon name="heart" color="#6B7280" size="28rpx"></up-icon>
|
||
<view class="num">{{item.data.collect_num }}</view>
|
||
</view>
|
||
</view>
|
||
<view class="time">
|
||
<up-icon name="clock" color="#6B7280" size="28rpx"></up-icon>
|
||
<view class="num">{{formatdate(item.data.push_date) }}</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</z-paging>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref, reactive } from "vue";
|
||
import navBarSearch from "@/components/navBarSearch/navBarSearch.vue";
|
||
import list from "@/uni_modules/z-paging/components/z-paging/z-paging";
|
||
import api from "@/api/api";
|
||
import { onLoad,onShow} from "@dcloudio/uni-app";
|
||
import dayjs from "dayjs";
|
||
import switchImg from "@/static/switch.png";
|
||
import navTo from "@/utils/navTo.js";
|
||
const paging = ref(null);
|
||
const uDropdownRef=ref(null);
|
||
const dataList = ref([]);
|
||
const total = ref(0);
|
||
const value = ref("");
|
||
const keyWord = ref("");
|
||
const isArticle=ref(true);
|
||
const isSearch=ref(false);
|
||
const navName=ref('肝胆相照临床病例库');
|
||
const type1=ref(0);
|
||
const type2=ref(1);
|
||
const title2=ref('文章病例库');
|
||
const options= ref([
|
||
{
|
||
label: "收藏",
|
||
value: 0,
|
||
},
|
||
{
|
||
label: "浏览",
|
||
value:1,
|
||
},
|
||
]);
|
||
const options1= ref([
|
||
{
|
||
label: "文章病例库",
|
||
value: 1,
|
||
},
|
||
{
|
||
label: "视频病例库",
|
||
value:2,
|
||
},
|
||
{
|
||
label: "病例交流",
|
||
value:3,
|
||
},
|
||
]);
|
||
|
||
const order=reactive({
|
||
read_num:'',
|
||
push_date:''
|
||
})
|
||
|
||
onLoad((options) => {
|
||
if(options.keyWord){
|
||
keyWord.value = options.keyWord;
|
||
};
|
||
});
|
||
onShow(()=>{
|
||
paging.value?.refresh();
|
||
})
|
||
const changetype1=(e)=>{
|
||
type1.value=e;
|
||
paging.value.reload();
|
||
}
|
||
const changetype2=(e)=>{
|
||
type2.value=e;
|
||
title2.value=options1.value[e-1].label;
|
||
paging.value.reload();
|
||
}
|
||
const formatdate=(date)=>{
|
||
return dayjs(date).format('YYYY-MM-DD')
|
||
}
|
||
const goDetail=(id)=>{
|
||
console.log(type1.value)
|
||
console.log(id)
|
||
let type="article";
|
||
if(type2.value==1){
|
||
type="article";
|
||
}else if(type2.value==2){
|
||
type="video";
|
||
}else if(type2.value==3){
|
||
type="exchange";
|
||
}
|
||
navTo({
|
||
url: `/pages/detail/detail?id=${id}&type=${type}`
|
||
})
|
||
}
|
||
const changeWord=(val)=>{
|
||
isSearch.value=true;
|
||
keyWord.value=val;
|
||
paging.value.reload();
|
||
}
|
||
const searchCollect=(params) => {
|
||
let searchForm={
|
||
keyword: keyWord.value,
|
||
type:type2.value,
|
||
}
|
||
api.getMyCollect({
|
||
...searchForm,
|
||
...params
|
||
}).then((res)=>{
|
||
paging.value.complete(res.data.data.data);
|
||
total.value=res.data.data.total;
|
||
}).catch(err=>{
|
||
paging.value.complete(false);
|
||
})
|
||
}
|
||
|
||
const searchRead = async(params) => {
|
||
let searchForm={
|
||
keyword: keyWord.value,
|
||
type:type2.value,
|
||
}
|
||
|
||
api.getMyRead({
|
||
...searchForm,
|
||
...params
|
||
}).then((res)=>{
|
||
paging.value.complete(res.data.data.data);
|
||
total.value=res.data.data.total;
|
||
}).catch(err=>{
|
||
paging.value.complete(false);
|
||
})
|
||
}
|
||
|
||
|
||
const queryList = (pageNo, pageSize) => {
|
||
const params = {
|
||
page: pageNo,
|
||
page_size: pageSize,
|
||
};
|
||
type1.value==1?searchRead(params):searchCollect(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{
|
||
background-color: #fff;
|
||
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:0rpx;
|
||
|
||
}
|
||
:deep(.u-dropdown__menu__item){
|
||
|
||
height:74rpx;
|
||
padding:0 20rpx;
|
||
background: #F3F4F6;
|
||
border-radius: 15rpx;
|
||
flex:none;
|
||
margin-left: 30rpx;
|
||
|
||
}
|
||
:deep(.u-dropdown__menu__item__text){
|
||
font-size: 14px!important;
|
||
color:#3CC7C0!important;
|
||
}
|
||
.deal {
|
||
margin-top: 20rpx;
|
||
display: flex;
|
||
color: #6b7280;
|
||
font-size: 24rpx;
|
||
justify-content: space-between;
|
||
.left {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
.collect {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
.eyebox {
|
||
width: 160rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
.time {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
.num {
|
||
margin-left: 8rpx;
|
||
}
|
||
}
|
||
.item {
|
||
background-color: #fff;
|
||
border-bottom: 1rpx solid #f3f4f6;
|
||
padding: 30rpx;
|
||
.title {
|
||
font-size: 30rpx;
|
||
color: #111827;
|
||
line-height: 46rpx;
|
||
}
|
||
}
|
||
.tagsbox {
|
||
margin-top: 20rpx;
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
.tag {
|
||
padding: 0 10rpx;
|
||
margin-right: 16rpx;
|
||
height: 46rpx;
|
||
line-height: 46rpx;
|
||
text-align: center;
|
||
background: rgba(60, 199, 192, 0.1);
|
||
border-radius: 8rpx;
|
||
font-weight: 400;
|
||
font-size: 24rpx;
|
||
color: #3cc7c0;
|
||
}
|
||
}
|
||
}
|
||
.detail {
|
||
background: #f9f9f9;
|
||
padding: 12rpx 30rpx;
|
||
.desc {
|
||
font-size: 26rpx;
|
||
color: #4b5563;
|
||
line-height: 40rpx;
|
||
}
|
||
.red{
|
||
color: #FF0000;
|
||
}
|
||
}
|
||
</style> |