Compare commits

..

No commits in common. "eb09b43ee874e86ba8f4a5320e3bce0634f3159e" and "29f4da6430ca73fbb749ca6308721203cd865379" have entirely different histories.

4 changed files with 24 additions and 77 deletions

View File

@ -102,9 +102,7 @@ FluWindow {
target: SignalFileOperation
function onOpen(file) {
stack_view.clear()
stack_view.push(file_view, {
"knowledgeFileId": file
})
stack_view.push(file_view, {knowledgeFileId: file})
}
function onOpenNote(note) {
stack_view.push(note_view, {
@ -115,9 +113,6 @@ FluWindow {
if (stack_view.depth > 0)
stack_view.pop()
}
function onCreateNote() {
stack_view.push(create_note_view)
}
}
Component {
@ -132,9 +127,12 @@ FluWindow {
Component {
id: create_note_view
CreateNotePage {}
CreateNotePage {
}
}
// ContentPage {
// Layout.fillHeight: true
// Layout.fillWidth: true

View File

@ -5,6 +5,5 @@ import QtQuick
QtObject {
signal open(string file)
signal openNote(string note)
signal createNote
signal back
signal back()
}

View File

@ -41,9 +41,10 @@ FluArea {
paddings: 0
backgroundColor: "#f9f9f9"
// visible: false
property string type: "MD"
property string type: ""
property string knowledgeFileId
signal back
signal download(string knowledgeFileId)
signal clickTags(string tagName)
// paddings: {
@ -67,13 +68,11 @@ FluArea {
property int browsCount: 555
property bool isFavorite: false
property bool isDownload: false
property double fileSize: 0
property double fileSize: 455
property string title: "文章标题"
property list<string> tags: ["tag 1", "tag 2", "tag 3"]
property var publishTime
property string brief: "这是一个简介"
property string fileUrl: "https://api.hammer-hfut.tk:233/aics/file/"
property string suffix: "md"
function getType(suffix) {
if (suffix === "md")
@ -115,14 +114,11 @@ FluArea {
// }
// content_page.favoriteCount = starers.length
if (content_area.type == "MD") {
// console.log(content_area.type)
console.log(content_area.type)
FileTransferManager.getMarkdown(
content_page.fileId)
} else if (content_area.type == "VIDEO") {
content_view.push(video_view, {
"url": fileUrl + "static/"
+ fileId + "." + suffix
})
} else {
Request.get("knowledge/" + knowledgeFileId + "/preview/external",
function (res) {
@ -215,13 +211,6 @@ FluArea {
id: button_favorite
iconSize: 15
iconSource: content_page.isFavorite ? FluentIcons.FavoriteStarFill : FluentIcons.FavoriteStar
onClicked: {
content_page.isFavorite = !content_page.isFavorite
content_page.favoriteCount += 1
Request.put("knowledge/" + knowledgeFileId + "/star", {
"active": UserData.userId
})
}
}
FluText {
id: text_favorite
@ -245,12 +234,10 @@ FluArea {
rightMargin: 20
}
onClicked: {
if (!content_page.isDownload)
FileTransferManager.download(content_page.fileId,
content_page.title)
else {
}
emit: content_area.download(content_area.knowledgeFileId)
//FileTransferManager.getMarkdown(content_page.fileId)
FileTransferManager.download(content_page.fileId,
content_page.title)
}
}
}
@ -267,9 +254,7 @@ FluArea {
}
FluText {
padding: 10
text: fileSize > 1024 * 1024 ? (fileSize / 1024 / 1024).toFixed(
2) + "MB" : (fileSize / 1024).toFixed(
2) + "KB"
text: content_page.fileSize.toString() + "MB"
}
FluText {
padding: 10

View File

@ -15,7 +15,7 @@ FluArea {
id: note_area
paddings: 0
backgroundColor: "#f9f9f9"
// visible: false
// visible: false
property string type: ""
property string noteFileId
signal clickTags(string tagName)
@ -26,6 +26,7 @@ FluArea {
// bottom: 10
// left: 10
// }
FluScrollablePage {
id: note_page
anchors.fill: parent
@ -46,46 +47,24 @@ 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")
if(suffix === "md")
return "MD"
else if (suffix === "mp4" || suffix === "avi" || suffix === "rmvb"
|| suffix === "rm" || suffix === "wmv" || suffix === "mkv")
else if(suffix === "mp4" || suffix === "avi"
|| suffix === "rmvb" || suffix === "rm"
|| suffix === "wmv" || suffix === "mkv")
return "VIDEO"
else
return "OTHER"
else return "OTHER"
}
function loadNote(noteFileId) {
note_area.noteFileId = noteFileId
}
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 +201,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(",")
// }
}
}