kuaifan 8ddc507bd5 feat: 添加 AI 助手生成任务功能
- 在 ProjectController 中新增 ai_generate 接口,支持根据用户输入生成任务标题和详细描述
- 在 AI 模块中实现 generateTask 方法,处理任务生成逻辑
- 更新前端 TaskAdd 组件,添加 AI 生成按钮,集成任务生成请求
- 优化 TEditor 和 TEditorTask 组件,支持设置内容格式
- 增强样式以提升用户体验
2025-09-23 13:11:33 +08:00

315 lines
8.5 KiB
SCSS
Vendored

.task-add {
position: relative;
.head {
display: flex;
align-items: center;
padding: 8px 0;
margin-bottom: 20px;
position: relative;
.ivu-cascader {
.ivu-cascader-menu-item {
max-width: 300px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
@media (width <= 600px) {
max-width: 200px;
}
@media (width <= 400px) {
max-width: 160px;
}
@media (width <= 320px) {
max-width: 100px;
}
}
.ivu-cascader-label {
width: auto;
padding: 0;
font-size: 15px;
display: flex;
align-items: center;
&:after {
transition: all 0.2s;
padding: 6px;
font-family: Ionicons, serif;
content: "\f116";
opacity: 1;
}
}
.ivu-cascader-arrow {
display: none;
}
.ivu-input {
padding: 4px 0;
border: 0;
box-shadow: none;
font-size: 15px;
}
.ivu-cascader-not-found-tip {
padding: 6px 12px;
}
}
&.empty {
.ivu-cascader {
.ivu-cascader-label {
&:after {
opacity: 0;
}
}
}
}
&.visible {
.ivu-cascader {
.ivu-cascader-label {
&:after {
transform: rotate(180deg);
}
}
}
}
}
.task-add-template {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 20px;
> li {
list-style: none;
padding: 6px 14px;
background-color: #f5f5f5;
border-radius: 20px;
line-height: 20px;
transition: all 0.3s ease;
cursor: pointer;
&:hover {
background-color: #e0e0e0;
}
&.active {
background-color: $primary-color;
color: white;
}
}
}
.task-add-form,
.task-add-advanced {
.title {
position: relative;
.ivu-input {
font-weight: 500;
font-size: 24px;
padding: 4px 32px 4px 0;
line-height: 1.4;
resize: none;
border-color: transparent;
&:focus {
box-shadow: none
}
}
.ai-btn {
position: absolute;
right: 0;
top: 0;
height: 44px;
display: flex;
align-items: center;
justify-content: center;
opacity: 0.8;
transition: opacity 0.2s;
cursor: pointer;
> i {
font-size: 24px;
}
&:hover {
opacity: 1;
}
}
}
.desc {
margin-top: 24px;
div[contenteditable="true"] {
outline: none
}
.mce-content-body {
img {
max-width: 100%;
}
pre {
padding: 14px;
margin: 7px 0;
overflow: auto;
background: #f5f2f0;
border-radius: 5px;
}
&[data-mce-placeholder]:not(.mce-visualblocks)::before {
color: #bbbbbb;
}
}
}
.advanced-option {
padding-top: 42px;
z-index: 1;
display: flex;
align-items: center;
&.advanced-open {
> button {
margin-left: 24px;
}
}
> button {
transition: margin 0.2s;
&:focus {
box-shadow: none;
}
}
.advanced-priority {
display: flex;
align-items: center;
margin-left: 24px;
height: 34px;
overflow-y: hidden;
overflow-x: auto;
&::-webkit-scrollbar {
display: none;
}
> li {
list-style: none;
margin-left: 3px;
.taskfont {
font-size: 34px;
cursor: pointer;
}
}
}
.advanced-time {
display: flex;
align-items: center;
margin-left: 20px;
position: relative;
cursor: pointer;
transition: margin 0.2s;
.ivu-icon {
font-size: 32px;
}
> em {
position: absolute;
top: -5px;
left: 16px;
font-family: "Monospaced Number", "serif";
transform: scale(0.8);
height: 20px;
min-width: 20px;
line-height: 20px;
border-radius: 10px;
background: $primary-color;
color: #fff;
text-align: center;
padding: 0 6px;
font-size: 12px;
font-style: normal;
white-space: nowrap;
box-shadow: 0 0 0 1px #fff;
}
}
}
.visibility-text {
cursor: pointer;
&.color {
color: #bbbbbb;
}
.taskfont {
display: inline-block;
transform: scale(0.9);
opacity: 0.8;
font-size: 12px;
margin-right: 0;
}
}
.task-add-visibility {
cursor: pointer;
color: rgba($primary-desc-color, 0.7);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.task-add-advanced {
margin: -16px 0 0;
padding: 46px 32px 6px;
border-radius: 8px;
border: 1px solid #e8e8e8;
.subtasks {
margin-bottom: 24px;
padding: 12px 16px;
border-radius: 6px;
background-color: #f8f8f8;
.enter-input {
&.empty {
.ivu-input {
background: transparent;
border-color: transparent;
&:hover,
&:focus {
box-shadow: none;
}
}
}
}
.sublist {
.ivu-row {
margin-bottom: 12px;
> div {
padding-right: 7px;
&:last-child {
padding-right: 0;
}
}
}
}
}
.ivu-date-picker {
width: 100%;
}
}
.ivu-modal-footer {
padding: 26px 0 22px !important;
}
}
body.window-portrait {
.task-add {
.task-add-form,
.task-add-advanced {
.advanced-option {
width: calc(100% + 8px);
padding-right: 8px;
justify-content: space-between;
&.advanced-open {
> button {
margin-left: 8px;
}
.advanced-time {
margin-right: 4px;
}
}
.advanced-priority {
margin-left: 8px;
}
.advanced-time {
margin-left: 4px;
}
}
}
.adaption {
> button {
padding: 0;
}
}
}
}