Compare commits

..

No commits in common. "ecff8e709ca5babace419a45c5a07db0b47cadb1" and "234c24e9f05affd9f0b2e6c4256a896ae64be942" have entirely different histories.

4 changed files with 18 additions and 67 deletions

View File

@ -95,7 +95,7 @@ FluWindow {
duration: 200
}
}
initialItem: note_view
initialItem: create_note_view
}
Connections {
@ -118,19 +118,18 @@ FluWindow {
stack_view.pop()
}
function onCreateNote(file, fileType, fileTitle) {
stack_view.push(create_note_view, {
stack_view.push(note_view, {
"knowledgeFileId": file,
"fileType": fileType,
"fileTitle": fileTitle
})
}
function onModifyNote(file, fileType, fileTitle, note) {
stack_view.push(create_note_view, {
stack_view.push(note_view, {
"knowledgeFileId": file,
"fileType": fileType,
"fileTitle": fileTitle,
"noteId": note,
"isModifying": true
"noteId": note
})
}
}

View File

@ -31,13 +31,11 @@ FluArea {
noteListModel: content_page.noteListModel
onOpen: function handle(noteId, authorId) {
emit: SignalFileOperation.openNote(noteId, authorId)
popup.close()
}
onCreateNote: function handle() {
emit: SignalFileOperation.createNote(content_page.fileId,
content_area.type,
emit: SignalFileOperation.createNote(
content_area.knowledgeFileId, content_area.type,
content_page.title)
popup.close()
}
}
}
@ -94,9 +92,8 @@ FluArea {
function loadFile(knowledgeFileId) {
content_area.knowledgeFileId = knowledgeFileId
console.log(knowledgeFileId)
Request.get("knowledge/" + knowledgeFileId + "/detailed",
Request.get("knowledge/" + knowledgeFileId + "/detail",
function (response, data) {
console.log(response)
content_page.publishTime = data.createTime
content_page.title = data.name
content_page.fileId = data.knowledgeFileAttribute.id
@ -104,7 +101,7 @@ FluArea {
content_page.fileSize = data.knowledgeFileAttribute.size
content_area.type = getType(content_page.suffix)
console.log(content_area.fileId)
console.log(content_area.type)
var tagString = ""
for (var j = 0; j < data.knowledgeFileAttribute.tags.length; j++) {
@ -248,7 +245,7 @@ FluArea {
content_page.isFavorite = !content_page.isFavorite
content_page.favoriteCount += 1
Request.put("knowledge/" + knowledgeFileId + "/star", {
"active": content_page.isFavorite
"active": UserData.userId
})
}
}
@ -354,6 +351,7 @@ FluArea {
FluMediaPlayer {
width: parent.width
height: width * 9 / 16.
source: "https://api.hammer-hfut.tk:233/aics/file/static/3f28fea9-27f1-4a85-9d3e-def187c4456e.mp4"
}
}
Component {

View File

@ -25,8 +25,6 @@ FluArea {
property bool isModifying: false
Component.onCompleted: {
console.log(knowledgeFileId)
isModifying = false
if (isModifying) {
Request.getSearch("/search/note/" + noteFileId + "/content",
function (response, data) {
@ -139,10 +137,7 @@ FluArea {
text: "上传"
onClicked: {
if (noteTitle.trim() !== "" && noteContent !== "") {
console.log(noteTitle)
console.log(noteContent)
console.log(knowledgeFileId)
if (!isModifying) {
if (isModifying) {
Request.post("note", {
"title": noteTitle,
"content": noteContent,

View File

@ -18,7 +18,6 @@ FluArea {
// visible: false
property string type: ""
property string noteFileId
property string authorId
signal clickTags(string tagName)
// paddings: {
@ -47,6 +46,7 @@ FluArea {
property string publishTime: "2020-01-01"
property string brief: "这是一个简介"
property string uuid: "354"
property string fileTitle: "dfnfgf"
property string fileType: "OTHER"
@ -65,37 +65,19 @@ FluArea {
}
Component.onCompleted: {
Request.getSearch("note/" + noteFileId, function (response, data) {
note_page.fileId = data.id
Request.getSearch("/", function (response, data) {
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 < data.tags.length; j++) {
for (var j = 0; j < file.knowledgeFileAttribute.tags.length; j++) {
if (j != 0)
tagString = tagString + ","
tagString = tagString + data.tags[j].name
tagString = tagString + file.knowledgeFileAttribute.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
}
}
})
}
@ -121,17 +103,6 @@ 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 {
@ -158,12 +129,6 @@ 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
@ -183,12 +148,6 @@ 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
@ -256,7 +215,7 @@ FluArea {
MouseArea {
anchors.fill: parent
onDoubleClicked: {
emit: SignalFileOperation.open(note_page.fileId)
emit: SignalFileOperation.open(note_page.uuid)
}
}
RowLayout {