mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-01-22 22:28:14 -05:00
Fixed: #136 || multiple image timestamp rename bug
This commit is contained in:
parent
1af9af74ce
commit
8a8b97a937
@ -74,7 +74,6 @@
|
||||
"axios": "^0.16.1",
|
||||
"dateformat": "^3.0.3",
|
||||
"element-ui": "^2.0.5",
|
||||
"fecha": "^2.3.3",
|
||||
"fs-extra": "^4.0.2",
|
||||
"image-size": "^0.6.1",
|
||||
"keycode": "^2.1.9",
|
||||
|
@ -5,7 +5,7 @@ import {
|
||||
ipcMain
|
||||
} from 'electron'
|
||||
import path from 'path'
|
||||
import fecha from 'fecha'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
// eslint-disable-next-line
|
||||
const requireFunc = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require
|
||||
@ -67,7 +67,7 @@ const uploader = (img, type, webContents) => {
|
||||
switch (type) {
|
||||
case 'imgFromClipboard':
|
||||
if (img !== null) {
|
||||
const today = fecha.format(new Date(), 'YYYYMMDDHHmmss') + '.png'
|
||||
const today = dayjs().format('YYYYMMDDHHmmss') + '.png'
|
||||
input = [
|
||||
{
|
||||
base64Image: img.imgUrl.replace(/^data\S+,/, ''),
|
||||
@ -88,11 +88,11 @@ const uploader = (img, type, webContents) => {
|
||||
handle: async ctx => {
|
||||
const rename = picgo.getConfig('settings.rename')
|
||||
const autoRename = picgo.getConfig('settings.autoRename')
|
||||
await Promise.all(ctx.output.map(async item => {
|
||||
await Promise.all(ctx.output.map(async (item, index) => {
|
||||
let name
|
||||
let fileName
|
||||
if (autoRename) {
|
||||
fileName = fecha.format(new Date(), 'YYYYMMDDHHmmss') + item.extname
|
||||
fileName = dayjs().add(index, 'second').format('YYYYMMDDHHmmss') + item.extname
|
||||
} else {
|
||||
fileName = item.fileName
|
||||
}
|
||||
|
@ -3660,10 +3660,6 @@ fd-slicer@~1.0.1:
|
||||
dependencies:
|
||||
pend "~1.2.0"
|
||||
|
||||
fecha@^2.3.3:
|
||||
version "2.3.3"
|
||||
resolved "http://registry.npm.taobao.org/fecha/download/fecha-2.3.3.tgz#948e74157df1a32fd1b12c3a3c3cdcb6ec9d96cd"
|
||||
|
||||
figures@^1.4.0:
|
||||
version "1.7.0"
|
||||
resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e"
|
||||
|
Loading…
Reference in New Issue
Block a user