tag1
This commit is contained in:
79
src/api/note.js
Normal file
79
src/api/note.js
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user