science.vue 15 KB

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