我的页面
This commit is contained in:
parent
c9dcab1e36
commit
1f4c0834fa
51
api/api.js
51
api/api.js
@ -87,12 +87,59 @@ const api = {
|
||||
getVideoDetail(data) {
|
||||
return request('/video/detail', data, 'get', true);
|
||||
},
|
||||
|
||||
getVideoHistory(data) {
|
||||
return request('/expertAPI/VideoWatchRecord', data, 'post', false);
|
||||
},
|
||||
deleteRecord(data) {
|
||||
return request('/expertAPI/deleteRecord', data, 'post', false);
|
||||
},
|
||||
|
||||
getCollectList(data) {
|
||||
return request('/expertAPI/collectList', data, 'post', false);
|
||||
},
|
||||
|
||||
getCollectionList(data) {
|
||||
return request('/expertAPI/collectionList', data, 'post', false);
|
||||
},
|
||||
//我的账户
|
||||
getMyAccount(data) {
|
||||
return request('/expertPay/getBalanceU', data, 'post', false);
|
||||
},
|
||||
|
||||
// 订单列表
|
||||
getOrderList(data) {
|
||||
return request('/expertPay/orderList', data, 'post', false);
|
||||
},
|
||||
|
||||
// 我的积分
|
||||
myBonusPoints(data) {
|
||||
return request('/expertAPI/myBonusPoints', data, 'post', false);
|
||||
},
|
||||
// 新闻详情
|
||||
getNewsDetail(data) {
|
||||
return request('/expertAPI/newsDetail', data, 'post', false);
|
||||
},
|
||||
|
||||
// 积分支付列表
|
||||
bonusPointsPayList(data) {
|
||||
return request('/expertAPI/bonusPointsPayList', data, 'post', false);
|
||||
},
|
||||
// 积分列表
|
||||
bonusPointsList(data) {
|
||||
return request('/expertAPI/bonusPointsList', data, 'post', false);
|
||||
},
|
||||
|
||||
getWelfarePage(data) {
|
||||
return request('/expertAPI/getWelfarePage', data, 'post', false);
|
||||
},
|
||||
|
||||
useWelfarePage(data) {
|
||||
return request('/expertAPI/useWelfarePage', data, 'post', false);
|
||||
},
|
||||
|
||||
getFlowerList(data) {
|
||||
return request('/expertPay/getFlowerList', data, 'post', false);
|
||||
},
|
||||
|
||||
// 课件详情
|
||||
getGandanFileDetail(data) {
|
||||
return request('/expertAPI/gandanFileDetail', data, 'post', false);
|
||||
|
||||
82
pages.json
82
pages.json
@ -421,6 +421,26 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "myAccount/myAccount",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "我的账户",
|
||||
"app": {
|
||||
"bounce": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "myAccount/billDetails",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "账单明细",
|
||||
"app": {
|
||||
"bounce": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "myCourseware/myCourseware",
|
||||
"style": {
|
||||
@ -523,7 +543,7 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "videoHistroy/videoHistroy",
|
||||
"path": "videoHistory/videoHistory",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "uni-app分页",
|
||||
@ -541,6 +561,66 @@
|
||||
"bounce": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "myCollect/video",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "uni-app分页",
|
||||
"app": {
|
||||
"bounce": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "myCollect/english",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "uni-app分页",
|
||||
"app": {
|
||||
"bounce": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "myCollect/file",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "uni-app分页",
|
||||
"app": {
|
||||
"bounce": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "myCollect/news",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "uni-app分页",
|
||||
"app": {
|
||||
"bounce": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "myCollect/huanjiao",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "uni-app分页",
|
||||
"app": {
|
||||
"bounce": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "myPoint/myPoint",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "积分",
|
||||
"app": {
|
||||
"bounce": "none"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
39
pages_app/myAccount/README.md
Normal file
39
pages_app/myAccount/README.md
Normal file
@ -0,0 +1,39 @@
|
||||
# 我的账户页面
|
||||
|
||||
## 页面描述
|
||||
这是一个100%还原的"我的账户"页面,包含以下功能:
|
||||
|
||||
### 主要功能
|
||||
1. **状态栏显示** - 显示时间、网络状态、电池等信息
|
||||
2. **头部导航** - 包含返回按钮和页面标题
|
||||
3. **账户余额展示** - 显示用户头像和账户余额
|
||||
4. **操作选项** - 提现和账单明细功能
|
||||
|
||||
### 页面结构
|
||||
- `status-bar` - 状态栏区域
|
||||
- `header` - 头部导航区域
|
||||
- `account-summary` - 账户余额展示区域
|
||||
- `action-items` - 操作选项列表
|
||||
- `bottom-indicator` - 底部指示器
|
||||
|
||||
### 样式特点
|
||||
- 使用深红色/棕色渐变背景 (#8B2316 到 #A0522D)
|
||||
- 圆形头像设计
|
||||
- 白色操作卡片
|
||||
- 响应式交互效果
|
||||
|
||||
### 使用方法
|
||||
1. 在 `pages.json` 中已配置路由
|
||||
2. 从其他页面通过 `uni.navigateTo` 跳转
|
||||
3. 支持返回上一页功能
|
||||
|
||||
### 技术实现
|
||||
- 使用 Vue 3 Composition API
|
||||
- SCSS 样式预处理器
|
||||
- uni-app 框架
|
||||
- 响应式设计
|
||||
|
||||
### 注意事项
|
||||
- 头像图片路径:`/static/new_man_big.png`
|
||||
- 页面标题:我的账户
|
||||
- 导航样式:自定义导航栏
|
||||
278
pages_app/myAccount/billDetails.vue
Normal file
278
pages_app/myAccount/billDetails.vue
Normal file
@ -0,0 +1,278 @@
|
||||
<template>
|
||||
<view class="bill-details-page">
|
||||
<!-- 顶部导航栏 -->
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
title="账单明细"
|
||||
@clickLeft="goBack"
|
||||
fixed
|
||||
color="#8B2316"
|
||||
height="140rpx"
|
||||
:border="false"
|
||||
backgroundColor="#eeeeee"
|
||||
></uni-nav-bar>
|
||||
|
||||
<!-- 表格头部 -->
|
||||
<view class="table-header">
|
||||
<view class="header-cell business-type">业务类型</view>
|
||||
<view class="header-cell user">用户</view>
|
||||
<view class="header-cell date-amount">
|
||||
<text class="date-label">日期</text>
|
||||
<text class="amount-label">金额</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 交易记录列表 -->
|
||||
<scroll-view
|
||||
class="transaction-list"
|
||||
scroll-y
|
||||
refresher-enabled
|
||||
@refresherrefresh="onRefresh"
|
||||
:refresher-triggered="refreshing"
|
||||
@scrolltolower="onLoadMore"
|
||||
:lower-threshold="100"
|
||||
>
|
||||
<view class="transaction-item" v-for="(item, index) in orderList" :key="item.id">
|
||||
<view class="cell business-type">{{ item.typeName }}</view>
|
||||
<view class="cell user">{{ item.userName }}</view>
|
||||
<view class="cell date-amount">
|
||||
<text class="date">{{ formatDate(item.createTime) }}</text>
|
||||
<text class="amount" :class="item.accountStr < 0 ? 'negative' : 'positive'">{{ item.accountStr }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多提示 -->
|
||||
<view v-if="loading" class="loading-more">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 空数据状态 -->
|
||||
<view v-if="!loading && orderList.length === 0" class="empty-state">
|
||||
<text>暂无交易记录</text>
|
||||
</view>
|
||||
|
||||
<!-- 没有更多数据提示 -->
|
||||
<view v-if="isLastPage && orderList.length > 0" class="no-more">
|
||||
<text>没有更多数据了</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import api from '@/api/api.js'
|
||||
|
||||
// 响应式数据
|
||||
const orderList = ref([])
|
||||
const loading = ref(false)
|
||||
const refreshing = ref(false)
|
||||
const page = ref(1)
|
||||
const total = ref(0)
|
||||
const isFirstPage = ref(true)
|
||||
const isLastPage = ref(false)
|
||||
|
||||
// 获取订单列表
|
||||
const getOrderList = async (isRefresh = false) => {
|
||||
if (loading.value) return
|
||||
|
||||
loading.value = true
|
||||
|
||||
try {
|
||||
const res = await api.getOrderList({
|
||||
page: page.value,
|
||||
})
|
||||
|
||||
console.log('订单列表:', res)
|
||||
|
||||
if (res && res.code === 200 && res.data) {
|
||||
const { list, total: totalCount, isFirstPage: firstPage, isLastPage: lastPage } = res.data
|
||||
|
||||
if (isRefresh) {
|
||||
orderList.value = []
|
||||
}
|
||||
|
||||
// 处理订单数据
|
||||
const processedList = list.map(item => ({
|
||||
id: item.trade_no,
|
||||
typeName: item.type_name,
|
||||
userName: item.user_name,
|
||||
createTime: item.create_time,
|
||||
accountStr: item.accountstr,
|
||||
payChannel: item.pay_channel,
|
||||
orderType: item.order_type,
|
||||
status: item.status
|
||||
}))
|
||||
|
||||
orderList.value.push(...processedList)
|
||||
total.value = totalCount
|
||||
isFirstPage.value = firstPage
|
||||
isLastPage.value = lastPage
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取订单列表失败:', error)
|
||||
uni.showToast({
|
||||
title: '获取数据失败',
|
||||
icon: 'none'
|
||||
})
|
||||
} finally {
|
||||
loading.value = false
|
||||
refreshing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新数据
|
||||
const onRefresh = () => {
|
||||
refreshing.value = true
|
||||
page.value = 1
|
||||
isLastPage.value = false
|
||||
getOrderList(true)
|
||||
}
|
||||
|
||||
// 加载更多
|
||||
const onLoadMore = () => {
|
||||
if (loading.value || isLastPage.value) return
|
||||
|
||||
page.value++
|
||||
getOrderList()
|
||||
}
|
||||
|
||||
// 格式化日期
|
||||
const formatDate = (dateStr) => {
|
||||
if (!dateStr) return ''
|
||||
const date = new Date(dateStr)
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
||||
|
||||
// 返回上一页
|
||||
const goBack = () => {
|
||||
uni.navigateBack()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getOrderList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.bill-details-page {
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 加载状态和空数据状态样式
|
||||
.loading-more, .no-more, .empty-state {
|
||||
text-align: center;
|
||||
padding: 30rpx;
|
||||
color: #999999;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
padding: 100rpx 30rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 表格头部样式
|
||||
.table-header {
|
||||
background-color: #e0e0e0;
|
||||
display: flex;
|
||||
padding: 20rpx 30rpx;
|
||||
margin-top: 170rpx; /* 为固定导航栏留出空间 */
|
||||
border-bottom: 1rpx solid #ccc;
|
||||
|
||||
.header-cell {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
|
||||
&.business-type {
|
||||
flex: 1;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
&.user {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&.date-amount {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
|
||||
.date-label {
|
||||
font-size: 24rpx;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.amount-label {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 交易记录列表样式
|
||||
.transaction-list {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.transaction-item {
|
||||
background-color: #f8f8f8;
|
||||
display: flex;
|
||||
padding: 20rpx 30rpx;
|
||||
border-bottom: 1rpx solid #e5e5e5;
|
||||
|
||||
.cell {
|
||||
font-size: 26rpx;
|
||||
|
||||
&.business-type {
|
||||
flex: 1;
|
||||
text-align: left;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
&.user {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
color: #ff0000;
|
||||
}
|
||||
|
||||
&.date-amount {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
|
||||
.date {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.amount {
|
||||
font-size: 24rpx;
|
||||
|
||||
&.positive {
|
||||
color: #ff0000;
|
||||
}
|
||||
|
||||
&.negative {
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
284
pages_app/myAccount/myAccount.vue
Normal file
284
pages_app/myAccount/myAccount.vue
Normal file
@ -0,0 +1,284 @@
|
||||
<template>
|
||||
<view class="my-account-page">
|
||||
<!-- 顶部导航栏 -->
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
title="我的账户"
|
||||
@clickLeft="goBack"
|
||||
fixed
|
||||
color="#8B2316"
|
||||
height="140rpx"
|
||||
:border="false"
|
||||
backgroundColor="#eeeeee"
|
||||
></uni-nav-bar>
|
||||
|
||||
<!-- 账户余额区域 -->
|
||||
<view class="account-summary">
|
||||
<view class="profile-section">
|
||||
<image class="profile-avatar" :src="avatar" mode="aspectFill"></image>
|
||||
</view>
|
||||
<text class="balance-label">账户余额(元)</text>
|
||||
<text class="balance-amount">{{ (accountBalance/100).toFixed(2) }}</text>
|
||||
|
||||
<!-- 账户信息详情 -->
|
||||
<view class="account-details">
|
||||
<view class="detail-item">
|
||||
<text class="detail-label">单次提现限额</text>
|
||||
<text class="detail-value">{{ (withdrawalBalanceMaxOnce/100).toFixed(2) }}元</text>
|
||||
</view>
|
||||
<view class="detail-item">
|
||||
<text class="detail-label">提现手续费</text>
|
||||
<text class="detail-value">{{ (withdrawalBalanceFee/100).toFixed(2) }}元</text>
|
||||
</view>
|
||||
<view class="detail-item">
|
||||
<text class="detail-label">最低提现金额</text>
|
||||
<text class="detail-value">{{ (lessWithdrawalBalance/100).toFixed(2) }}元</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 操作选项 -->
|
||||
<view class="action-items">
|
||||
<view class="action-item" @click="handleWithdrawal">
|
||||
<view class="action-icon withdrawal-icon">
|
||||
<text class="icon-text">💰</text>
|
||||
</view>
|
||||
<view class="action-content">
|
||||
<text class="action-title">提现</text>
|
||||
<text class="action-subtitle">提现金额不得少于{{ (lessWithdrawalBalance/100).toFixed(2) }}元</text>
|
||||
</view>
|
||||
<text class="action-arrow">></text>
|
||||
</view>
|
||||
|
||||
<view class="action-item" @click="handleBillDetails">
|
||||
<view class="action-icon bill-icon">
|
||||
<text class="icon-text">📋</text>
|
||||
</view>
|
||||
<view class="action-content">
|
||||
<text class="action-title">账单明细</text>
|
||||
</view>
|
||||
<text class="action-arrow">></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部指示器 -->
|
||||
<view class="bottom-indicator"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import api from '@/api/api.js'
|
||||
import docUrl from '@/utils/docUrl'
|
||||
// 响应式数据
|
||||
const accountBalance = ref(0)
|
||||
const withdrawalBalanceMaxOnce = ref(0)
|
||||
const withdrawalBalanceFee = ref(0)
|
||||
const lessWithdrawalBalance = ref(0)
|
||||
const avatar = ref('')
|
||||
|
||||
onMounted(() => {
|
||||
getMyAccount()
|
||||
|
||||
let userInfo= uni.getStorageSync('userInfo')
|
||||
avatar.value = docUrl+userInfo.photo
|
||||
})
|
||||
|
||||
// 方法
|
||||
const goBack = () => {
|
||||
uni.navigateBack()
|
||||
}
|
||||
|
||||
const handleWithdrawal = () => {
|
||||
uni.showToast({
|
||||
title: '提现功能开发中',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
const handleBillDetails = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages_app/myAccount/billDetails'
|
||||
})
|
||||
}
|
||||
|
||||
const getMyAccount = async () => {
|
||||
const res = await api.getMyAccount({})
|
||||
console.log(res)
|
||||
if (res && res.code === 200 && res.data) {
|
||||
accountBalance.value = res.data.balance
|
||||
withdrawalBalanceMaxOnce.value = res.data.withdrawalBalanceMaxOnce
|
||||
withdrawalBalanceFee.value = res.data.withdrawalBalanceFee
|
||||
lessWithdrawalBalance.value = res.data.lessWithdrawalBalance
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.my-account-page {
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
// 账户余额区域样式
|
||||
.account-summary {
|
||||
background: linear-gradient(135deg, #8B2316, #A0522D);
|
||||
margin: 30rpx;
|
||||
border-radius: 20rpx;
|
||||
padding: 60rpx 40rpx;
|
||||
text-align: center;
|
||||
box-shadow: 0 8rpx 24rpx rgba(139, 35, 22, 0.3);
|
||||
position: relative;
|
||||
|
||||
.profile-section {
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
.profile-avatar {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 60rpx;
|
||||
border: 4rpx solid rgba(255, 255, 255, 0.3);
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
.balance-label {
|
||||
display: block;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 20rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.balance-amount {
|
||||
display: block;
|
||||
color: #ffffff;
|
||||
font-size: 72rpx;
|
||||
font-weight: bold;
|
||||
text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2);
|
||||
letter-spacing: 2rpx;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
// 账户信息详情样式
|
||||
.account-details {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 16rpx;
|
||||
padding: 30rpx;
|
||||
margin-top: 20rpx;
|
||||
|
||||
.detail-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.detail-label {
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.detail-value {
|
||||
color: #ffffff;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 操作选项样式
|
||||
.action-items {
|
||||
background-color: #ffffff;
|
||||
margin: 0 30rpx;
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
|
||||
|
||||
.action-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 40rpx 30rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
transition: background-color 0.2s ease;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
.action-icon {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 30rpx;
|
||||
background-color: #f8f8f8;
|
||||
|
||||
.icon-text {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.withdrawal-icon {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.bill-icon {
|
||||
background-color: #fff8e1;
|
||||
}
|
||||
|
||||
.action-content {
|
||||
flex: 1;
|
||||
|
||||
.action-title {
|
||||
display: block;
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.action-subtitle {
|
||||
display: block;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
line-height: 1.4;
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
|
||||
.action-arrow {
|
||||
font-size: 32rpx;
|
||||
color: #ccc;
|
||||
font-weight: bold;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 底部指示器
|
||||
.bottom-indicator {
|
||||
position: fixed;
|
||||
bottom: 20rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 120rpx;
|
||||
height: 6rpx;
|
||||
background-color: #e0e0e0;
|
||||
border-radius: 3rpx;
|
||||
opacity: 0.6;
|
||||
}
|
||||
</style>
|
||||
381
pages_app/myCollect/english.vue
Normal file
381
pages_app/myCollect/english.vue
Normal file
@ -0,0 +1,381 @@
|
||||
<template>
|
||||
<view class="english-journal-page">
|
||||
<!-- 顶部导航栏 -->
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
:title="isEditMode ? '选择期刊' : '英文期刊'"
|
||||
@clickLeft="goBack"
|
||||
fixed
|
||||
color="#8B2316"
|
||||
height="140rpx"
|
||||
:border="false"
|
||||
backgroundColor="#eeeeee"
|
||||
>
|
||||
<template v-slot:right>
|
||||
<text class="edit-btn" @click="onEdit">{{ isEditMode ? '取消' : '编辑' }}</text>
|
||||
</template>
|
||||
</uni-nav-bar>
|
||||
|
||||
<!-- 期刊列表 -->
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="journal-list"
|
||||
refresher-enabled
|
||||
@refresherrefresh="onRefresh"
|
||||
:refresher-triggered="refreshing"
|
||||
@scrolltolower="onLoadMore"
|
||||
:lower-threshold="100"
|
||||
>
|
||||
<view class="journal-item" v-for="(item, index) in journalList" :key="item.id" @click="onItemClick(item)">
|
||||
<!-- 选择框 -->
|
||||
<view v-if="isEditMode" class="checkbox-wrapper" @click.stop="toggleSelect(item)">
|
||||
<view class="checkbox" :class="{ 'checked': selectedItems.includes(item.id) }">
|
||||
<text v-if="selectedItems.includes(item.id)" class="check-icon">✓</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="content">
|
||||
<view class="title">{{ item.title }}</view>
|
||||
<view class="subtitle">{{ item.subtitle }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多提示 -->
|
||||
<view v-if="loading" class="loading-more">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 空数据状态 -->
|
||||
<view v-if="!loading && journalList.length === 0" class="empty-state">
|
||||
<text>暂无英文期刊</text>
|
||||
</view>
|
||||
|
||||
<!-- 没有更多数据提示 -->
|
||||
<view v-if="noMore && journalList.length > 0" class="no-more">
|
||||
<text>没有更多数据了</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 底部操作栏 -->
|
||||
<view v-if="isEditMode" class="bottom-action-bar">
|
||||
<view class="action-left">
|
||||
<text class="select-all-btn" @click="toggleSelectAll">全选</text>
|
||||
</view>
|
||||
<view class="action-right">
|
||||
<text class="delete-btn" @click="deleteSelected" :class="{ 'disabled': selectedItems.length === 0 }">删除</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import api from '@/api/api.js';
|
||||
const refreshing = ref(false);
|
||||
const loading = ref(false);
|
||||
const noMore = ref(false);
|
||||
const page = ref(1);
|
||||
const pageSize = ref(10);
|
||||
const isEditMode = ref(false);
|
||||
const selectedItems = ref([]);
|
||||
|
||||
// 期刊数据列表
|
||||
const journalList = ref([]);
|
||||
|
||||
const goBack = () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
|
||||
const onEdit = () => {
|
||||
if (isEditMode.value) {
|
||||
// 退出编辑模式
|
||||
isEditMode.value = false;
|
||||
selectedItems.value = [];
|
||||
} else {
|
||||
// 进入编辑模式
|
||||
isEditMode.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
const onItemClick = (item) => {
|
||||
// 编辑模式下不跳转
|
||||
if (isEditMode.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 跳转到期刊详情页面
|
||||
uni.navigateTo({
|
||||
url: `/pages_app/qikan?id=${item.id}&title=${encodeURIComponent(item.title)}&subtitle=${encodeURIComponent(item.subtitle)}&path=${encodeURIComponent(item.path)}&libraryUuid=${encodeURIComponent(item.libraryUuid)}`
|
||||
});
|
||||
};
|
||||
|
||||
// 切换选择状态
|
||||
const toggleSelect = (item) => {
|
||||
const index = selectedItems.value.indexOf(item.id);
|
||||
if (index > -1) {
|
||||
selectedItems.value.splice(index, 1);
|
||||
} else {
|
||||
selectedItems.value.push(item.id);
|
||||
}
|
||||
};
|
||||
|
||||
// 全选/取消全选
|
||||
const toggleSelectAll = () => {
|
||||
if (selectedItems.value.length === journalList.value.length) {
|
||||
// 取消全选
|
||||
selectedItems.value = [];
|
||||
} else {
|
||||
// 全选
|
||||
selectedItems.value = journalList.value.map(item => item.id);
|
||||
}
|
||||
};
|
||||
|
||||
// 删除选中的期刊
|
||||
const deleteSelected = () => {
|
||||
if (selectedItems.value.length === 0) {
|
||||
uni.showToast({ title: '请选择要删除的期刊', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showModal({
|
||||
title: '确认删除',
|
||||
content: `确定要删除选中的 ${selectedItems.value.length} 个期刊吗?`,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// 调用删除API
|
||||
api.deleteCollect({
|
||||
uuid: selectedItems.value.join(',')
|
||||
}).then(res => {
|
||||
if (res.code === 200) {
|
||||
// 从本地列表中移除
|
||||
journalList.value = journalList.value.filter(item => !selectedItems.value.includes(item.id));
|
||||
selectedItems.value = [];
|
||||
isEditMode.value = false;
|
||||
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.message || '删除失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error('删除失败:', err);
|
||||
uni.showToast({
|
||||
title: '删除失败,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 获取期刊列表
|
||||
const getJournalList = () => {
|
||||
api.getCollectList({
|
||||
page: page.value,
|
||||
pageSize: pageSize.value,
|
||||
type: 3
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.code === 200 && res.data) {
|
||||
const { list, totalRow, totalPage, pageNumber } = res.data;
|
||||
|
||||
// 如果是第一页,清空列表
|
||||
if (page.value === 1) {
|
||||
journalList.value = [];
|
||||
}
|
||||
|
||||
// 处理期刊数据
|
||||
const processedList = list.map(item => ({
|
||||
id: item.uuid,
|
||||
title: item.title || '未知标题',
|
||||
subtitle: item.secondTitle || '未知副标题',
|
||||
libraryUuid: item.libraryUuid,
|
||||
path: item.path,
|
||||
createDate: item.createDate,
|
||||
isCollect: item.isCollect,
|
||||
status: item.status
|
||||
}));
|
||||
|
||||
// 添加到列表
|
||||
journalList.value.push(...processedList);
|
||||
|
||||
// 更新分页状态
|
||||
noMore.value = pageNumber >= totalPage;
|
||||
|
||||
// 如果是第一页且有数据,显示总数
|
||||
if (page.value === 1 && totalRow > 0) {
|
||||
uni.showToast({
|
||||
title: `共找到 ${totalRow} 条记录`,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.message || '获取数据失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error('获取期刊列表失败:', err);
|
||||
uni.showToast({
|
||||
title: '网络错误,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
refreshing.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
const onRefresh = () => {
|
||||
refreshing.value = true;
|
||||
page.value = 1;
|
||||
noMore.value = false;
|
||||
|
||||
// 调用API刷新数据
|
||||
getJournalList();
|
||||
};
|
||||
|
||||
const onLoadMore = () => {
|
||||
if (loading.value || noMore.value) return;
|
||||
|
||||
loading.value = true;
|
||||
page.value++;
|
||||
|
||||
// 调用API加载更多数据
|
||||
getJournalList();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getJournalList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.english-journal-page {
|
||||
min-height: 100vh;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.journal-list {
|
||||
height: calc(100vh - 140rpx);
|
||||
position: fixed;
|
||||
top: 140rpx;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
padding-bottom: 100rpx; /* 为底部操作栏留出空间 */
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
color: #8B2316;
|
||||
font-size: 28rpx;
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.journal-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
background: #ffffff;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
.checkbox-wrapper {
|
||||
margin-right: 20rpx;
|
||||
|
||||
.checkbox {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border: 2rpx solid #ddd;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #fff;
|
||||
|
||||
&.checked {
|
||||
background: #8B2316;
|
||||
border-color: #8B2316;
|
||||
}
|
||||
|
||||
.check-icon {
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.loading-more, .no-more, .empty-state {
|
||||
text-align: center;
|
||||
padding: 30rpx;
|
||||
color: #999999;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
padding: 100rpx 30rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.bottom-action-bar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 100rpx;
|
||||
background: #fff;
|
||||
border-top: 1rpx solid #eee;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 30rpx;
|
||||
z-index: 100;
|
||||
|
||||
.action-left {
|
||||
.select-all-btn {
|
||||
color: #333;
|
||||
font-size: 28rpx;
|
||||
padding: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.action-right {
|
||||
.delete-btn {
|
||||
color: #ff4757;
|
||||
font-size: 28rpx;
|
||||
padding: 20rpx;
|
||||
|
||||
&.disabled {
|
||||
color: #ccc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
214
pages_app/myCollect/file.vue
Normal file
214
pages_app/myCollect/file.vue
Normal file
@ -0,0 +1,214 @@
|
||||
<template>
|
||||
<view class="courseware-page">
|
||||
<!-- 顶部导航栏 -->
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
title="课件文档"
|
||||
@clickLeft="goBack"
|
||||
fixed
|
||||
color="#8B2316"
|
||||
height="140rpx"
|
||||
:border="false"
|
||||
backgroundColor="#eeeeee"
|
||||
>
|
||||
</uni-nav-bar>
|
||||
|
||||
<!-- 文档列表 -->
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="document-list"
|
||||
refresher-enabled
|
||||
@refresherrefresh="onRefresh"
|
||||
:refresher-triggered="refreshing"
|
||||
@scrolltolower="onLoadMore"
|
||||
:lower-threshold="100"
|
||||
>
|
||||
<view class="document-item" v-for="(item, index) in documentList" :key="item.id" @click="onItemClick(item)">
|
||||
<view class="content">
|
||||
<view class="title">{{ item.title }}</view>
|
||||
<view class="subtitle">{{ item.subtitle }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多提示 -->
|
||||
<view v-if="loading" class="loading-more">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 空数据状态 -->
|
||||
<view v-if="!loading && documentList.length === 0" class="empty-state">
|
||||
<text>暂无课件文档</text>
|
||||
</view>
|
||||
|
||||
<!-- 没有更多数据提示 -->
|
||||
<view v-if="noMore && documentList.length > 0" class="no-more">
|
||||
<text>没有更多数据了</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import api from '@/api/api.js';
|
||||
|
||||
const refreshing = ref(false);
|
||||
const loading = ref(false);
|
||||
const noMore = ref(false);
|
||||
const page = ref(1);
|
||||
const pageSize = ref(10);
|
||||
|
||||
// 文档数据列表
|
||||
const documentList = ref([]);
|
||||
|
||||
const goBack = () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
|
||||
const onItemClick = (item) => {
|
||||
// 跳转到文档详情页面
|
||||
uni.navigateTo({
|
||||
url: `/pages_app/myCourseware?id=${item.id}&title=${encodeURIComponent(item.title)}&subtitle=${encodeURIComponent(item.subtitle)}&path=${encodeURIComponent(item.path)}&userUuid=${encodeURIComponent(item.userUuid)}`
|
||||
});
|
||||
};
|
||||
|
||||
// 获取文档列表
|
||||
const getDocumentList = () => {
|
||||
api.getCollectionList({
|
||||
page: page.value,
|
||||
type: 6,
|
||||
title: ""
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.code === 200 && res.data) {
|
||||
const { list, totalRow, totalPage, pageNumber } = res.data;
|
||||
|
||||
// 如果是第一页,清空列表
|
||||
if (page.value === 1) {
|
||||
documentList.value = [];
|
||||
}
|
||||
|
||||
// 处理文档数据
|
||||
const processedList = list.map(item => ({
|
||||
id: item.other_uuid,
|
||||
title: item.title || '未知标题',
|
||||
subtitle: item.public_name || '未知作者',
|
||||
userUuid: item.user_uuid,
|
||||
path: item.path,
|
||||
type: item.type,
|
||||
agreenum: item.agreenum,
|
||||
readnum: item.readnum,
|
||||
videoType: item.video_type,
|
||||
imgpath: item.imgpath
|
||||
}));
|
||||
|
||||
// 添加到列表
|
||||
documentList.value.push(...processedList);
|
||||
|
||||
console.log(documentList.value);
|
||||
// 更新分页状态
|
||||
noMore.value = pageNumber >= totalPage;
|
||||
|
||||
// 如果是第一页且有数据,显示总数
|
||||
if (page.value === 1 && totalRow > 0) {
|
||||
uni.showToast({
|
||||
title: `共找到 ${totalRow} 条记录`,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.message || '获取数据失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error('获取文档列表失败:', err);
|
||||
uni.showToast({
|
||||
title: '网络错误,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
refreshing.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
const onRefresh = () => {
|
||||
refreshing.value = true;
|
||||
page.value = 1;
|
||||
noMore.value = false;
|
||||
|
||||
// 调用API刷新数据
|
||||
getDocumentList();
|
||||
};
|
||||
|
||||
const onLoadMore = () => {
|
||||
if (loading.value || noMore.value) return;
|
||||
|
||||
loading.value = true;
|
||||
page.value++;
|
||||
|
||||
// 调用API加载更多数据
|
||||
getDocumentList();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getDocumentList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.courseware-page {
|
||||
min-height: 100vh;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.document-list {
|
||||
height: calc(100vh - 140rpx);
|
||||
position: fixed;
|
||||
top: 140rpx;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.document-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
background: #ffffff;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.loading-more, .no-more, .empty-state {
|
||||
text-align: center;
|
||||
padding: 30rpx;
|
||||
color: #999999;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
padding: 100rpx 30rpx;
|
||||
color: #999999;
|
||||
}
|
||||
</style>
|
||||
246
pages_app/myCollect/huanjiao.vue
Normal file
246
pages_app/myCollect/huanjiao.vue
Normal file
@ -0,0 +1,246 @@
|
||||
<template>
|
||||
<view class="video-history-page">
|
||||
<!-- 顶部导航栏 -->
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
title="收藏视频"
|
||||
@clickLeft="goBack"
|
||||
fixed
|
||||
color="#8B2316"
|
||||
height="140rpx"
|
||||
:border="false"
|
||||
backgroundColor="#eeeeee"
|
||||
>
|
||||
</uni-nav-bar>
|
||||
|
||||
<!-- 观看历史列表 -->
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="history-list"
|
||||
refresher-enabled
|
||||
@refresherrefresh="onRefresh"
|
||||
:refresher-triggered="refreshing"
|
||||
@scrolltolower="onLoadMore"
|
||||
:lower-threshold="100"
|
||||
>
|
||||
<view class="history-item" v-for="(item, index) in historyList" :key="item.id" @click="onItemClick(item)">
|
||||
<view class="thumbnail">
|
||||
<image :src="item.thumbnail" width="200rpx" height="120rpx" mode="aspectFill" class="thumb-img"></image>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="title">{{ item.title }}</view>
|
||||
<view class="author">{{ item.author }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多提示 -->
|
||||
<view v-if="loading" class="loading-more">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 空数据状态 -->
|
||||
<view v-if="!loading && historyList.length === 0" class="empty-state">
|
||||
<text>暂无收藏视频</text>
|
||||
</view>
|
||||
|
||||
<!-- 没有更多数据提示 -->
|
||||
<view v-if="noMore && historyList.length > 0" class="no-more">
|
||||
<text>没有更多数据了</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import api from '@/api/api.js';
|
||||
import docUrl from "@/utils/docUrl.js";
|
||||
const refreshing = ref(false);
|
||||
const loading = ref(false);
|
||||
const noMore = ref(false);
|
||||
const page = ref(1);
|
||||
const pageSize = ref(10);
|
||||
const historyList = ref([]);
|
||||
|
||||
const goBack = () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
|
||||
|
||||
|
||||
const onItemClick = (item) => {
|
||||
// 跳转到视频详情页面
|
||||
uni.navigateTo({
|
||||
url: `/pages_app/videoDetail/videoDetail?id=${item.id}&title=${encodeURIComponent(item.title)}&author=${encodeURIComponent(item.author)}&videoPath=${encodeURIComponent(item.videoPath)}&userUuid=${encodeURIComponent(item.userUuid)}`
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
getVideoHistoryList();
|
||||
});
|
||||
|
||||
const getVideoHistoryList = () => {
|
||||
api.getCollectionList({
|
||||
page: page.value,
|
||||
type: 2,
|
||||
title: ""
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.code === 200 && res.data) {
|
||||
const { list, totalRow, totalPage, pageNumber } = res.data;
|
||||
|
||||
// 如果是第一页,清空列表
|
||||
if (page.value === 1) {
|
||||
historyList.value = [];
|
||||
}
|
||||
|
||||
// 处理视频数据
|
||||
const processedList = list.map(item => ({
|
||||
id: item.other_uuid,
|
||||
thumbnail: item.imgpath || '/static/bo_bg.png',
|
||||
title: item.title || '未知标题',
|
||||
author: item.public_name || '未知作者',
|
||||
videoPath: item.path,
|
||||
userUuid: item.user_uuid,
|
||||
videoType: item.video_type,
|
||||
agreenum: item.agreenum,
|
||||
readnum: item.readnum,
|
||||
type: item.type
|
||||
}));
|
||||
|
||||
// 添加到列表
|
||||
historyList.value.push(...processedList);
|
||||
|
||||
console.log(historyList.value);
|
||||
// 更新分页状态
|
||||
noMore.value = pageNumber >= totalPage;
|
||||
|
||||
// 如果是第一页且有数据,显示总数
|
||||
if (page.value === 1 && totalRow > 0) {
|
||||
uni.showToast({
|
||||
title: `共找到 ${totalRow} 条记录`,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.message || '获取数据失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error('获取收藏视频失败:', err);
|
||||
uni.showToast({
|
||||
title: '网络错误,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
refreshing.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
const onRefresh = () => {
|
||||
refreshing.value = true;
|
||||
page.value = 1;
|
||||
noMore.value = false;
|
||||
|
||||
// 调用API刷新数据
|
||||
getVideoHistoryList();
|
||||
};
|
||||
|
||||
const onLoadMore = () => {
|
||||
if (loading.value || noMore.value) return;
|
||||
|
||||
loading.value = true;
|
||||
page.value++;
|
||||
|
||||
// 调用API加载更多数据
|
||||
getVideoHistoryList();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.video-history-page {
|
||||
min-height: 100vh;
|
||||
background: #f9f9f9;
|
||||
}
|
||||
|
||||
.history-list {
|
||||
height: calc(100vh - 140rpx);
|
||||
position: fixed;
|
||||
top:140rpx;
|
||||
bottom:0;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
color: #8B2316;
|
||||
font-size: 28rpx;
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.history-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
background: #ffffff;
|
||||
margin-bottom: 2rpx;
|
||||
|
||||
.thumbnail {
|
||||
margin-right: 20rpx;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.thumb-img {
|
||||
width: 200rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
height: 120rpx;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
margin-right: 20rpx;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 10rpx;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.author {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.loading-more, .no-more, .empty-state {
|
||||
text-align: center;
|
||||
padding: 30rpx;
|
||||
color: #999999;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
padding: 100rpx 30rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
@ -5,7 +5,7 @@
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
title="我的收藏"
|
||||
@cviewckLeft="goBack"
|
||||
@clickLeft="goBack()"
|
||||
fixed
|
||||
color="#8B2316"
|
||||
height="140rpx"
|
||||
@ -18,42 +18,28 @@
|
||||
<!-- 内容区域 -->
|
||||
<view class="content-area">
|
||||
<!-- 观看历史 -->
|
||||
<view class="list-item" @click="goToHistory">
|
||||
<view class="list-item" @click="goToEnglish">
|
||||
<text class="item-text">英文期刊</text>
|
||||
<uni-icons type="right" color="#999999" size="16"></uni-icons>
|
||||
</view>
|
||||
|
||||
<!-- 分隔线 -->
|
||||
<view class="divider"></view>
|
||||
|
||||
<!-- 离线缓存 -->
|
||||
<view class="list-item" @click="goToCache">
|
||||
<text class="item-text">病例荟萃</text>
|
||||
<uni-icons type="right" color="#999999" size="16"></uni-icons>
|
||||
</view>
|
||||
<!-- 分隔线 -->
|
||||
<view class="divider"></view>
|
||||
<view class="list-item" @click="goToCache">
|
||||
<text class="item-text">病例讨论</text>
|
||||
<uni-icons type="right" color="#999999" size="16"></uni-icons>
|
||||
</view>
|
||||
<view class="divider"></view>
|
||||
<view class="list-item" @click="goToCache">
|
||||
<view class="list-item" @click="goToVideo">
|
||||
<text class="item-text">肝胆视频</text>
|
||||
<uni-icons type="right" color="#999999" size="16"></uni-icons>
|
||||
</view>
|
||||
<view class="divider"></view>
|
||||
<view class="list-item" @click="goToCache">
|
||||
<view class="list-item" @click="goToFile">
|
||||
<text class="item-text">课件文档</text>
|
||||
<uni-icons type="right" color="#999999" size="16"></uni-icons>
|
||||
</view>
|
||||
<view class="divider"></view>
|
||||
<view class="list-item" @click="goToCache">
|
||||
<view class="list-item" @click="goToNews">
|
||||
<text class="item-text">肝胆新闻</text>
|
||||
<uni-icons type="right" color="#999999" size="16"></uni-icons>
|
||||
</view>
|
||||
<view class="divider"></view>
|
||||
<view class="list-item" @click="goToCache">
|
||||
<view class="list-item" @click="goToHuanjiao">
|
||||
<text class="item-text">患教学堂</text>
|
||||
<uni-icons type="right" color="#999999" size="16"></uni-icons>
|
||||
</view>
|
||||
@ -64,11 +50,42 @@
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import navTo from "@/utils/navTo.js";
|
||||
const goBack = () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
|
||||
const goToVideo = () => {
|
||||
navTo({
|
||||
url:'/pages_app/myCollect/video'
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
const goToEnglish = () => {
|
||||
navTo({
|
||||
url:'/pages_app/myCollect/english'
|
||||
})
|
||||
};
|
||||
|
||||
const goToFile = () => {
|
||||
navTo({
|
||||
url:'/pages_app/myCollect/file'
|
||||
})
|
||||
};
|
||||
|
||||
const goToNews = () => {
|
||||
navTo({
|
||||
url:'/pages_app/myCollect/news'
|
||||
})
|
||||
};
|
||||
|
||||
const goToHuanjiao = () => {
|
||||
navTo({
|
||||
url:'/pages_app/myCollect/huanjiao'
|
||||
})
|
||||
};
|
||||
|
||||
const goToHistory = () => {
|
||||
uni.showToast({ title: '观看历史', icon: 'none' });
|
||||
};
|
||||
|
||||
276
pages_app/myCollect/news.vue
Normal file
276
pages_app/myCollect/news.vue
Normal file
@ -0,0 +1,276 @@
|
||||
<template>
|
||||
<view class="news-page">
|
||||
<!-- 顶部导航栏 -->
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
title="肝胆新闻"
|
||||
@clickLeft="goBack"
|
||||
fixed
|
||||
color="#8B2316"
|
||||
height="140rpx"
|
||||
:border="false"
|
||||
backgroundColor="#eeeeee"
|
||||
>
|
||||
</uni-nav-bar>
|
||||
|
||||
<!-- 新闻列表 -->
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="news-list"
|
||||
refresher-enabled
|
||||
@refresherrefresh="onRefresh"
|
||||
:refresher-triggered="refreshing"
|
||||
@scrolltolower="onLoadMore"
|
||||
:lower-threshold="100"
|
||||
>
|
||||
<view class="news-item" v-for="(item, index) in newsList" :key="item.id" @click="onItemClick(item)">
|
||||
<view class="thumbnail">
|
||||
<image :src="item.thumbnail" width="200rpx" height="120rpx" mode="aspectFill" class="thumb-img"></image>
|
||||
<!-- 重要通知标识 -->
|
||||
<view v-if="item.isImportant" class="important-badge">
|
||||
<text class="important-text">重要通知</text>
|
||||
<text class="click-text">点击查看</text>
|
||||
<view class="red-dot"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="title">{{ item.title }}</view>
|
||||
<view class="subtitle">{{ item.subtitle }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多提示 -->
|
||||
<view v-if="loading" class="loading-more">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 空数据状态 -->
|
||||
<view v-if="!loading && newsList.length === 0" class="empty-state">
|
||||
<text>暂无新闻</text>
|
||||
</view>
|
||||
|
||||
<!-- 没有更多数据提示 -->
|
||||
<view v-if="noMore && newsList.length > 0" class="no-more">
|
||||
<text>没有更多数据了</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import api from '@/api/api.js';
|
||||
|
||||
const refreshing = ref(false);
|
||||
const loading = ref(false);
|
||||
const noMore = ref(false);
|
||||
const page = ref(1);
|
||||
const pageSize = ref(10);
|
||||
|
||||
// 新闻数据列表
|
||||
const newsList = ref([]);
|
||||
|
||||
const goBack = () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
|
||||
const onItemClick = (item) => {
|
||||
// 跳转到新闻详情页面
|
||||
uni.navigateTo({
|
||||
url: `/pages_app/news?id=${item.id}&title=${encodeURIComponent(item.title)}&subtitle=${encodeURIComponent(item.subtitle)}&path=${encodeURIComponent(item.path)}&userUuid=${encodeURIComponent(item.userUuid)}`
|
||||
});
|
||||
};
|
||||
|
||||
// 获取新闻列表
|
||||
const getNewsList = () => {
|
||||
api.getCollectionList({
|
||||
page: page.value,
|
||||
type: 1,
|
||||
title: ""
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.code === 200 && res.data) {
|
||||
const { list, totalRow, totalPage, pageNumber } = res.data;
|
||||
|
||||
// 如果是第一页,清空列表
|
||||
if (page.value === 1) {
|
||||
newsList.value = [];
|
||||
}
|
||||
|
||||
// 处理新闻数据
|
||||
const processedList = list.map(item => ({
|
||||
id: item.other_uuid,
|
||||
title: item.title || '未知标题',
|
||||
subtitle: item.public_name || '未知来源',
|
||||
thumbnail: item.imgpath || '/static/news1.png',
|
||||
userUuid: item.user_uuid,
|
||||
path: item.path,
|
||||
type: item.type,
|
||||
agreenum: item.agreenum,
|
||||
readnum: item.readnum,
|
||||
videoType: item.video_type,
|
||||
// 判断是否为重要通知(根据标题关键词)
|
||||
isImportant: item.title && (item.title.includes('卫健委') || item.title.includes('重要') || item.title.includes('通知'))
|
||||
}));
|
||||
|
||||
// 添加到列表
|
||||
newsList.value.push(...processedList);
|
||||
|
||||
console.log(newsList.value);
|
||||
// 更新分页状态
|
||||
noMore.value = pageNumber >= totalPage;
|
||||
|
||||
// 如果是第一页且有数据,显示总数
|
||||
if (page.value === 1 && totalRow > 0) {
|
||||
uni.showToast({
|
||||
title: `共找到 ${totalRow} 条记录`,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.message || '获取数据失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error('获取新闻列表失败:', err);
|
||||
uni.showToast({
|
||||
title: '网络错误,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
refreshing.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
const onRefresh = () => {
|
||||
refreshing.value = true;
|
||||
page.value = 1;
|
||||
noMore.value = false;
|
||||
|
||||
// 调用API刷新数据
|
||||
getNewsList();
|
||||
};
|
||||
|
||||
const onLoadMore = () => {
|
||||
if (loading.value || noMore.value) return;
|
||||
|
||||
loading.value = true;
|
||||
page.value++;
|
||||
|
||||
// 调用API加载更多数据
|
||||
getNewsList();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getNewsList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.news-page {
|
||||
min-height: 100vh;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.news-list {
|
||||
height: calc(100vh - 140rpx);
|
||||
position: fixed;
|
||||
top: 140rpx;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.news-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
background: #ffffff;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
.thumbnail {
|
||||
position: relative;
|
||||
margin-right: 20rpx;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.thumb-img {
|
||||
width: 200rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.important-badge {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: linear-gradient(135deg, #ff4757, #ff3742);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 8rpx;
|
||||
|
||||
.important-text {
|
||||
color: #ffffff;
|
||||
font-size: 24rpx;
|
||||
font-weight: bold;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.click-text {
|
||||
color: #ffffff;
|
||||
font-size: 20rpx;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.red-dot {
|
||||
width: 8rpx;
|
||||
height: 8rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 8rpx;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.loading-more, .no-more, .empty-state {
|
||||
text-align: center;
|
||||
padding: 30rpx;
|
||||
color: #999999;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
padding: 100rpx 30rpx;
|
||||
color: #999999;
|
||||
}
|
||||
</style>
|
||||
246
pages_app/myCollect/video.vue
Normal file
246
pages_app/myCollect/video.vue
Normal file
@ -0,0 +1,246 @@
|
||||
<template>
|
||||
<view class="video-history-page">
|
||||
<!-- 顶部导航栏 -->
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
title="收藏视频"
|
||||
@clickLeft="goBack"
|
||||
fixed
|
||||
color="#8B2316"
|
||||
height="140rpx"
|
||||
:border="false"
|
||||
backgroundColor="#eeeeee"
|
||||
>
|
||||
</uni-nav-bar>
|
||||
|
||||
<!-- 观看历史列表 -->
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="history-list"
|
||||
refresher-enabled
|
||||
@refresherrefresh="onRefresh"
|
||||
:refresher-triggered="refreshing"
|
||||
@scrolltolower="onLoadMore"
|
||||
:lower-threshold="100"
|
||||
>
|
||||
<view class="history-item" v-for="(item, index) in historyList" :key="item.id" @click="onItemClick(item)">
|
||||
<view class="thumbnail">
|
||||
<image :src="item.thumbnail" width="200rpx" height="120rpx" mode="aspectFill" class="thumb-img"></image>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="title">{{ item.title }}</view>
|
||||
<view class="author">{{ item.author }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多提示 -->
|
||||
<view v-if="loading" class="loading-more">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 空数据状态 -->
|
||||
<view v-if="!loading && historyList.length === 0" class="empty-state">
|
||||
<text>暂无收藏视频</text>
|
||||
</view>
|
||||
|
||||
<!-- 没有更多数据提示 -->
|
||||
<view v-if="noMore && historyList.length > 0" class="no-more">
|
||||
<text>没有更多数据了</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import api from '@/api/api.js';
|
||||
import docUrl from "@/utils/docUrl.js";
|
||||
const refreshing = ref(false);
|
||||
const loading = ref(false);
|
||||
const noMore = ref(false);
|
||||
const page = ref(1);
|
||||
const pageSize = ref(10);
|
||||
const historyList = ref([]);
|
||||
|
||||
const goBack = () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
|
||||
|
||||
|
||||
const onItemClick = (item) => {
|
||||
// 跳转到视频详情页面
|
||||
uni.navigateTo({
|
||||
url: `/pages_app/videoDetail/videoDetail?id=${item.id}&title=${encodeURIComponent(item.title)}&author=${encodeURIComponent(item.author)}&videoPath=${encodeURIComponent(item.videoPath)}&userUuid=${encodeURIComponent(item.userUuid)}`
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
getVideoHistoryList();
|
||||
});
|
||||
|
||||
const getVideoHistoryList = () => {
|
||||
api.getCollectionList({
|
||||
page: page.value,
|
||||
type: 5,
|
||||
title: ""
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.code === 200 && res.data) {
|
||||
const { list, totalRow, totalPage, pageNumber } = res.data;
|
||||
|
||||
// 如果是第一页,清空列表
|
||||
if (page.value === 1) {
|
||||
historyList.value = [];
|
||||
}
|
||||
|
||||
// 处理视频数据
|
||||
const processedList = list.map(item => ({
|
||||
id: item.other_uuid,
|
||||
thumbnail: docUrl + item.imgpath || '/static/bo_bg.png',
|
||||
title: item.title || '未知标题',
|
||||
author: item.public_name || '未知作者',
|
||||
videoPath: item.path,
|
||||
userUuid: item.user_uuid,
|
||||
videoType: item.video_type,
|
||||
agreenum: item.agreenum,
|
||||
readnum: item.readnum,
|
||||
type: item.type
|
||||
}));
|
||||
|
||||
// 添加到列表
|
||||
historyList.value.push(...processedList);
|
||||
|
||||
console.log(historyList.value);
|
||||
// 更新分页状态
|
||||
noMore.value = pageNumber >= totalPage;
|
||||
|
||||
// 如果是第一页且有数据,显示总数
|
||||
if (page.value === 1 && totalRow > 0) {
|
||||
uni.showToast({
|
||||
title: `共找到 ${totalRow} 条记录`,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.message || '获取数据失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error('获取收藏视频失败:', err);
|
||||
uni.showToast({
|
||||
title: '网络错误,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
refreshing.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
const onRefresh = () => {
|
||||
refreshing.value = true;
|
||||
page.value = 1;
|
||||
noMore.value = false;
|
||||
|
||||
// 调用API刷新数据
|
||||
getVideoHistoryList();
|
||||
};
|
||||
|
||||
const onLoadMore = () => {
|
||||
if (loading.value || noMore.value) return;
|
||||
|
||||
loading.value = true;
|
||||
page.value++;
|
||||
|
||||
// 调用API加载更多数据
|
||||
getVideoHistoryList();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.video-history-page {
|
||||
min-height: 100vh;
|
||||
background: #f9f9f9;
|
||||
}
|
||||
|
||||
.history-list {
|
||||
height: calc(100vh - 140rpx);
|
||||
position: fixed;
|
||||
top:140rpx;
|
||||
bottom:0;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
color: #8B2316;
|
||||
font-size: 28rpx;
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.history-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
background: #ffffff;
|
||||
margin-bottom: 2rpx;
|
||||
|
||||
.thumbnail {
|
||||
margin-right: 20rpx;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.thumb-img {
|
||||
width: 200rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
height: 120rpx;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
margin-right: 20rpx;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 10rpx;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.author {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.loading-more, .no-more, .empty-state {
|
||||
text-align: center;
|
||||
padding: 30rpx;
|
||||
color: #999999;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
padding: 100rpx 30rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
@ -5,7 +5,7 @@
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
title="我的下载"
|
||||
@cviewckLeft="goBack"
|
||||
@clickLeft="goBack()"
|
||||
fixed
|
||||
color="#8B2316"
|
||||
height="140rpx"
|
||||
|
||||
@ -40,7 +40,8 @@
|
||||
:refresher-triggered="refreshing"
|
||||
@refresherrefresh="onRefresh"
|
||||
@scrolltolower="onLoadMore"
|
||||
lower-threshold="80"
|
||||
lower-threshold="100"
|
||||
:scroll-top="scrollTop"
|
||||
>
|
||||
<view v-if="records.length === 0" class="empty-wrap">
|
||||
<up-image :src="emptyImg" width="176rpx" height="204rpx" ></up-image>
|
||||
@ -53,17 +54,28 @@
|
||||
<text class="cell qty" :class="{ plus: item.amount > 0, minus: item.amount < 0 }">{{ item.amount }}</text>
|
||||
</view>
|
||||
|
||||
<view v-if="loading" class="loading">加载中...</view>
|
||||
<view v-if="noMore" class="no-more">没有更多了</view>
|
||||
<view v-if="loading" class="loading">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
<view v-if="noMore && records.length > 0" class="no-more">
|
||||
<text>没有更多数据了</text>
|
||||
</view>
|
||||
|
||||
<!-- 调试按钮 -->
|
||||
<view v-if="records.length > 0" class="debug-actions">
|
||||
<button @click="testLoadMore" size="mini" type="primary">测试加载更多</button>
|
||||
<text class="debug-info">当前页: {{ page }}, 加载中: {{ loading }}, 无更多: {{ noMore }}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { ref, onMounted } from 'vue';
|
||||
import flowerImg from "@/static/flowers.png"
|
||||
import moneyImg from "@/static/mind_totle_money.png"
|
||||
import emptyImg from "@/static/icon_empty.png"
|
||||
import api from '@/api/api.js';
|
||||
// 与截图一致的顶部两项统计:总鲜花数与累计金额
|
||||
const stat = ref({ totalCount: 0, totalAmount: 0.0 });
|
||||
|
||||
@ -76,12 +88,9 @@ const loading = ref(false);
|
||||
const noMore = ref(false);
|
||||
const page = ref(1);
|
||||
const pageSize = ref(10);
|
||||
const scrollTop = ref(0);
|
||||
|
||||
|
||||
const mockMore = Array.from({ length: 24 }).map((_, i) => ({
|
||||
name: i % 2 ? '王医生' : '李医生',
|
||||
time: `2025-06-${20 + (i % 10)} 17:1${i % 6}:2${i % 9}`,
|
||||
amount: i % 2 ? +1 : +2
|
||||
}));
|
||||
|
||||
const goBack = () => {
|
||||
uni.navigateBack({
|
||||
@ -91,37 +100,118 @@ const goBack = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const getFlowerList = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 只在第一页时设置loading状态,避免与onLoadMore冲突
|
||||
if (page.value === 1) {
|
||||
loading.value = true;
|
||||
}
|
||||
|
||||
console.log('正在获取第', page.value, '页数据...');
|
||||
|
||||
api.getFlowerList({page: page.value}).then(res => {
|
||||
console.log('接口返回数据:', res);
|
||||
if (res.code === 200 && res.data) {
|
||||
const { flower_data, total_amount, total_num } = res.data;
|
||||
|
||||
// 更新统计数据
|
||||
stat.value.totalCount = total_num || 0;
|
||||
stat.value.totalAmount = total_amount || 0;
|
||||
|
||||
// 处理列表数据
|
||||
if (flower_data && flower_data.list) {
|
||||
const newRecords = flower_data.list.map(item => ({
|
||||
name: item.patient_name || '未知',
|
||||
time: item.create_date || '',
|
||||
amount: item.num || 0,
|
||||
// 保留原始数据以备后用
|
||||
original: item
|
||||
}));
|
||||
|
||||
// 如果是第一页,替换数据;否则追加数据
|
||||
if (page.value === 1) {
|
||||
records.value = newRecords;
|
||||
console.log('第一页数据,替换列表,共', newRecords.length, '条');
|
||||
} else {
|
||||
records.value.push(...newRecords);
|
||||
console.log('第', page.value, '页数据,追加到列表,新增', newRecords.length, '条');
|
||||
}
|
||||
|
||||
// 判断是否还有更多数据
|
||||
noMore.value = flower_data.isLastPage;
|
||||
console.log('是否最后一页:', flower_data.isLastPage, ',总页数:', flower_data.pages);
|
||||
}
|
||||
resolve(res);
|
||||
} else {
|
||||
reject(new Error('接口返回错误'));
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error('获取鲜花列表失败:', err);
|
||||
uni.showToast({ title: '获取数据失败', icon: 'error' });
|
||||
reject(err);
|
||||
}).finally(() => {
|
||||
// 只在第一页时重置loading状态
|
||||
if (page.value === 1) {
|
||||
loading.value = false;
|
||||
}
|
||||
refreshing.value = false;
|
||||
});
|
||||
});
|
||||
};
|
||||
onMounted(() => {
|
||||
getFlowerList();
|
||||
});
|
||||
|
||||
const onRefresh = async () => {
|
||||
if (refreshing.value) return;
|
||||
refreshing.value = true;
|
||||
try {
|
||||
await new Promise(r => setTimeout(r, 600));
|
||||
page.value = 1;
|
||||
noMore.value = false;
|
||||
records.value = []; // 清空为模拟无数据或重新拉取
|
||||
records.value = []; // 清空数据
|
||||
getFlowerList(); // 重新获取第一页数据
|
||||
uni.showToast({ title: '刷新成功', icon: 'success' });
|
||||
} finally {
|
||||
refreshing.value = false;
|
||||
} catch (error) {
|
||||
console.error('刷新失败:', error);
|
||||
uni.showToast({ title: '刷新失败', icon: 'error' });
|
||||
}
|
||||
};
|
||||
|
||||
const onLoadMore = async () => {
|
||||
if (loading.value || noMore.value) return;
|
||||
console.log('触发上拉加载更多事件');
|
||||
|
||||
// 检查各种状态
|
||||
if (loading.value) {
|
||||
console.log('正在加载中,忽略重复请求');
|
||||
return;
|
||||
}
|
||||
|
||||
if (noMore.value) {
|
||||
console.log('已经没有更多数据了');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('开始加载下一页,当前页码:', page.value);
|
||||
|
||||
loading.value = true;
|
||||
try {
|
||||
await new Promise(r => setTimeout(r, 600));
|
||||
const start = (page.value - 1) * pageSize.value;
|
||||
const chunk = mockMore.slice(start, start + pageSize.value);
|
||||
if (!chunk.length) {
|
||||
noMore.value = true;
|
||||
} else {
|
||||
records.value.push(...chunk);
|
||||
page.value += 1;
|
||||
}
|
||||
page.value += 1;
|
||||
await getFlowerList(); // 等待数据加载完成
|
||||
console.log('加载完成,当前页码:', page.value);
|
||||
} catch (error) {
|
||||
console.error('加载更多失败:', error);
|
||||
page.value -= 1; // 恢复页码
|
||||
uni.showToast({ title: '加载失败', icon: 'error' });
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 测试加载更多功能
|
||||
const testLoadMore = () => {
|
||||
console.log('手动测试加载更多');
|
||||
onLoadMore();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@ -192,5 +282,36 @@ $card: #ffffff;
|
||||
.empty-icon { width: 220rpx; height: 220rpx; opacity: .4; }
|
||||
.empty-text { margin-top: 20rpx; font-size: 30rpx; }
|
||||
|
||||
.loading, .no-more { text-align: center; color: #9aa0a6; padding: 20rpx 0; font-size: 26rpx; }
|
||||
.loading, .no-more {
|
||||
text-align: center;
|
||||
color: #9aa0a6;
|
||||
padding: 30rpx 0;
|
||||
font-size: 26rpx;
|
||||
|
||||
text {
|
||||
display: inline-block;
|
||||
padding: 10rpx 20rpx;
|
||||
background: #f5f5f5;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.debug-actions {
|
||||
text-align: center;
|
||||
padding: 20rpx;
|
||||
border-top: 1rpx solid #eee;
|
||||
|
||||
button {
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.debug-info {
|
||||
display: block;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
background: #f8f8f8;
|
||||
padding: 10rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
1043
pages_app/myPoint/myPoint.vue
Normal file
1043
pages_app/myPoint/myPoint.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
title="我的视频"
|
||||
@cviewckLeft="goBack"
|
||||
@clickLeft="goBack()"
|
||||
fixed
|
||||
color="#8B2316"
|
||||
height="140rpx"
|
||||
@ -14,6 +14,7 @@
|
||||
>
|
||||
|
||||
</uni-nav-bar>
|
||||
|
||||
|
||||
<!-- 内容区域 -->
|
||||
<view class="content-area">
|
||||
@ -37,13 +38,16 @@
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import navTo from "@/utils/navTo.js";
|
||||
const goBack = () => {
|
||||
console.log(123)
|
||||
uni.navigateBack();
|
||||
};
|
||||
|
||||
const goToHistory = () => {
|
||||
uni.showToast({ title: '观看历史', icon: 'none' });
|
||||
navTo({
|
||||
url:'/pages_app/videoHistory/videoHistory'
|
||||
})
|
||||
};
|
||||
|
||||
const goToCache = () => {
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
class="benefit-card"
|
||||
v-for="(benefit, index) in benefitsList"
|
||||
:key="index"
|
||||
:class="benefit.type"
|
||||
:class="[benefit.type, { 'disabled': !benefit.flag }]"
|
||||
@click="claimBenefit(benefit)"
|
||||
>
|
||||
<view class="card-title">{{ benefit.title }}</view>
|
||||
@ -60,21 +60,20 @@
|
||||
|
||||
<view class="card-details">
|
||||
<view class="left-section">
|
||||
<text class="condition">{{ benefit.condition }}</text>
|
||||
<text class="requirement">{{ benefit.requirement }}</text>
|
||||
<text class="condition">{{ benefit.left_tip }}</text>
|
||||
<text class="requirement">{{ benefit.left_result }}</text>
|
||||
</view>
|
||||
<view class="right-section">
|
||||
<text class="reward-type">{{ benefit.rewardType }}</text>
|
||||
<text class="reward-value">{{ benefit.rewardValue }}</text>
|
||||
<text class="reward-type">{{ benefit.right_tip }}</text>
|
||||
<text class="reward-value">{{ benefit.right_result }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<!-- 兑换福利卡 -->
|
||||
<view class="scrollbox">
|
||||
</view>
|
||||
|
||||
<!-- 底部导航栏 -->
|
||||
<view class="bottom-nav">
|
||||
<view class="nav-item" @click="goPointsDetail">
|
||||
@ -87,10 +86,10 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { ref, onMounted } from 'vue';
|
||||
import jifenImg from "@/static/duihuan.png"
|
||||
|
||||
|
||||
import api from '@/api/api';
|
||||
import navTo from "@/utils/navTo.js";
|
||||
// 当前选中的标签页
|
||||
const activeTab = ref(0);
|
||||
|
||||
@ -102,7 +101,9 @@
|
||||
condition: '赠送积分',
|
||||
requirement: '200积分',
|
||||
rewardType: '立即领取',
|
||||
rewardValue: ''
|
||||
rewardValue: '',
|
||||
flag: true, // 表示是否可领取
|
||||
num: 0 // 需要的新随访数量
|
||||
},
|
||||
{
|
||||
type: 'video',
|
||||
@ -110,7 +111,9 @@
|
||||
condition: '再新增随访',
|
||||
requirement: '1个',
|
||||
rewardType: '赠送下载',
|
||||
rewardValue: '2集'
|
||||
rewardValue: '2集',
|
||||
flag: true,
|
||||
num: 1
|
||||
},
|
||||
{
|
||||
type: 'courseware',
|
||||
@ -118,7 +121,9 @@
|
||||
condition: '再新增随访',
|
||||
requirement: '6个',
|
||||
rewardType: '赠送下载',
|
||||
rewardValue: '1篇'
|
||||
rewardValue: '1篇',
|
||||
flag: true,
|
||||
num: 6
|
||||
},
|
||||
{
|
||||
type: 'usb',
|
||||
@ -126,7 +131,9 @@
|
||||
condition: '再新增随访 (年度计算)',
|
||||
requirement: '96个',
|
||||
rewardType: '赠送U盘',
|
||||
rewardValue: '1个'
|
||||
rewardValue: '1个',
|
||||
flag: true,
|
||||
num: 96
|
||||
}
|
||||
]);
|
||||
|
||||
@ -150,18 +157,32 @@
|
||||
|
||||
const switchTab = (index) => {
|
||||
activeTab.value = index;
|
||||
// 这里可以根据标签页切换加载不同的数据
|
||||
uni.showToast({
|
||||
title: `切换到${['领取福利', '使用福利', '兑福利卡'][index]}`,
|
||||
icon: 'none'
|
||||
});
|
||||
|
||||
if (index === 0) {
|
||||
getWelfarePage();
|
||||
} else if (index === 1) {
|
||||
useWelfarePage();
|
||||
} else if (index === 2) {
|
||||
navTo({
|
||||
url: '/pages_app/myWelfareCard/myWelfareCard'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const claimBenefit = (benefit) => {
|
||||
if (!benefit.flag) {
|
||||
uni.showToast({
|
||||
title: `需${benefit.num}个新随访`,
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showToast({
|
||||
title: `领取${benefit.title}`,
|
||||
icon: 'none'
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
const goPointsDetail = () => {
|
||||
@ -184,6 +205,37 @@
|
||||
icon: 'none'
|
||||
});
|
||||
};
|
||||
|
||||
const useWelfarePage = () => {
|
||||
api.useWelfarePage().then(res => {
|
||||
if (res.code === '200' && res.data) {
|
||||
// 更新福利列表数据
|
||||
benefitsList.value = res.data;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const getWelfarePage = () => {
|
||||
api.getWelfarePage().then(res => {
|
||||
console.log(res);
|
||||
if (res.code === '200' && res.data) {
|
||||
|
||||
// 更新福利列表数据
|
||||
benefitsList.value = res.data;
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error('获取福利数据失败:', err);
|
||||
uni.showToast({
|
||||
title: '获取福利数据失败',
|
||||
icon: 'none'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getWelfarePage();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@ -200,22 +252,6 @@
|
||||
$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;
|
||||
@ -226,7 +262,9 @@
|
||||
.status-bar {
|
||||
height: 44rpx;
|
||||
background-color: $white;
|
||||
@include flex-between;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 30rpx;
|
||||
font-size: 24rpx;
|
||||
color: $text-primary;
|
||||
@ -262,7 +300,9 @@
|
||||
.header {
|
||||
height: 88rpx;
|
||||
background-color: $white;
|
||||
@include flex-between;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 30rpx;
|
||||
border-bottom: 1rpx solid $border-color;
|
||||
|
||||
@ -305,7 +345,9 @@
|
||||
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
@include flex-center;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
|
||||
@ -338,7 +380,7 @@
|
||||
box-sizing: border-box;
|
||||
bottom: $bottom-nav-height;
|
||||
margin: 30rpx 0 ;
|
||||
overflow-y: auto;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.benefits-list {
|
||||
|
||||
@ -352,20 +394,9 @@
|
||||
overflow: hidden;
|
||||
border:2rpx solid #fff;
|
||||
|
||||
&.points {
|
||||
|
||||
}
|
||||
|
||||
&.video {
|
||||
|
||||
}
|
||||
|
||||
&.courseware {
|
||||
|
||||
}
|
||||
|
||||
&.usb {
|
||||
|
||||
|
||||
.disabled-text {
|
||||
color: $text-light !important;
|
||||
}
|
||||
|
||||
.card-bg {
|
||||
@ -374,9 +405,6 @@
|
||||
right: 20rpx;
|
||||
left:20rpx;
|
||||
z-index:0;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
.card-content {
|
||||
@ -429,6 +457,22 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.status-indicator {
|
||||
position: absolute;
|
||||
top: 10rpx;
|
||||
right: 10rpx;
|
||||
background-color: #4CAF50;
|
||||
border-radius: 20rpx;
|
||||
padding: 4rpx 10rpx;
|
||||
font-size: 20rpx;
|
||||
color: $white;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.status-indicator.disabled {
|
||||
background-color: #FF9800;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -447,7 +491,8 @@
|
||||
padding: 0 20rpx;
|
||||
|
||||
.nav-item {
|
||||
@include flex-center;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: flex;
|
||||
gap: 8rpx;
|
||||
|
||||
|
||||
@ -193,8 +193,41 @@
|
||||
password: password.value,
|
||||
client_type:"A",
|
||||
current_spec:"Iphone15"
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
}).then(result => {
|
||||
console.log(result)
|
||||
|
||||
|
||||
// 保存用户信息到本地存储
|
||||
if (process.env.UNI_PLATFORM == "h5") {
|
||||
if (window.location.href.indexOf('dev') > -1) {
|
||||
uni.setStorageSync('AUTH_TOKEN_App',result.access_token);
|
||||
uni.setStorageSync('AUTH_YX_ACCID_App', result.YX_accid);
|
||||
uni.setStorageSync('AUTH_YX_TOKEN_App', result.YX_token);
|
||||
uni.setStorageSync('userInfo', result.data);
|
||||
|
||||
} else {
|
||||
uni.setStorageSync('DEV_AUTH_TOKEN_App', result.access_token);
|
||||
uni.setStorageSync('DEV_AUTH_YX_ACCID_App', result.YX_accid);
|
||||
uni.setStorageSync('DEV_AUTH_YX_TOKEN_App', result.YX_token);
|
||||
uni.setStorageSync('userInfo', result.data);
|
||||
}
|
||||
} else if(process.env.UNI_PLATFORM == "mp-weixin") {
|
||||
const {
|
||||
envVersion
|
||||
} = uni.getAccountInfoSync().miniProgram;
|
||||
if (envVersion == "release") {
|
||||
uni.setStorageSync('AUTH_TOKEN_App',result.access_token);
|
||||
uni.setStorageSync('AUTH_YX_ACCID_App', result.YX_accid);
|
||||
uni.setStorageSync('AUTH_YX_TOKEN_App', result.YX_token);
|
||||
uni.setStorageSync('userInfo', result.data);
|
||||
} else {
|
||||
uni.setStorageSync('DEV_AUTH_TOKEN_App', result.access_token);
|
||||
uni.setStorageSync('DEV_AUTH_YX_ACCID_App', result.YX_accid);
|
||||
uni.setStorageSync('DEV_AUTH_YX_TOKEN_App', result.YX_token);
|
||||
uni.setStorageSync('userInfo', result.data);
|
||||
}
|
||||
}
|
||||
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '登录成功',
|
||||
|
||||
@ -37,6 +37,11 @@
|
||||
|
||||
<!-- 内容区 -->
|
||||
<view v-if="activeTab === 'info'" class="intro">
|
||||
<!-- 显示传递过来的视频信息 -->
|
||||
<view v-if="pageParams.title" class="video-info">
|
||||
<view class="video-title">{{ decodeURIComponent(pageParams.title) }}</view>
|
||||
<view v-if="pageParams.author" class="video-author">{{ decodeURIComponent(pageParams.author) }}</view>
|
||||
</view>
|
||||
<view class="speaker">陈煜 教授</view>
|
||||
<text class="intro-text">{{ introText }}</text>
|
||||
</view>
|
||||
@ -76,6 +81,28 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import uniVideo from '@/components/uniVideo/uniVideo.vue';
|
||||
|
||||
// 接收页面参数
|
||||
const pageParams = ref({});
|
||||
|
||||
// 使用uni-app的onLoad生命周期
|
||||
const onLoad = (options) => {
|
||||
pageParams.value = options;
|
||||
console.log('接收到的参数:', pageParams.value);
|
||||
|
||||
// 如果有标题参数,可以在这里进行相应处理
|
||||
if (options.title) {
|
||||
// 可以更新页面标题或进行其他操作
|
||||
console.log('视频标题:', decodeURIComponent(options.title));
|
||||
}
|
||||
if (options.author) {
|
||||
console.log('视频作者:', decodeURIComponent(options.author));
|
||||
}
|
||||
if (options.id) {
|
||||
console.log('视频ID:', options.id);
|
||||
}
|
||||
};
|
||||
|
||||
const videoSrc = ref('');
|
||||
const poster = ref('/static/livebg.png');
|
||||
const activeTab = ref('info');
|
||||
@ -244,6 +271,26 @@ $theme-color: #8B2316;
|
||||
background: #fff;
|
||||
padding: 24rpx 28rpx 40rpx;
|
||||
|
||||
.video-info {
|
||||
margin-bottom: 20rpx;
|
||||
padding: 20rpx;
|
||||
background: #f8f9fa;
|
||||
border-radius: 8rpx;
|
||||
|
||||
.video-title {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
margin-bottom: 8rpx;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.video-author {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
|
||||
.speaker {
|
||||
font-size: 32rpx;
|
||||
color: $text-primary;
|
||||
|
||||
390
pages_app/videoHistory/videoHistory.vue
Normal file
390
pages_app/videoHistory/videoHistory.vue
Normal file
@ -0,0 +1,390 @@
|
||||
<template>
|
||||
<view class="video-history-page">
|
||||
<!-- 顶部导航栏 -->
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
:title="isEditMode ? '选择视频' : '观看历史'"
|
||||
@clickLeft="goBack"
|
||||
fixed
|
||||
color="#8B2316"
|
||||
height="140rpx"
|
||||
:border="false"
|
||||
backgroundColor="#eeeeee"
|
||||
>
|
||||
<template v-slot:right>
|
||||
<text class="edit-btn" @click="onEdit">{{ isEditMode ? '取消' : '编辑' }}</text>
|
||||
</template>
|
||||
</uni-nav-bar>
|
||||
|
||||
<!-- 观看历史列表 -->
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="history-list"
|
||||
refresher-enabled
|
||||
@refresherrefresh="onRefresh"
|
||||
:refresher-triggered="refreshing"
|
||||
@scrolltolower="onLoadMore"
|
||||
:lower-threshold="100"
|
||||
>
|
||||
<view class="history-item" v-for="(item, index) in historyList" :key="item.id" @click="onItemClick(item)">
|
||||
<!-- 选择框 -->
|
||||
<view v-if="isEditMode" class="checkbox-wrapper" @click.stop="toggleSelect(item)">
|
||||
<view class="checkbox" :class="{ 'checked': selectedItems.includes(item.id) }">
|
||||
<text v-if="selectedItems.includes(item.id)" class="check-icon">✓</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="thumbnail">
|
||||
<image :src="item.thumbnail" width="200rpx" height="120rpx" mode="aspectFill" class="thumb-img"></image>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="title">{{ item.title }}</view>
|
||||
<view class="author">{{ item.author }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多提示 -->
|
||||
<view v-if="loading" class="loading-more">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 空数据状态 -->
|
||||
<view v-if="!loading && historyList.length === 0" class="empty-state">
|
||||
<text>暂无观看历史</text>
|
||||
</view>
|
||||
|
||||
<!-- 没有更多数据提示 -->
|
||||
<view v-if="noMore && historyList.length > 0" class="no-more">
|
||||
<text>没有更多数据了</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 底部操作栏 -->
|
||||
<view v-if="isEditMode" class="bottom-action-bar">
|
||||
<view class="action-left">
|
||||
<text class="select-all-btn" @click="toggleSelectAll">全选</text>
|
||||
</view>
|
||||
<view class="action-right">
|
||||
<text class="delete-btn" @click="deleteSelected" :class="{ 'disabled': selectedItems.length === 0 }">删除</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import api from '@/api/api.js';
|
||||
import docUrl from "@/utils/docUrl.js";
|
||||
const refreshing = ref(false);
|
||||
const loading = ref(false);
|
||||
const noMore = ref(false);
|
||||
const page = ref(1);
|
||||
const pageSize = ref(10);
|
||||
const isEditMode = ref(false);
|
||||
const selectedItems = ref([]);
|
||||
const historyList = ref([]);
|
||||
|
||||
const goBack = () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
|
||||
const onEdit = () => {
|
||||
if (isEditMode.value) {
|
||||
// 退出编辑模式
|
||||
isEditMode.value = false;
|
||||
selectedItems.value = [];
|
||||
} else {
|
||||
// 进入编辑模式
|
||||
isEditMode.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
const onItemClick = (item) => {
|
||||
// 编辑模式下不跳转
|
||||
if (isEditMode.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 跳转到视频详情页面
|
||||
uni.navigateTo({
|
||||
url: `/pages_app/videoDetail/videoDetail?id=${item.id}&title=${encodeURIComponent(item.title)}&author=${encodeURIComponent(item.author)}&videoPath=${encodeURIComponent(item.videoPath)}&polyvUuid=${encodeURIComponent(item.polyvUuid)}`
|
||||
});
|
||||
};
|
||||
|
||||
// 切换选择状态
|
||||
const toggleSelect = (item) => {
|
||||
const index = selectedItems.value.indexOf(item.id);
|
||||
if (index > -1) {
|
||||
selectedItems.value.splice(index, 1);
|
||||
} else {
|
||||
selectedItems.value.push(item.id);
|
||||
}
|
||||
};
|
||||
|
||||
// 全选/取消全选
|
||||
const toggleSelectAll = () => {
|
||||
if (selectedItems.value.length === historyList.value.length) {
|
||||
// 取消全选
|
||||
selectedItems.value = [];
|
||||
} else {
|
||||
// 全选
|
||||
selectedItems.value = historyList.value.map(item => item.id);
|
||||
}
|
||||
};
|
||||
|
||||
// 删除选中的视频
|
||||
const deleteSelected = () => {
|
||||
if (selectedItems.value.length === 0) {
|
||||
uni.showToast({ title: '请选择要删除的视频', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
uni.showModal({
|
||||
title: '确认删除',
|
||||
content: `确定要删除选中的 ${selectedItems.value.length} 个视频吗?`,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// 这里可以调用删除API
|
||||
api.deleteRecord({
|
||||
video_uuid: selectedItems.value.join(',')
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
});
|
||||
// 暂时从本地列表中移除
|
||||
historyList.value = historyList.value.filter(item => !selectedItems.value.includes(item.id));
|
||||
selectedItems.value = [];
|
||||
isEditMode.value = false;
|
||||
|
||||
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getVideoHistoryList();
|
||||
});
|
||||
|
||||
const getVideoHistoryList = () => {
|
||||
api.getVideoHistory({
|
||||
page: page.value,
|
||||
pageSize: pageSize.value
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.code === '200' && res.data) {
|
||||
const { list, isLastPage, total } = res.data;
|
||||
|
||||
// 如果是第一页,清空列表
|
||||
if (page.value === 1) {
|
||||
historyList.value = [];
|
||||
}
|
||||
|
||||
// 处理视频数据
|
||||
const processedList = list.map(item => ({
|
||||
id: item.video_uuid,
|
||||
thumbnail: docUrl + item.imgpath || '/static/bo_bg.png',
|
||||
title: item.video_name || '未知标题',
|
||||
author: item.public_name || item.user_name || '未知作者',
|
||||
videoPath: item.path,
|
||||
polyvUuid: item.polyv_uuid,
|
||||
content: item.content,
|
||||
videoType: item.video_type,
|
||||
status: item.status
|
||||
}));
|
||||
|
||||
// 添加到列表
|
||||
historyList.value.push(...processedList);
|
||||
|
||||
// 更新分页状态
|
||||
noMore.value = isLastPage;
|
||||
|
||||
// 如果是第一页且有数据,显示总数
|
||||
if (page.value === 1 && total > 0) {
|
||||
uni.showToast({
|
||||
title: `共找到 ${total} 条记录`,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.message || '获取数据失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error('获取视频历史失败:', err);
|
||||
uni.showToast({
|
||||
title: '网络错误,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
refreshing.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
const onRefresh = () => {
|
||||
refreshing.value = true;
|
||||
page.value = 1;
|
||||
noMore.value = false;
|
||||
|
||||
// 调用API刷新数据
|
||||
getVideoHistoryList();
|
||||
};
|
||||
|
||||
const onLoadMore = () => {
|
||||
if (loading.value || noMore.value) return;
|
||||
|
||||
loading.value = true;
|
||||
page.value++;
|
||||
|
||||
// 调用API加载更多数据
|
||||
getVideoHistoryList();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.video-history-page {
|
||||
min-height: 100vh;
|
||||
background: #f9f9f9;
|
||||
}
|
||||
|
||||
.history-list {
|
||||
height: calc(100vh - 140rpx);
|
||||
position: fixed;
|
||||
top:140rpx;
|
||||
bottom:0;
|
||||
width:100%;
|
||||
padding-bottom: 100rpx; /* 为底部操作栏留出空间 */
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
color: #8B2316;
|
||||
font-size: 28rpx;
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.history-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
background: #ffffff;
|
||||
margin-bottom: 2rpx;
|
||||
|
||||
.checkbox-wrapper {
|
||||
margin-right: 20rpx;
|
||||
|
||||
.checkbox {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border: 2rpx solid #ddd;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #fff;
|
||||
|
||||
&.checked {
|
||||
background: #8B2316;
|
||||
border-color: #8B2316;
|
||||
}
|
||||
|
||||
.check-icon {
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.thumbnail {
|
||||
margin-right: 20rpx;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.thumb-img {
|
||||
width: 200rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
height: 120rpx;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
margin-right: 20rpx;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 10rpx;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.author {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.loading-more, .no-more, .empty-state {
|
||||
text-align: center;
|
||||
padding: 30rpx;
|
||||
color: #999999;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
padding: 100rpx 30rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.bottom-action-bar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 100rpx;
|
||||
background: #fff;
|
||||
border-top: 1rpx solid #eee;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 30rpx;
|
||||
z-index: 100;
|
||||
|
||||
.action-left {
|
||||
.select-all-btn {
|
||||
color: #333;
|
||||
font-size: 28rpx;
|
||||
padding: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.action-right {
|
||||
.delete-btn {
|
||||
color: #ff4757;
|
||||
font-size: 28rpx;
|
||||
padding: 20rpx;
|
||||
|
||||
&.disabled {
|
||||
color: #ccc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,214 +0,0 @@
|
||||
<template>
|
||||
<view class="video-history-page">
|
||||
<!-- 顶部导航栏 -->
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
title="观看历史"
|
||||
@clickLeft="goBack"
|
||||
fixed
|
||||
color="#8B2316"
|
||||
height="140rpx"
|
||||
:border="false"
|
||||
backgroundColor="#eeeeee"
|
||||
>
|
||||
<template v-slot:right>
|
||||
<text class="edit-btn" @click="onEdit">编辑</text>
|
||||
</template>
|
||||
</uni-nav-bar>
|
||||
|
||||
<!-- 观看历史列表 -->
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="history-list"
|
||||
refresher-enabled
|
||||
@refresherrefresh="onRefresh"
|
||||
:refresher-triggered="refreshing"
|
||||
@scrolltolower="onLoadMore"
|
||||
:lower-threshold="100"
|
||||
>
|
||||
<view class="history-item" v-for="(item, index) in historyList" :key="index" @click="onItemClick(item)">
|
||||
<view class="thumbnail">
|
||||
<up-image :src="item.thumbnail" width="200rpx" height="120rpx" mode="aspectFill"></up-image>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="title">{{ item.title }}</view>
|
||||
<view class="author">{{ item.author }}</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 加载更多提示 -->
|
||||
<view v-if="loading" class="loading-more">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 没有更多数据提示 -->
|
||||
<view v-if="noMore" class="no-more">
|
||||
<text>没有更多数据了</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
const refreshing = ref(false);
|
||||
const loading = ref(false);
|
||||
const noMore = ref(false);
|
||||
const page = ref(1);
|
||||
const pageSize = ref(10);
|
||||
const historyList = ref([
|
||||
{
|
||||
thumbnail: '/static/bo_bg.png',
|
||||
title: '隐球菌性脑膜(脑)炎的诊治',
|
||||
author: '蒋荣猛'
|
||||
},
|
||||
{
|
||||
thumbnail: '/static/bo_bg.png',
|
||||
title: '南京市第二医院疑难肝病病理读片会暨疑难肝病MDT 第135期',
|
||||
author: '南京市第二医院'
|
||||
},
|
||||
{
|
||||
thumbnail: '/static/bo_bg.png',
|
||||
title: '徐医感染: 硬化出血发热路, 关关难过关关过',
|
||||
author: '徐州医科大学附属医院感染科'
|
||||
},
|
||||
{
|
||||
thumbnail: '/static/bo_bg.png',
|
||||
title: '自身免疫性肝病专栏|免疫治疗的双刃剑——1例自身免疫肝炎患者的…',
|
||||
author: '首都医科大学附属北京佑安医院…'
|
||||
},
|
||||
{
|
||||
thumbnail: '/static/bo_bg.png',
|
||||
title: '慢性乙肝功能性治愈讨论',
|
||||
author: '庄辉'
|
||||
},
|
||||
{
|
||||
thumbnail: '/static/bo_bg.png',
|
||||
title: '《2025年版慢加急性肝衰竭指南》解读',
|
||||
author: '陈煜'
|
||||
},
|
||||
{
|
||||
thumbnail: '/static/bo_bg.png',
|
||||
title: '《2025年版慢加急性肝衰竭指南》解读',
|
||||
author: '陈煜'
|
||||
},
|
||||
{
|
||||
thumbnail: '/static/bo_bg.png',
|
||||
title: '慢性乙肝功能性治愈讨论',
|
||||
author: '庄辉'
|
||||
}
|
||||
]);
|
||||
|
||||
const goBack = () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
|
||||
const onEdit = () => {
|
||||
uni.showToast({ title: '编辑功能', icon: 'none' });
|
||||
};
|
||||
|
||||
const onItemClick = (item) => {
|
||||
uni.showToast({ title: `点击了: ${item.title}`, icon: 'none' });
|
||||
};
|
||||
|
||||
const onRefresh = () => {
|
||||
refreshing.value = true;
|
||||
page.value = 1;
|
||||
noMore.value = false;
|
||||
|
||||
// 模拟刷新数据
|
||||
setTimeout(() => {
|
||||
refreshing.value = false;
|
||||
uni.showToast({ title: '刷新完成', icon: 'success' });
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
const onLoadMore = () => {
|
||||
if (loading.value || noMore.value) return;
|
||||
|
||||
loading.value = true;
|
||||
|
||||
// 模拟加载更多数据
|
||||
setTimeout(() => {
|
||||
// 这里可以调用API加载更多数据
|
||||
// 示例:添加更多数据到列表
|
||||
if (page.value < 3) { // 模拟只有3页数据
|
||||
page.value++;
|
||||
// 可以在这里添加新的数据到 historyList
|
||||
uni.showToast({ title: '加载完成', icon: 'success' });
|
||||
} else {
|
||||
noMore.value = true;
|
||||
}
|
||||
loading.value = false;
|
||||
}, 1000);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.video-history-page {
|
||||
min-height: 100vh;
|
||||
background: #f9f9f9;
|
||||
}
|
||||
|
||||
.history-list {
|
||||
height: calc(100vh - 140rpx);
|
||||
position: fixed;
|
||||
top:140rpx;
|
||||
bottom:0;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
color: #8B2316;
|
||||
font-size: 28rpx;
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.history-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
background: #ffffff;
|
||||
margin-bottom: 2rpx;
|
||||
|
||||
.thumbnail {
|
||||
margin-right: 20rpx;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
height: 120rpx;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
margin-right: 20rpx;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 10rpx;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.author {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.loading-more, .no-more {
|
||||
text-align: center;
|
||||
padding: 30rpx;
|
||||
color: #999999;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
</style>
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="demo-page">
|
||||
<view class="demo-header">
|
||||
<text class="demo-title">课程页面演示</text>
|
||||
<text class="demo-title">课程页面演示1</text>
|
||||
</view>
|
||||
|
||||
<view class="demo-content">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user