main
karlis 2023-07-07 00:24:17 +08:00
parent eb09b43ee8
commit d27ed8ede0
6 changed files with 329 additions and 100 deletions

View File

@ -37,12 +37,15 @@ FluArea {
message: fileItem.title
onPositiveClicked: text => {
var param = {
"name": text,
"parentId": fuuid
"parentId": fileItem.fuuid,
"name": text
}
Request.post("/knowledge",
JSON.stringify(param))
console.log(JSON.stringify(param))
Request.put(
"/knowledge/" + fileItem.uuid,
JSON.stringify(param), () => {
refresh()
})
}
}
}
@ -63,6 +66,7 @@ FluArea {
"parentId": uuid,
"name": fileItem.title
}
console.log(JSON.stringify(param))
Request.put(
"/knowledge/" + fileItem.uuid,
JSON.stringify(param), () => {
@ -114,6 +118,7 @@ FluArea {
font.bold: true
font.pointSize: 12
text: fileItem.title
textFormat: Text.RichText
}
}

View File

@ -4,18 +4,91 @@ import QtQuick.Window
import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI
import "qrc:///AicsKnowledgeBase/qml/component"
import "qrc:///AicsKnowledgeBase/qml/global"
FluArea {
property string url: ''
backgroundColor: "#f9f9f9"
Layout.fillWidth: true
Layout.fillHeight: true
paddings: 10
Layout.topMargin: 20
FluText {
id: title
Layout.topMargin: 20
text: "Audio"
}
FileList {
anchors.top: title.bottom
disableHeader: true
width: parent.width
dataModel: listModel
}
ListModel {
id: listModel
}
Component.onCompleted: {
Request.get("/knowledge?type=AUDIO", response => {
var files = JSON.parse(response)
listModel.clear()
for (var i = 0; i < files.length; i++) {
var file = files[i]
console.log(file.name)
var modelItem = {
"title": file.name,
"uuid": file.id,
"date"// cut time after 'T'
: file.createTime.substring(0, 10),
"fuuid": "0"
}
if (file.knowledgeFileAttribute === null) {
modelItem.type = "folder"
modelItem.isDir = true
modelItem.size = 0
} else {
modelItem.isDir = false
modelItem.type = getType(
file.knowledgeFileAttribute.suffix)
modelItem.size = file.knowledgeFileAttribute.size
modelItem.brief = file.knowledgeFileAttribute.brief
modelItem.pageView = file.knowledgeFileAttribute.pageView
modelItem.stars = 0
var tagString = ""
for (var j = 0; j < file.knowledgeFileAttribute.tags.length; j++) {
if (j != 0)
tagString = tagString + ","
tagString = tagString + file.knowledgeFileAttribute.tags[j].name
}
modelItem.tags = tagString
}
listModel.append(modelItem)
}
})
}
function getType(suffix) {
if (suffix === "ppt" || suffix === "pptx")
return "PPT"
else if (suffix === "doc" || suffix === "docx")
return "WORD"
else if (suffix === "pdf")
return "PDF"
else if (suffix === "txt")
return "TXT"
else if (suffix === "xls" || suffix === "xlsx")
return "EXCEL"
else if (suffix === "zip" || suffix === "rar")
return "ZIP"
else if (suffix === "png" || suffix === "jpg" || suffix === "jpeg"
|| suffix === "gif")
return "IMAGE"
else if (suffix === "mp3" || suffix === "wav")
return "AUDIO"
else if (suffix === "mp4" || suffix === "avi" || suffix === "rmvb"
|| suffix === "rm" || suffix === "wmv" || suffix === "mkv")
return "VIDEO"
else
return "OTHER"
}
}

View File

@ -4,6 +4,8 @@ import QtQuick.Window
import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI
import "qrc:///AicsKnowledgeBase/qml/component"
import "qrc:///AicsKnowledgeBase/qml/global"
FluArea {
property string url: ''
@ -14,7 +16,79 @@ FluArea {
Layout.topMargin: 20
FluText {
id: title
Layout.topMargin: 20
text: "Document"
}
FileList {
anchors.top: title.bottom
disableHeader: true
width: parent.width
dataModel: listModel
}
ListModel {
id: listModel
}
Component.onCompleted: {
Request.get("/knowledge?type=DOCUMENT", response => {
var files = JSON.parse(response)
listModel.clear()
for (var i = 0; i < files.length; i++) {
var file = files[i]
console.log(file.name)
var modelItem = {
"title": file.name,
"uuid": file.id,
"date"// cut time after 'T'
: file.createTime.substring(0, 10),
"fuuid": "0"
}
if (file.knowledgeFileAttribute === null) {
modelItem.type = "folder"
modelItem.isDir = true
modelItem.size = 0
} else {
modelItem.isDir = false
modelItem.type = getType(
file.knowledgeFileAttribute.suffix)
modelItem.size = file.knowledgeFileAttribute.size
modelItem.brief = file.knowledgeFileAttribute.brief
modelItem.pageView = file.knowledgeFileAttribute.pageView
modelItem.stars = 0
var tagString = ""
for (var j = 0; j < file.knowledgeFileAttribute.tags.length; j++) {
if (j != 0)
tagString = tagString + ","
tagString = tagString + file.knowledgeFileAttribute.tags[j].name
}
modelItem.tags = tagString
}
listModel.append(modelItem)
}
})
}
function getType(suffix) {
if (suffix === "ppt" || suffix === "pptx")
return "PPT"
else if (suffix === "doc" || suffix === "docx")
return "WORD"
else if (suffix === "pdf")
return "PDF"
else if (suffix === "txt")
return "TXT"
else if (suffix === "xls" || suffix === "xlsx")
return "EXCEL"
else if (suffix === "zip" || suffix === "rar")
return "ZIP"
else if (suffix === "png" || suffix === "jpg" || suffix === "jpeg"
|| suffix === "gif")
return "IMAGE"
else if (suffix === "mp3" || suffix === "wav")
return "AUDIO"
else if (suffix === "mp4" || suffix === "avi" || suffix === "rmvb"
|| suffix === "rm" || suffix === "wmv" || suffix === "mkv")
return "VIDEO"
else
return "OTHER"
}
}

View File

@ -46,7 +46,6 @@ FluArea {
property list<string> tags: ["tag 1", "tag 2", "tag 3"]
property string publishTime: "2020-01-01"
property string brief: "这是一个简介"
property var fromFile
function getType(suffix) {
if (suffix === "md")
@ -63,29 +62,7 @@ FluArea {
}
Component.onCompleted: {
Request.get("knowledge/", function (response, data) {
fromFile = {
"uuid": data.id,
"fuuid": data.knowledgeFileAttribute.id,
"title": data.name,
"date": data.createTime,
"brief": data.knowledgeFileAttribute.brief,
"suffix": data.knowledgeFileAttribute.suffix,
"type": getType(data.knowledgeFileAttribute.suffix),
"pageView": data.knowledgeFileAttribute.pageView,
"size": data.knowledgeFileAttribute.size
}
fromFile.stars = 0
var tagString = ""
for (var j = 0; j < file.knowledgeFileAttribute.tags.length; j++) {
if (j != 0)
tagString = tagString + ","
tagString = tagString + file.knowledgeFileAttribute.tags[j].name
}
fromFile.tags = tagString
})
}
FluIconButton {
@ -222,19 +199,5 @@ FluArea {
width: parent.width
implicitHeight: 400
}
// FistListItem {
// id: fileListItem
// uuid: fromFile.uuid
// fuuid: fromFile.fuuid
// title: fromFile.title
// date: fromFile.date
// brief: fromFile.brief
// type: fromFile.type
// pageView: fromFile.pageView
// size: fromFile.size
// stars: fromFile.stars
// tags: fromFile.tags === null || fromFile.tags === undefined
// || fromFile.tags === "" ? [] : fromFile.tags.split(",")
// }
}
}

View File

@ -8,6 +8,7 @@ import "qrc:///AicsKnowledgeBase/qml/global"
import "qrc:///AicsKnowledgeBase/qml/component"
FluArea {
id: searchPage
property string url: ''
backgroundColor: "#f9f9f9"
Layout.fillHeight: true
@ -19,6 +20,8 @@ FluArea {
// Layout.topMargin: 20
// text: "Search"
// }
/*
*/
@ -27,6 +30,7 @@ FluArea {
width: parent.width
RowLayout {
width: parent.width
// FluDropDownButton{
// id:select_model
// Layout.alignment: Qt.AlignLeft
@ -52,11 +56,9 @@ FluArea {
// }
// ]
// }
FluTextBox {
placeholderText: "对标题进行搜索……"
Layout.fillWidth: true
}
FluIconButton {
Layout.alignment: Qt.AlignRight
@ -70,16 +72,12 @@ FluArea {
var url = "?name="
url = url + allTags[i]
console.log(url)
Request.get(url,
function(result, data){
Request.get(url, function (result, data) {
allTagId.push()
}
)
})
}
}
}
}
FluCheckBox {
id: searchTitleAndContent
@ -130,7 +128,8 @@ FluArea {
}
function setAllStatus() {
selectAllFormat.checked = selectVideo.checked && selectDoc.checked && selectAudio.checked
selectAllFormat.checked = selectVideo.checked
&& selectDoc.checked && selectAudio.checked
}
}
@ -148,9 +147,9 @@ FluArea {
width: 290
}
function getAllTags(tagList) {
var allTags=[];
var allTags = []
for (var i = 0; i < tagList.count; i++) {
var item = tagList.get(i);
var item = tagList.get(i)
allTags.push(item.tag)
}
return allTags
@ -200,4 +199,45 @@ FluArea {
}
}
}
function getKnowledgeDetail(uuid, title, brief, tags) {
var raw = Request.getAwait("/knowledget/" + uuid)
var data = JSON.parse(raw)
var item = {
"uuid": uuid,
"title": title,
"brief": brief,
"isDir": false,
"date": data.createTime,
"fuuid": data.parent.id,
"pageView": data.knowledgeFileAttribute.pageView,
"stars": data.knowledgeFileAttribute.stars,
"size": data.knowledgeFileAttribute.size,
"type": getType(data.knowledgeFileAttribute.suffix),
"tags": tags
}
}
function getType(suffix) {
if (suffix === "ppt" || suffix === "pptx")
return "PPT"
else if (suffix === "doc" || suffix === "docx")
return "WORD"
else if (suffix === "pdf")
return "PDF"
else if (suffix === "txt")
return "TXT"
else if (suffix === "xls" || suffix === "xlsx")
return "EXCEL"
else if (suffix === "zip" || suffix === "rar")
return "ZIP"
else if (suffix === "png" || suffix === "jpg" || suffix === "jpeg"
|| suffix === "gif")
return "IMAGE"
else if (suffix === "mp3" || suffix === "wav")
return "AUDIO"
else if (suffix === "mp4" || suffix === "avi" || suffix === "rmvb"
|| suffix === "rm" || suffix === "wmv" || suffix === "mkv")
return "VIDEO"
else
return "OTHER"
}
}

View File

@ -4,6 +4,8 @@ import QtQuick.Window
import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI
import "qrc:///AicsKnowledgeBase/qml/component"
import "qrc:///AicsKnowledgeBase/qml/global"
FluArea {
property string url: ''
@ -14,7 +16,79 @@ FluArea {
Layout.topMargin: 20
FluText {
id: title
Layout.topMargin: 20
text: "Video"
}
FileList {
anchors.top: title.bottom
disableHeader: true
width: parent.width
dataModel: listModel
}
ListModel {
id: listModel
}
Component.onCompleted: {
Request.get("/knowledge?type=VIDEO", response => {
var files = JSON.parse(response)
listModel.clear()
for (var i = 0; i < files.length; i++) {
var file = files[i]
console.log(file.name)
var modelItem = {
"title": file.name,
"uuid": file.id,
"date"// cut time after 'T'
: file.createTime.substring(0, 10),
"fuuid": "0"
}
if (file.knowledgeFileAttribute === null) {
modelItem.type = "folder"
modelItem.isDir = true
modelItem.size = 0
} else {
modelItem.isDir = false
modelItem.type = getType(
file.knowledgeFileAttribute.suffix)
modelItem.size = file.knowledgeFileAttribute.size
modelItem.brief = file.knowledgeFileAttribute.brief
modelItem.pageView = file.knowledgeFileAttribute.pageView
modelItem.stars = 0
var tagString = ""
for (var j = 0; j < file.knowledgeFileAttribute.tags.length; j++) {
if (j != 0)
tagString = tagString + ","
tagString = tagString + file.knowledgeFileAttribute.tags[j].name
}
modelItem.tags = tagString
}
listModel.append(modelItem)
}
})
}
function getType(suffix) {
if (suffix === "ppt" || suffix === "pptx")
return "PPT"
else if (suffix === "doc" || suffix === "docx")
return "WORD"
else if (suffix === "pdf")
return "PDF"
else if (suffix === "txt")
return "TXT"
else if (suffix === "xls" || suffix === "xlsx")
return "EXCEL"
else if (suffix === "zip" || suffix === "rar")
return "ZIP"
else if (suffix === "png" || suffix === "jpg" || suffix === "jpeg"
|| suffix === "gif")
return "IMAGE"
else if (suffix === "mp3" || suffix === "wav")
return "AUDIO"
else if (suffix === "mp4" || suffix === "avi" || suffix === "rmvb"
|| suffix === "rm" || suffix === "wmv" || suffix === "mkv")
return "VIDEO"
else
return "OTHER"
}
}