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.

562 lines
12 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 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">
  55. <span class="write" @click="writeWorks(work.groupId,work.submit)">写作业</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%; /* 假设桌面布局的容器宽度为 80% */
  67. margin: 0 auto; /* 居中对齐 */
  68. }
  69. body{
  70. margin: 0;
  71. }
  72. .work-name {
  73. opacity: 1;
  74. /** 文本1 */
  75. font-size: 1.5vw;
  76. font-weight: 700;
  77. letter-spacing: 0px;
  78. color: rgba(53, 56, 112, 1);
  79. text-align: left;
  80. /*左对齐*/
  81. vertical-align: top;
  82. /* 这个属性在 Flex 容器中不起作用,将被移除 */
  83. display: flex;
  84. /* 启用 Flexbox 布局 */
  85. align-items: center;
  86. /* 垂直居中 */
  87. height: 30%;
  88. /* 设置高度,根据需要调整 */
  89. width: 50%;
  90. /* 如果需要,也可以设置宽度 */
  91. }
  92. .ketangzuoye {
  93. margin-top: 2vh;
  94. margin-left: 2vw;
  95. width: 43%;
  96. }
  97. .book {
  98. float: right;
  99. margin-right: 1vw;
  100. width: 30%;
  101. }
  102. /* 手机 */
  103. @media (max-width: 768px) {
  104. .container {
  105. width: 100%;
  106. margin: auto;
  107. }
  108. .works {
  109. /* ../api/ShowApi
  110. work\src\assets\bg@3x.png */
  111. background-image: url('../assets/bg.png');
  112. background-size: 100% 100%;
  113. background-color: #8f98f6;
  114. width: 100%;
  115. min-height: 100vh;
  116. position: relative;
  117. margin: auto;
  118. }
  119. .work-list {
  120. width: 95%;
  121. display: flex;
  122. justify-content: center;
  123. align-items: center;
  124. flex-direction: column;
  125. margin: auto;
  126. }
  127. .list {
  128. display: flex;
  129. justify-content: center;
  130. align-items: center;
  131. width: 97%;
  132. height: 16vh;
  133. opacity: 1;
  134. border-radius: 10px;
  135. background-color: rgba(255, 225, 174, 1);
  136. margin-bottom: 3%;
  137. }
  138. .work-item {
  139. width: 87%;
  140. height: 63%;
  141. padding: 10px;
  142. position: relative;
  143. background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(250, 245, 235, 1) 100%);
  144. border-radius: 10px;
  145. border-radius: 10px;
  146. }
  147. .work-name {
  148. opacity: 1;
  149. /** 文本1 */
  150. font-size: 4vw;
  151. font-weight: 700;
  152. letter-spacing: 0px;
  153. color: rgba(53, 56, 112, 1);
  154. text-align: left;
  155. /*左对齐*/
  156. vertical-align: top;
  157. /* 这个属性在 Flex 容器中不起作用,将被移除 */
  158. display: flex;
  159. /* 启用 Flexbox 布局 */
  160. align-items: center;
  161. /* 垂直居中 */
  162. height: 30%;
  163. /* 设置高度,根据需要调整 */
  164. width: 50%;
  165. /* 如果需要,也可以设置宽度 */
  166. }
  167. .work-content {
  168. width: 95%;
  169. height: 35%;
  170. position: absolute;
  171. bottom: 10%;
  172. display: flex;
  173. }
  174. .work-time {
  175. position: absolute;
  176. display: flex;
  177. width: 70%;
  178. bottom: 12%;
  179. }
  180. .deadline {
  181. color: rgba(142, 142, 142, 1);
  182. font-size: 3.6vw;
  183. opacity: 1;
  184. align-items: center;
  185. padding-top: 0.5vw;
  186. /* 水平居中 */
  187. /* justify-content: center; */
  188. }
  189. .work-status {
  190. font-size: 3.8vw;
  191. display: inline-block;
  192. background: rgba(53, 56, 112, 0.1);
  193. padding: 1% 3.5%;
  194. text-align: center;
  195. color: #353870;
  196. border-radius: 5px;
  197. opacity: 2;
  198. margin-left: 5px;
  199. }
  200. .work-status2 {
  201. font-size: 3.8vw;
  202. display: inline-block;
  203. background: #ffe1ae;
  204. padding: 1% 3.5%;
  205. text-align: center;
  206. color: #353870;
  207. border-radius: 5px;
  208. opacity: 2;
  209. margin-left: 5px;
  210. }
  211. .work-bottem {
  212. cursor: pointer;
  213. display: flex;
  214. position: absolute;
  215. width: 28%;
  216. height: 70%;
  217. right: 0;
  218. bottom: 2%;
  219. opacity: 1;
  220. border-radius: 50px;
  221. background: linear-gradient(270deg, rgba(4, 15, 179, 1) 0%, rgba(120, 89, 255, 1) 100%);
  222. border: 1px solid #a5e0f3;
  223. justify-content: center;
  224. /* 水平居中 */
  225. align-items: center;
  226. /* 垂直居中 */
  227. text-align: center;
  228. /* 确保文本在其容器内居中 */
  229. }
  230. .write {
  231. opacity: 1;
  232. /** 文本1 */
  233. padding: auto;
  234. font-size: 18px;
  235. font-weight: 700;
  236. letter-spacing: 0px;
  237. line-height: 26.06px;
  238. color: rgba(255, 255, 255, 1);
  239. }
  240. }
  241. /* 平板 */
  242. @media (min-width: 768px) and (max-width:1280px) {
  243. .container {
  244. width: 100%;
  245. margin: auto;
  246. }
  247. .works {
  248. /* ../api/ShowApi
  249. work\src\assets\bg@3x.png */
  250. background-image: url('../assets/bg@2x.png');
  251. background-color: #8f98f6;
  252. width: 100%;
  253. min-height: 100vh;
  254. position: relative;
  255. margin: auto;
  256. background-size: 100% 100%;
  257. }
  258. .work-list {
  259. width: 95%;
  260. display: flex;
  261. justify-content: center;
  262. align-items: center;
  263. flex-direction: column;
  264. margin: auto;
  265. }
  266. .list {
  267. display: flex;
  268. justify-content: center;
  269. align-items: center;
  270. width: 97%;
  271. height: 17vh;
  272. opacity: 1;
  273. border-radius: 10px;
  274. background-color: rgba(255, 225, 174, 1);
  275. margin-bottom: 3%;
  276. }
  277. .work-item {
  278. width: 90%;
  279. height: 70%;
  280. padding: 10px;
  281. position: relative;
  282. background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(250, 245, 235, 1) 100%);
  283. border-radius: 10px;
  284. border-radius: 10px;
  285. }
  286. .work-name {
  287. opacity: 1;
  288. /** 文本1 */
  289. font-size: 1.6rem;
  290. font-weight: 700;
  291. letter-spacing: 0px;
  292. color: rgba(53, 56, 112, 1);
  293. text-align: left;
  294. /*左对齐*/
  295. vertical-align: top;
  296. /* 这个属性在 Flex 容器中不起作用,将被移除 */
  297. display: flex;
  298. /* 启用 Flexbox 布局 */
  299. align-items: center;
  300. /* 垂直居中 */
  301. height: 30%;
  302. /* 设置高度,根据需要调整 */
  303. width: 50%;
  304. /* 如果需要,也可以设置宽度 */
  305. }
  306. .work-content {
  307. width: 90%;
  308. height: 35%;
  309. position: absolute;
  310. bottom: 10%;
  311. display: flex;
  312. }
  313. .work-time {
  314. position: absolute;
  315. display: flex;
  316. width: 70%;
  317. bottom: 20%;
  318. }
  319. .deadline {
  320. color: rgba(142, 142, 142, 1);
  321. font-size: 14px;
  322. opacity: 1;
  323. }
  324. .work-status {
  325. display: inline-block;
  326. background: rgba(53, 56, 112, 0.1);
  327. padding: 0.5% 2%;
  328. text-align: center;
  329. color: #353870;
  330. font-size: 1rem;
  331. border-radius: 5px;
  332. opacity: 2;
  333. margin-left: 5px;
  334. }
  335. .work-status2 {
  336. display: inline-block;
  337. background: #ffe1ae;
  338. padding: 0.5% 2%;
  339. text-align: center;
  340. color: #353870;
  341. font-size: 1rem;
  342. border-radius: 5px;
  343. opacity: 2;
  344. margin-left: 5px;
  345. }
  346. .work-bottem {
  347. cursor: pointer;
  348. display: flex;
  349. position: absolute;
  350. width: 25%;
  351. height: 70%;
  352. right: 0%;
  353. bottom: 2%;
  354. opacity: 1;
  355. border-radius: 50px;
  356. background: linear-gradient(270deg, rgba(4, 15, 179, 1) 0%, rgba(120, 89, 255, 1) 100%);
  357. border: 1px solid #a5e0f3;
  358. justify-content: center;
  359. /* 水平居中 */
  360. align-items: center;
  361. /* 垂直居中 */
  362. text-align: center;
  363. /* 确保文本在其容器内居中 */
  364. }
  365. .write {
  366. opacity: 1;
  367. /** 文本1 */
  368. padding: auto;
  369. font-size: 1.125rem;
  370. font-weight: 700;
  371. letter-spacing: 0px;
  372. line-height: 26.06px;
  373. color: rgba(255, 255, 255, 1);
  374. }
  375. }
  376. /* 电脑 */
  377. @media (min-width: 1280px) {
  378. .container {
  379. width: 27%;
  380. margin: auto;
  381. }
  382. .works {
  383. /* ../api/ShowApi
  384. work\src\assets\bg@3x.png */
  385. background-image: url('../assets/bg@3x.png');
  386. background-color: #8f98f6;
  387. width: 100%;
  388. min-height: 100vh;
  389. position: relative;
  390. margin: auto;
  391. background-size: 100% 100%;
  392. }
  393. .work-name {
  394. opacity: 1;
  395. /** 文本1 */
  396. font-size: 1.4vw;
  397. font-weight: 700;
  398. letter-spacing: 0px;
  399. color: rgba(53, 56, 112, 1);
  400. text-align: left;
  401. /*左对齐*/
  402. vertical-align: top;
  403. /* 这个属性在 Flex 容器中不起作用,将被移除 */
  404. display: flex;
  405. /* 启用 Flexbox 布局 */
  406. align-items: center;
  407. /* 垂直居中 */
  408. height: 30%;
  409. /* 设置高度,根据需要调整 */
  410. width: 70%;
  411. }
  412. .work-list {
  413. width: 95%;
  414. display: flex;
  415. justify-content: center;
  416. align-items: center;
  417. flex-direction: column;
  418. margin: auto;
  419. }
  420. .list {
  421. display: flex;
  422. justify-content: center;
  423. align-items: center;
  424. width: 97%;
  425. height: 17vh;
  426. opacity: 1;
  427. border-radius: 10px;
  428. background-color: rgba(255, 225, 174, 1);
  429. margin-bottom: 3%;
  430. }
  431. .work-item {
  432. width: 90%;
  433. height: 70%;
  434. padding: 10px;
  435. position: relative;
  436. background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(250, 245, 235, 1) 100%);
  437. border-radius: 10px;
  438. border-radius: 10px;
  439. }
  440. .work-content {
  441. width: 90%;
  442. height: 35%;
  443. position: absolute;
  444. bottom: 10%;
  445. display: flex;
  446. }
  447. .work-time {
  448. position: absolute;
  449. display: flex;
  450. width: 70%;
  451. bottom: 15%;
  452. }
  453. .deadline {
  454. color: rgba(142, 142, 142, 1);
  455. font-size: 14px;
  456. opacity: 1;
  457. align-items: center;
  458. padding-top: 0.2vw;
  459. }
  460. .work-status {
  461. display: inline-block;
  462. background: rgba(53, 56, 112, 0.1);
  463. padding: 0.5% 2%;
  464. text-align: center;
  465. color: #353870;
  466. font-size: 1rem;
  467. border-radius: 5px;
  468. opacity: 2;
  469. margin-left: 5px;
  470. }
  471. .work-status2 {
  472. display: inline-block;
  473. background: #ffe1ae;
  474. padding: 0.5% 2%;
  475. text-align: center;
  476. color: #353870;
  477. font-size: 1rem;
  478. border-radius: 5px;
  479. opacity: 2;
  480. margin-left: 5px;
  481. }
  482. .work-bottem {
  483. cursor: pointer;
  484. display: flex;
  485. position: absolute;
  486. width: 25%;
  487. height: 70%;
  488. right: 0%;
  489. bottom: 2%;
  490. opacity: 1;
  491. border-radius: 50px;
  492. background: linear-gradient(270deg, rgba(4, 15, 179, 1) 0%, rgba(120, 89, 255, 1) 100%);
  493. border: 1px solid #a5e0f3;
  494. justify-content: center;
  495. /* 水平居中 */
  496. align-items: center;
  497. /* 垂直居中 */
  498. text-align: center;
  499. /* 确保文本在其容器内居中 */
  500. }
  501. .write {
  502. opacity: 1;
  503. /** 文本1 */
  504. padding: auto;
  505. font-size: 1.125rem;
  506. font-weight: 700;
  507. letter-spacing: 0px;
  508. line-height: 26.06px;
  509. color: rgba(255, 255, 255, 1);
  510. }
  511. }
  512. .work-list{
  513. margin-top: 12%;
  514. }
  515. </style>