答辩版本
parent
f32bcae463
commit
d56a236466
|
@ -128,12 +128,14 @@ FluWindow {
|
|||
"fileTitle": fileTitle
|
||||
})
|
||||
}
|
||||
function onModifyNote(file, fileType, fileTitle, note) {
|
||||
function onModifyNote(file, fileType, fileTitle, note, noteTitle, noteContent) {
|
||||
stack_view.push(create_note_view, {
|
||||
"knowledgeFileId": file,
|
||||
"fileType": fileType,
|
||||
"fileTitle": fileTitle,
|
||||
"noteFileId": note,
|
||||
"noteTitle": noteTitle,
|
||||
"noteContent": noteContent,
|
||||
"isModifying": true
|
||||
})
|
||||
}
|
||||
|
|
|
@ -7,14 +7,6 @@ FluObject {
|
|||
|
||||
property var navigationView
|
||||
|
||||
FluPaneItem {
|
||||
title: "探索"
|
||||
icon: FluentIcons.Home
|
||||
onTap: {
|
||||
navigationView.push("qrc:/AicsKnowledgeBase/qml/page/HomePage.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItem {
|
||||
title: "全部"
|
||||
icon: FluentIcons.FileExplorer
|
||||
|
@ -27,7 +19,8 @@ FluObject {
|
|||
title: "文档"
|
||||
icon: FluentIcons.Document
|
||||
onTap: {
|
||||
navigationView.push("qrc:/AicsKnowledgeBase/qml/page/DocumentPage.qml")
|
||||
navigationView.push(
|
||||
"qrc:/AicsKnowledgeBase/qml/page/DocumentPage.qml")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +44,8 @@ FluObject {
|
|||
title: "搜索"
|
||||
icon: FluentIcons.Search
|
||||
onTap: {
|
||||
navigationView.push("qrc:/AicsKnowledgeBase/qml/page/SearchPage.qml")
|
||||
navigationView.push(
|
||||
"qrc:/AicsKnowledgeBase/qml/page/SearchPage.qml")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,11 +72,14 @@ QtObject {
|
|||
|
||||
function putForm(url, arg, success, failure) {
|
||||
var xhr = new XMLHttpRequest
|
||||
xhr.open("POST", baseUrl + url)
|
||||
xhr.setRequestHeader("Content-Length", arg.length)
|
||||
xhr.open("PUT", baseUrl + url)
|
||||
//xhr.setRequestHeader("Content-Length", arg.length)
|
||||
xhr.setRequestHeader("Content-Type",
|
||||
"application/x-www-form-urlencoded;")
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState === 4) {
|
||||
console.log(this.responseText)
|
||||
}
|
||||
handleResponse(xhr, success, failure)
|
||||
}
|
||||
xhr.send(arg)
|
||||
|
|
|
@ -6,6 +6,6 @@ QtObject {
|
|||
signal open(string file)
|
||||
signal openNote(string note, string authorId)
|
||||
signal createNote(string file, string fileType, string fileTitle)
|
||||
signal modifyNote(string file, string fileType, string fileTitle, string note)
|
||||
signal modifyNote(string file, string fileType, string fileTitle, string note, string noteTitle, string noteContent)
|
||||
signal back
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ FluArea {
|
|||
backgroundColor: "#f9f9f9"
|
||||
NoteList {
|
||||
id: noteList
|
||||
//noteListModel: noteListModel2
|
||||
noteListModel: noteListModel2
|
||||
onOpen: function handle(noteId, authorId) {
|
||||
emit: SignalFileOperation.openNote(noteId, authorId)
|
||||
popup.close()
|
||||
|
@ -125,7 +125,8 @@ FluArea {
|
|||
isFavorite = false
|
||||
var starers = data.knowledgeFileAttribute.starers
|
||||
for (var i = 0; i < starers.length; i++) {
|
||||
if (starers[i].id === UserData.userId) {
|
||||
if (starers[i].id.toString(
|
||||
) === UserData.userId) {
|
||||
isFavorite = true
|
||||
}
|
||||
}
|
||||
|
@ -263,13 +264,10 @@ FluArea {
|
|||
content_page.isFavorite = !content_page.isFavorite
|
||||
console.log(content_page.isFavorite)
|
||||
content_page.favoriteCount += (content_page.isFavorite ? 1 : -1)
|
||||
Request.put("knowledge/" + knowledgeFileId + "/star", {
|
||||
"active": content_page.isFavorite
|
||||
}, response => {
|
||||
console.log(response)
|
||||
}, response => {
|
||||
console.log(response)
|
||||
})
|
||||
var form = "active=" + content_page.isFavorite ? "true" : "false"
|
||||
Request.putForm(
|
||||
"knowledge/" + knowledgeFileId + "/star",
|
||||
form)
|
||||
}
|
||||
}
|
||||
FluText {
|
||||
|
|
|
@ -25,23 +25,19 @@ FluArea {
|
|||
property bool isModifying: false
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log(knowledgeFileId)
|
||||
isModifying = false
|
||||
if (isModifying) {
|
||||
Request.getSearch("/search/note/" + noteFileId + "/content",
|
||||
function (response, data) {
|
||||
input_title.text = data.title
|
||||
input_md.contentMd = data.content
|
||||
tags = data.tags
|
||||
function (response) {
|
||||
input_title.text = noteTitle
|
||||
})
|
||||
} else {
|
||||
noteTitle = Qt.binding(function () {
|
||||
return input_title.text
|
||||
})
|
||||
noteContent = Qt.binding(function () {
|
||||
return input_md.contentMd
|
||||
})
|
||||
}
|
||||
|
||||
noteTitle = Qt.binding(function () {
|
||||
return input_title.text
|
||||
})
|
||||
noteContent = Qt.binding(function () {
|
||||
return input_md.contentMd
|
||||
})
|
||||
}
|
||||
|
||||
FluScrollablePage {
|
||||
|
@ -92,24 +88,23 @@ FluArea {
|
|||
Item {
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 50
|
||||
FluText {
|
||||
id: text_title
|
||||
padding: 10
|
||||
text: "标题"
|
||||
font {
|
||||
pointSize: 15
|
||||
bold: true
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
FluText {
|
||||
id: text_title
|
||||
padding: 10
|
||||
text: "标题"
|
||||
font {
|
||||
pointSize: 15
|
||||
bold: true
|
||||
}
|
||||
}
|
||||
}
|
||||
FluTextBox {
|
||||
id: input_title
|
||||
padding: 10
|
||||
placeholderText: "单行输入框"
|
||||
implicitWidth: parent.width
|
||||
font.pointSize: 12
|
||||
anchors {
|
||||
left: text_title.right
|
||||
verticalCenter: text_title.verticalCenter
|
||||
FluTextBox {
|
||||
id: input_title
|
||||
padding: 10
|
||||
placeholderText: "单行输入框"
|
||||
implicitWidth: parent.width
|
||||
font.pointSize: 12
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,6 +125,7 @@ FluArea {
|
|||
height: width * 9 / 16
|
||||
isEditable: true
|
||||
isEditing: true
|
||||
contentMd: noteContent
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
|
|
@ -46,6 +46,7 @@ FluArea {
|
|||
}
|
||||
|
||||
textArea_edit.text = edit_area.contentMd
|
||||
|
||||
edit_area.contentMd = Qt.binding(function () {
|
||||
return textArea_edit.text
|
||||
})
|
||||
|
|
|
@ -155,7 +155,9 @@ FluArea {
|
|||
emit: SignalFileOperation.modifyNote(note_page.fileId,
|
||||
note_page.fileType,
|
||||
note_page.fileTitle,
|
||||
noteFileId)
|
||||
noteFileId,
|
||||
note_page.title,
|
||||
text_view.contentMd)
|
||||
}
|
||||
anchors {
|
||||
left: text_title.right
|
||||
|
|
|
@ -432,3 +432,29 @@ void FileTransferManager::openLocalFile(const QString &fileName)
|
|||
QDesktopServices::openUrl(QUrl::fromLocalFile("D:\\Downloads\\"+ fileName));
|
||||
}
|
||||
|
||||
void FileTransferManager::putForm(QString knowledgeId, bool active)
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if (!curl) {
|
||||
qCritical() << "CURL INIT FAILED!";
|
||||
return;
|
||||
}
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT");
|
||||
curl_easy_setopt(curl, CURLOPT_URL, ("https://api.hammer-hfut.tk:233/aics/main/knowledge/"+knowledgeId+"/star").toStdString().c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, true);
|
||||
curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 3000);
|
||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
|
||||
curl_mime *mime;
|
||||
curl_mimepart *part;
|
||||
mime = curl_mime_init(curl);
|
||||
part = curl_mime_addpart(mime);
|
||||
curl_mime_name(part, "active");
|
||||
curl_mime_data(part, active?"true":"false", CURL_ZERO_TERMINATED);
|
||||
curl_easy_setopt(curl, CURLOPT_MIMEPOST, mime);
|
||||
auto res = curl_easy_perform(curl);
|
||||
curl_mime_free(mime);
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,9 +34,14 @@ public:
|
|||
|
||||
Q_INVOKABLE void openLocalFile(const QString &fileName);
|
||||
|
||||
Q_INVOKABLE void putForm(QString knowledgeId, bool active);
|
||||
|
||||
signals:
|
||||
|
||||
void transferComplete(bool download, QString fileId, QString fileName);
|
||||
|
||||
void markdownData(QString data);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue