|
@ -95,7 +95,7 @@ FluWindow {
|
|||
duration: 200
|
||||
}
|
||||
}
|
||||
initialItem: create_note_view
|
||||
initialItem: note_view
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
@ -107,17 +107,31 @@ FluWindow {
|
|||
"knowledgeFileId": file
|
||||
})
|
||||
}
|
||||
function onOpenNote(note) {
|
||||
function onOpenNote(note, authorId) {
|
||||
stack_view.push(note_view, {
|
||||
"noteFileId": note
|
||||
"noteFileId": note,
|
||||
"authorId": authorId
|
||||
})
|
||||
}
|
||||
function onBack() {
|
||||
if (stack_view.depth > 0)
|
||||
stack_view.pop()
|
||||
}
|
||||
function onCreateNote() {
|
||||
stack_view.push(create_note_view)
|
||||
function onCreateNote(file, fileType, fileTitle) {
|
||||
stack_view.push(create_note_view, {
|
||||
"knowledgeFileId": file,
|
||||
"fileType": fileType,
|
||||
"fileTitle": fileTitle
|
||||
})
|
||||
}
|
||||
function onModifyNote(file, fileType, fileTitle, note) {
|
||||
stack_view.push(create_note_view, {
|
||||
"knowledgeFileId": file,
|
||||
"fileType": fileType,
|
||||
"fileTitle": fileTitle,
|
||||
"noteId": note,
|
||||
"isModifying": true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -117,6 +117,20 @@ Rectangle {
|
|||
Layout.rightMargin: 10
|
||||
iconSource: FluentIcons.PenPalette
|
||||
iconSize: 14
|
||||
onClicked: {
|
||||
note_menu.open()
|
||||
}
|
||||
FluMenu {
|
||||
id: note_menu
|
||||
x: parent ? (parent.width - width) / 2 : 0
|
||||
y: parent ? parent.height : 0
|
||||
FluMenuItem {
|
||||
text: "收藏的笔记"
|
||||
}
|
||||
FluMenuItem {
|
||||
text: "我的笔记"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
|
@ -218,5 +232,6 @@ Rectangle {
|
|||
frameless_helper.setHitTestVisible(btn_maximize)
|
||||
frameless_helper.setHitTestVisible(btn_close)
|
||||
frameless_helper.setHitTestVisible(btn_transfer)
|
||||
frameless_helper.setHitTestVisible(btn_note)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,9 +126,15 @@ Item {
|
|||
return "OTHER"
|
||||
}
|
||||
RowLayout {
|
||||
Layout.preferredWidth: parent.width
|
||||
Layout.alignment: Qt.AlignRight
|
||||
//Layout.preferredWidth: parent.width
|
||||
layoutDirection: Qt.RightToLeft
|
||||
UploadButton {
|
||||
//Layout.alignment: Qt.AlignRight
|
||||
header: header
|
||||
}
|
||||
Item {
|
||||
anchors.right: uploadBtn.left
|
||||
//anchors.right: uploadBtn.left
|
||||
height: 28
|
||||
width: 28
|
||||
InputDialog {
|
||||
|
@ -153,59 +159,14 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
source: "qrc:/AicsKnowledgeBase/res/createFolder.png"
|
||||
anchors.fill: parent
|
||||
}
|
||||
MouseArea {
|
||||
FluIconButton {
|
||||
anchors.fill: parent
|
||||
iconSource: FluentIcons.NewFolder
|
||||
onClicked: {
|
||||
dialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
FluButton {
|
||||
id: uploadIcon
|
||||
Layout.alignment: Qt.AlignRight
|
||||
text: "上传"
|
||||
onClicked: function () {
|
||||
console.log("click")
|
||||
fileDialog.open()
|
||||
}
|
||||
FileDialog {
|
||||
id: fileDialog
|
||||
onAccepted: function () {
|
||||
let name = FileTransferManager.getFileName(
|
||||
selectedFile)
|
||||
const size = FileTransferManager.getFileSize(
|
||||
selectedFile)
|
||||
const md5 = FileTransferManager.getFileMd5(
|
||||
selectedFile)
|
||||
if (size <= 0 || md5 === '')
|
||||
return
|
||||
var body = {
|
||||
"name": name,
|
||||
"brief": "brief",
|
||||
"size": size,
|
||||
"md5": md5,
|
||||
"tags": [],
|
||||
"parentId": header.items.length !== 0 ? header.items[header.items.length - 1].uuid : null
|
||||
}
|
||||
console.log("begin")
|
||||
Request.post("knowledge/file",
|
||||
JSON.stringify(body),
|
||||
function (res, data) {
|
||||
console.log(res)
|
||||
console.log(data)
|
||||
FileTransferManager.upload(
|
||||
selectedFile, data.id,
|
||||
data.ticket, name)
|
||||
}, function (res, data) {
|
||||
console.log(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
id: fileListItemHeaderItem
|
||||
|
|
|
@ -84,17 +84,8 @@ FluArea {
|
|||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: row
|
||||
anchors.fill: parent
|
||||
anchors.margins: 10
|
||||
spacing: 10
|
||||
|
||||
ColumnLayout {
|
||||
id: clickable
|
||||
anchors.fill: parent
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
anchors.fill: row
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onDoubleClicked: {
|
||||
fileItem.parent.doubleClicked()
|
||||
|
@ -105,6 +96,11 @@ FluArea {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: clickable
|
||||
anchors.fill: row
|
||||
|
||||
RowLayout {
|
||||
id: titleRow
|
||||
Image {
|
||||
|
@ -112,6 +108,7 @@ FluArea {
|
|||
source: type ? "qrc:/AicsKnowledgeBase/res/" + type + ".png" : ""
|
||||
Layout.preferredHeight: 24
|
||||
Layout.preferredWidth: 24
|
||||
fillMode: Image.PreserveAspectFit
|
||||
}
|
||||
FluText {
|
||||
id: title
|
||||
|
|
|
@ -5,7 +5,7 @@ import "qrc:///AicsKnowledgeBase/qml/global"
|
|||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
signal open(string note)
|
||||
signal open(string note, string authorId)
|
||||
signal createNote
|
||||
width: parent.width - 8
|
||||
property ListModel noteListModel: ListModel {
|
||||
|
@ -14,6 +14,7 @@ Item {
|
|||
title: "超级无敌报错"
|
||||
brief: "file:///D:/academic/2023-qtBig/AicsKnowledgeBase_client/AicsKnowledgeBase/qml/component/NoteList.qml:41:21: Unable to assign [undefined] to QString"
|
||||
author: "admin"
|
||||
authorId: "345"
|
||||
pageView: 123
|
||||
stars: 27
|
||||
date: "2022-02-02"
|
||||
|
@ -23,6 +24,7 @@ Item {
|
|||
title: "Qt布局"
|
||||
brief: "锚定(anchors)在确定父子组件之间,同级组件之间的相对位置时非常常用,若使用锚定方式确定子组件与父组件之间的位置关系,使用 top,bottom,left,right, topMargin,bottomMargin,leftMargin,rightMargin进行上下左右对齐,以及对齐后的留白距离。若要使子组件在父组件的水平,垂直居中,使用:"
|
||||
author: "超级无敌长的账户名"
|
||||
authorId: "345"
|
||||
pageView: 123
|
||||
stars: 27
|
||||
date: "2022-02-02"
|
||||
|
@ -32,6 +34,7 @@ Item {
|
|||
title: "Qt布局"
|
||||
brief: "锚定(anchors)在确定父子组件之间,同级组件之间的相对位置时非常常用,若使用锚定方式确定子组件与父组件之间的位置关系,使用 top,bottom,left,right, topMargin,bottomMargin,leftMargin,rightMargin进行上下左右对齐,以及对齐后的留白距离。若要使子组件在父组件的水平,垂直居中,使用:"
|
||||
author: "超级无敌长的账户名"
|
||||
authorId: "345"
|
||||
pageView: 123
|
||||
stars: 27
|
||||
date: "2022-02-02"
|
||||
|
@ -41,6 +44,7 @@ Item {
|
|||
title: "Qt布局"
|
||||
brief: "锚定(anchors)在确定父子组件之间,同级组件之间的相对位置时非常常用,若使用锚定方式确定子组件与父组件之间的位置关系,使用 top,bottom,left,right, topMargin,bottomMargin,leftMargin,rightMargin进行上下左右对齐,以及对齐后的留白距离。若要使子组件在父组件的水平,垂直居中,使用:"
|
||||
author: "超级无敌长的账户名"
|
||||
authorId: "345"
|
||||
pageView: 123
|
||||
stars: 27
|
||||
date: "2022-02-02"
|
||||
|
@ -87,7 +91,7 @@ Item {
|
|||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
open(model.uuid)
|
||||
open(model.uuid, model.authorId)
|
||||
}
|
||||
}
|
||||
NoteListItem {
|
||||
|
@ -100,6 +104,7 @@ Item {
|
|||
brief: model.brief
|
||||
pageView: model.pageView
|
||||
author: model.author
|
||||
authorId: model.authorId
|
||||
stars: model.stars
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ FluArea {
|
|||
property int pageView
|
||||
property int stars
|
||||
property string author
|
||||
property string authorId
|
||||
|
||||
ColumnLayout {
|
||||
id: row
|
||||
|
|
|
@ -16,27 +16,29 @@ Rectangle {
|
|||
radius: 5
|
||||
clip: true
|
||||
|
||||
ListModel { id: tagListModel }
|
||||
ListModel {
|
||||
id: tagListModel
|
||||
}
|
||||
property ListModel tagList: tagListModel
|
||||
property var tagMap: []
|
||||
property var presetsTags: []
|
||||
property var presetsTagsItem: []
|
||||
|
||||
Component.onCompleted: {
|
||||
Request.get("tag?name",
|
||||
function(result, data){
|
||||
Request.get("tag?name", function (result, data) {
|
||||
// console.log("success")
|
||||
// console.log(result)
|
||||
// console.log(data.length)
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
tagMap.push([data[i].id,data[i].name])
|
||||
tagMap.push(data[i])
|
||||
presetsTags.push(data[i].name)
|
||||
presetsTagsItem.push({title:data[i].name})
|
||||
presetsTagsItem.push({
|
||||
"title": data[i].name
|
||||
})
|
||||
}
|
||||
// console.log(tagMap)
|
||||
// console.log(presetsTags)
|
||||
},function (p1, p2) {
|
||||
// console.log("failure")
|
||||
}, function (p1, p2) {// console.log("failure")
|
||||
// console.log(p1)
|
||||
// console.log(p2)
|
||||
})
|
||||
|
@ -62,7 +64,9 @@ Rectangle {
|
|||
tagListModel.remove(index)
|
||||
})
|
||||
|
||||
item.tag = Qt.binding(function(){return tag})
|
||||
item.tag = Qt.binding(function () {
|
||||
return tag
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +81,6 @@ Rectangle {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: parent.width
|
||||
|
||||
|
||||
placeholderText: "按回车键Enter创建标签"
|
||||
Layout.preferredWidth: 300
|
||||
//items:[{title:"前端"},{title:"后端"},{title:"数据库"}]
|
||||
|
@ -92,14 +95,18 @@ Rectangle {
|
|||
if (text.length === 0)
|
||||
return
|
||||
|
||||
if(presetsTags.indexOf(text) === -1){
|
||||
text = ""
|
||||
return
|
||||
}
|
||||
tagListModel.append({"tag": text})
|
||||
var tagId
|
||||
for (var i = 0; i < tagMap.length; i++) {
|
||||
if (tagMap[i].name === text) {
|
||||
tagListModel.append({
|
||||
"tag": text,
|
||||
"id": tagMap[i].id
|
||||
})
|
||||
//console.log(tagListModel.get(0))
|
||||
text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Keys.onPressed: {
|
||||
if (event.key === Qt.Key_Backspace) {
|
||||
if (text.length === 0 && tagListModel.count) {
|
||||
|
@ -111,11 +118,10 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
property Component tagItem:
|
||||
Rectangle {
|
||||
property Component tagItem: Rectangle {
|
||||
id: rootTagItem
|
||||
property alias tag: tagText.text
|
||||
signal closeClicked()
|
||||
signal closeClicked
|
||||
|
||||
width: content.width
|
||||
height: 25
|
||||
|
@ -136,7 +142,10 @@ Rectangle {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
height: rootTagItem.height
|
||||
|
||||
Item { width: 5; height: 1 }
|
||||
Item {
|
||||
width: 5
|
||||
height: 1
|
||||
}
|
||||
|
||||
Text {
|
||||
id: tagText
|
||||
|
@ -146,7 +155,11 @@ Rectangle {
|
|||
color: "white"
|
||||
}
|
||||
|
||||
Item { visible: mouseArea.hovered; width: 5; height: 1 }
|
||||
Item {
|
||||
visible: mouseArea.hovered
|
||||
width: 5
|
||||
height: 1
|
||||
}
|
||||
|
||||
Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
@ -154,11 +167,15 @@ Rectangle {
|
|||
height: rootTagItem.height
|
||||
visible: mouseArea.hovered
|
||||
Behavior on width {
|
||||
NumberAnimation {duration: 100}
|
||||
NumberAnimation {
|
||||
duration: 100
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on visible {
|
||||
NumberAnimation {duration: 100}
|
||||
NumberAnimation {
|
||||
duration: 100
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
@ -189,9 +206,11 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
Item { width: 5; height: 1 }
|
||||
Item {
|
||||
width: 5
|
||||
height: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,11 +10,12 @@ FluButton {
|
|||
property var header
|
||||
property var currentSelectedFile: null
|
||||
|
||||
Layout.alignment: Qt.AlignRight
|
||||
//Layout.alignment: Qt.AlignRight
|
||||
text: "上传"
|
||||
onClicked: function () {
|
||||
console.log("click")
|
||||
fileDialog.open()
|
||||
//popup.open()
|
||||
}
|
||||
FileDialog {
|
||||
id: fileDialog
|
||||
|
@ -52,7 +53,7 @@ FluButton {
|
|||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
Column {
|
||||
id: content
|
||||
topPadding: 14
|
||||
leftPadding: 20
|
||||
|
@ -68,6 +69,9 @@ FluButton {
|
|||
width: parent.width - parent.leftPadding - parent.rightPadding
|
||||
placeholderText: "请输入简介"
|
||||
}
|
||||
Tag {
|
||||
id: tags
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
@ -107,6 +111,12 @@ FluButton {
|
|||
text: "上传"
|
||||
onClicked: {
|
||||
popup.close()
|
||||
var tagIds = []
|
||||
for (var i = 0; i < tags.tagList.count; i++) {
|
||||
console.log(tags.tagList.get(i).tag)
|
||||
console.log(tags.tagList.get(i).id)
|
||||
tagIds.push(tags.tagList.get(i).id)
|
||||
}
|
||||
let name = FileTransferManager.getFileName(
|
||||
currentSelectedFile)
|
||||
const size = FileTransferManager.getFileSize(
|
||||
|
@ -120,7 +130,7 @@ FluButton {
|
|||
"brief": brief_textbox.text,
|
||||
"size": size,
|
||||
"md5": md5,
|
||||
"tags": [],
|
||||
"tags": tagIds,
|
||||
"parentId": currentParentId()
|
||||
}
|
||||
console.log("begin")
|
||||
|
|
|
@ -4,7 +4,8 @@ import QtQuick
|
|||
|
||||
QtObject {
|
||||
signal open(string file)
|
||||
signal openNote(string note)
|
||||
signal createNote
|
||||
signal openNote(string note, string authorId)
|
||||
signal createNote(string file, string fileType, string fileTitle)
|
||||
signal modifyNote(string file, string fileType, string fileTitle, string note)
|
||||
signal back
|
||||
}
|
||||
|
|
|
@ -28,11 +28,16 @@ FluArea {
|
|||
backgroundColor: "#f9f9f9"
|
||||
NoteList {
|
||||
id: noteList
|
||||
onOpen: function handle(noteId) {
|
||||
emit: SignalFileOperation.openNote(noteId)
|
||||
noteListModel: content_page.noteListModel
|
||||
onOpen: function handle(noteId, authorId) {
|
||||
emit: SignalFileOperation.openNote(noteId, authorId)
|
||||
popup.close()
|
||||
}
|
||||
onCreateNote: function handle() {
|
||||
console.log("create note")
|
||||
emit: SignalFileOperation.createNote(content_page.fileId,
|
||||
content_area.type,
|
||||
content_page.title)
|
||||
popup.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +71,7 @@ FluArea {
|
|||
property int shareCount: 0
|
||||
property int browsCount: 555
|
||||
property bool isFavorite: false
|
||||
property bool isDownload: false
|
||||
property bool isDownload: UserData.downloadedFiles.indexOf(fileId) != -1
|
||||
property double fileSize: 0
|
||||
property string title: "文章标题"
|
||||
property list<string> tags: ["tag 1", "tag 2", "tag 3"]
|
||||
|
@ -74,6 +79,7 @@ FluArea {
|
|||
property string brief: "这是一个简介"
|
||||
property string fileUrl: "https://api.hammer-hfut.tk:233/aics/file/"
|
||||
property string suffix: "md"
|
||||
property ListModel noteListModel
|
||||
|
||||
function getType(suffix) {
|
||||
if (suffix === "md")
|
||||
|
@ -88,15 +94,17 @@ FluArea {
|
|||
function loadFile(knowledgeFileId) {
|
||||
content_area.knowledgeFileId = knowledgeFileId
|
||||
console.log(knowledgeFileId)
|
||||
Request.get("knowledge/" + knowledgeFileId,
|
||||
Request.get("knowledge/" + knowledgeFileId + "/detailed",
|
||||
function (response, data) {
|
||||
console.log(response)
|
||||
content_page.publishTime = data.createTime
|
||||
content_page.title = data.name
|
||||
content_page.fileId = data.knowledgeFileAttribute.id
|
||||
content_page.suffix = data.knowledgeFileAttribute.suffix
|
||||
content_page.fileSize = data.knowledgeFileAttribute.size
|
||||
|
||||
content_area.type = getType(
|
||||
data.knowledgeFileAttribute.suffix)
|
||||
console.log(content_area.type)
|
||||
content_area.type = getType(content_page.suffix)
|
||||
console.log(content_area.fileId)
|
||||
|
||||
var tagString = ""
|
||||
for (var j = 0; j < data.knowledgeFileAttribute.tags.length; j++) {
|
||||
|
@ -109,19 +117,40 @@ FluArea {
|
|||
content_page.brief = data.knowledgeFileAttribute.brief
|
||||
content_page.browsCount = data.knowledgeFileAttribute.pageView
|
||||
|
||||
// var starers = data.knowledgeFileAttribute.starers
|
||||
// for (var i = 0; i < starers.length; i++) {
|
||||
isFavorite = false
|
||||
var starers = data.knowledgeFileAttribute.starers
|
||||
for (var i = 0; i < starers.length; i++) {
|
||||
if (starers[i].id === UserData.userId) {
|
||||
isFavorite = true
|
||||
}
|
||||
}
|
||||
content_page.favoriteCount = starers.length
|
||||
|
||||
// }
|
||||
// content_page.favoriteCount = starers.length
|
||||
if (content_area.type == "MD") {
|
||||
noteListModel.clear()
|
||||
var notes = data.knowledgeFileAttribute.notes
|
||||
noteCount = notes.length
|
||||
for (var i = 0; i < notes.length; i++) {
|
||||
noteListModel.append({
|
||||
"uuid": notes[i].id,
|
||||
"title": notes[i].title,
|
||||
"brief": notes[i].content,
|
||||
"author": notes[i].author.username,
|
||||
"authorId": notes[i].author.id,
|
||||
"pageView": notes[i].pageView,
|
||||
"stars": notes[i].starrers.length,
|
||||
"date": notes[i].createTime
|
||||
})
|
||||
}
|
||||
|
||||
if (content_area.type === "MD") {
|
||||
// console.log(content_area.type)
|
||||
FileTransferManager.getMarkdown(
|
||||
content_page.fileId)
|
||||
} else if (content_area.type == "VIDEO") {
|
||||
} else if (content_area.type === "VIDEO") {
|
||||
console.log(fileUrl + "static/" + fileId + "." + suffix)
|
||||
content_view.push(video_view, {
|
||||
"url": fileUrl + "static/"
|
||||
+ fileId + "." + suffix
|
||||
"source": fileUrl + "static/" + fileId
|
||||
+ "." + suffix
|
||||
})
|
||||
} else {
|
||||
Request.get("knowledge/" + knowledgeFileId + "/preview/external",
|
||||
|
@ -219,7 +248,7 @@ FluArea {
|
|||
content_page.isFavorite = !content_page.isFavorite
|
||||
content_page.favoriteCount += 1
|
||||
Request.put("knowledge/" + knowledgeFileId + "/star", {
|
||||
"active": UserData.userId
|
||||
"active": content_page.isFavorite
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -249,7 +278,7 @@ FluArea {
|
|||
FileTransferManager.download(content_page.fileId,
|
||||
content_page.title)
|
||||
else {
|
||||
|
||||
FileTransferManager.openLocalFile(content_page.title)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -267,8 +296,9 @@ FluArea {
|
|||
}
|
||||
FluText {
|
||||
padding: 10
|
||||
text: fileSize > 1024 * 1024 ? (fileSize / 1024 / 1024).toFixed(
|
||||
2) + "MB" : (fileSize / 1024).toFixed(
|
||||
text: content_page.fileSize > 1024
|
||||
* 1024 ? (content_page.fileSize / 1024 / 1024).toFixed(
|
||||
2) + "MB" : (content_page.fileSize / 1024).toFixed(
|
||||
2) + "KB"
|
||||
}
|
||||
FluText {
|
||||
|
@ -316,13 +346,14 @@ FluArea {
|
|||
id: content_view
|
||||
Layout.fillWidth: true
|
||||
height: 500
|
||||
//initialItem: video_view
|
||||
}
|
||||
|
||||
Component {
|
||||
id: video_view
|
||||
FluMediaPlayer {
|
||||
width: parent.width
|
||||
implicitHeight: width * 9 / 16.
|
||||
height: width * 9 / 16.
|
||||
}
|
||||
}
|
||||
Component {
|
||||
|
|
|
@ -15,10 +15,29 @@ FluArea {
|
|||
id: edit_area
|
||||
paddings: 0
|
||||
backgroundColor: "#f9f9f9"
|
||||
property string noteTitle
|
||||
property string noteContent
|
||||
property string knowledgeFileId
|
||||
property string fileType: "OTHER"
|
||||
property string fileTitle: "dgfgf"
|
||||
property string noteFileId
|
||||
property string noteTitle: ""
|
||||
property string noteContent: ""
|
||||
property var tags: []
|
||||
property bool isModifying: false
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log(knowledgeFileId)
|
||||
isModifying = false
|
||||
if (isModifying) {
|
||||
Request.getSearch("/search/note/" + noteFileId + "/content",
|
||||
function (response, data) {
|
||||
noteTitle = data.title
|
||||
noteContent = data.content
|
||||
input_title.text = noteTitle
|
||||
input_md.contentMd = noteContent
|
||||
tags = data.tags
|
||||
})
|
||||
}
|
||||
|
||||
noteTitle = Qt.binding(function () {
|
||||
return input_title.text
|
||||
})
|
||||
|
@ -34,6 +53,20 @@ FluArea {
|
|||
topPadding: 5
|
||||
rightPadding: 5
|
||||
bottomPadding: 0
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 30
|
||||
Layout.leftMargin: 5
|
||||
Layout.bottomMargin: 10
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onDoubleClicked: {
|
||||
emit: SignalFileOperation.open(note_page.knowledgeFileId)
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
id: titleRow
|
||||
RowLayout {
|
||||
FluIconButton {
|
||||
iconSize: 12
|
||||
|
@ -41,7 +74,21 @@ FluArea {
|
|||
onClicked: {
|
||||
emit: SignalFileOperation.back()
|
||||
}
|
||||
Layout.margins: -5
|
||||
}
|
||||
}
|
||||
Image {
|
||||
id: icon
|
||||
source: edit_area.fileType ? "qrc:/AicsKnowledgeBase/res/"
|
||||
+ edit_area.fileType + ".png" : ""
|
||||
Layout.preferredHeight: 24
|
||||
Layout.preferredWidth: 24
|
||||
}
|
||||
FluText {
|
||||
id: title
|
||||
font.bold: true
|
||||
font.pointSize: 12
|
||||
text: edit_area.fileTitle
|
||||
}
|
||||
}
|
||||
}
|
||||
Item {
|
||||
|
@ -62,6 +109,7 @@ FluArea {
|
|||
padding: 10
|
||||
placeholderText: "单行输入框"
|
||||
implicitWidth: parent.width
|
||||
font.pointSize: 12
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,12 +138,33 @@ FluArea {
|
|||
FluFilledButton {
|
||||
text: "上传"
|
||||
onClicked: {
|
||||
if (noteTitle.trim() !== "" && noteContent !== "") {
|
||||
console.log(noteTitle)
|
||||
console.log(noteContent)
|
||||
console.log(knowledgeFileId)
|
||||
if (!isModifying) {
|
||||
Request.post("note", {
|
||||
"title": noteTitle,
|
||||
"content": noteContent,
|
||||
"tags": [],
|
||||
"linkingKnowledgeFiles": [knowledgeFileId]
|
||||
})
|
||||
} else {
|
||||
Request.put("note/" + noteFileId, {
|
||||
"title": noteTitle,
|
||||
"content": noteContent,
|
||||
"tags": [],
|
||||
"linkingKnowledgeFiles": [knowledgeFileId]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
FluButton {
|
||||
text: "取消"
|
||||
onClicked: {
|
||||
emit: SignalFileOperation.back()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ FluArea {
|
|||
// visible: false
|
||||
property string type: ""
|
||||
property string noteFileId
|
||||
property string authorId
|
||||
signal clickTags(string tagName)
|
||||
|
||||
// paddings: {
|
||||
|
@ -41,12 +42,14 @@ FluArea {
|
|||
property int browsCount: 555
|
||||
property bool isLike: false
|
||||
property bool isFavorite: false
|
||||
property double fileSize: 455
|
||||
property string title: "文章标题"
|
||||
property list<string> tags: ["tag 1", "tag 2", "tag 3"]
|
||||
property string publishTime: "2020-01-01"
|
||||
property string brief: "这是一个简介"
|
||||
|
||||
property string fileTitle: "dfnfgf"
|
||||
property string fileType: "OTHER"
|
||||
|
||||
function getType(suffix) {
|
||||
if (suffix === "md")
|
||||
return "MD"
|
||||
|
@ -62,7 +65,38 @@ FluArea {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Request.getSearch("note/" + noteFileId, function (response, data) {
|
||||
note_page.fileId = data.id
|
||||
note_page.fileTitle = data.name
|
||||
note_page.fileType = getType(data.knowledgeFileAttribute.suffix)
|
||||
note_page.fileStars = 0
|
||||
|
||||
var tagString = ""
|
||||
for (var j = 0; j < data.tags.length; j++) {
|
||||
if (j != 0)
|
||||
tagString = tagString + ","
|
||||
tagString = tagString + data.tags[j].name
|
||||
}
|
||||
note_page.fileTags = tagString
|
||||
|
||||
likeCount = data.likers.length
|
||||
isLike = false
|
||||
for (var j = 0; j < data.likers.length; j++) {
|
||||
if (data.likers[j].id === UserData.userId) {
|
||||
isLike = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
favoriteCount = data.starrers.length
|
||||
isLike = false
|
||||
for (var j = 0; j < data.starrers.length; j++) {
|
||||
if (data.starrers[j].id === UserData.userId) {
|
||||
isFavorite = true
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
FluIconButton {
|
||||
|
@ -87,6 +121,17 @@ FluArea {
|
|||
bold: true
|
||||
}
|
||||
}
|
||||
FluIconButton {
|
||||
id: button_edit_note
|
||||
iconSize: FluentIcons.Edit
|
||||
visible: authorId === UserData.userId
|
||||
onClicked: {
|
||||
emit: SignalFileOperation.modifyNote(note_page.fileId,
|
||||
note_page.fileType,
|
||||
note_page.fileTitle,
|
||||
noteFileId)
|
||||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
id: layout_share
|
||||
FluIconButton {
|
||||
|
@ -113,6 +158,12 @@ FluArea {
|
|||
id: button_favorite
|
||||
iconSize: 15
|
||||
iconSource: note_page.isFavorite ? FluentIcons.FavoriteStarFill : FluentIcons.FavoriteStar
|
||||
onClicked: {
|
||||
note_page.isFavorite = !note_page.isFavorite
|
||||
Request.put("/note/" + noteFileId + "/star", {
|
||||
"active": note_page.isFavorite
|
||||
})
|
||||
}
|
||||
}
|
||||
FluText {
|
||||
id: text_favorite
|
||||
|
@ -132,6 +183,12 @@ FluArea {
|
|||
id: button_like
|
||||
iconSize: 15
|
||||
iconSource: note_page.isLike ? FluentIcons.HeartFill : FluentIcons.Heart
|
||||
onClicked: {
|
||||
note_page.isLike = !note_page.isLike
|
||||
Request.put("/note/" + noteFileId + "/like", {
|
||||
"active": note_page.isLike
|
||||
})
|
||||
}
|
||||
}
|
||||
FluText {
|
||||
id: text_like
|
||||
|
@ -149,7 +206,7 @@ FluArea {
|
|||
|
||||
FluArea {
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 100
|
||||
implicitHeight: 140
|
||||
ColumnLayout {
|
||||
RowLayout {
|
||||
width: parent.width
|
||||
|
@ -191,13 +248,42 @@ FluArea {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 30
|
||||
Layout.leftMargin: 10
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onDoubleClicked: {
|
||||
emit: SignalFileOperation.open(note_page.fileId)
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
id: titleRow
|
||||
Image {
|
||||
id: icon
|
||||
source: note_page.fileType ? "qrc:/AicsKnowledgeBase/res/"
|
||||
+ note_page.fileType + ".png" : ""
|
||||
Layout.preferredHeight: 24
|
||||
Layout.preferredWidth: 24
|
||||
}
|
||||
FluText {
|
||||
id: title
|
||||
font.bold: true
|
||||
font.pointSize: 12
|
||||
text: note_page.fileTitle
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NoteEditPage {
|
||||
id: text_view
|
||||
noteId: "255454"
|
||||
width: parent.width
|
||||
implicitHeight: 400
|
||||
implicitHeight: width * 9 / 16
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 2.0 KiB |
|
@ -11,7 +11,7 @@ FileTransferListModel::FileTransferListModel(QObject *parent)
|
|||
m_roleName.insert(kSpeedRole, "speed");
|
||||
m_roleName.insert(kPausedRole, "paused");
|
||||
|
||||
m_data.append({true, "id", "name", 30, 100, 30});
|
||||
//m_data.append({true, "id", "name", 30, 100, 30});
|
||||
}
|
||||
|
||||
|
||||
|
|