Squashed commit of the following:

commit 977b40cd4f
Author: zcx <1078327420@qq.com>
Date:   Fri May 10 10:44:28 2024 +0800

    新的页面代码

commit 548cc49c7d
Author: zcx <1078327420@qq.com>
Date:   Fri May 10 10:20:18 2024 +0800

    聊天界面初始版

commit ff3952859f
Merge: 7b44e8a c656856
Author: zcx <1078327420@qq.com>
Date:   Fri May 10 10:15:56 2024 +0800

    Merge branch 'develop' of https://bdgit.educoder.net/mwxbgi697/softegg into 曾晨曦_branch

    # Conflicts:
    #	doc/自由同行-软件需求构思及描述.docx

commit 7b44e8a348
Author: zcx <1078327420@qq.com>
Date:   Fri May 10 10:12:14 2024 +0800

    1

commit 5e48c1f463
Merge: 167bb2d bfb34b1
Author: zcx <1078327420@qq.com>
Date:   Fri May 10 10:10:13 2024 +0800

    Merge branch '曾晨曦_branch' of https://bdgit.educoder.net/mwxbgi697/softegg into 曾晨曦_branch

    # Conflicts:
    #	doc/“自由同行”软件需求规格说明书.docx

commit 167bb2d273
Author: zcx <1078327420@qq.com>
Date:   Fri May 10 10:09:46 2024 +0800

    前端代码初始版

commit e5d3488734
Author: zcx <1078327420@qq.com>
Date:   Sun Mar 31 11:48:46 2024 +0800

    更新

commit bfb34b10a2
Author: zcx <1078327420@qq.com>
Date:   Tue Mar 26 11:15:48 2024 +0800

    需求规格说明书

commit 26f7946e45
Author: zcx <1078327420@qq.com>
Date:   Tue Mar 26 11:08:14 2024 +0800

    1

commit 31f1339042
Merge: 3671794 9d34b69
Author: zcx <1078327420@qq.com>
Date:   Tue Mar 26 11:07:41 2024 +0800

    Merge branch 'develop' of https://bdgit.educoder.net/mwxbgi697/softegg into 曾晨曦_branch

commit 36717942eb
Author: zcx <1078327420@qq.com>
Date:   Thu Mar 21 15:50:06 2024 +0800

    用例图
pull/9/head
zcx 1 year ago
parent f6fc54bb2a
commit f0eb9cae7e

@ -0,0 +1,131 @@
<template>
<div class="task-app">
<h1>任务发布和展示</h1>
<!-- 发布任务表单 -->
<div class="task-form-container">
<h2>发布任务</h2>
<form @submit.prevent="submitTask" class="task-form">
<label for="taskInput">任务</label>
<input type="text" id="taskInput" v-model.trim="newTask" placeholder="请输入任务内容">
<button type="submit" :disabled="!newTask.trim()">发布任务</button>
</form>
</div>
<!-- 展示任务列表 -->
<div class="task-list-container">
<h2>已发布任务</h2>
<div v-if="tasks.length > 0" class="task-list">
<ul>
<li v-for="(task, index) in tasks" :key="index">{{ task }}</li>
</ul>
</div>
<div v-else class="no-tasks">
<p>暂无任务</p>
</div>
</div>
</div>
</template>
<script>
import axios from 'axios';
export default {
data() {
return {
tasks: [],
newTask: ''
};
},
mounted() {
this.fetchTasks();
},
methods: {
fetchTasks() {
axios.get('/api/tasks')
.then(response => {
this.tasks = response.data.tasks;
})
.catch(error => {
console.error('Error fetching tasks:', error);
});
},
submitTask() {
if (!this.newTask.trim()) return;
axios.post('/api/tasks', { task: this.newTask.trim() })
.then(() => {
this.newTask = ''; //
this.fetchTasks(); //
})
.catch(error => {
console.error('Error submitting task:', error);
});
}
}
};
</script>
<style scoped>
.task-app {
max-width: 600px;
margin: 0 auto;
padding: 20px;
font-family: Arial, sans-serif;
}
.task-form-container {
border: 2px solid #007bff;
border-radius: 8px;
padding: 10px;
margin-bottom: 20px;
}
.task-list-container {
border: 2px solid #28a745;
border-radius: 8px;
padding: 10px;
}
.task-form {
margin-bottom: 20px;
}
.task-form input[type="text"] {
width: calc(100% - 80px);
padding: 8px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 4px;
}
.task-form button {
padding: 8px 16px;
font-size: 16px;
border: none;
border-radius: 4px;
background-color: #007bff;
color: #fff;
cursor: pointer;
}
.task-form button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.task-list {
margin-top: 20px;
}
.no-tasks {
color: #888;
}
/* 响应式设计 */
@media (max-width: 768px) {
.task-form input[type="text"] {
width: 100%;
}
}
</style>

@ -0,0 +1,95 @@
<template>
<div class="user-feedback">
<!-- 输入评价 -->
<div class="feedback-input">
<h2>输入评价</h2>
<form @submit.prevent="submitFeedback">
<textarea id="feedback" v-model.trim="feedback" rows="4" cols="50" placeholder="在这里输入您的评价"></textarea>
<button type="submit">发布评价</button>
</form>
</div>
<!-- 已发布评价 -->
<div class="submitted-feedback" v-if="submittedFeedback">
<h2>已发布评价</h2>
<div class="feedback-item">
<p>{{ submittedFeedback }}</p>
</div>
</div>
</div>
</template>
<script>
import axios from 'axios';
export default {
data() {
return {
feedback: '',
submittedFeedback: ''
};
},
methods: {
submitFeedback() {
if (!this.feedback.trim()) {
return;
}
axios.post('/api/feedback', { feedback: this.feedback.trim() })
.then(response => {
this.submittedFeedback = response.data.feedback;
this.feedback = ''; //
})
.catch(error => {
console.error('Error submitting feedback:', error);
});
}
}
};
</script>
<style scoped>
.user-feedback {
max-width: 600px;
margin: 0 auto;
}
.feedback-input {
margin-bottom: 20px;
}
textarea {
width: 100%;
padding: 8px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 4px;
margin-bottom: 10px;
}
button {
padding: 8px 16px;
font-size: 16px;
border: none;
border-radius: 4px;
background-color: #007bff;
color: #fff;
cursor: pointer;
}
.submitted-feedback {
border-top: 1px solid #ccc;
padding-top: 20px;
}
.feedback-item {
background-color: #f9f9f9;
border: 1px solid #ccc;
border-radius: 4px;
padding: 10px;
}
.feedback-item p {
margin: 0;
}
</style>
Loading…
Cancel
Save