This commit is contained in:
Jesse-Ma
2022-05-27 14:29:30 +08:00
parent af75777b4e
commit 0d10a1802a
32 changed files with 1909 additions and 1 deletions

79
src/api/note.js Normal file
View File

@@ -0,0 +1,79 @@
import axios from "axios";
import Jquery from "jquery";
import {getStoreKey} from "@/api/lock";
import storage from "@/libs/storage";
export function saveNote(noteForm) {
let storeKey = getStoreKey(noteForm.key);
let storeText = storage.local.getText(storeKey + '.text');
let note = {
"lock": storeText.substring(0, 1),
"text": storeText.substring(35)
}
console.log("n"+ storeText)
return axios({
url: '/note/' + noteForm.key,
method: 'post',
data: note
}
)
}
// export function getSecretKey(key, password) {
// console.log("getSecretKey");
// let secretKey = '';
// Jquery.ajax({
// method: 'POST',
// url: '/note/' + key + "/secretKey",
// async: false,
// contentType: 'application/json',
// dataTeyp: 'json',
// data: JSON.stringify({'password': password}),
// success: function (data) {
// secretKey = data;
// },
// error: function () {
// alert('服务器链接异常 ');
// },
// });
// return secretKey;
// }
export function getNoteMeta(key) {
console.log("getNoteMeta");
let noteMeta = {};
Jquery.ajax({
method: 'GET',
url: '/note/' + key + "/noteMeta",
async: false,
success: function (data) {
noteMeta = eval(data); //eval("(" + data + ")");
},
error: function () {
noteMeta = null;
},
});
return noteMeta;
}
export function getKeyMeta() {
console.log("getKeyMeta");
let keyMeta = {};
Jquery.ajax({
method: 'GET',
url: '/note/keyMeta',
async: false,
success: function (data) {
keyMeta = eval(data); //eval("(" + data + ")");
},
error: function () {
keyMeta = null;
},
});
return keyMeta;
}