Compare commits
2 Commits
29f4da6430
...
eb09b43ee8
Author | SHA1 | Date |
---|---|---|
wuyize | eb09b43ee8 | |
wuyize | 49aa95204e |
|
@ -102,7 +102,9 @@ 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, {
|
||||
|
@ -113,6 +115,9 @@ FluWindow {
|
|||
if (stack_view.depth > 0)
|
||||
stack_view.pop()
|
||||
}
|
||||
function onCreateNote() {
|
||||
stack_view.push(create_note_view)
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
|
@ -127,11 +132,8 @@ FluWindow {
|
|||
|
||||
Component {
|
||||
id: create_note_view
|
||||
CreateNotePage {
|
||||
|
||||
CreateNotePage {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ContentPage {
|
||||
// Layout.fillHeight: true
|
||||
|
|
|
@ -5,5 +5,6 @@ import QtQuick
|
|||
QtObject {
|
||||
signal open(string file)
|
||||
signal openNote(string note)
|
||||
signal back()
|
||||
signal createNote
|
||||
signal back
|
||||
}
|
||||
|
|
|
@ -41,10 +41,9 @@ FluArea {
|
|||
paddings: 0
|
||||
backgroundColor: "#f9f9f9"
|
||||
// visible: false
|
||||
property string type: ""
|
||||
property string type: "MD"
|
||||
property string knowledgeFileId
|
||||
signal back
|
||||
signal download(string knowledgeFileId)
|
||||
signal clickTags(string tagName)
|
||||
|
||||
// paddings: {
|
||||
|
@ -68,11 +67,13 @@ FluArea {
|
|||
property int browsCount: 555
|
||||
property bool isFavorite: false
|
||||
property bool isDownload: false
|
||||
property double fileSize: 455
|
||||
property double fileSize: 0
|
||||
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")
|
||||
|
@ -114,11 +115,14 @@ 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) {
|
||||
|
@ -211,6 +215,13 @@ 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
|
||||
|
@ -234,10 +245,12 @@ FluArea {
|
|||
rightMargin: 20
|
||||
}
|
||||
onClicked: {
|
||||
emit: content_area.download(content_area.knowledgeFileId)
|
||||
//FileTransferManager.getMarkdown(content_page.fileId)
|
||||
if (!content_page.isDownload)
|
||||
FileTransferManager.download(content_page.fileId,
|
||||
content_page.title)
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -254,7 +267,9 @@ FluArea {
|
|||
}
|
||||
FluText {
|
||||
padding: 10
|
||||
text: content_page.fileSize.toString() + "MB"
|
||||
text: fileSize > 1024 * 1024 ? (fileSize / 1024 / 1024).toFixed(
|
||||
2) + "MB" : (fileSize / 1024).toFixed(
|
||||
2) + "KB"
|
||||
}
|
||||
FluText {
|
||||
padding: 10
|
||||
|
|
|
@ -26,7 +26,6 @@ FluArea {
|
|||
// bottom: 10
|
||||
// left: 10
|
||||
// }
|
||||
|
||||
FluScrollablePage {
|
||||
id: note_page
|
||||
anchors.fill: parent
|
||||
|
@ -47,24 +46,46 @@ 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")
|
||||
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 {
|
||||
|
@ -201,5 +222,19 @@ 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(",")
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue