Compare commits

..

No commits in common. "f40c6b28654f0d45cd0aa4f1510da2928b8a2cac" and "1c6aba5baf715a8cd4cd5bc59bcf2be72323c2b2" have entirely different histories.

5 changed files with 111 additions and 165 deletions

View File

@ -4,7 +4,6 @@ import QtQuick.Window
import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI
import SignalFileOperation 1.0
import org.wangwenx190.FramelessHelper
import "qrc:///AicsKnowledgeBase/qml/global"
import "qrc:///AicsKnowledgeBase/qml/page"
@ -55,76 +54,15 @@ FluWindow {
}
}
StackView {
id: stack_view
ContentPage {
Layout.fillHeight: true
Layout.fillWidth: true
Layout.topMargin: 45
Layout.bottomMargin: 4
Layout.rightMargin: 4
replaceEnter: Transition {
PropertyAnimation {
target: stack_view
property: "opacity"
from: 0
to: 1
duration:700
easing.type: Easing.InOutElastic;
easing.amplitude: 2.0;
easing.period: 1.5
type: "md"
}
}
replaceExit: Transition {
PropertyAnimation {
target: stack_view
property: "opacity"
from: 1
to: 0
duration:500
easing.type: Easing.InOutElastic;
easing.amplitude: 2.0;
easing.period: 1.5
}
}
}
Connections {
target: SignalFileOperation
function onOpen(file) {
stack_view.push(file_view, {knowledgeFileId: file})
}
function onOpenNote(note) {
stack_view.push(note_view, {noteFileId: note})
}
function onBack() {
if(stack_view.depth > 0)
stack_view.pop()
}
}
Component {
id: file_view
ContentPage {
}
}
Component {
id: note_view
NotePage {
}
}
// ContentPage {
// Layout.fillHeight: true
// Layout.fillWidth: true
// Layout.topMargin: 45
// Layout.bottomMargin: 4
// Layout.rightMargin: 4
// type: "md"
// }
/*

View File

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

View File

@ -40,10 +40,9 @@ FluArea {
id: content_area
paddings: 0
backgroundColor: "#f9f9f9"
// visible: false
visible: false
property string type: ""
property string knowledgeFileId
signal back()
signal download(string knowledgeFileId)
signal clickTags(string tagName)
@ -53,6 +52,13 @@ FluArea {
// bottom: 10
// left: 10
// }
Connections {
target: SignalFileOperation
function onOpen(file) {
content_area.visible = true
content_page.loadFile(file)
}
}
FluScrollablePage {
id: content_page
@ -63,7 +69,6 @@ FluArea {
bottomPadding: 0
property string fileId
property int noteCount: 0
property int favoriteCount: 0
property int shareCount: 0
property int browsCount: 555
@ -72,7 +77,7 @@ FluArea {
property double fileSize: 455
property string title: "文章标题"
property list<string> tags: ["tag 1", "tag 2", "tag 3"]
property var publishTime
property string publishTime: "2020-01-01"
property string brief: "这是一个简介"
function getType(suffix) {
@ -116,19 +121,8 @@ FluArea {
}
Component.onCompleted: {
loadFile(knowledgeFileId)
console.log(content_area.type)
}
FluIconButton {
iconSize: 12
iconSource: FluentIcons.Back
onClicked: {
emit: SignalFileOperation.back()
}
Layout.margins: -5
}
Item {
Layout.fillWidth: true
@ -155,7 +149,7 @@ FluArea {
}
}
FluText {
text: content_page.noteCount
text: ""
font.pointSize: 8
Layout.alignment: button_note.Center
Layout.topMargin: -5
@ -268,47 +262,38 @@ FluArea {
}
}
Loader {
id: content_view
Layout.fillWidth: true
sourceComponent: video_view
}
Component {
id: video_view
FluMediaPlayer {
Layout.fillWidth: true
implicitHeight: width * 9 / 16.
}
}
Component {
id: text_view
NoteEditPage {
noteId: "255454"
Layout.fillWidth: true
implicitHeight: 400
}
}
Component {
id: other_view
WebEngineView {
Layout.fillWidth: true
id: sitemonitory_view
backgroundColor: "transparent"
implicitHeight: 200
settings.javascriptEnabled: true
settings.pluginsEnabled: true
url: "https://www.baidu.com"
}
// StackView {
// id: content_view
// Layout.fillWidth: true
// implicitHeight: 400
// initialItem: other_view
// }
// Component {
// id: video_view
// FluMediaPlayer {
// width: parent.width
// implicitHeight: width * 9 / 16.
// }
// }
// Component {
// id: text_view
// NoteEditPage {
// noteId: "255454"
// width: parent.width
// implicitHeight: 400
// }
// }
// Component {
// id: other_view
// WebEngineView {
// width: parent.width
// backgroundColor: "transparent"
// implicitHeight: 200
// settings.javascriptEnabled: true
// settings.pluginsEnabled: true
// url: "https://www.baidu.com"
// }
// }
}
}
}

View File

@ -8,16 +8,16 @@ import FluentUI
import AicsKB.FileTransferManager
import SignalFileOperation 1.0
import "qrc:///AicsKnowledgeBase/qml/page"
import "qrc:///AicsKnowledgeBase/qml/component"
import "qrc:///AicsKnowledgeBase/qml/global"
FluArea {
id: note_area
paddings: 0
backgroundColor: "#f9f9f9"
// visible: false
visible: false
property string type: ""
property string noteFileId
property string noteId
property string isFile: false
property string knowledgeUrl : "aics/main/knowledge/"
signal clickTags(string tagName)
// paddings: {
@ -26,6 +26,12 @@ FluArea {
// bottom: 10
// left: 10
// }
Connections {
target: SignalFileOperation
function onOpen(file) {
}
}
FluScrollablePage {
id: note_page
@ -35,45 +41,44 @@ FluArea {
rightPadding: 10
bottomPadding: 0
property string fileId
property int likeCount: 0
property int favoriteCount: 0
property int shareCount: 0
property int browsCount: 555
property bool isLike: false
property bool isFavorite: false
property bool isDownload: 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 list<string> tags: ["tag1", "tag2", "tag3"]
property string publishTime: "2002-01-01"
property string brief: "这是一个简介"
function getType(suffix) {
if(suffix === "md")
return "MD"
else if(suffix === "mp4" || suffix === "avi"
|| suffix === "rmvb" || suffix === "rm"
|| suffix === "wmv" || suffix === "mkv")
return "VIDEO"
else return "OTHER"
return "md"
else if(suffix === "mp4" || suffix === "avi" || suffix === "rmvb" || suffix === "mkv")
return "video"
else return "other"
}
function loadFile(noteFileId) {
note_area.noteFileId = noteFileId
function loadFile(noteId) {
var fileUrl = knowledgeUrl+noteId
Request.get(fileUrl, function (response) {
var data = JSON.parse(response)
console.log(data.knowledgeFileAttribute)
publishTime = data.createTime
type = getType(data.knowledgeFileAttribute.suffix)
brief = data.knowledgeFileAttribute.brief
fileSize = data.knowledgeFileAttribute.size
browsCount = data.knowledgeFileAttribute.pageView
var tagString = ""
for (var j = 0; j < file.knowledgeFileAttribute.tags.length; j++) {
if (j != 0)
tagString = tagString + ","
tagString = tagString + file.knowledgeFileAttribute.tags[j].name
}
Component.onCompleted: {
}
FluIconButton {
iconSize: 12
iconSource: FluentIcons.Back
onClicked: {
emit: SignalFileOperation.back()
}
Layout.margins: -5
tags = tagString.split(",")
})
}
Item {
@ -83,7 +88,7 @@ FluArea {
FluText {
id: text_title
padding: 10
text: note_page.title
text: "文章标题"
font {
pointSize: 15
bold: true
@ -95,7 +100,7 @@ FluArea {
id: button_share
iconSize: 15
iconSource: FluentIcons.Share
text: note_page.shareCount.toString()
text: content_page.shareCount.toString()
}
FluText {
id: text_share
@ -113,8 +118,12 @@ FluArea {
id: layout_favorite
FluIconButton {
id: button_favorite
iconSize: 15
iconSource: note_page.isFavorite ? FluentIcons.FavoriteStarFill : FluentIcons.FavoriteStar
onClicked: {
Request.put()
}
}
FluText {
id: text_favorite
@ -137,7 +146,7 @@ FluArea {
}
FluText {
id: text_like
text: note_page.likeCount
text: note_page.favoriteCount
font.pointSize: 8
Layout.alignment: button_like.Center
Layout.topMargin: -5
@ -147,6 +156,20 @@ FluArea {
right: layout_favorite.left
}
}
FluIconButton {
id: button_download
iconSize: 25
iconSource: note_page.isDownload ? FluentIcons.OEM : FluentIcons.Download
anchors {
verticalCenter: text_title.verticalCenter
right: layout_like.left
rightMargin: 20
}
onClicked: {
emit: content_area.download(content_area.knowledgeFileId)
FileTransferManager.download(content_area.knowledgeFileId)
}
}
}
FluArea {
@ -154,33 +177,32 @@ FluArea {
implicitHeight: 100
ColumnLayout {
RowLayout {
width: parent.width
FluText {
padding: 10
text: note_page.publishTime
text: content_page.publishTime
}
FluText {
padding: 10
text: note_page.fileSize.toString() + "MB"
text: content_page.fileSize.toString() + "MB"
}
FluText {
padding: 10
text: note_page.browsCount.toString() + "浏览量"
text: content_page.browsCount.toString() + "浏览量"
}
}
FluText {
Layout.topMargin: -2
Layout.leftMargin: 10
text: note_page.brief
text: content_page.brief
}
RowLayout {
Layout.topMargin: 2
Layout.leftMargin: 5
Repeater {
model: note_page.tags
model: content_page.tags
delegate: Button {
Layout.margins: 2
text: "#" + note_page.tags[index]
text: "#" + content_page.tags[index]
background: Rectangle {
implicitHeight: 10
implicitWidth: 10
@ -188,18 +210,20 @@ FluArea {
radius: 10
}
onClicked: {
emit: note_area.clickTags(text)
emit: content_area.clickTags(text)
}
}
}
}
}
}
NoteEditPage {
id: text_view
id: md_edit_page
noteId: "255454"
width: parent.width
Layout.fillWidth: true
implicitHeight: 400
}
}
}