resource rename

This commit is contained in:
lmm214
2023-03-05 19:19:05 +08:00
parent 1035134582
commit 7be3484d7f
+8 -4
View File
@@ -1,3 +1,6 @@
dayjs.extend(window.dayjs_plugin_relativeTime)
dayjs.locale('zh-cn')
function get_info(callback) { function get_info(callback) {
chrome.storage.sync.get( chrome.storage.sync.get(
{ {
@@ -59,7 +62,6 @@ get_info(function (info) {
} else { } else {
$("textarea[name=text]").val(info.open_content) $("textarea[name=text]").val(info.open_content)
} }
//从localstorage 里面读取数据 //从localstorage 里面读取数据
setTimeout(get_info, 1) setTimeout(get_info, 1)
}) })
@@ -144,7 +146,11 @@ function uploadImage(data) {
get_info(function (info) { get_info(function (info) {
const formData = new FormData() const formData = new FormData()
if (info.status) { if (info.status) {
formData.append('file', data) let old_name = data.name.split('.');
let file_ext = data.name.split('.').pop();
let now = dayjs().format('YYYYMMDDHHmm')
let new_name = old_name[0] + '_' + now + '.' + file_ext;
formData.append('file', data, new_name)
$.ajax({ $.ajax({
url: info.apiUrl.replace(/api\/memo/,'api/resource/blob'), url: info.apiUrl.replace(/api\/memo/,'api/resource/blob'),
data: formData, data: formData,
@@ -290,8 +296,6 @@ $(document).on("click",".item-lock",function () {
) )
}) })
dayjs.extend(window.dayjs_plugin_relativeTime)
dayjs.locale('zh-cn')
$('#search').click(function () { $('#search').click(function () {
get_info(function (info) { get_info(function (info) {
if (info.status) { if (info.status) {