Compare commits

..

No commits in common. "b6627ccd2cb6894eb07370a542f11cafcf813cb3" and "b8581ba3df0301268ba1b87557e71a302d69e60b" have entirely different histories.

4 changed files with 25 additions and 241 deletions

View File

@ -1,106 +0,0 @@
import QtQuick 2.15
import FluentUI
import QtQuick.Layouts
FluArea {
id: fileItem
property string uuid
property string title
property string brief
property string date
property string type
property string suffix
property bool isDir: false
property int size
property int pageView
property var tags: []
property int stars
property var colorList: ["blue", "green", "orange", "red", "yellow", "purple", "pink", "brown", "teal", "cyan", "gray", "darkgray"]
signal tagClicked(string tag)
ColumnLayout {
id: row
spacing: 10
ColumnLayout {
id: clickable
anchors.fill: parent
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onDoubleClicked: {
fileItem.parent.doubleClicked()
}
}
RowLayout {
id: titleRow
Image {
id: icon
source: type ? "qrc:/AicsKnowledgeBase/res/" + type + ".png" : ""
Layout.preferredHeight: 24
Layout.preferredWidth: 24
}
FluText {
id: title
font.bold: true
font.pointSize: 12
text: fileItem.title
}
}
FluText {
id: brief
visible: !fileItem.isDir
text: fileItem.brief
Layout.fillWidth: true
wrapMode: Text.WrapAnywhere
elide: Text.ElideRight
maximumLineCount: 2
textFormat: Text.RichText
}
RowLayout {
id: infoRow
visible: !fileItem.isDir
FluText {
id: date
color: "#5F5F5F"
text: fileItem.date
}
FluText {
id: size
// cast Byte size to right text size
color: "#5F5F5F"
text: fileItem.size > 1024
* 1024 ? (fileItem.size / 1024 / 1024).toFixed(
2) + "MB" : (fileItem.size / 1024).toFixed(
2) + "KB"
}
FluText {
id: pageView
color: "#5F5F5F"
text: fileItem.pageView + "浏览"
}
FluText {
id: stars
color: "#5F5F5F"
text: fileItem.stars + "收藏"
}
}
}
RowLayout {
visible: !fileItem.isDir
Repeater {
model: fileItem.tags
delegate: FluTextButton {
text: "#" + fileItem.tags[index]
normalColor: colorList[index % colorList.length]
font.pixelSize: 12
Layout.preferredWidth: 50
onClicked: {
emit: tagClicked(text)
}
}
}
}
}
}

View File

