You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

711 lines
16 KiB

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. <script setup>
  2. import { ref } from 'vue';
  3. import ShowApi from '../api/ShowApi';
  4. import { format } from 'date-fns';
  5. import { useRouter } from "vue-router";
  6. import { ElMessage } from "element-plus";
  7. const router = useRouter()
  8. //作业展示列表
  9. const works = ref([]);
  10. function loadWorks() {
  11. ShowApi.getWorks().then(result => {
  12. works.value = result.data;
  13. console.log(works.value);
  14. console.log(result.data);
  15. works.value.forEach(work => {
  16. let date = work.endData;
  17. work.endData = format(new Date(date), 'yyyy-MM-dd');
  18. });
  19. })
  20. }
  21. loadWorks();
  22. //跳转写作业页面
  23. function writeWorks(id, sub) {
  24. if (sub >= 3) {
  25. ElMessage.error('每个作业可提交3次,您已提交3次。')
  26. } else {
  27. router.push({
  28. path: `/doWork/${id}/${sub}`
  29. })
  30. }
  31. }
  32. </script>
  33. <template>
  34. <div class="container">
  35. <div class="works">
  36. <div class="work-header">
  37. <img class="ketangzuoye" src="http://39.101.133.168:8857/LiveActivity/img/ketangzuoye.cc888815.png">
  38. <img class="book"
  39. src="https://img.js.design/assets/img/65f9235904fb00a3ea731672.png#dcda48ae8da37daeccd6583d45c7790b">
  40. </div>
  41. <div class="work-list">
  42. <div class="list" v-for="work in works">
  43. <div class="work-item">
  44. <div class="work-name">
  45. {{ work.name }}
  46. </div>
  47. <div class="work-content">
  48. <div class="work-time">
  49. <span class="deadline">截止时间{{ work.endData }}</span>
  50. <!-- 作业提价状态 -->
  51. <div v-if="work.submit == 0" class="work-status">未提交</div>
  52. <div v-else class="work-status2">已提交</div>
  53. </div>
  54. <div class="work-bottem" @click="writeWorks(work.groupId, work.submit)">
  55. <span class="write">写作业</span>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. </template>
  64. <style scoped>
  65. .container {
  66. width: 27%;
  67. /* 假设桌面布局的容器宽度为 80% */
  68. margin: 0 auto;
  69. /* 居中对齐 */
  70. }
  71. body {
  72. margin: 0;
  73. }
  74. .ketangzuoye {
  75. margin-top: 2vh;
  76. margin-left: 2vw;
  77. width: 43%;
  78. }
  79. .book {
  80. float: right;
  81. margin-right: 1vw;
  82. width: 30%;
  83. }
  84. /* 手机 */
  85. @media (max-width: 768px) {
  86. .container {
  87. width: 100%;
  88. margin: auto;
  89. }
  90. .works {
  91. /* ../api/ShowApi
  92. work\src\assets\bg@3x.png */
  93. background-image: url('../assets/bg.png');
  94. background-size: 100% 100%;
  95. background-color: #8f98f6;
  96. width: 100%;
  97. min-height: 100vh;
  98. position: relative;
  99. margin: auto;
  100. }
  101. .work-list {
  102. width: 95%;
  103. display: flex;
  104. justify-content: center;
  105. align-items: center;
  106. flex-direction: column;
  107. margin: auto;
  108. }
  109. .list {
  110. display: flex;
  111. justify-content: center;
  112. align-items: center;
  113. width: 97%;
  114. height: 16vh;
  115. opacity: 1;
  116. border-radius: 10px;
  117. background-color: rgba(255, 225, 174, 1);
  118. margin-bottom: 3%;
  119. }
  120. .work-item {
  121. width: 87%;
  122. height: 63%;
  123. padding: 10px;
  124. position: relative;
  125. background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(250, 245, 235, 1) 100%);
  126. border-radius: 10px;
  127. border-radius: 10px;
  128. }
  129. .work-name {
  130. opacity: 1;
  131. font-size: 3.6vw;
  132. font-weight: 700;
  133. letter-spacing: 0px;
  134. color: rgba(53, 56, 112, 1);
  135. text-align: left;
  136. width: 50%;
  137. height: 10vw;
  138. overflow: hidden;
  139. display: -webkit-box;
  140. -webkit-box-orient: vertical;
  141. -webkit-line-clamp: 2; /* 限制显示两行文本 */
  142. text-overflow: ellipsis;
  143. /* padding-top: 2vw; */
  144. }
  145. .work-content {
  146. width: 95%;
  147. height: vw;
  148. position: absolute;
  149. bottom: 4%;
  150. display: flex;
  151. }
  152. .work-time {
  153. position: absolute;
  154. display: flex;
  155. width: 70%;
  156. bottom: 12%;
  157. }
  158. .deadline {
  159. color: rgba(142, 142, 142, 1);
  160. font-size: 2.5vw;
  161. opacity: 1;
  162. align-items: center;
  163. padding-top: 0.5vw;
  164. /* 水平居中 */
  165. /* justify-content: center; */
  166. }
  167. .work-status {
  168. font-size: 2.5vw;
  169. display: inline-block;
  170. background: rgba(53, 56, 112, 0.1);
  171. padding: 1% 3.5%;
  172. text-align: center;
  173. color: #353870;
  174. border-radius: 5px;
  175. opacity: 2;
  176. margin-left: 5px;
  177. }
  178. .work-status2 {
  179. font-size: 2.5vw;
  180. display: inline-block;
  181. background: #ffe1ae;
  182. padding: 1% 3.5%;
  183. text-align: center;
  184. color: #353870;
  185. border-radius: 5px;
  186. opacity: 2;
  187. margin-left: 5px;
  188. }
  189. .work-bottem {
  190. cursor: pointer;
  191. display: flex;
  192. position: absolute;
  193. width: 28%;
  194. /* height: 70%; */
  195. right: 0;
  196. bottom: 2%;
  197. opacity: 1;
  198. border-radius: 50px;
  199. background: linear-gradient(270deg, rgba(4, 15, 179, 1) 0%, rgba(120, 89, 255, 1) 100%);
  200. border: 1px solid #a5e0f3;
  201. justify-content: center;
  202. /* 水平居中 */
  203. align-items: center;
  204. /* 垂直居中 */
  205. text-align: center;
  206. /* 确保文本在其容器内居中 */
  207. }
  208. .write {
  209. opacity: 1;
  210. /** 文本1 */
  211. padding: auto;
  212. font-size: 18px;
  213. font-weight: 700;
  214. letter-spacing: 0px;
  215. line-height: 26.06px;
  216. color: rgba(255, 255, 255, 1);
  217. }
  218. }
  219. /* 电脑 */
  220. @media (min-width: 1023px) {
  221. .container {
  222. width: 27%;
  223. margin: auto;
  224. }
  225. .works {
  226. /* ../api/ShowApi
  227. work\src\assets\bg@3x.png */
  228. background-image: url('../assets/bg@3x.png');
  229. background-color: #8f98f6;
  230. width: 100%;
  231. min-height: 100vh;
  232. position: relative;
  233. margin: auto;
  234. background-size: 100% 100%;
  235. }
  236. .work-name {
  237. opacity: 1;
  238. font-size: 1.2vw; /* 尝试使用固定像素值 */
  239. font-weight: 700;
  240. color: rgba(53, 56, 112, 1);
  241. text-align: left;
  242. width: 50%;
  243. height: 3vw;
  244. overflow: hidden;
  245. display: -webkit-box;
  246. -webkit-box-orient: vertical;
  247. -webkit-line-clamp: 2; /* 限制显示两行文本 */
  248. text-overflow: ellipsis;
  249. }
  250. .work-list {
  251. width: 95%;
  252. display: flex;
  253. justify-content: center;
  254. align-items: center;
  255. flex-direction: column;
  256. margin: auto;
  257. }
  258. .list {
  259. display: flex;
  260. justify-content: center;
  261. align-items: center;
  262. width: 97%;
  263. height: 17vh;
  264. opacity: 1;
  265. border-radius: 10px;
  266. background-color: rgba(255, 225, 174, 1);
  267. margin-bottom: 3%;
  268. }
  269. .work-item {
  270. width: 90%;
  271. height: 70%;
  272. padding: 10px;
  273. position: relative;
  274. background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(250, 245, 235, 1) 100%);
  275. border-radius: 10px;
  276. border-radius: 10px;
  277. }
  278. .work-content {
  279. width: 90%;
  280. height: 35%;
  281. position: absolute;
  282. bottom: 10%;
  283. display: flex;
  284. }
  285. .work-time {
  286. position: absolute;
  287. display: flex;
  288. width: 70%;
  289. bottom: 15%;
  290. }
  291. .deadline {
  292. color: rgba(142, 142, 142, 1);
  293. font-size: 1vw;
  294. opacity: 1;
  295. align-items: center;
  296. padding-top: 0.2vw;
  297. }
  298. .work-status {
  299. display: inline-block;
  300. background: rgba(53, 56, 112, 0.1);
  301. padding: 0.5% 2%;
  302. text-align: center;
  303. color: #353870;
  304. font-size: 1vw;
  305. border-radius: 5px;
  306. opacity: 2;
  307. margin-left: 5px;
  308. }
  309. .work-status2 {
  310. display: inline-block;
  311. background: #ffe1ae;
  312. padding: 0.5% 2%;
  313. text-align: center;
  314. color: #353870;
  315. font-size: 1vw;
  316. border-radius: 5px;
  317. opacity: 2;
  318. margin-left: 5px;
  319. }
  320. .work-bottem {
  321. cursor: pointer;
  322. display: flex;
  323. position: absolute;
  324. width: 25%;
  325. height: 70%;
  326. right: 0%;
  327. bottom: 2%;
  328. opacity: 1;
  329. border-radius: 50px;
  330. background: linear-gradient(270deg, rgba(4, 15, 179, 1) 0%, rgba(120, 89, 255, 1) 100%);
  331. border: 1px solid #a5e0f3;
  332. justify-content: center;
  333. /* 水平居中 */
  334. align-items: center;
  335. /* 垂直居中 */
  336. text-align: center;
  337. /* 确保文本在其容器内居中 */
  338. }
  339. .write {
  340. opacity: 1;
  341. /** 文本1 */
  342. padding: auto;
  343. font-size: 1.5vw;
  344. font-weight: 700;
  345. letter-spacing: 0px;
  346. line-height: 26.06px;
  347. color: rgba(255, 255, 255, 1);
  348. }
  349. }
  350. /* 平板 */
  351. @media (min-width: 766px) and (max-width:1023px) {
  352. .container {
  353. width: 100%;
  354. margin: auto;
  355. }
  356. .works {
  357. /* ../api/ShowApi
  358. work\src\assets\bg@3x.png */
  359. background-image: url('../assets/bg@2x.png');
  360. background-color: #8f98f6;
  361. width: 100%;
  362. min-height: 100vh;
  363. position: relative;
  364. margin: auto;
  365. background-size: 100% 100%;
  366. }
  367. .work-list {
  368. width: 95%;
  369. display: flex;
  370. justify-content: center;
  371. align-items: center;
  372. flex-direction: column;
  373. margin: auto;
  374. }
  375. .list {
  376. display: flex;
  377. justify-content: center;
  378. align-items: center;
  379. width: 97%;
  380. height: 17vh;
  381. opacity: 1;
  382. border-radius: 10px;
  383. background-color: rgba(255, 225, 174, 1);
  384. margin-bottom: 3%;
  385. }
  386. .work-item {
  387. width: 90%;
  388. height: 70%;
  389. padding: 10px;
  390. position: relative;
  391. background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(250, 245, 235, 1) 100%);
  392. border-radius: 10px;
  393. border-radius: 10px;
  394. }
  395. .work-name {
  396. opacity: 1;
  397. /** 文本1 */
  398. font-size: 2.7vw;
  399. font-weight: 700;
  400. letter-spacing: 0px;
  401. color: rgba(53, 56, 112, 1);
  402. text-align: left;
  403. /*左对齐*/
  404. vertical-align: top;
  405. /* 这个属性在 Flex 容器中不起作用,将被移除 */
  406. display: flex;
  407. /* 启用 Flexbox 布局 */
  408. align-items: center;
  409. /* 垂直居中 */
  410. height: 6vw;
  411. /* 设置高度,根据需要调整 */
  412. width: 50%;
  413. /* 如果需要,也可以设置宽度 */
  414. overflow: hidden;
  415. display: -webkit-box;
  416. -webkit-box-orient: vertical;
  417. -webkit-line-clamp: 2; /* 限制显示两行文本 */
  418. text-overflow: ellipsis;
  419. padding: 1vw;
  420. }
  421. .work-content {
  422. width: 90%;
  423. height: 35%;
  424. position: absolute;
  425. bottom: 5%;
  426. display: flex;
  427. }
  428. .work-time {
  429. position: absolute;
  430. display: flex;
  431. width: 70%;
  432. bottom: 20%;
  433. }
  434. .deadline {
  435. color: rgba(142, 142, 142, 1);
  436. font-size: 14px;
  437. opacity: 1;
  438. }
  439. .work-status {
  440. display: inline-block;
  441. background: rgba(53, 56, 112, 0.1);
  442. padding: 0.5% 2%;
  443. text-align: center;
  444. color: #353870;
  445. font-size: 1rem;
  446. border-radius: 5px;
  447. opacity: 2;
  448. margin-left: 5px;
  449. }
  450. .work-status2 {
  451. display: inline-block;
  452. background: #ffe1ae;
  453. padding: 0.5% 2%;
  454. text-align: center;
  455. color: #353870;
  456. font-size: 1rem;
  457. border-radius: 5px;
  458. opacity: 2;
  459. margin-left: 5px;
  460. }
  461. .work-bottem {
  462. cursor: pointer;
  463. display: flex;
  464. position: absolute;
  465. width: 25%;
  466. height: 70%;
  467. right: 0%;
  468. bottom: 2%;
  469. opacity: 1;
  470. border-radius: 50px;
  471. background: linear-gradient(270deg, rgba(4, 15, 179, 1) 0%, rgba(120, 89, 255, 1) 100%);
  472. border: 1px solid #a5e0f3;
  473. justify-content: center;
  474. /* 水平居中 */
  475. align-items: center;
  476. /* 垂直居中 */
  477. text-align: center;
  478. /* 确保文本在其容器内居中 */
  479. }
  480. .write {
  481. opacity: 1;
  482. /** 文本1 */
  483. padding: auto;
  484. font-size: 1.125rem;
  485. font-weight: 700;
  486. letter-spacing: 0px;
  487. line-height: 26.06px;
  488. color: rgba(255, 255, 255, 1);
  489. }
  490. }
  491. /* 平板 */
  492. @media (min-device-width: 768px) and (max-device-width: 1023px) {
  493. .container {
  494. width: 100%;
  495. margin: auto;
  496. }
  497. .works {
  498. /* ../api/ShowApi
  499. work\src\assets\bg@3x.png */
  500. background-image: url('../assets/bg@2x.png');
  501. background-color: #8f98f6;
  502. width: 100%;
  503. min-height: 100vh;
  504. position: relative;
  505. margin: auto;
  506. background-size: 100% 100%;
  507. }
  508. .work-list {
  509. width: 95%;
  510. display: flex;
  511. justify-content: center;
  512. align-items: center;
  513. flex-direction: column;
  514. margin: auto;
  515. }
  516. .list {
  517. display: flex;
  518. justify-content: center;
  519. align-items: center;
  520. width: 97%;
  521. height: 17vh;
  522. opacity: 1;
  523. border-radius: 10px;
  524. background-color: rgba(255, 225, 174, 1);
  525. margin-bottom: 3%;
  526. }
  527. .work-item {
  528. width: 90%;
  529. height: 70%;
  530. padding: 10px;
  531. position: relative;
  532. background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(250, 245, 235, 1) 100%);
  533. border-radius: 10px;
  534. border-radius: 10px;
  535. }
  536. .work-name {
  537. opacity: 1;
  538. /** 文本1 */
  539. font-size: 3vw;
  540. font-weight: 700;
  541. letter-spacing: 0px;
  542. color: rgba(53, 56, 112, 1);
  543. text-align: left;
  544. /*左对齐*/
  545. vertical-align: top;
  546. /* 这个属性在 Flex 容器中不起作用,将被移除 */
  547. display: flex;
  548. /* 启用 Flexbox 布局 */
  549. align-items: center;
  550. /* 垂直居中 */
  551. height: 7vw;
  552. /* 设置高度,根据需要调整 */
  553. width: 50%;
  554. /* 如果需要,也可以设置宽度 */
  555. overflow: hidden;
  556. display: -webkit-box;
  557. -webkit-box-orient: vertical;
  558. -webkit-line-clamp: 2; /* 限制显示两行文本 */
  559. text-overflow: ellipsis;
  560. padding: 1vw;
  561. }
  562. .work-content {
  563. width: 90%;
  564. height: 35%;
  565. position: absolute;
  566. bottom: 10%;
  567. display: flex;
  568. }
  569. .work-time {
  570. position: absolute;
  571. display: flex;
  572. width: 70%;
  573. bottom: 20%;
  574. }
  575. .deadline {
  576. color: rgba(142, 142, 142, 1);
  577. font-size: 14px;
  578. opacity: 1;
  579. }
  580. .work-status {
  581. display: inline-block;
  582. background: rgba(53, 56, 112, 0.1);
  583. padding: 0.5% 2%;
  584. text-align: center;
  585. color: #353870;
  586. font-size: 1rem;
  587. border-radius: 5px;
  588. opacity: 2;
  589. margin-left: 5px;
  590. }
  591. .work-status2 {
  592. display: inline-block;
  593. background: #ffe1ae;
  594. padding: 0.5% 2%;
  595. text-align: center;
  596. color: #353870;
  597. font-size: 1rem;
  598. border-radius: 5px;
  599. opacity: 2;
  600. margin-left: 5px;
  601. }
  602. .work-bottem {
  603. cursor: pointer;
  604. display: flex;
  605. position: absolute;
  606. width: 25%;
  607. height: 70%;
  608. right: 0%;
  609. bottom: 2%;
  610. opacity: 1;
  611. border-radius: 50px;
  612. background: linear-gradient(270deg, rgba(4, 15, 179, 1) 0%, rgba(120, 89, 255, 1) 100%);
  613. border: 1px solid #a5e0f3;
  614. justify-content: center;
  615. /* 水平居中 */
  616. align-items: center;
  617. /* 垂直居中 */
  618. text-align: center;
  619. /* 确保文本在其容器内居中 */
  620. }
  621. .write {
  622. opacity: 1;
  623. /** 文本1 */
  624. padding: auto;
  625. font-size: 1.125rem;
  626. font-weight: 700;
  627. letter-spacing: 0px;
  628. line-height: 26.06px;
  629. color: rgba(255, 255, 255, 1);
  630. }
  631. }
  632. .work-list {
  633. margin-top: 12%;
  634. }
  635. </style>