airClassroom.vue 15 KB

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