@ -28,12 +28,11 @@ FluArea {
backgroundColor: "#f9f9f9" backgroundColor: "#f9f9f9"
NoteList { NoteList {
id: noteList id: noteList
noteListModel: content_page.noteListModel
onOpen: function handle(noteId) { onOpen: function handle(noteId) {
emit: SignalFileOperation.openNote(noteId) emit: SignalFileOperation.openNote(noteId)
} }
onCreateNote: function handle() { onCreateNote: function handle() {
emit: SignalFileOperation.createNote() console.log("create note")
} }
} }
} }
@ -75,7 +74,6 @@ FluArea {
property string brief: "这是一个简介" property string brief: "这是一个简介"
property string fileUrl: "https://api.hammer-hfut.tk:233/aics/file/" property string fileUrl: "https://api.hammer-hfut.tk:233/aics/file/"
property string suffix: "md" property string suffix: "md"
property ListModel noteListModel
function getType(suffix) { function getType(suffix) {
if (suffix === "md") if (suffix === "md")
@ -90,14 +88,14 @@ FluArea {
function loadFile(knowledgeFileId) { function loadFile(knowledgeFileId) {
content_area.knowledgeFileId = knowledgeFileId content_area.knowledgeFileId = knowledgeFileId
console.log(knowledgeFileId) console.log(knowledgeFileId)
Request.get("knowledge/" + knowledgeFileId + "/detail", Request.get("knowledge/" + knowledgeFileId,
function (response, data) { function (response, data) {
content_page.publishTime = data.createTime content_page.publishTime = data.createTime
content_page.title = data.name content_page.title = data.name
content_page.fileId = data.knowledgeFileAttribute.id content_page.fileId = data.knowledgeFileAttribute.id
content_page.suffix = data.knowledgeFileAttribute.suffix
content_area.type = getType(content_page.suffix) content_area.type = getType(
data.knowledgeFileAttribute.suffix)
console.log(content_area.type) console.log(content_area.type)
var tagString = "" var tagString = ""
@ -111,39 +109,19 @@ FluArea {
content_page.brief = data.knowledgeFileAttribute.brief content_page.brief = data.knowledgeFileAttribute.brief
content_page.browsCount = data.knowledgeFileAttribute.pageView content_page.browsCount = data.knowledgeFileAttribute.pageView
isFavorite = false // var starers = data.knowledgeFileAttribute.starers
var starers = data.knowledgeFileAttribute.starers // for (var i = 0; i < starers.length; i++) {
for (var i = 0; i < starers.length; i++) {
if (starers[i].id === UserData.userId) {
isFavorite = true
}
}
content_page.favoriteCount = starers.length
noteListModel.clear() // }
var notes = data.knowledgeFileAttribute.notes // content_page.favoriteCount = starers.length
noteCount = notes.length if (content_area.type == "MD") {
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,
"pageView": notes[i].pageView,
"stars": notes[i].starrers.length,
"date": notes[i].createTime
})
}
if (content_area.type === "MD") {
// console.log(content_area.type) // console.log(content_area.type)
FileTransferManager.getMarkdown( FileTransferManager.getMarkdown(
content_page.fileId) 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, { content_view.push(video_view, {
"source": fileUrl + "static/" + fileId "url": fileUrl + "static/"
+ "." + suffix + fileId + "." + suffix
}) })
} else { } else {
Request.get("knowledge/" + knowledgeFileId + "/preview/external", Request.get("knowledge/" + knowledgeFileId + "/preview/external",
@ -338,15 +316,13 @@ FluArea {
id: content_view id: content_view
Layout.fillWidth: true Layout.fillWidth: true
height: 500 height: 500
//initialItem: video_view
} }
Component { Component {
id: video_view id: video_view
FluMediaPlayer { FluMediaPlayer {
width: parent.width width: parent.width
height: width * 9 / 16. implicitHeight: width * 9 / 16.
source: "https://api.hammer-hfut.tk:233/aics/file/static/3f28fea9-27f1-4a85-9d3e-def187c4456e.mp4"
} }
} }
Component { Component {

View File

@ -15,19 +15,10 @@ FluArea {
id: edit_area id: edit_area
paddings: 0 paddings: 0
backgroundColor: "#f9f9f9" backgroundColor: "#f9f9f9"
property string uuid
property string fileType: "OTHER"
property string fileTitle: "dgfgf"
property string noteId
property string noteTitle property string noteTitle
property string noteContent property string noteContent
property bool isModifying: false
Component.onCompleted: { Component.onCompleted: {
if (isModifying) {
}
noteTitle = Qt.binding(function () { noteTitle = Qt.binding(function () {
return input_title.text return input_title.text
}) })
@ -43,42 +34,14 @@ FluArea {
topPadding: 5 topPadding: 5
rightPadding: 5 rightPadding: 5
bottomPadding: 0 bottomPadding: 0
RowLayout {
Item { FluIconButton {
Layout.fillWidth: true iconSize: 12
implicitHeight: 30 iconSource: FluentIcons.Back
Layout.leftMargin: 5 onClicked: {
Layout.bottomMargin: 10 emit: SignalFileOperation.back()
MouseArea {
anchors.fill: parent
onDoubleClicked: {
emit: SignalFileOperation.open(note_page.uuid)
}
}
RowLayout {
id: titleRow
RowLayout {
FluIconButton {
iconSize: 12
iconSource: FluentIcons.Back
onClicked: {
emit: SignalFileOperation.back()
}
}
}
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
} }
Layout.margins: -5
} }
} }
Item { Item {
@ -127,7 +90,8 @@ FluArea {
FluFilledButton { FluFilledButton {
text: "上传" text: "上传"
onClicked: { onClicked: {
console.log(noteTitle)
console.log(noteContent)
} }
} }
FluButton { FluButton {

View File

@ -41,15 +41,12 @@ FluArea {
property int browsCount: 555 property int browsCount: 555
property bool isLike: false property bool isLike: false
property bool isFavorite: false property bool isFavorite: false
property double fileSize: 455
property string title: "文章标题" property string title: "文章标题"
property list<string> tags: ["tag 1", "tag 2", "tag 3"] property list<string> tags: ["tag 1", "tag 2", "tag 3"]
property string publishTime: "2020-01-01" property string publishTime: "2020-01-01"
property string brief: "这是一个简介" property string brief: "这是一个简介"
property string uuid: "354"
property string fileTitle: "dfnfgf"
property string fileType: "OTHER"
function getType(suffix) { function getType(suffix) {
if (suffix === "md") if (suffix === "md")
return "MD" return "MD"
@ -66,24 +63,6 @@ FluArea {
Component.onCompleted: { Component.onCompleted: {
// Request.get("knowledge/", function (response, data) {
// fromFile = {
// note_page.uuid = 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 < file.knowledgeFileAttribute.tags.length; j++) {
// if (j != 0)
// tagString = tagString + ","
// tagString = tagString + file.knowledgeFileAttribute.tags[j].name
// }
// note_page.fileTags = tagString
// })
} }
FluIconButton { FluIconButton {
@ -170,7 +149,7 @@ FluArea {
FluArea { FluArea {
Layout.fillWidth: true Layout.fillWidth: true
implicitHeight: 140 implicitHeight: 100
ColumnLayout { ColumnLayout {
RowLayout { RowLayout {
width: parent.width width: parent.width
@ -212,42 +191,13 @@ FluArea {
} }
} }
} }
Item {
Layout.fillWidth: true
implicitHeight: 30
Layout.leftMargin: 10
MouseArea {
anchors.fill: parent
onDoubleClicked: {
emit: SignalFileOperation.open(note_page.uuid)
}
}
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 { NoteEditPage {
id: text_view id: text_view
noteId: "255454" noteId: "255454"
width: parent.width width: parent.width
implicitHeight: width * 9 / 16 implicitHeight: 400
} }
} }
} }