From d6a30a98f94de7aab7f8e024f83deaa10d66b95f Mon Sep 17 00:00:00 2001 From: jiayuqi7813 <63686458+jiayuqi7813@users.noreply.github.com> Date: Fri, 24 Jun 2022 00:47:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E8=A7=A3=E9=A2=98=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/challenges/challenges.vue | 126 ++++++++++++++++++++--- 1 file changed, 110 insertions(+), 16 deletions(-) diff --git a/src/components/challenges/challenges.vue b/src/components/challenges/challenges.vue index 26b9c0e..d6411e0 100644 --- a/src/components/challenges/challenges.vue +++ b/src/components/challenges/challenges.vue @@ -34,7 +34,8 @@
- +
{{c.name}} @@ -78,19 +79,51 @@
{{challenges.description}}
-
+ +
+ + +
+
+ 附件下载 +
+
+ +
+
+
+ + + + + + + + + +
+ submit + submit + +
+  {{h}}
+
+ +
+
+ +
+
+
+
- - - - - - - - - - -
@@ -108,14 +141,20 @@ import { Setting, } from '@element-plus/icons-vue' import axios from "axios"; +import { ElNotification } from 'element-plus'; + export default { data() { return { + formData: { + flag: "", + }, challengetype: '', data:[], challenges:[], - tags:[] + tags:[], + attachment:[], } }, @@ -124,18 +163,68 @@ export default { this.challenges = this.data[index] this.tags = this.data[index].tags.split(',') + this.attachment = this.data[index].attachment + + //判断是否显示连接与附件 + if(this.attachment!=undefined && this.attachment.length==0){ + if(this.attachment[0]==''){ + console.log('no link') + } + else{ + var link = document.getElementById("link"); + link.href = this.attachment[0]; + } + if(this.attachment[1]==''){ + var file = document.getElementById("file"); + file.href = this.attachment[1]; + } + + } + + }, + submitflag(){ + //提交flag + axios({ + method:'post', + url:'/api/v1/user/submitflag', + headers:{ + 'Content-Type':'application/json;charset=UTF-8' + }, + data:{ + "cid":this.challenges.id, + "flag":this.formData.flag, + } + }).then(res=>{ + console.log(res.data) + if(res.data.code===200){ + ElNotification.success({ + title: 'Success', + message: '提交成功', + duration: 2000 + }); + this.formData.flag = '' + } + else{ + ElNotification.error({ + title: '提交失败', + message: res.data.msg, + duration: 2000 + }); + + } + }) }, - + //选中分类 handleSelect(index) { this.challengetype = index; axios.get("/api/v1/user/challenges/" + index).then(res => { if (res.data.code === 200) { - this.data = res.data.data; } }) this.challenges=[]; + }, } } @@ -179,6 +268,11 @@ export default { font-weight: normal; margin-top: 10px; } + .attachment{ + display: flex; + justify-content: space-between; + margin-bottom: 5px; + } } } .all-card{