airClassroom.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. <template>
  2. <view class="container">
  3. <!-- 筛选标签栏 -->
  4. <view class="filter-bar">
  5. <view class="filter-tabs">
  6. <view class="tab-item"
  7. :class="{ active: currentTab === item.value }"
  8. v-for="(item, index) in tabs"
  9. :key="index"
  10. @click="switchTab(item.value)">
  11. {{ item.label }}
  12. </view>
  13. </view>
  14. <view class="filter-divider"></view>
  15. <view class="filter-btn" @click="showFilter = true">
  16. <image class="w32 h32" src="@/static/image/icon_select.png" mode=""></image>
  17. </view>
  18. </view>
  19. <!-- 任务列表 -->
  20. <scroll-view class="content" scroll-y>
  21. <view class="task-card" v-for="(item, index) in taskList" :key="index" @click="showDetail(item)">
  22. <view class="card-header">
  23. <view class="card-title">{{ item.title }}</view>
  24. <view class="status-tag" :class="item.status">
  25. {{ item.statusText }}
  26. </view>
  27. </view>
  28. <view class="card-tags">
  29. <view class="tag-item video-tag" v-if="item.videoType">
  30. <image class="w28 h28 mr10" src="@/static/image/icon_longvideo.png" mode=""></image>
  31. <text>{{ item.videoType }}</text>
  32. </view>
  33. <view class="tag-item" v-if="item.category">
  34. {{ item.category }}
  35. </view>
  36. <view class="tag-item points-tag">
  37. {{ item.points }}积分
  38. </view>
  39. <view class="tag-item">
  40. {{ item.count }}个
  41. </view>
  42. </view>
  43. <view class="card-dates">
  44. <view class="date-item">
  45. <text>开始时间: {{ item.startTime }}</text>
  46. </view>
  47. <view class="date-item">
  48. <text>结束时间: {{ item.endTime }}</text>
  49. </view>
  50. </view>
  51. <view class="card-warning" v-if="item.warning">
  52. <text class="warning-icon">⚠</text>
  53. <text>{{ item.warning }}</text>
  54. </view>
  55. <view class="card-rejection" v-if="item.rejectionReason">
  56. <text class="rejection-icon">❌</text>
  57. <text>驳回原因: {{ item.rejectionReason }}</text>
  58. </view>
  59. <view class="card-footer">
  60. <view class="footer-date">{{ item.createTime }}</view>
  61. <view class="footer-actions">
  62. <view class="action-btn" v-if="item.status === 'pending'" @click="goComplete(item)">
  63. 去完成
  64. </view>
  65. <view class="action-btn" v-if="item.status === 'rejected'" @click="goEdit(item)">
  66. 编辑
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </scroll-view>
  72. <!-- 筛选弹窗 -->
  73. <view class="filter-popup" v-if="showFilter" @click="closeFilter">
  74. <view class="filter-content" @click.stop>
  75. <view class="filter-header">
  76. <view class="filter-title">筛选</view>
  77. <view class="filter-close-btn" @click="closeFilter">×</view>
  78. </view>
  79. <!-- 申请时间筛选 -->
  80. <view class="filter-group">
  81. <view class="group-label">申请时间</view>
  82. <view class="date-range-inputs">
  83. <picker mode="date" :value="tempDateRange.startDate" @change="onStartDateChange">
  84. <view class="date-input" :class="{ placeholder: !tempDateRange.startDate }">
  85. {{ tempDateRange.startDate || '开始时间' }}
  86. </view>
  87. </picker>
  88. <text class="date-separator">-</text>
  89. <picker mode="date" :value="tempDateRange.endDate" @change="onEndDateChange">
  90. <view class="date-input" :class="{ placeholder: !tempDateRange.endDate }">
  91. {{ tempDateRange.endDate || '结束时间' }}
  92. </view>
  93. </picker>
  94. </view>
  95. </view>
  96. <!-- 操作按钮 -->
  97. <view class="filter-actions">
  98. <view class="reset-btn" @click="resetFilters">重置</view>
  99. <view class="confirm-btn" @click="confirmFilters">确定</view>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. </template>
  105. <script>
  106. import { getAirClassroomList } from '@/api-js/airClassroom'
  107. export default {
  108. data() {
  109. return {
  110. statusBarHeight: uni.getSystemInfoSync().statusBarHeight + 'px',
  111. currentTab: 'all',
  112. showFilter: false,
  113. dateRange: {
  114. startDate: '',
  115. endDate: ''
  116. },
  117. tempDateRange: {
  118. startDate: '',
  119. endDate: ''
  120. },
  121. tabs: [
  122. { label: '全部', value: 'all' },
  123. { label: '未完成', value: 'pending' },
  124. { label: '待审核', value: 'reviewing' },
  125. { label: '已通过', value: 'approved' },
  126. { label: '已驳回', value: 'rejected' }
  127. ],
  128. taskList: []
  129. }
  130. },
  131. watch: {
  132. showFilter(newVal) {
  133. if (newVal) {
  134. // 打开弹窗时,同步临时日期范围为当前日期范围
  135. this.tempDateRange = {
  136. startDate: this.dateRange.startDate,
  137. endDate: this.dateRange.endDate
  138. }
  139. }
  140. }
  141. },
  142. onLoad() {
  143. this.loadData()
  144. },
  145. onReachBottom() {
  146. this.loadMore()
  147. },
  148. methods: {
  149. goBack() {
  150. uni.navigateBack()
  151. },
  152. switchTab(value) {
  153. this.currentTab = value
  154. this.loadData()
  155. },
  156. closeFilter() {
  157. // 关闭弹窗时,恢复临时日期范围为当前日期范围
  158. this.tempDateRange = {
  159. startDate: this.dateRange.startDate,
  160. endDate: this.dateRange.endDate
  161. }
  162. this.showFilter = false
  163. },
  164. onStartDateChange(e) {
  165. this.tempDateRange.startDate = e.detail.value
  166. },
  167. onEndDateChange(e) {
  168. this.tempDateRange.endDate = e.detail.value
  169. },
  170. resetFilters() {
  171. this.tempDateRange = {
  172. startDate: '',
  173. endDate: ''
  174. }
  175. },
  176. confirmFilters() {
  177. // 验证日期范围
  178. if (this.tempDateRange.startDate && this.tempDateRange.endDate) {
  179. if (new Date(this.tempDateRange.startDate) > new Date(this.tempDateRange.endDate)) {
  180. uni.showToast({
  181. icon: 'none',
  182. title: '开始时间不能大于结束时间'
  183. })
  184. return
  185. }
  186. }
  187. this.dateRange = {
  188. startDate: this.tempDateRange.startDate,
  189. endDate: this.tempDateRange.endDate
  190. }
  191. this.showFilter = false
  192. this.loadData()
  193. },
  194. goComplete(item) {
  195. uni.navigateTo({
  196. url: `/pages_task/completeTask?id=${item.id}`
  197. })
  198. },
  199. goEdit(item) {
  200. uni.navigateTo({
  201. url: `/pages_task/completeTask?id=${item.id}&edit=true`
  202. })
  203. },
  204. // 查看详情
  205. showDetail(item) {
  206. uni.navigateTo({
  207. url: `/pages_task/taskDetail?id=${item.id}`
  208. })
  209. },
  210. async loadData() {
  211. try {
  212. uni.showLoading({ title: '加载中...' })
  213. const res = await getAirClassroomList({
  214. status: this.currentTab,
  215. startDate: this.dateRange.startDate,
  216. endDate: this.dateRange.endDate,
  217. page: 1,
  218. pageSize: 20
  219. })
  220. uni.hideLoading()
  221. if (res.code === 200 && res.data) {
  222. this.taskList = res.data.list || this.getDefaultData()
  223. } else {
  224. this.taskList = this.getDefaultData()
  225. }
  226. } catch (e) {
  227. uni.hideLoading()
  228. console.error('加载数据失败', e)
  229. this.taskList = this.getDefaultData()
  230. }
  231. },
  232. async loadMore() {
  233. // 加载更多数据
  234. },
  235. getDefaultData() {
  236. return [
  237. {
  238. id: 1,
  239. title: '王小明医生空中任务',
  240. videoType: '长视频',
  241. category: '学术',
  242. points: '10',
  243. count: '1',
  244. startTime: '2025-9-20 13:55',
  245. endTime: '2025-9-20 13:55',
  246. createTime: '2025-9-20 13:55',
  247. status: 'pending',
  248. statusText: '待完成'
  249. },
  250. {
  251. id: 2,
  252. title: '王小明医生空中任务',
  253. videoType: '长视频',
  254. category: '学术',
  255. points: '10',
  256. count: '1',
  257. startTime: '2025-9-20 13:55',
  258. endTime: '2025-9-20 13:55',
  259. createTime: '2025-9-20 13:55',
  260. status: 'pending',
  261. statusText: '待完成',
  262. warning: '有效观看不足5人'
  263. },
  264. {
  265. id: 3,
  266. title: '王小明医生空中任务',
  267. videoType: '短视频',
  268. category: '学术',
  269. points: '10',
  270. count: '1',
  271. startTime: '2025-9-20 13:55',
  272. endTime: '2025-9-20 13:55',
  273. createTime: '2025-9-20 13:55',
  274. status: 'reviewing',
  275. statusText: '待审核'
  276. },
  277. {
  278. id: 4,
  279. title: '王小明医生空中任务',
  280. videoType: '文章',
  281. category: '学术',
  282. points: '10',
  283. count: '1',
  284. startTime: '2025-9-20 13:55',
  285. endTime: '2025-9-20 13:55',
  286. createTime: '2025-9-20 13:55',
  287. status: 'rejected',
  288. statusText: '已驳回',
  289. rejectionReason: '交付物无效,请重新编辑'
  290. },
  291. {
  292. id: 5,
  293. title: '王小明医生空中任务',
  294. videoType: '长视频',
  295. category: '学术',
  296. points: '10',
  297. count: '1',
  298. startTime: '2025-9-20 13:55',
  299. endTime: '2025-9-20 13:55',
  300. createTime: '2025-9-20 13:55',
  301. status: 'approved',
  302. statusText: '已通过'
  303. }
  304. ]
  305. }
  306. }
  307. }
  308. </script>
  309. <style lang="scss" scoped>
  310. .container {
  311. min-height: 100vh;
  312. background: #f5f5f5;
  313. display: flex;
  314. flex-direction: column;
  315. }
  316. .status-bar {
  317. width: 100%;
  318. background: #fff;
  319. }
  320. .header {
  321. position: relative;
  322. height: 88rpx;
  323. display: flex;
  324. align-items: center;
  325. justify-content: center;
  326. background: #fff;
  327. border-bottom: 1rpx solid #f0f0f0;
  328. .back-btn {
  329. position: absolute;
  330. left: 24rpx;
  331. width: 40rpx;
  332. height: 40rpx;
  333. image {
  334. width: 100%;
  335. height: 100%;
  336. }
  337. }
  338. .title {
  339. font-size: 36rpx;
  340. font-weight: bold;
  341. color: #333;
  342. }
  343. .header-right {
  344. position: absolute;
  345. right: 24rpx;
  346. display: flex;
  347. align-items: center;
  348. gap: 16rpx;
  349. .more-icon {
  350. font-size: 32rpx;
  351. color: #333;
  352. }
  353. }
  354. }
  355. .filter-bar {
  356. display: flex;
  357. align-items: center;
  358. background: #fff;
  359. padding: 0 24rpx;
  360. border-bottom: 1rpx solid #f0f0f0;
  361. .filter-tabs {
  362. flex: 1;
  363. display: flex;
  364. align-items: center;
  365. gap: 32rpx;
  366. overflow-x: auto;
  367. .tab-item {
  368. padding: 24rpx 0;
  369. font-size: 28rpx;
  370. color: #666;
  371. white-space: nowrap;
  372. position: relative;
  373. &.active {
  374. color: #388BFF;
  375. font-weight: bold;
  376. &::after {
  377. content: '';
  378. position: absolute;
  379. bottom: 0;
  380. left: 0;
  381. right: 0;
  382. height: 4rpx;
  383. background: #388BFF;
  384. }
  385. }
  386. }
  387. }
  388. .filter-divider {
  389. width: 1rpx;
  390. height: 40rpx;
  391. background: #e0e0e0;
  392. margin: 0 16rpx;
  393. }
  394. .filter-btn {
  395. padding: 24rpx 0;
  396. .filter-icon {
  397. font-size: 32rpx;
  398. color: #333;
  399. }
  400. }
  401. }
  402. .content {
  403. flex: 1;
  404. padding: 24rpx;
  405. box-sizing: border-box;
  406. }
  407. .task-card {
  408. background: #fff;
  409. border-radius: 16rpx;
  410. padding: 24rpx;
  411. margin-bottom: 24rpx;
  412. .card-header {
  413. display: flex;
  414. align-items: flex-start;
  415. justify-content: space-between;
  416. margin-bottom: 16rpx;
  417. .card-title {
  418. flex: 1;
  419. font-size: 32rpx;
  420. font-weight: bold;
  421. color: #333;
  422. }
  423. .status-tag {
  424. padding: 8rpx 16rpx;
  425. border-radius: 20rpx;
  426. font-size: 24rpx;
  427. &.pending {
  428. background: #E3F2FD;
  429. color: #2196F3;
  430. }
  431. &.reviewing {
  432. background: #FFF3E0;
  433. color: #FF9800;
  434. }
  435. &.approved {
  436. background: #E8F5E9;
  437. color: #4CAF50;
  438. }
  439. &.rejected {
  440. background: #FFEBEE;
  441. color: #F44336;
  442. }
  443. }
  444. }
  445. .card-tags {
  446. display: flex;
  447. align-items: center;
  448. flex-wrap: wrap;
  449. gap: 12rpx;
  450. margin-bottom: 16rpx;
  451. .tag-item {
  452. padding: 8rpx 16rpx;
  453. background:#FFFAF4;
  454. border-radius: 8rpx;
  455. font-size: 24rpx;
  456. color: #5D410F;
  457. display: flex;
  458. align-items: center;
  459. &.video-tag {
  460. background: linear-gradient( 90deg, #FFE9C7 0%, #F3D091 100%);
  461. .tag-icon {
  462. margin-right: 4rpx;
  463. }
  464. }
  465. &.points-tag {
  466. border: 1rpx solid #388BFF;
  467. color: #388BFF;
  468. background: transparent;
  469. }
  470. }
  471. }
  472. .card-dates {
  473. margin-bottom: 16rpx;
  474. .date-item {
  475. font-size: 26rpx;
  476. color: #999;
  477. margin-bottom: 8rpx;
  478. }
  479. }
  480. .card-warning {
  481. display: flex;
  482. align-items: center;
  483. gap: 8rpx;
  484. padding: 12rpx;
  485. background: #FFF3E0;
  486. border-radius: 8rpx;
  487. margin-bottom: 16rpx;
  488. font-size: 26rpx;
  489. color: #FF9800;
  490. .warning-icon {
  491. font-size: 28rpx;
  492. }
  493. }
  494. .card-rejection {
  495. display: flex;
  496. align-items: center;
  497. gap: 8rpx;
  498. padding: 12rpx;
  499. background: #FFEBEE;
  500. border-radius: 8rpx;
  501. margin-bottom: 16rpx;
  502. font-size: 26rpx;
  503. color: #F44336;
  504. .rejection-icon {
  505. font-size: 28rpx;
  506. }
  507. }
  508. .card-footer {
  509. display: flex;
  510. align-items: center;
  511. justify-content: space-between;
  512. padding-top: 16rpx;
  513. border-top: 1rpx solid #f0f0f0;
  514. .footer-date {
  515. font-size: 24rpx;
  516. color: #999;
  517. }
  518. .footer-actions {
  519. .action-btn {
  520. padding: 12rpx 32rpx;
  521. background: #388BFF;
  522. border-radius: 8rpx;
  523. font-size: 28rpx;
  524. color: #fff;
  525. }
  526. }
  527. }
  528. }
  529. .filter-popup {
  530. position: fixed;
  531. top: 0;
  532. left: 0;
  533. right: 0;
  534. bottom: 0;
  535. background: rgba(0, 0, 0, 0.5);
  536. z-index: 999;
  537. display: flex;
  538. align-items: flex-end;
  539. }
  540. .filter-content {
  541. width: 100%;
  542. background: #fff;
  543. border-radius: 24rpx 24rpx 0 0;
  544. padding: 24rpx;
  545. .filter-header {
  546. display: flex;
  547. align-items: center;
  548. justify-content: space-between;
  549. margin-bottom: 32rpx;
  550. .filter-title {
  551. font-size: 32rpx;
  552. font-weight: bold;
  553. color: #333;
  554. }
  555. .filter-close-btn {
  556. width: 48rpx;
  557. height: 48rpx;
  558. display: flex;
  559. align-items: center;
  560. justify-content: center;
  561. font-size: 40rpx;
  562. color: #999;
  563. }
  564. }
  565. .filter-group {
  566. margin-bottom: 32rpx;
  567. .group-label {
  568. font-size: 28rpx;
  569. font-weight: bold;
  570. color: #333;
  571. margin-bottom: 20rpx;
  572. }
  573. .date-range-inputs {
  574. display: flex;
  575. align-items: center;
  576. gap: 16rpx;
  577. .date-input {
  578. flex: 1;
  579. height: 80rpx;
  580. line-height: 80rpx;
  581. padding: 0 24rpx;
  582. background: #f5f5f5;
  583. border-radius: 8rpx;
  584. font-size: 28rpx;
  585. color: #333;
  586. text-align: center;
  587. &.placeholder {
  588. color: #999;
  589. }
  590. }
  591. .date-separator {
  592. font-size: 28rpx;
  593. color: #666;
  594. }
  595. }
  596. }
  597. .filter-actions {
  598. display: flex;
  599. gap: 24rpx;
  600. margin-top: 40rpx;
  601. padding-top: 24rpx;
  602. border-top: 1rpx solid #f0f0f0;
  603. .reset-btn,
  604. .confirm-btn {
  605. flex: 1;
  606. height: 88rpx;
  607. line-height: 88rpx;
  608. text-align: center;
  609. border-radius: 8rpx;
  610. font-size: 30rpx;
  611. }
  612. .reset-btn {
  613. background: #fff;
  614. color: #666;
  615. border: 1rpx solid #e0e0e0;
  616. }
  617. .confirm-btn {
  618. background: #388BFF;
  619. color: #fff;
  620. }
  621. }
  622. }
  623. </style>