unimodules
This commit is contained in:
@@ -0,0 +1,285 @@
|
||||
<template>
|
||||
|
||||
<!-- 顶部导航栏 -->
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
title="消息"
|
||||
@clickLeft="goBack"
|
||||
fixed
|
||||
color="#8B2316"
|
||||
height="140rpx"
|
||||
:border="false"
|
||||
backgroundColor="#eeeeee"
|
||||
></uni-nav-bar>
|
||||
<view class="msg-page">
|
||||
|
||||
|
||||
<!-- 四宫格入口 -->
|
||||
<view class="shortcut-grid">
|
||||
<view class="grid-item" @click="goBenefit">
|
||||
<view class="icon-wrap gift">
|
||||
<uni-icons type="gift" size="34" color="#fff"></uni-icons>
|
||||
</view>
|
||||
<text class="label">福利</text>
|
||||
</view>
|
||||
<view class="grid-item" @click="goOrder">
|
||||
<view class="icon-wrap order">
|
||||
<uni-icons type="list" size="34" color="#fff"></uni-icons>
|
||||
</view>
|
||||
<text class="label">订单</text>
|
||||
</view>
|
||||
<view class="grid-item" @click="goFollow">
|
||||
<view class="icon-wrap visit">
|
||||
<uni-icons type="heart" size="34" color="#fff"></uni-icons>
|
||||
<view class="badge" v-if="followBadge > 0">{{ followBadge }}</view>
|
||||
</view>
|
||||
<text class="label">随访</text>
|
||||
</view>
|
||||
<view class="grid-item" @click="goReply">
|
||||
<view class="icon-wrap reply">
|
||||
<uni-icons type="chatbubble" size="34" color="#fff"></uni-icons>
|
||||
</view>
|
||||
<text class="label">回复我的</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 消息列表 -->
|
||||
<scroll-view
|
||||
class="msg-list"
|
||||
scroll-y="true"
|
||||
:show-scrollbar="false"
|
||||
refresher-enabled="true"
|
||||
:refresher-triggered="refreshing"
|
||||
@refresherrefresh="onRefresh"
|
||||
@scrolltolower="onLoadMore"
|
||||
lower-threshold="80"
|
||||
>
|
||||
<view class="group" v-for="(group, gIdx) in msgGroups" :key="gIdx">
|
||||
<view class="group-time">{{ group.time }}</view>
|
||||
<view class="card" v-for="(msg, idx) in group.items" :key="idx">
|
||||
<view class="card-title">系统消息</view>
|
||||
<view class="card-content">{{ msg }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 加载更多提示 -->
|
||||
<view v-if="loading" class="loading-more">
|
||||
<text class="loading-text">加载中...</text>
|
||||
</view>
|
||||
<!-- 没有更多数据提示 -->
|
||||
<view v-if="noMore" class="no-more">
|
||||
<text class="no-more-text">没有更多数据了</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
const followBadge = ref(5);
|
||||
|
||||
const msgGroups = ref([
|
||||
{
|
||||
time: '2022-04-22 16:32:54',
|
||||
items: ['恭喜您,您的肝胆积分又增加了,快去查看吧']
|
||||
},
|
||||
{
|
||||
time: '2022-04-20 13:33:23',
|
||||
items: ['恭喜您,您的肝胆积分又增加了,快去查看吧']
|
||||
},
|
||||
{
|
||||
time: '2022-04-15 13:36:23',
|
||||
items: ['恭喜您,您的肝胆积分又增加了,快去查看吧']
|
||||
}
|
||||
]);
|
||||
|
||||
// 刷新/加载状态
|
||||
const refreshing = ref(false);
|
||||
const loading = ref(false);
|
||||
const noMore = ref(false);
|
||||
const page = ref(1);
|
||||
const pageSize = ref(10);
|
||||
|
||||
// 模拟更多数据(请在接入接口后替换)
|
||||
const mockMore = [
|
||||
{ time: '2022-04-10 09:20:11', items: ['系统保养完成,服务更稳定~'] },
|
||||
{ time: '2022-04-05 18:06:42', items: ['积分到账提醒,请注意查收。'] },
|
||||
{ time: '2022-03-30 08:15:00', items: ['本周学术会议日程已发布。'] },
|
||||
{ time: '2022-03-25 10:05:16', items: ['您有新的随访任务待处理。'] }
|
||||
];
|
||||
|
||||
const goBack = () => {
|
||||
uni.navigateBack({
|
||||
fail() {
|
||||
uni.redirectTo({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const goBenefit = () => uni.showToast({ title: '福利', icon: 'none' });
|
||||
const goOrder = () => uni.showToast({ title: '订单', icon: 'none' });
|
||||
const goFollow = () => uni.showToast({ title: '随访', icon: 'none' });
|
||||
const goReply = () => uni.showToast({ title: '回复我的', icon: 'none' });
|
||||
|
||||
// 下拉刷新
|
||||
const onRefresh = async () => {
|
||||
if (refreshing.value) return;
|
||||
refreshing.value = true;
|
||||
try {
|
||||
await new Promise(r => setTimeout(r, 800));
|
||||
page.value = 1;
|
||||
noMore.value = false;
|
||||
msgGroups.value.unshift({
|
||||
time: new Date().toISOString().slice(0, 19).replace('T', ' '),
|
||||
items: ['您有一条新的系统通知,欢迎查看。']
|
||||
});
|
||||
} finally {
|
||||
refreshing.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 上拉加载
|
||||
const onLoadMore = async () => {
|
||||
if (loading.value || noMore.value) return;
|
||||
loading.value = true;
|
||||
try {
|
||||
await new Promise(r => setTimeout(r, 800));
|
||||
const start = (page.value - 1) * 2;
|
||||
const chunk = mockMore.slice(start, start + 2);
|
||||
if (chunk.length === 0) {
|
||||
noMore.value = true;
|
||||
} else {
|
||||
msgGroups.value.push(...chunk);
|
||||
page.value += 1;
|
||||
}
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$bg: #f5f6f7;
|
||||
$text-primary: #333;
|
||||
$text-secondary: #666;
|
||||
$muted: #999;
|
||||
$divider: #eeeeee;
|
||||
$theme: #8B2316;
|
||||
$nav-h: 140rpx; // 与 uni-nav-bar 保持一致
|
||||
$grid-h: 200rpx; // 四宫格区域高度
|
||||
|
||||
@mixin flex-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.msg-page {
|
||||
min-height: 100vh;
|
||||
background: $bg;
|
||||
padding-top: $nav-h; // 与导航栏高度一致
|
||||
}
|
||||
|
||||
.shortcut-grid {
|
||||
position: fixed;
|
||||
top: $nav-h;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 9;
|
||||
height: $grid-h;
|
||||
background: #fff;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
padding: 30rpx 20rpx 10rpx;
|
||||
column-gap: 10rpx;
|
||||
row-gap: 10rpx;
|
||||
border-bottom: 1rpx solid $divider;
|
||||
|
||||
.grid-item {
|
||||
@include flex-center;
|
||||
flex-direction: column;
|
||||
gap: 12rpx;
|
||||
|
||||
.icon-wrap {
|
||||
position: relative;
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
border-radius: 20rpx;
|
||||
@include flex-center;
|
||||
&.gift { background: linear-gradient(180deg, #ff6680, #ff4d6a); }
|
||||
&.order { background: linear-gradient(180deg, #ffcc66, #ffb300); }
|
||||
&.visit { background: linear-gradient(180deg, #4dd0e1, #2ec4b6); }
|
||||
&.reply { background: linear-gradient(180deg, #6edc82, #2ecc71); }
|
||||
|
||||
.badge {
|
||||
position: absolute;
|
||||
right: -6rpx;
|
||||
top: -6rpx;
|
||||
min-width: 32rpx;
|
||||
height: 32rpx;
|
||||
border-radius: 50rpx;
|
||||
background: #ff3b30;
|
||||
color: #fff;
|
||||
font-size: 22rpx;
|
||||
@include flex-center;
|
||||
padding: 0 6rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 26rpx;
|
||||
color: $text-secondary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.msg-list {
|
||||
position: fixed;
|
||||
// 减去导航与宫格的高度
|
||||
top: 360rpx; // 让列表起始位置在宫格下方
|
||||
padding: 20rpx 24rpx 40rpx;
|
||||
box-sizing: border-box;
|
||||
bottom: 0rpx;
|
||||
// 加载状态样式
|
||||
.loading-more, .no-more {
|
||||
@include flex-center;
|
||||
padding: 28rpx 0;
|
||||
.loading-text, .no-more-text {
|
||||
font-size: 26rpx;
|
||||
color: $muted;
|
||||
}
|
||||
}
|
||||
|
||||
.group {
|
||||
.group-time {
|
||||
text-align: center;
|
||||
color: $muted;
|
||||
font-size: 24rpx;
|
||||
margin: 26rpx 0 16rpx;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 26rpx;
|
||||
box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
|
||||
margin-bottom: 26rpx;
|
||||
|
||||
.card-title {
|
||||
font-size: 30rpx;
|
||||
color: $text-primary;
|
||||
font-weight: 600;
|
||||
margin-bottom: 14rpx;
|
||||
}
|
||||
|
||||
.card-content {
|
||||
font-size: 28rpx;
|
||||
color: $text-secondary;
|
||||
line-height: 1.6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,465 @@
|
||||
<template>
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
title="我的福利"
|
||||
@clickLeft="goBack"
|
||||
fixed
|
||||
color="#8B2316"
|
||||
height="140rpx"
|
||||
:border="false"
|
||||
backgroundColor="#eeeeee"
|
||||
></uni-nav-bar>
|
||||
|
||||
<view class="benefits-page">
|
||||
|
||||
|
||||
<!-- 头部导航栏 -->
|
||||
|
||||
<!-- 分段控制器 -->
|
||||
<view class="segmented-control">
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ active: activeTab === 0 }"
|
||||
@click="switchTab(0)"
|
||||
>
|
||||
<text class="tab-text">领取福利</text>
|
||||
</view>
|
||||
<view class="divider"></view>
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ active: activeTab === 1 }"
|
||||
@click="switchTab(1)"
|
||||
>
|
||||
<text class="tab-text">使用福利</text>
|
||||
</view>
|
||||
<view class="divider"></view>
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ active: activeTab === 2 }"
|
||||
@click="switchTab(2)"
|
||||
>
|
||||
<text class="tab-text">兑福利卡</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 福利卡片列表 -->
|
||||
<view class="scrollbox">
|
||||
<scroll-view class="benefits-list" scroll-y="true" :show-scrollbar="false">
|
||||
<view
|
||||
class="benefit-card"
|
||||
v-for="(benefit, index) in benefitsList"
|
||||
:key="index"
|
||||
:class="benefit.type"
|
||||
@click="claimBenefit(benefit)"
|
||||
>
|
||||
<view class="card-bg">
|
||||
<view class="human-figure">👥</view>
|
||||
</view>
|
||||
<view class="card-content">
|
||||
<view class="card-title">{{ benefit.title }}</view>
|
||||
<view class="card-details">
|
||||
<view class="left-section">
|
||||
<text class="condition">{{ benefit.condition }}</text>
|
||||
<text class="requirement">{{ benefit.requirement }}</text>
|
||||
</view>
|
||||
<view class="right-section">
|
||||
<text class="reward-type">{{ benefit.rewardType }}</text>
|
||||
<text class="reward-value">{{ benefit.rewardValue }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 底部导航栏 -->
|
||||
<view class="bottom-nav">
|
||||
<view class="nav-item" @click="goPointsDetail">
|
||||
<view class="nav-icon">📋</view>
|
||||
<text class="nav-text">积分详情</text>
|
||||
</view>
|
||||
<view class="nav-item" @click="goBenefitDetail">
|
||||
<view class="nav-icon">🎁</view>
|
||||
<text class="nav-text">福利详情</text>
|
||||
</view>
|
||||
<view class="nav-item" @click="addPatient">
|
||||
<view class="nav-icon">👤+</view>
|
||||
<text class="nav-text">添加患者</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
// 当前选中的标签页
|
||||
const activeTab = ref(0);
|
||||
|
||||
// 福利列表数据
|
||||
const benefitsList = ref([
|
||||
{
|
||||
type: 'points',
|
||||
title: '肝胆积分 (5个新随访)',
|
||||
condition: '赠送积分',
|
||||
requirement: '200积分',
|
||||
rewardType: '立即领取',
|
||||
rewardValue: ''
|
||||
},
|
||||
{
|
||||
type: 'video',
|
||||
title: '肝胆视频',
|
||||
condition: '再新增随访',
|
||||
requirement: '1个',
|
||||
rewardType: '赠送下载',
|
||||
rewardValue: '2集'
|
||||
},
|
||||
{
|
||||
type: 'courseware',
|
||||
title: '肝胆课件',
|
||||
condition: '再新增随访',
|
||||
requirement: '6个',
|
||||
rewardType: '赠送下载',
|
||||
rewardValue: '1篇'
|
||||
},
|
||||
{
|
||||
type: 'usb',
|
||||
title: '知识U盘',
|
||||
condition: '再新增随访 (年度计算)',
|
||||
requirement: '96个',
|
||||
rewardType: '赠送U盘',
|
||||
rewardValue: '1个'
|
||||
}
|
||||
]);
|
||||
|
||||
// 方法
|
||||
const goBack = () => {
|
||||
uni.navigateBack({
|
||||
fail() {
|
||||
uni.redirectTo({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const showRules = () => {
|
||||
uni.showToast({
|
||||
title: '福利规则',
|
||||
icon: 'none'
|
||||
});
|
||||
};
|
||||
|
||||
const switchTab = (index) => {
|
||||
activeTab.value = index;
|
||||
// 这里可以根据标签页切换加载不同的数据
|
||||
uni.showToast({
|
||||
title: `切换到${['领取福利', '使用福利', '兑福利卡'][index]}`,
|
||||
icon: 'none'
|
||||
});
|
||||
};
|
||||
|
||||
const claimBenefit = (benefit) => {
|
||||
uni.showToast({
|
||||
title: `领取${benefit.title}`,
|
||||
icon: 'none'
|
||||
});
|
||||
};
|
||||
|
||||
const goPointsDetail = () => {
|
||||
uni.showToast({
|
||||
title: '积分详情',
|
||||
icon: 'none'
|
||||
});
|
||||
};
|
||||
|
||||
const goBenefitDetail = () => {
|
||||
uni.showToast({
|
||||
title: '福利详情',
|
||||
icon: 'none'
|
||||
});
|
||||
};
|
||||
|
||||
const addPatient = () => {
|
||||
uni.showToast({
|
||||
title: '添加患者',
|
||||
icon: 'none'
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 变量定义
|
||||
$bg-color: #f5f6f7;
|
||||
$text-primary: #333333;
|
||||
$text-secondary: #666666;
|
||||
$text-light: #999999;
|
||||
$border-color: #e5e5e5;
|
||||
$white: #ffffff;
|
||||
$theme-color: #e74c3c;
|
||||
$divider-color: #cccccc;
|
||||
$nav-height: 140rpx; // 导航栏高度
|
||||
$segmented-height: 80rpx; // 分段控制器高度
|
||||
$bottom-nav-height: 120rpx; // 底部导航高度
|
||||
|
||||
// 混合器
|
||||
@mixin flex-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
@mixin flex-between {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
@mixin shadow {
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.benefits-page {
|
||||
min-height: 100vh;
|
||||
background-color: $bg-color;
|
||||
padding-top: $nav-height; // 为固定导航栏预留空间
|
||||
}
|
||||
|
||||
.status-bar {
|
||||
height: 44rpx;
|
||||
background-color: $white;
|
||||
@include flex-between;
|
||||
padding: 0 30rpx;
|
||||
font-size: 24rpx;
|
||||
color: $text-primary;
|
||||
|
||||
.status-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
|
||||
.time {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.butterfly {
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.status-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
|
||||
.network-info,
|
||||
.signal,
|
||||
.wifi,
|
||||
.battery {
|
||||
font-size: 22rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.header {
|
||||
height: 88rpx;
|
||||
background-color: $white;
|
||||
@include flex-between;
|
||||
padding: 0 30rpx;
|
||||
border-bottom: 1rpx solid $border-color;
|
||||
|
||||
.header-left {
|
||||
.back-btn {
|
||||
font-size: 48rpx;
|
||||
color: $theme-color;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.header-center {
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
color: $text-primary;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.header-right {
|
||||
.rules-btn {
|
||||
font-size: 28rpx;
|
||||
color: $text-primary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.segmented-control {
|
||||
position: fixed;
|
||||
top: $nav-height;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
height: 80rpx;
|
||||
background-color: $white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 30rpx;
|
||||
border-bottom: 1rpx solid $border-color;
|
||||
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
@include flex-center;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
|
||||
.tab-text {
|
||||
font-size: 28rpx;
|
||||
color: $text-secondary;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
&.active {
|
||||
.tab-text {
|
||||
color: $theme-color;
|
||||
font-weight: 600;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.divider {
|
||||
width: 2rpx;
|
||||
height: 40rpx;
|
||||
background-color: $divider-color;
|
||||
}
|
||||
}
|
||||
.scrollbox{
|
||||
position: fixed;
|
||||
top: calc(#{$nav-height} + #{$segmented-height});
|
||||
left: 30rpx;
|
||||
right: 30rpx;
|
||||
box-sizing: border-box;
|
||||
bottom: $bottom-nav-height;
|
||||
margin: 30rpx 0 ;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.benefits-list {
|
||||
|
||||
|
||||
.benefit-card {
|
||||
background: $white;
|
||||
border-radius: 20rpx;
|
||||
padding: 30rpx;
|
||||
margin-bottom: 30rpx;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
@include shadow;
|
||||
|
||||
&.points {
|
||||
background: linear-gradient(135deg, #ff6b6b, #ee5a52);
|
||||
}
|
||||
|
||||
&.video {
|
||||
background: linear-gradient(135deg, #ffa726, #ff9800);
|
||||
}
|
||||
|
||||
&.courseware {
|
||||
background: linear-gradient(135deg, #ab47bc, #8e24aa);
|
||||
}
|
||||
|
||||
&.usb {
|
||||
background: linear-gradient(135deg, #26a69a, #00897b);
|
||||
}
|
||||
|
||||
.card-bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
opacity: 0.1;
|
||||
|
||||
.human-figure {
|
||||
font-size: 120rpx;
|
||||
color: $white;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
|
||||
.card-content {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
|
||||
.card-title {
|
||||
font-size: 32rpx;
|
||||
color: $white;
|
||||
font-weight: 600;
|
||||
margin-bottom: 30rpx;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.card-details {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
|
||||
.left-section,
|
||||
.right-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
|
||||
.condition,
|
||||
.reward-type {
|
||||
font-size: 24rpx;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
|
||||
.requirement,
|
||||
.reward-value {
|
||||
font-size: 36rpx;
|
||||
color: $white;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.right-section {
|
||||
align-items: flex-end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bottom-nav {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
height: 120rpx;
|
||||
background-color: #00cbc0;
|
||||
border-top: 1rpx solid $border-color;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
padding: 0 20rpx;
|
||||
|
||||
.nav-item {
|
||||
@include flex-center;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
|
||||
.nav-icon {
|
||||
font-size: 40rpx;
|
||||
}
|
||||
|
||||
.nav-text {
|
||||
font-size: 24rpx;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,637 @@
|
||||
<template>
|
||||
<!-- 头部导航栏 -->
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
title="肝胆课件"
|
||||
@clickLeft="goBack"
|
||||
fixed
|
||||
color="#8B2316"
|
||||
height="140rpx"
|
||||
:border="false"
|
||||
backgroundColor="#eeeeee"
|
||||
></uni-nav-bar>
|
||||
|
||||
<view class="courseware-container">
|
||||
|
||||
<!-- 排序和筛选栏 -->
|
||||
<view class="filter-bar">
|
||||
<view class="filter-item" @click="toggleSort">
|
||||
<text class="filter-text">最新</text>
|
||||
<view class="newbox">
|
||||
<up-image :src="upImg" width="20rpx" height="26rpx" ></up-image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="divider"></view>
|
||||
<view class="filter-item" @click="showFilterPopup">
|
||||
<text class="filter-text">筛选</text>
|
||||
<view class="filterbox">
|
||||
<up-image :src="isFilterActive ? filterOn : filter" width="30rpx" height="30rpx" ></up-image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 课件列表 -->
|
||||
<scroll-view class="courseware-list" scroll-y="true"
|
||||
refresher-enabled="true"
|
||||
:refresher-triggered="refreshing"
|
||||
@refresherrefresh="onRefresh"
|
||||
@scrolltolower="onLoadMore"
|
||||
:show-scrollbar="false">
|
||||
<view
|
||||
class="courseware-item"
|
||||
v-for="(item, index) in coursewareList"
|
||||
:key="index"
|
||||
@click="viewCourseware(item)"
|
||||
>
|
||||
<view class="item-left">
|
||||
<view class="pdf-icon">📄</view>
|
||||
</view>
|
||||
<view class="item-content">
|
||||
<view class="item-title">{{ item.title }}</view>
|
||||
<view class="item-author">{{ item.author }}</view>
|
||||
<view class="item-stats">
|
||||
<view class="views">
|
||||
<uni-icons type="eye" size="30rpx" color="#999"></uni-icons>
|
||||
<text class="view-count">{{ item.views }}人阅读</text>
|
||||
</view>
|
||||
|
||||
<view class="price">
|
||||
<up-image :src="downLoadImg" width="32rpx" height="32rpx" ></up-image>
|
||||
<text class="price-value">{{ item.price }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 筛选弹窗 -->
|
||||
<view class="filter-popup" v-if="showFilter" @click="hideFilterPopup">
|
||||
<view class="filter-content" @click.stop>
|
||||
<!-- 筛选标签网格 -->
|
||||
<view class="filter-tags">
|
||||
<view
|
||||
class="tag-item"
|
||||
v-for="(tag, index) in filterTags"
|
||||
:key="index"
|
||||
:class="{ active: tag.selected }"
|
||||
@click="toggleTag(index)"
|
||||
>
|
||||
{{ tag.name }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<view class="filter-buttons">
|
||||
<view class="btn-reset" @click="resetFilter">重置</view>
|
||||
<view class="btn-confirm" @click="confirmFilter">确定</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 投稿按钮 -->
|
||||
<view class="submit-btn" @click="submitCourseware">
|
||||
<up-image :src="tougaoImg" width="152rpx" height="80rpx" ></up-image>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { onShow } from "@dcloudio/uni-app";
|
||||
import filter from "@/static/cb_screen_no.png"
|
||||
import filterOn from "@/static/cb_screen_yes.png"
|
||||
import upImg from "@/static/cb_up.png"
|
||||
import downImg from "@/static/cb_up.png"
|
||||
import tougaoImg from "@/static/kejiantougao.png"
|
||||
import downLoadImg from "@/static/wdxz.png"
|
||||
const isFilterActive=ref(false)
|
||||
// 响应式数据
|
||||
const refreshing = ref(false);
|
||||
const loading = ref(false);
|
||||
const noMore = ref(false);
|
||||
const page = ref(1);
|
||||
const pageSize = ref(10);
|
||||
|
||||
// 响应式数据
|
||||
const coursewareList = ref([
|
||||
{
|
||||
title: "颜学兵: 广东省基孔肯雅热诊疗指引",
|
||||
author: "颜学兵 徐州医科大学附属医院",
|
||||
views: 179,
|
||||
price: "10.0"
|
||||
},
|
||||
{
|
||||
title: "颜学兵: 佛山市基孔肯雅热中医诊治推荐用方",
|
||||
author: "颜学兵 徐州医科大学附属医院",
|
||||
views: 122,
|
||||
price: "10.0"
|
||||
},
|
||||
{
|
||||
title: "抗菌药物的临床应用",
|
||||
author: "肝胆相照官方账号 北京肝胆相照公益基金会",
|
||||
views: 656,
|
||||
price: "15.0"
|
||||
},
|
||||
{
|
||||
title: "中国肝癌多学科综合治疗专家共识 (2025)",
|
||||
author: "肝胆相照官方账号 北京肝胆相照公益基金会",
|
||||
views: 208,
|
||||
price: "15.0"
|
||||
},
|
||||
{
|
||||
title: "耐药结核病全口服短程治疗专家共识 (2025)",
|
||||
author: "肝胆相照官方账号 北京肝胆相照公益基金会",
|
||||
views: 256,
|
||||
price: "15.0"
|
||||
},
|
||||
{
|
||||
title: "结核分枝杆菌合并乙型肝炎病毒治专家共识",
|
||||
author: "肝胆相照官方账号 北京肝胆相照公益基金会",
|
||||
views: 358,
|
||||
price: "15.0"
|
||||
}
|
||||
]);
|
||||
|
||||
// 方法
|
||||
const goBack = () => {
|
||||
uni.navigateBack({
|
||||
fail(){
|
||||
uni.redirectTo({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const showSearch = () => {
|
||||
uni.showToast({
|
||||
title: '搜索功能',
|
||||
icon: 'none'
|
||||
});
|
||||
};
|
||||
|
||||
const toggleSort = () => {
|
||||
uni.showToast({
|
||||
title: '排序功能',
|
||||
icon: 'none'
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
const viewCourseware = (item) => {
|
||||
uni.showToast({
|
||||
title: `查看课件: ${item.title}`,
|
||||
icon: 'none'
|
||||
});
|
||||
};
|
||||
|
||||
const submitCourseware = () => {
|
||||
uni.showToast({
|
||||
title: '课件投稿功能',
|
||||
icon: 'none'
|
||||
});
|
||||
};
|
||||
// 模拟API数据
|
||||
const mockApiData = [
|
||||
{
|
||||
id: 7,
|
||||
title: "肝胆疾病影像学诊断指南",
|
||||
author: "影像科专家团队 北京协和医院",
|
||||
views: 445,
|
||||
price: "20.0"
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
title: "肝硬化并发症治疗新进展",
|
||||
author: "消化内科专家 上海交通大学医学院",
|
||||
views: 332,
|
||||
price: "18.0"
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
title: "肝胆外科手术技巧精要",
|
||||
author: "外科专家 中山大学附属第一医院",
|
||||
views: 567,
|
||||
price: "25.0"
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
title: "肝胆疾病护理规范",
|
||||
author: "护理专家团队 中国护理学会",
|
||||
views: 289,
|
||||
price: "12.0"
|
||||
}
|
||||
];
|
||||
|
||||
// 下拉刷新
|
||||
const onRefresh = async () => {
|
||||
refreshing.value = true;
|
||||
|
||||
try {
|
||||
// 模拟API调用延迟
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
|
||||
// 重置数据
|
||||
page.value = 1;
|
||||
noMore.value = false;
|
||||
|
||||
// 重新加载第一页数据
|
||||
await loadData(true);
|
||||
|
||||
uni.showToast({
|
||||
title: '刷新成功',
|
||||
icon: 'success'
|
||||
});
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
title: '刷新失败',
|
||||
icon: 'error'
|
||||
});
|
||||
} finally {
|
||||
refreshing.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 上拉加载更多
|
||||
const onLoadMore = async () => {
|
||||
console.log('加载更多')
|
||||
if (loading.value || noMore.value) return;
|
||||
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
// 模拟API调用延迟
|
||||
await new Promise(resolve => setTimeout(resolve, 800));
|
||||
|
||||
// 加载下一页数据
|
||||
await loadData(false);
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
title: '加载失败',
|
||||
icon: 'error'
|
||||
});
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 加载数据
|
||||
const loadData = async (isRefresh = false) => {
|
||||
// 模拟API分页逻辑
|
||||
const startIndex = (page.value - 1) * pageSize.value;
|
||||
const endIndex = startIndex + pageSize.value;
|
||||
const newData = mockApiData.slice(startIndex, endIndex);
|
||||
|
||||
if (isRefresh) {
|
||||
// 刷新时替换所有数据
|
||||
coursewareList.value = coursewareList.value.slice(0, 6); // 保留原有6条数据
|
||||
} else {
|
||||
// 加载更多时追加数据
|
||||
if (newData.length > 0) {
|
||||
coursewareList.value.push(...newData);
|
||||
page.value++;
|
||||
} else {
|
||||
noMore.value = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
const showFilter = ref(false)
|
||||
|
||||
// 筛选弹窗相关数据
|
||||
const filterTags = ref([
|
||||
{ name: '指南解读', selected: false },
|
||||
{ name: '病例分析', selected: false },
|
||||
{ name: '学术讲座', selected: false },
|
||||
{ name: '手术视频', selected: false },
|
||||
{ name: '研究进展', selected: false },
|
||||
{ name: '肝病治疗', selected: false },
|
||||
{ name: '肝癌诊断', selected: false },
|
||||
{ name: '肝移植', selected: false },
|
||||
{ name: '微创手术', selected: false },
|
||||
{ name: '免疫治疗', selected: false },
|
||||
{ name: '靶向治疗', selected: false },
|
||||
{ name: '化疗方案', selected: false }
|
||||
]);
|
||||
|
||||
// 筛选弹窗相关方法
|
||||
const showFilterPopup = () => {
|
||||
showFilter.value = true;
|
||||
};
|
||||
|
||||
const hideFilterPopup = () => {
|
||||
showFilter.value = false;
|
||||
};
|
||||
|
||||
const toggleTag = (index) => {
|
||||
filterTags.value[index].selected = !filterTags.value[index].selected;
|
||||
isFilterActive.value = filterTags.value.some(tag => tag.selected);
|
||||
};
|
||||
|
||||
const resetFilter = () => {
|
||||
filterTags.value.forEach(tag => tag.selected = false);
|
||||
isFilterActive.value = false;
|
||||
};
|
||||
|
||||
const confirmFilter = () => {
|
||||
const selectedTags = filterTags.value.filter(tag => tag.selected);
|
||||
console.log('选中的筛选标签:', selectedTags);
|
||||
hideFilterPopup();
|
||||
// 这里可以根据选中的标签进行数据筛选
|
||||
};
|
||||
onShow(() => {
|
||||
// 页面显示时的逻辑
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
// 变量定义
|
||||
$primary-color: #e74c3c;
|
||||
$text-primary: #333333;
|
||||
$text-secondary: #666666;
|
||||
$text-light: #999999;
|
||||
$border-color: #e5e5e5;
|
||||
$background-color: #f8f9fa;
|
||||
$white: #ffffff;
|
||||
$submit-btn-color: #20b2aa;
|
||||
$theme-color: #8B2316;
|
||||
$white: #fff;
|
||||
// 混合器
|
||||
@mixin flex-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
@mixin flex-between {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
@mixin shadow {
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.courseware-container {
|
||||
height: calc(100vh - 140rpx);
|
||||
background-color: $background-color;
|
||||
}
|
||||
|
||||
.status-bar {
|
||||
height: 44rpx;
|
||||
background-color: $white;
|
||||
@include flex-between;
|
||||
padding: 0 30rpx;
|
||||
font-size: 24rpx;
|
||||
color: $text-primary;
|
||||
|
||||
.status-left {
|
||||
.time {
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.status-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
|
||||
.network-info,
|
||||
.signal,
|
||||
.wifi,
|
||||
.battery {
|
||||
font-size: 22rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.header {
|
||||
height: 88rpx;
|
||||
background-color: $white;
|
||||
@include flex-between;
|
||||
padding: 0 30rpx;
|
||||
border-bottom: 1rpx solid $border-color;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.filter-bar {
|
||||
height: 100rpx;
|
||||
background-color: $white;
|
||||
@include flex-center;
|
||||
gap: 100rpx;
|
||||
border-bottom: 1rpx solid $border-color;
|
||||
position: sticky;
|
||||
top: 140rpx;
|
||||
z-index: 99;
|
||||
.divider{
|
||||
width: 2rpx;
|
||||
height: 30rpx;
|
||||
background-color: #999;
|
||||
}
|
||||
.filter-item{
|
||||
display:flex;
|
||||
.filterbox{
|
||||
margin-top: 5rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.courseware-list {
|
||||
position: fixed;
|
||||
top:240rpx;
|
||||
flex: 1;
|
||||
bottom:0;
|
||||
width:100%;
|
||||
padding-top: 20rpx;
|
||||
margin: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
width:auto;
|
||||
.courseware-item {
|
||||
background-color: $white;
|
||||
border-radius: 16rpx;
|
||||
padding: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
@include shadow;
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
|
||||
.item-left {
|
||||
.pdf-icon {
|
||||
font-size: 60rpx;
|
||||
color: $primary-color;
|
||||
}
|
||||
}
|
||||
|
||||
.item-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16rpx;
|
||||
|
||||
.item-title {
|
||||
font-size: 32rpx;
|
||||
color: $text-primary;
|
||||
font-weight: 500;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.item-author {
|
||||
font-size: 28rpx;
|
||||
color: $text-secondary;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.item-stats {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
|
||||
.views {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
|
||||
.eye-icon {
|
||||
font-size: 24rpx;
|
||||
color: $text-light;
|
||||
}
|
||||
|
||||
.view-count {
|
||||
font-size: 26rpx;
|
||||
color: $text-light;
|
||||
}
|
||||
}
|
||||
|
||||
.download {
|
||||
.download-icon {
|
||||
font-size: 32rpx;
|
||||
color: $text-light;
|
||||
}
|
||||
}
|
||||
|
||||
.price {
|
||||
display: flex;
|
||||
margin-left: 30rpx;
|
||||
align-items: baseline;
|
||||
gap: 4rpx;
|
||||
|
||||
.price-symbol {
|
||||
font-size: 24rpx;
|
||||
color: $primary-color;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.price-value {
|
||||
font-size: 32rpx;
|
||||
color: $primary-color;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
position: fixed;
|
||||
right: 0rpx;
|
||||
bottom: 100rpx;
|
||||
|
||||
width: 152rpx;
|
||||
height: 80rpx;
|
||||
z-index: 100;
|
||||
|
||||
.submit-icon {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.submit-text {
|
||||
font-size: 28rpx;
|
||||
color: $white;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
// 筛选弹窗样式
|
||||
.filter-popup {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
// background-color: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
z-index: 9999;
|
||||
|
||||
.filter-content {
|
||||
margin-top:245rpx;
|
||||
|
||||
background-color: $white;
|
||||
// border-radius: 20rpx 20rpx 0 0;
|
||||
padding: 20rpx 30rpx 60rpx;
|
||||
width: 100%;
|
||||
max-height: 80vh;
|
||||
|
||||
.filter-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20rpx;
|
||||
margin-bottom: 60rpx;
|
||||
max-height: 65vh;
|
||||
overflow-y: auto;
|
||||
|
||||
.tag-item {
|
||||
background-color: #f8f8f8;
|
||||
color: #666;
|
||||
padding: 8rpx 24rpx;
|
||||
border-radius: 30rpx;
|
||||
font-size: 26rpx;
|
||||
border: 2rpx solid #efefef;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&.active {
|
||||
background-color: #fff;
|
||||
color: $theme-color;
|
||||
border-color: $theme-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.filter-buttons {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
position: fixed;
|
||||
bottom: 30rpx;
|
||||
left: 30rpx;
|
||||
right: 30rpx;
|
||||
|
||||
.btn-reset,
|
||||
.btn-confirm {
|
||||
flex: 1;
|
||||
height: 70rpx;
|
||||
border-radius: 14rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.btn-reset {
|
||||
background-color: $white;
|
||||
color: $theme-color;
|
||||
border: 2rpx solid $theme-color;
|
||||
}
|
||||
|
||||
.btn-confirm {
|
||||
border: 2rpx solid $theme-color;
|
||||
background-color: $theme-color;
|
||||
color: $white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -314,12 +314,12 @@
|
||||
|
||||
uni.hideLoading();
|
||||
|
||||
if (result.data.code === 200) {
|
||||
if (result.data.code == 1) {
|
||||
// 保存用户信息到本地存储
|
||||
if (result.data.data && result.data.data.token) {
|
||||
uni.setStorageSync('AUTH_TOKEN_App', result.data.data.token);
|
||||
if (result.data.data.userInfo) {
|
||||
uni.setStorageSync('USER_INFO', result.data.data.userInfo);
|
||||
if (result.data.data) {
|
||||
uni.setStorageSync('USER_INFO', result.data.data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user