science.vue 17 KB

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