yang.yongquan 2023-07-05 20:04:48 +08:00
commit a9a0997714
2 changed files with 115 additions and 74 deletions

View File

@ -15,7 +15,7 @@ Rectangle {
clip: true clip: true
border.color: textInput.activeFocus ? "#268CDC":"#979592" //gray100 border.color: textInput.activeFocus ? "#268CDC":"#979592" //gray100
ListModel { id: tagListModel } ListModel { id: tagListModel }
property ListModel tagList: tagListModel
Row { Row {
@ -52,6 +52,9 @@ Rectangle {
id:textInput id:textInput
placeholderText: qsTr("按回车键Enter创建标签") placeholderText: qsTr("按回车键Enter创建标签")
onFocusChanged: {
text =""
}
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: parent.width - 15 width: parent.width - 15
@ -61,9 +64,14 @@ Rectangle {
} }
Keys.onReturnPressed: { Keys.onReturnPressed: {
var presetsTags = ["前端","后端","数据库"]
if (text.length === 0) if (text.length === 0)
return return
if(presetsTags.indexOf(text) === -1){
text = ""
return
}
tagListModel.append({"tag": text}) tagListModel.append({"tag": text})
//console.log(tagListModel.get(0)) //console.log(tagListModel.get(0))
@ -91,7 +99,8 @@ Rectangle {
width: content.width width: content.width
height: 25 height: 25
radius: 5 radius: 5
border.color: "#77c7ff" color: "#00aeec"
border.color: "#00aeec"
MouseArea { MouseArea {
id: mouseArea id: mouseArea
@ -113,7 +122,7 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
font.pixelSize: rootTagItem.height * 0.5 font.pixelSize: rootTagItem.height * 0.5
text: "Hello" text: "Hello"
color: rootTagItem.border.color color: "white"
} }
Item { visible: mouseArea.hovered; width: 5; height: 1 } Item { visible: mouseArea.hovered; width: 5; height: 1 }
@ -143,7 +152,7 @@ Rectangle {
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
text: "×" text: "×"
color: closeMouseArea.hovered ? "white" : rootTagItem.border.color color: "white"
} }
MouseArea { MouseArea {

View File

@ -4,6 +4,7 @@ import QtQuick.Window
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Controls.Basic import QtQuick.Controls.Basic
import FluentUI import FluentUI
import "qrc:///AicsKnowledgeBase/qml/global"
import "qrc:///AicsKnowledgeBase/qml/component" import "qrc:///AicsKnowledgeBase/qml/component"
FluArea { FluArea {
@ -18,112 +19,143 @@ FluArea {
// Layout.topMargin: 20 // Layout.topMargin: 20
// text: "Search" // text: "Search"
// } // }
/* /*
*/ */
ColumnLayout { ColumnLayout{
width: parent.width width: parent.width
RowLayout { RowLayout{
width: parent.width width:parent.width
FluDropDownButton { // FluDropDownButton{
id: select_model // id:select_model
Layout.alignment: Qt.AlignLeft // Layout.alignment: Qt.AlignLeft
text: "标题" // text:""
items: [ // items:[
FluMenuItem { // FluMenuItem{
text: "标题" // text:""
onClicked: { // onClicked: {
select_model.text = text // select_model.text = text
} // }
}, // },
FluMenuItem { // FluMenuItem{
text: "内容" // text:""
onClicked: { // onClicked: {
select_model.text = text // select_model.text = text
} // }
}, // },
FluMenuItem { // FluMenuItem{
text: "标签" // text:""
onClicked: { // onClicked: {
select_model.text = text // select_model.text = text
} // }
// }
// ]
// }
FluTextBox{
placeholderText:"对标题进行搜索……"
Layout.fillWidth: true
}
FluIconButton{
Layout.alignment: Qt.AlignRight
iconSource:FluentIcons.Search
onClicked:{
var allTags = inputTags.getAllTags(tags.tagList)
var allTagId =[]
console.log(allTags)
for (var i = 0; i < allTags.length; i++) {
var url = "?name="
url = url + allTags[i]
console.log(url)
Request.get(url,
function(result, data){
allTagId.push()
}
)
} }
] }
} }
FluTextBox { }
//placeholderText:"" FluCheckBox{
Layout.fillWidth: true id:searchTitleAndContent
} text:"同时搜索简介和内容"
FluIconButton {
Layout.alignment: Qt.AlignRight
iconSource: FluentIcons.Search
}
} }
// //
RowLayout { RowLayout{
id: selectFormat id:selectFormat
width: parent.width width:parent.width
FluText { FluText{
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
text: "类型: " text:"类型: "
} }
FluCheckBox { FluCheckBox{
id: selectAllFormat id:selectAllFormat
text: "all" text:"all"
Component.onCompleted: { Component.onCompleted:{
clicked() clicked()
} }
onClicked: { onClicked:{
selectVideo.checked = true selectVideo.checked=true
selectDoc.checked = true selectDoc.checked=true
selectAudio.checked = true selectAudio.checked=true
} }
} }
FluCheckBox { FluCheckBox{
id: selectVideo id:selectVideo
text: "Video" text:"Video"
onClicked: { onClicked:{
selectFormat.setAllStatus() selectFormat.setAllStatus()
} }
} }
FluCheckBox { FluCheckBox{
id: selectDoc id:selectDoc
text: "Doc" text:"Doc"
onClicked: { onClicked:{
selectFormat.setAllStatus() selectFormat.setAllStatus()
} }
} }
FluCheckBox { FluCheckBox{
id: selectAudio id:selectAudio
text: "Audio" text:"Audio"
onClicked: { onClicked:{
selectFormat.setAllStatus() selectFormat.setAllStatus()
} }
} }
function setAllStatus() { function setAllStatus() {
selectAllFormat.checked = selectVideo.checked selectAllFormat.checked = selectVideo.checked && selectDoc.checked && selectAudio.checked
&& selectDoc.checked && selectAudio.checked
} }
} }
RowLayout { RowLayout{
width: parent.width id:inputTags
width:parent.width
height: 32 height: 32
FluText { FluText{
id: tag
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
text: "标签: " text:"标签: "
} }
Tag { Tag{
id:tags
width: 290 width: 290
} }
function getAllTags(tagList){
var allTags=[];
for (var i = 0; i < tagList.count; i++) {
var item = tagList.get(i);
allTags.push(item.tag)
}
return allTags
//console.log(allTags)
}
} }
FluArea { FluArea {