science.vue 16 KB

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