Optimize the functionality of history records and bookmarks
Former-commit-id: 66ae47c23bfcd17e8e1b3ac92651b2783420fb7bpull/174/head
parent
221a51285a
commit
a353e41045
|
|
@ -1 +1 @@
|
|||
9dc494cdf61d0a08d80b3a70ab36e37b0bce928e
|
||||
8b170933a5d6546e73e62330145fd627f47f89f3
|
||||
|
|
@ -1 +1 @@
|
|||
e80e9d025b8fca2da7fee65df5b9bc95e0f0f1ac
|
||||
f9e84131e7791851eb4a2ebcdb477d12fdb2e320
|
||||
|
|
@ -1,11 +1,14 @@
|
|||
<template>
|
||||
<div>
|
||||
<block v-for="(item) in prompts" :key="item.name">
|
||||
<template v-for="(item) in prompts" :key="item.name">
|
||||
<physton-prompt v-if="item.$textarea" :id="item.id" :ref="item.id" :name="item.name"
|
||||
:neg="item.neg" :textarea="item.$textarea" :steps="item.$steps"
|
||||
v-model:language-code="languageCode"
|
||||
:translate-apis="translateApis" :languages="languages"
|
||||
:history-key="item.historyKey" :favorite-key="item.favoriteKey"
|
||||
:history-key="item.historyKey"
|
||||
@click:show-history="onShowHistory(item.id, $event)"
|
||||
:favorite-key="item.favoriteKey"
|
||||
@click:show-favorite="onShowFavorite(item.id, $event)"
|
||||
v-model:auto-translate-to-english="autoTranslateToEnglish"
|
||||
v-model:auto-translate-to-local="autoTranslateToLocal"
|
||||
:hide-default-input="item.hideDefaultInput"
|
||||
|
|
@ -17,7 +20,7 @@
|
|||
:translate-api-config="translateApiConfig"
|
||||
@click:translate-api="onTranslateApiClick"
|
||||
@click:select-language="onSelectLanguageClick"></physton-prompt>
|
||||
</block>
|
||||
</template>
|
||||
<translate-setting ref="translateSetting" v-model:language-code="languageCode"
|
||||
:translate-apis="translateApis" :languages="languages"
|
||||
@forceUpdate:translateApi="updateTranslateApiConfig"
|
||||
|
|
@ -26,6 +29,10 @@
|
|||
:translate-apis="translateApis"
|
||||
:languages="languages"
|
||||
v-model:translate-api="translateApi"></select-language>
|
||||
<history ref="history" v-model:language-code="languageCode"
|
||||
:translate-apis="translateApis" :languages="languages" @use="onUseHistory"/>
|
||||
<favorite ref="favorite" v-model:language-code="languageCode"
|
||||
:translate-apis="translateApis" :languages="languages" @use="onUseFavorite"></favorite>
|
||||
|
||||
<div class="physton-paste-popup" v-if="showPastePopup" @click="closePastePopup">
|
||||
<div class="paste-popup-main" @click.stop>
|
||||
|
|
@ -52,10 +59,14 @@ import common from "@/utils/common";
|
|||
import IconClose from "@/components/icons/iconClose.vue";
|
||||
import IconLoading from "@/components/icons/iconLoading.vue";
|
||||
import SelectLanguage from "@/components/selectLanguage.vue";
|
||||
import Favorite from "@/components/favorite.vue";
|
||||
import History from "@/components/history.vue";
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
History,
|
||||
Favorite,
|
||||
SelectLanguage,
|
||||
IconLoading,
|
||||
IconClose,
|
||||
|
|
@ -73,9 +84,7 @@ export default {
|
|||
button: 'txt2img_token_button',
|
||||
steps: 'txt2img_steps',
|
||||
historyKey: 'txt2img',
|
||||
history: [],
|
||||
favoriteKey: 'txt2img',
|
||||
favorite: [],
|
||||
$prompt: null,
|
||||
$textarea: null,
|
||||
$steps: null,
|
||||
|
|
@ -94,9 +103,7 @@ export default {
|
|||
button: 'txt2img_negative_token_button',
|
||||
steps: 'txt2img_steps',
|
||||
historyKey: 'txt2img_neg',
|
||||
history: [],
|
||||
favoriteKey: 'txt2img_neg',
|
||||
favorite: [],
|
||||
$prompt: null,
|
||||
$textarea: null,
|
||||
$steps: null,
|
||||
|
|
@ -115,9 +122,7 @@ export default {
|
|||
button: 'img2img_token_button',
|
||||
steps: 'img2img_steps',
|
||||
historyKey: 'img2img',
|
||||
history: [],
|
||||
favoriteKey: 'img2img',
|
||||
favorite: [],
|
||||
$prompt: null,
|
||||
$textarea: null,
|
||||
$steps: null,
|
||||
|
|
@ -136,9 +141,7 @@ export default {
|
|||
button: 'img2img_negative_token_button',
|
||||
steps: 'img2img_steps',
|
||||
historyKey: 'img2img_neg',
|
||||
history: [],
|
||||
favoriteKey: 'img2img_neg',
|
||||
favorite: [],
|
||||
$prompt: null,
|
||||
$textarea: null,
|
||||
$steps: null,
|
||||
|
|
@ -163,13 +166,14 @@ export default {
|
|||
|
||||
startWatchSave: false,
|
||||
|
||||
showSelectLanguage: false,
|
||||
|
||||
pasteBtn: null,
|
||||
showPastePopup: false,
|
||||
pasteTitle: '',
|
||||
pasteContent: '',
|
||||
pasteLoading: false,
|
||||
|
||||
historyCurrentPrompt: '',
|
||||
favoriteCurrentPrompt: '',
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -263,8 +267,6 @@ export default {
|
|||
init() {
|
||||
let dataListsKeys = ['languageCode', 'autoTranslateToEnglish', 'autoTranslateToLocal', /*'hideDefaultInput', */'translateApi', 'enableTooltip']
|
||||
this.prompts.forEach(item => {
|
||||
// dataListsKeys.push(item.historyKey)
|
||||
// dataListsKeys.push(item.favoriteKey)
|
||||
dataListsKeys.push(item.hideDefaultInputKey)
|
||||
dataListsKeys.push(item.hidePanelKey)
|
||||
})
|
||||
|
|
@ -313,8 +315,6 @@ export default {
|
|||
item.$prompt = document.getElementById(item.prompt)
|
||||
item.$textarea = item.$prompt.getElementsByTagName("textarea")[0]
|
||||
item.$steps = document.getElementById(item.steps)
|
||||
// item.history = data[item.historyKey] || []
|
||||
// item.favorite = data[item.favoriteKey] || []
|
||||
})
|
||||
this.$nextTick(() => {
|
||||
this.prompts.forEach(item => {
|
||||
|
|
@ -327,7 +327,13 @@ export default {
|
|||
})
|
||||
|
||||
this.handlePaste()
|
||||
|
||||
// todo: test
|
||||
// this.$refs.translateSetting.open(this.translateApi)
|
||||
/*this.onShowFavorite('phystonPrompt_txt2img_prompt', {
|
||||
clientY: 150,
|
||||
clientX: 283,
|
||||
})*/
|
||||
})
|
||||
},
|
||||
updateTippyState() {
|
||||
|
|
@ -363,6 +369,7 @@ export default {
|
|||
this.$refs.translateSetting.open(this.translateApi)
|
||||
},
|
||||
handlePaste() {
|
||||
if (typeof gradioApp !== 'function') return
|
||||
const $pastes = gradioApp().querySelectorAll("#paste")
|
||||
if (!$pastes || $pastes.length <= 0) return
|
||||
$pastes.forEach(($paste, index) => {
|
||||
|
|
@ -456,6 +463,32 @@ export default {
|
|||
item.hidePanel = value
|
||||
this.gradioAPI.setData(item.hidePanelKey, item.hidePanel)
|
||||
},
|
||||
onShowHistory(id, e) {
|
||||
this.$refs.favorite.hide()
|
||||
this.historyCurrentPrompt = id
|
||||
const item = this.prompts.find(item => item.id == id)
|
||||
if (!item) return
|
||||
this.$refs.history.show(item.historyKey, e)
|
||||
},
|
||||
onUseHistory(history) {
|
||||
if (!this.historyCurrentPrompt) return
|
||||
const item = this.prompts.find(item => item.id == this.historyCurrentPrompt)
|
||||
if (!item) return
|
||||
this.$refs[item.id][0].useFavorite(history)
|
||||
},
|
||||
onShowFavorite(id, e) {
|
||||
this.$refs.history.hide()
|
||||
this.favoriteCurrentPrompt = id
|
||||
const item = this.prompts.find(item => item.id == id)
|
||||
if (!item) return
|
||||
this.$refs.favorite.show(item.favoriteKey, e)
|
||||
},
|
||||
onUseFavorite(favorite) {
|
||||
if (!this.favoriteCurrentPrompt) return
|
||||
const item = this.prompts.find(item => item.id == this.favoriteCurrentPrompt)
|
||||
if (!item) return
|
||||
this.$refs[item.id][0].useFavorite(favorite)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,24 +1,32 @@
|
|||
<template>
|
||||
<div class="physton-prompt-favorite" ref="favorite" :style="style" @mouseenter="onMouseEnter"
|
||||
@mouseleave="onMouseLeave">
|
||||
<div class="favorite-content">
|
||||
<div class="favorite-detail" v-show="currentItem && currentItem.tags">
|
||||
<div class="favorite-item-tags">
|
||||
<template v-for="(tag, index) in currentItem.tags" :key="index">
|
||||
<div v-if="tag.type && tag.type === 'wrap'" class="favorite-item-wrap"></div>
|
||||
<div v-else class="favorite-item-tag">
|
||||
<div class="item-tag-value">{{ tag.value }}</div>
|
||||
<div class="item-tag-local-value">{{ tag.localValue }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="physton-prompt-favorite" ref="favorite" v-show="isShow" @mouseenter="onMouseEnter"
|
||||
@mouseleave="onMouseLeave" @click.stop="">
|
||||
<div class="popup-tabs">
|
||||
<div v-for="(group) in favorites" :key="group.key"
|
||||
:class="['popup-tab', group.key === favoriteKey ? 'active': '']" @click="onTabClick(group.key)">
|
||||
<div class="tab-name">{{ getLang(group.name) }}</div>
|
||||
<div class="tab-type">{{ getLang(group.type) }}</div>
|
||||
<div class="tab-count">{{ group.list.length }}</div>
|
||||
</div>
|
||||
<div class="favorite-list" v-show="favorites.length > 0" :style="{height: defaultHeight + 'px'}">
|
||||
<div class="favorite-item" v-for="(item, index) in favorites" :key="item.id"
|
||||
</div>
|
||||
<div class="popup-detail" v-show="currentItem && currentItem.tags">
|
||||
<div class="popup-item-tags">
|
||||
<template v-for="(tag, index) in currentItem.tags" :key="index">
|
||||
<div v-if="tag.type && tag.type === 'wrap'" class="item-wrap"></div>
|
||||
<div v-else class="item-tag">
|
||||
<div class="item-tag-value">{{ tag.value }}</div>
|
||||
<div class="item-tag-local-value">{{ tag.localValue }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div v-for="(group) in favorites" :key="group.key" :class="['popup-tab-content', group.key === favoriteKey ? 'active': '']">
|
||||
<div class="content-list" v-show="group.list.length > 0">
|
||||
<div class="content-item" v-for="(item, index) in group.list" :key="item.id"
|
||||
@mouseenter="onItemMouseEnter(index)" @mouseleave="onItemMouseLeave(index)">
|
||||
<div class="favorite-item-header">
|
||||
<div class="item-header">
|
||||
<div class="item-header-left">
|
||||
<div class="item-header-index">{{ favorites.length - index }}</div>
|
||||
<div class="item-header-index">{{ group.list.length - index }}</div>
|
||||
<div class="item-header-time">{{ formatTime(item.time) }}</div>
|
||||
<div class="item-header-name">
|
||||
<input class="header-name-input" :value="item.name"
|
||||
|
|
@ -45,13 +53,13 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="favorite-item-prompt">{{ item.prompt }}</div>
|
||||
<div class="item-prompt">{{ item.prompt }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="favorite-empty" v-show="favorites.length === 0">
|
||||
<icon-loading width="64" height="64" v-if="loading"/>
|
||||
<span v-else>{{ emptyMsg }}</span>
|
||||
<div class="content-empty" v-show="group.list.length === 0">
|
||||
<icon-loading width="64" height="64" v-if="loading"/>
|
||||
<span v-else>{{ emptyMsg }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -66,145 +74,131 @@ import IconUse from "@/components/icons/iconUse.vue";
|
|||
|
||||
export default {
|
||||
components: {IconUse, IconCopy, IconLoading, IconFavoriteState},
|
||||
props: {
|
||||
favoriteKey: {
|
||||
type: String,
|
||||
default: '',
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
props: {},
|
||||
mixins: [LanguageMixin],
|
||||
data() {
|
||||
return {
|
||||
favorites: [],
|
||||
favoriteKey: '',
|
||||
favorites: [
|
||||
{
|
||||
'name': 'txt2img',
|
||||
'type': 'prompt',
|
||||
'key': 'txt2img',
|
||||
'list': [],
|
||||
},
|
||||
{
|
||||
'name': 'txt2img',
|
||||
'type': 'negative_prompt',
|
||||
'key': 'txt2img_neg',
|
||||
'list': [],
|
||||
},
|
||||
{
|
||||
'name': 'img2img',
|
||||
'type': 'prompt',
|
||||
'key': 'img2img',
|
||||
'list': [],
|
||||
},
|
||||
{
|
||||
'name': 'img2img',
|
||||
'type': 'negative_prompt',
|
||||
'key': 'img2img_neg',
|
||||
'list': [],
|
||||
},
|
||||
],
|
||||
isShow: false,
|
||||
top: 0,
|
||||
left: 0,
|
||||
loading: false,
|
||||
emptyMsg: '',
|
||||
defaultWidth: 500,
|
||||
defaultHeight: 500,
|
||||
style: {
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
overflow: 'hidden',
|
||||
},
|
||||
mouseEnter: false,
|
||||
currentItem: {}
|
||||
}
|
||||
},
|
||||
emits: ['use'],
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
formatTime(time) {
|
||||
let now = new Date(time * 1000);
|
||||
let year = now.getFullYear();
|
||||
let month = now.getMonth() + 1;
|
||||
if (month < 10) month = "0" + month;
|
||||
let day = now.getDate();
|
||||
if (day < 10) day = "0" + day;
|
||||
let hour = now.getHours();
|
||||
if (hour < 10) hour = "0" + hour;
|
||||
let minute = now.getMinutes();
|
||||
if (minute < 10) minute = "0" + minute;
|
||||
let second = now.getSeconds();
|
||||
if (second < 10) second = "0" + second;
|
||||
return `${month}/${day} ${hour}:${minute}:${second}`
|
||||
return common.formatTime(time, false)
|
||||
},
|
||||
show($button) {
|
||||
if (!$button) return
|
||||
if (this.isShow) {
|
||||
this._hide(0)
|
||||
return
|
||||
}
|
||||
this.mouseEnter = false
|
||||
this.favorites = []
|
||||
|
||||
let eWidth = $button.offsetWidth
|
||||
let eHeight = $button.offsetHeight
|
||||
let top = $button.offsetTop
|
||||
let left = $button.offsetLeft + eWidth + 2
|
||||
if (top + this.defaultHeight > window.innerHeight) top = window.innerHeight - this.defaultHeight
|
||||
if (left + this.defaultWidth > window.innerWidth) left = window.innerWidth - this.defaultWidth
|
||||
if (top < 0) top = 0
|
||||
if (left < 0) left = 0
|
||||
this.top = top
|
||||
this.left = left
|
||||
|
||||
this._show()
|
||||
this.gradioAPI.getFavorites(this.favoriteKey).then(res => {
|
||||
// 倒序
|
||||
res.reverse()
|
||||
res.forEach(item => {
|
||||
item.is_favorite = true
|
||||
})
|
||||
this.favorites = res
|
||||
getFavorites(favoriteKey) {
|
||||
if (!favoriteKey) return
|
||||
let favoriteItem = this.favorites.find(item => item.key === favoriteKey)
|
||||
if (!favoriteItem) return
|
||||
this.loading = true
|
||||
this.gradioAPI.getFavorites(favoriteKey).then(res => {
|
||||
if(res && res.length > 0){
|
||||
// 倒序
|
||||
res.reverse()
|
||||
res.forEach(item => {
|
||||
item.is_favorite = true
|
||||
})
|
||||
favoriteItem.list = res
|
||||
}
|
||||
this.emptyMsg = this.getLang('no_favorite')
|
||||
this.loading = false
|
||||
}).catch(err => {
|
||||
this.emptyMsg = this.getLang('get_favorite_error')
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
show(favoriteKey, e) {
|
||||
if (!favoriteKey || !e) return
|
||||
this.favoriteKey = favoriteKey
|
||||
if (this.isShow) {
|
||||
this.isShow = false
|
||||
return
|
||||
}
|
||||
this.mouseEnter = false
|
||||
|
||||
this.loading = true
|
||||
this.isShow = true
|
||||
this.$refs.favorite.style.top = (e.clientY + 2) + 'px'
|
||||
this.$refs.favorite.style.left = (e.clientX + 2) + 'px'
|
||||
|
||||
this.getFavorites(this.favoriteKey)
|
||||
|
||||
// 如果n秒后鼠标还没进来,就隐藏
|
||||
setTimeout(() => {
|
||||
if (this.mouseEnter) return
|
||||
this._hide(0)
|
||||
this.hide()
|
||||
}, 3000)
|
||||
},
|
||||
_show() {
|
||||
this.isShow = true
|
||||
this.style.top = this.top + 'px'
|
||||
this.style.left = this.left + 'px'
|
||||
this.style.width = this.defaultWidth + 'px'
|
||||
this.style.height = this.defaultHeight + 'px'
|
||||
this.style.overflow = 'visible'
|
||||
},
|
||||
_hide(timeout = 1000) {
|
||||
hide() {
|
||||
this.mouseEnter = false
|
||||
this.isShow = false
|
||||
setTimeout(() => {
|
||||
if (this.isShow) return
|
||||
this.style.overflow = 'hidden'
|
||||
this.style.width = 0
|
||||
this.style.height = 0
|
||||
setTimeout(() => {
|
||||
if (this.isShow) return
|
||||
this.style.top = '-9999px'
|
||||
this.style.left = '-9999px'
|
||||
}, 200)
|
||||
}, timeout)
|
||||
},
|
||||
hide(timeout = 1000) {
|
||||
this._hide(timeout)
|
||||
},
|
||||
onMouseEnter() {
|
||||
this.mouseEnter = true
|
||||
this._show()
|
||||
},
|
||||
onMouseLeave() {
|
||||
this.mouseEnter = false
|
||||
this._hide()
|
||||
this.hide()
|
||||
},
|
||||
onTabClick(key) {
|
||||
this.favoriteKey = key
|
||||
this.getFavorites(this.favoriteKey)
|
||||
},
|
||||
onFavoriteClick(index) {
|
||||
let favorite = this.favorites[index]
|
||||
let group = this.favorites.find(item => item.key === this.favoriteKey)
|
||||
if (!group) return
|
||||
let favorite = group.list[index]
|
||||
if (!favorite.is_favorite) {
|
||||
this.gradioAPI.doFavorite(this.favoriteKey, favorite.id).then(res => {
|
||||
if (res) {
|
||||
this.favorites[index].is_favorite = true
|
||||
favorite.is_favorite = true
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.gradioAPI.unFavorite(this.favoriteKey, favorite.id).then(res => {
|
||||
if (res) {
|
||||
this.favorites[index].is_favorite = false
|
||||
favorite.is_favorite = false
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
onCopyClick(index) {
|
||||
this.$copyText(this.favorites[index].prompt).then(() => {
|
||||
let group = this.favorites.find(item => item.key === this.favoriteKey)
|
||||
if (!group) return
|
||||
let favorite = group.list[index]
|
||||
this.$copyText(favorite.prompt).then(() => {
|
||||
this.$toastr.success("success!")
|
||||
}).catch(() => {
|
||||
this.$toastr.error("error!")
|
||||
|
|
@ -214,30 +208,36 @@ export default {
|
|||
if (e.keyCode === 13) {
|
||||
// 离开焦点
|
||||
e.target.blur()
|
||||
// this.favorites[index].name = e.target.value
|
||||
}
|
||||
},
|
||||
onNameChange(index, e) {
|
||||
let group = this.favorites.find(item => item.key === this.favoriteKey)
|
||||
if (!group) return
|
||||
let favorite = group.list[index]
|
||||
const value = e.target.value
|
||||
this.gradioAPI.setFavoriteName(this.favoriteKey, this.favorites[index].id, value).then(res => {
|
||||
this.gradioAPI.setFavoriteName(this.favoriteKey, favorite.id, value).then(res => {
|
||||
if (res) {
|
||||
this.favorites[index].name = value
|
||||
favorite.name = value
|
||||
} else {
|
||||
e.target.value = this.favorites[index].name
|
||||
e.target.value = favorite.name
|
||||
}
|
||||
}).catch(err => {
|
||||
e.target.value = this.favorites[index].name
|
||||
e.target.value = favorite.name
|
||||
})
|
||||
},
|
||||
onItemMouseEnter(index) {
|
||||
this.currentItem = this.favorites[index]
|
||||
let group = this.favorites.find(item => item.key === this.favoriteKey)
|
||||
if (!group) return
|
||||
this.currentItem = group.list[index]
|
||||
},
|
||||
onItemMouseLeave(index) {
|
||||
this.currentItem = {}
|
||||
},
|
||||
onUseClick(index) {
|
||||
this._hide(0)
|
||||
this.$emit('use', this.favorites[index])
|
||||
let group = this.favorites.find(item => item.key === this.favoriteKey)
|
||||
if (!group) return
|
||||
this.hide()
|
||||
this.$emit('use', group.list[index])
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,36 @@
|
|||
<template>
|
||||
<div class="physton-prompt-history" ref="history" :style="style" @mouseenter="onMouseEnter"
|
||||
@mouseleave="onMouseLeave">
|
||||
<div class="history-content">
|
||||
<div class="history-detail" v-show="currentItem && currentItem.tags">
|
||||
<div class="history-item-tags">
|
||||
<template v-for="(tag, index) in currentItem.tags" :key="index">
|
||||
<div v-if="tag.type && tag.type === 'wrap'" class="history-item-wrap"></div>
|
||||
<div v-else class="history-item-tag">
|
||||
<div class="item-tag-value">{{ tag.value }}</div>
|
||||
<div class="item-tag-local-value">{{ tag.localValue }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="physton-prompt-history" ref="history" v-show="isShow" @mouseenter="onMouseEnter"
|
||||
@mouseleave="onMouseLeave" @click.stop="">
|
||||
<div class="popup-tabs">
|
||||
<div v-for="(group) in histories" :key="group.key"
|
||||
:class="['popup-tab', group.key === historyKey ? 'active': '']" @click="onTabClick(group.key)">
|
||||
<div class="tab-name">{{ getLang(group.name) }}</div>
|
||||
<div class="tab-type">{{ getLang(group.type) }}</div>
|
||||
<div class="tab-count">{{ group.list.length }}</div>
|
||||
</div>
|
||||
<div class="history-list" v-show="histories.length > 0" :style="{height: defaultHeight + 'px'}">
|
||||
<div class="history-clear" @click="onDeleteAllHistoryClick">
|
||||
</div>
|
||||
<div class="popup-detail" v-show="currentItem && currentItem.tags">
|
||||
<div class="popup-item-tags">
|
||||
<template v-for="(tag, index) in currentItem.tags" :key="index">
|
||||
<div v-if="tag.type && tag.type === 'wrap'" class="item-wrap"></div>
|
||||
<div v-else class="item-tag">
|
||||
<div class="item-tag-value">{{ tag.value }}</div>
|
||||
<div class="item-tag-local-value">{{ tag.localValue }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div v-for="(group) in histories" :key="group.key" :class="['popup-tab-content', group.key === historyKey ? 'active': '']">
|
||||
<div class="content-list" v-show="group.list.length > 0">
|
||||
<div class="clear-btn" @click="onDeleteAllHistoryClick">
|
||||
<icon-remove width="18" height="18" color="#ff4a4a"></icon-remove>
|
||||
{{ getLang('delete_all_history') }}
|
||||
</div>
|
||||
<div class="history-item" v-for="(item, index) in histories" :key="item.id"
|
||||
<div class="content-item" v-for="(item, index) in group.list" :key="item.id"
|
||||
@mouseenter="onItemMouseEnter(index)" @mouseleave="onItemMouseLeave(index)">
|
||||
<div class="history-item-header">
|
||||
<div class="item-header">
|
||||
<div class="item-header-left">
|
||||
<div class="item-header-index">{{ histories.length - index }}</div>
|
||||
<div class="item-header-index">{{ group.list.length - index }}</div>
|
||||
<div class="item-header-time">{{ formatTime(item.time) }}</div>
|
||||
<div class="item-header-name">
|
||||
<input class="header-name-input" :value="item.name"
|
||||
|
|
@ -49,13 +57,13 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="history-item-prompt">{{ item.prompt }}</div>
|
||||
<div class="item-prompt">{{ item.prompt }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="history-empty" v-show="histories.length === 0">
|
||||
<icon-loading width="64" height="64" v-if="loading"/>
|
||||
<span v-else>{{ emptyMsg }}</span>
|
||||
<div class="content-empty" v-show="group.list.length === 0">
|
||||
<icon-loading width="64" height="64" v-if="loading"/>
|
||||
<span v-else>{{ emptyMsg }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -71,158 +79,128 @@ import IconRemove from "@/components/icons/iconRemove.vue";
|
|||
|
||||
export default {
|
||||
components: {IconRemove, IconUse, IconCopy, IconLoading, IconFavoriteState},
|
||||
props: {
|
||||
historyKey: {
|
||||
type: String,
|
||||
default: '',
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
props: {},
|
||||
mixins: [LanguageMixin],
|
||||
data() {
|
||||
return {
|
||||
histories: [],
|
||||
historyKey: '',
|
||||
histories: [
|
||||
{
|
||||
'name': 'txt2img',
|
||||
'type': 'prompt',
|
||||
'key': 'txt2img',
|
||||
'list': [],
|
||||
},
|
||||
{
|
||||
'name': 'txt2img',
|
||||
'type': 'negative_prompt',
|
||||
'key': 'txt2img_neg',
|
||||
'list': [],
|
||||
},
|
||||
{
|
||||
'name': 'img2img',
|
||||
'type': 'prompt',
|
||||
'key': 'img2img',
|
||||
'list': [],
|
||||
},
|
||||
{
|
||||
'name': 'img2img',
|
||||
'type': 'negative_prompt',
|
||||
'key': 'img2img_neg',
|
||||
'list': [],
|
||||
},
|
||||
],
|
||||
isShow: false,
|
||||
top: 0,
|
||||
left: 0,
|
||||
loading: false,
|
||||
emptyMsg: '',
|
||||
defaultWidth: 500,
|
||||
defaultHeight: 600,
|
||||
style: {
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
overflow: 'hidden',
|
||||
},
|
||||
mouseEnter: false,
|
||||
currentItem: {}
|
||||
}
|
||||
},
|
||||
emits: ['use'],
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
formatTime(time) {
|
||||
let now = new Date(time * 1000);
|
||||
let year = now.getFullYear();
|
||||
let month = now.getMonth() + 1;
|
||||
if (month < 10) month = "0" + month;
|
||||
let day = now.getDate();
|
||||
if (day < 10) day = "0" + day;
|
||||
let hour = now.getHours();
|
||||
if (hour < 10) hour = "0" + hour;
|
||||
let minute = now.getMinutes();
|
||||
if (minute < 10) minute = "0" + minute;
|
||||
let second = now.getSeconds();
|
||||
if (second < 10) second = "0" + second;
|
||||
return `${month}/${day} ${hour}:${minute}:${second}`
|
||||
return common.formatTime(time, false)
|
||||
},
|
||||
show($button) {
|
||||
if (!$button) return
|
||||
if (this.isShow) {
|
||||
this._hide(0)
|
||||
return
|
||||
}
|
||||
this.mouseEnter = false
|
||||
this.histories = []
|
||||
|
||||
let eWidth = $button.offsetWidth
|
||||
let eHeight = $button.offsetHeight
|
||||
let top = $button.offsetTop
|
||||
let left = $button.offsetLeft + eWidth + 2
|
||||
if (top + this.defaultHeight > window.innerHeight) top = window.innerHeight - this.defaultHeight
|
||||
if (left + this.defaultWidth > window.innerWidth) left = window.innerWidth - this.defaultWidth
|
||||
if (top < 0) top = 0
|
||||
if (left < 0) left = 0
|
||||
this.top = top
|
||||
this.left = left
|
||||
|
||||
this._show()
|
||||
this.gradioAPI.getHistories(this.historyKey).then(res => {
|
||||
// 倒序
|
||||
res.reverse()
|
||||
this.histories = res
|
||||
getHistories(historyKey) {
|
||||
if (!historyKey) return
|
||||
let historyItem = this.histories.find(item => item.key === historyKey)
|
||||
if (!historyItem) return
|
||||
this.loading = true
|
||||
this.gradioAPI.getHistories(historyKey).then(res => {
|
||||
if (res && res.length > 0) {
|
||||
// 倒序
|
||||
res.reverse()
|
||||
historyItem.list = res
|
||||
}
|
||||
this.emptyMsg = this.getLang('no_history')
|
||||
this.loading = false
|
||||
}).catch(err => {
|
||||
this.emptyMsg = this.getLang('get_history_error')
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
show(historyKey, e) {
|
||||
if (!historyKey || !e) return
|
||||
this.historyKey = historyKey
|
||||
if (this.isShow) {
|
||||
this.isShow = false
|
||||
return
|
||||
}
|
||||
this.mouseEnter = false
|
||||
|
||||
this.loading = true
|
||||
this.isShow = true
|
||||
this.$refs.history.style.top = (e.clientY + 2) + 'px'
|
||||
this.$refs.history.style.left = (e.clientX + 2) + 'px'
|
||||
|
||||
this.getHistories(this.historyKey)
|
||||
|
||||
// 如果n秒后鼠标还没进来,就隐藏
|
||||
setTimeout(() => {
|
||||
if (this.mouseEnter) return
|
||||
this._hide(0)
|
||||
this.hide()
|
||||
}, 3000)
|
||||
},
|
||||
_show() {
|
||||
this.isShow = true
|
||||
this.style.top = this.top + 'px'
|
||||
this.style.left = this.left + 'px'
|
||||
this.style.width = this.defaultWidth + 'px'
|
||||
this.style.height = this.defaultHeight + 'px'
|
||||
this.style.overflow = 'visible'
|
||||
},
|
||||
_hide(timeout = 1000) {
|
||||
hide() {
|
||||
this.mouseEnter = false
|
||||
this.isShow = false
|
||||
setTimeout(() => {
|
||||
if (this.isShow) return
|
||||
this.style.overflow = 'hidden'
|
||||
this.style.width = 0
|
||||
this.style.height = 0
|
||||
setTimeout(() => {
|
||||
if (this.isShow) return
|
||||
this.style.top = '-9999px'
|
||||
this.style.left = '-9999px'
|
||||
}, 200)
|
||||
}, timeout)
|
||||
},
|
||||
hide(timeout = 1000) {
|
||||
this._hide(timeout)
|
||||
},
|
||||
onMouseEnter() {
|
||||
this.mouseEnter = true
|
||||
this._show()
|
||||
},
|
||||
onMouseLeave() {
|
||||
this.mouseEnter = false
|
||||
this._hide()
|
||||
this.hide()
|
||||
},
|
||||
push(tags, prompt) {
|
||||
if (!tags.length) return
|
||||
this.gradioAPI.getLatestHistory(this.historyKey).then(res => {
|
||||
if (res && res.prompt === prompt) {
|
||||
// 如果有上一条记录,并且prompt相同,则更新
|
||||
this.gradioAPI.setHistory(this.historyKey, res.id, tags, prompt, res.name).then(res => {
|
||||
}).catch(err => {
|
||||
})
|
||||
} else {
|
||||
this.gradioAPI.pushHistory(this.historyKey, tags, prompt).then(res => {
|
||||
}).catch(err => {
|
||||
})
|
||||
}
|
||||
}).catch(err => {
|
||||
})
|
||||
onTabClick(key) {
|
||||
this.historyKey = key
|
||||
this.getHistories(this.historyKey)
|
||||
},
|
||||
onFavoriteClick(index) {
|
||||
let history = this.histories[index]
|
||||
let group = this.histories.find(item => item.key === this.historyKey)
|
||||
if (!group) return
|
||||
let history = group.list[index]
|
||||
if (!history.is_favorite) {
|
||||
this.gradioAPI.doFavorite(this.historyKey, history.id).then(res => {
|
||||
if (res) {
|
||||
this.histories[index].is_favorite = true
|
||||
history.is_favorite = true
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.gradioAPI.unFavorite(this.historyKey, history.id).then(res => {
|
||||
if (res) {
|
||||
this.histories[index].is_favorite = false
|
||||
history.is_favorite = false
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
onCopyClick(index) {
|
||||
this.$copyText(this.histories[index].prompt).then(() => {
|
||||
let group = this.histories.find(item => item.key === this.historyKey)
|
||||
if (!group) return
|
||||
let history = group.list[index]
|
||||
this.$copyText(history.prompt).then(() => {
|
||||
this.$toastr.success("success!")
|
||||
}).catch(() => {
|
||||
this.$toastr.error("error!")
|
||||
|
|
@ -232,35 +210,43 @@ export default {
|
|||
if (e.keyCode === 13) {
|
||||
// 离开焦点
|
||||
e.target.blur()
|
||||
// this.histories[index].name = e.target.value
|
||||
}
|
||||
},
|
||||
onNameChange(index, e) {
|
||||
let group = this.histories.find(item => item.key === this.historyKey)
|
||||
if (!group) return
|
||||
let history = group.list[index]
|
||||
const value = e.target.value
|
||||
this.gradioAPI.setFavoriteName(this.historyKey, this.histories[index].id, value).then(res => {
|
||||
this.gradioAPI.setHistoryName(this.historyKey, history.id, value).then(res => {
|
||||
if (res) {
|
||||
this.histories[index].name = value
|
||||
history.name = value
|
||||
} else {
|
||||
e.target.value = this.histories[index].name
|
||||
e.target.value = history.name
|
||||
}
|
||||
}).catch(err => {
|
||||
e.target.value = this.histories[index].name
|
||||
e.target.value = history.name
|
||||
})
|
||||
},
|
||||
onItemMouseEnter(index) {
|
||||
this.currentItem = this.histories[index]
|
||||
let group = this.histories.find(item => item.key === this.historyKey)
|
||||
if (!group) return
|
||||
this.currentItem = group.list[index]
|
||||
},
|
||||
onItemMouseLeave(index) {
|
||||
this.currentItem = {}
|
||||
},
|
||||
onUseClick(index) {
|
||||
this._hide(0)
|
||||
this.$emit('use', this.histories[index])
|
||||
let group = this.histories.find(item => item.key === this.historyKey)
|
||||
if (!group) return
|
||||
this.hide()
|
||||
this.$emit('use', group.list[index])
|
||||
},
|
||||
onDeleteAllHistoryClick() {
|
||||
let group = this.histories.find(item => item.key === this.historyKey)
|
||||
if (!group) return
|
||||
if (!confirm(this.getLang('delete_all_history_confirm'))) return
|
||||
this.gradioAPI.deleteHistories(this.historyKey).then(res => {
|
||||
this.histories = []
|
||||
group.list = []
|
||||
}).catch(err => {
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
a251853a9a60e36df77c40141c839a0d4b2fc01b
|
||||
59cccb48f1acf3516c34c580235ec9fc018cc9a8
|
||||
|
|
@ -650,10 +650,14 @@
|
|||
|
||||
.append-group-name {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
|
||||
.name-icon {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.arrow-right {
|
||||
margin-left: 20px;
|
||||
|
||||
|
|
@ -754,18 +758,55 @@
|
|||
}
|
||||
|
||||
.physton-prompt-favorite, .physton-prompt-history {
|
||||
.common-popup-main(0, 0, absolute);
|
||||
.common-popup-main(500px, 0, absolute);
|
||||
z-index: 999;
|
||||
top: -9999px;
|
||||
left: -9999px;
|
||||
top: 0;
|
||||
left: 0;
|
||||
overflow: visible;
|
||||
|
||||
.favorite-content, .history-content {
|
||||
position: relative;
|
||||
.popup-tabs {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
border-top-left-radius: 6px;
|
||||
border-top-right-radius: 6px;
|
||||
overflow: hidden;
|
||||
|
||||
.popup-tab {
|
||||
padding: 5px 0;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
flex: 1;
|
||||
border-bottom: 1px solid #787878;
|
||||
|
||||
&:hover, &.active {
|
||||
.common-colourful-background();
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.tab-name, .tab-type, .tab-count {
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.tab-name {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.tab-type {
|
||||
font-size: 12px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.tab-count {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.favorite-detail, .history-detail {
|
||||
.popup-detail {
|
||||
position: absolute;
|
||||
right: -404px;
|
||||
left: 100%;
|
||||
top: 0;
|
||||
width: 400px;
|
||||
z-index: 1000;
|
||||
|
|
@ -774,20 +815,20 @@
|
|||
padding: 10px;
|
||||
color: #1d1d1d;
|
||||
|
||||
.favorite-item-tags, .history-item-tags {
|
||||
.popup-item-tags {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.favorite-item-wrap, .history-item-wrap {
|
||||
.item-wrap {
|
||||
flex-basis: 100%;
|
||||
height: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.favorite-item-tag, .history-item-tag {
|
||||
.item-tag {
|
||||
margin-right: 5px;
|
||||
margin-bottom: 5px;
|
||||
|
||||
|
|
@ -811,127 +852,138 @@
|
|||
}
|
||||
}
|
||||
|
||||
.favorite-list, .history-list {
|
||||
.popup-tab-content {
|
||||
display: none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
overflow-y: auto;
|
||||
height: 500px;
|
||||
|
||||
.history-clear {
|
||||
background: rgba(30, 30, 30, .9);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
padding: 10px 10px;
|
||||
cursor: pointer;
|
||||
border-bottom: 1px solid @common-blue; // 6772FF
|
||||
color: @common-red;
|
||||
text-align: center;
|
||||
&.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.content-list {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
overflow: hidden;
|
||||
overflow-y: auto;
|
||||
|
||||
.clear-btn {
|
||||
background: rgba(30, 30, 30, .9);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
padding: 10px 10px;
|
||||
cursor: pointer;
|
||||
border-bottom: 1px solid @common-blue; // 6772FF
|
||||
color: @common-red;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
&:hover {
|
||||
border-bottom: 1px solid @common-red;
|
||||
font-weight: bold;
|
||||
//background: center center @common-blue;
|
||||
}
|
||||
}
|
||||
|
||||
.content-item {
|
||||
padding: 6px 10px;
|
||||
border-bottom: 1px solid #3c3c3c;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: rgba(255, 255, 255, .2);
|
||||
//.common-colourful-background();
|
||||
|
||||
.item-prompt {
|
||||
overflow: visible;
|
||||
white-space: normal;
|
||||
//color: #1d1d1d;
|
||||
}
|
||||
}
|
||||
|
||||
.item-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
|
||||
.item-header-left, .item-header-right {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
|
||||
> div {
|
||||
margin-right: 10px;
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-header-left {
|
||||
.item-header-index {
|
||||
background: @common-blue;
|
||||
padding: 2px 0;
|
||||
width: 32px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.item-header-time {
|
||||
width: 110px;
|
||||
}
|
||||
|
||||
.item-header-name {
|
||||
.header-name-input {
|
||||
background: transparent;
|
||||
border: 1px solid #3c3c3c;
|
||||
height: 20px;
|
||||
padding: 0 4px;
|
||||
width: 210px;
|
||||
font-size: 12px;
|
||||
color: #00F9E5;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: @common-blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-header-right {
|
||||
font-size: 12px;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.item-prompt {
|
||||
margin-top: 5px;
|
||||
font-size: 14px;
|
||||
line-height: 18px;
|
||||
color: #fff;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.content-empty {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
&:hover {
|
||||
border-bottom: 1px solid @common-red;
|
||||
font-weight: bold;
|
||||
//background: center center @common-blue;
|
||||
span {
|
||||
font-size: 22px;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.favorite-item, .history-item {
|
||||
padding: 6px 10px;
|
||||
border-bottom: 1px solid #3c3c3c;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
.common-colourful-background();
|
||||
|
||||
.favorite-item-prompt, .history-item-prompt {
|
||||
overflow: visible;
|
||||
white-space: normal;
|
||||
color: #1d1d1d;
|
||||
}
|
||||
}
|
||||
|
||||
.favorite-item-header, .history-item-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
|
||||
.item-header-left, .item-header-right {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
|
||||
> div {
|
||||
margin-right: 10px;
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-header-left {
|
||||
.item-header-index {
|
||||
background: @common-blue;
|
||||
padding: 2px 0;
|
||||
width: 32px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.item-header-time {
|
||||
width: 110px;
|
||||
}
|
||||
|
||||
.item-header-name {
|
||||
.header-name-input {
|
||||
background: transparent;
|
||||
border: 1px solid #3c3c3c;
|
||||
height: 20px;
|
||||
padding: 0 4px;
|
||||
width: 210px;
|
||||
font-size: 12px;
|
||||
color: #00F9E5;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: @common-blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-header-right {
|
||||
font-size: 12px;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.favorite-item-prompt, .history-item-prompt {
|
||||
margin-top: 5px;
|
||||
font-size: 14px;
|
||||
line-height: 18px;
|
||||
color: #fff;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.favorite-empty, .history-empty {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
span {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import splitTags from "@/utils/splitTags";
|
||||
|
||||
export default {
|
||||
weightNumRegex: /(.*):([0-9\.]+)/,
|
||||
weightNumRegexEN: /(.*):\s*([0-9\.]+)/,
|
||||
|
|
@ -351,4 +352,29 @@ export default {
|
|||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取当前时间
|
||||
* @param time {number}
|
||||
* @returns {string}
|
||||
*/
|
||||
formatTime(time, hasYear = true) {
|
||||
let now = new Date(time * 1000);
|
||||
let year = now.getFullYear();
|
||||
let month = now.getMonth() + 1;
|
||||
if (month < 10) month = "0" + month;
|
||||
let day = now.getDate();
|
||||
if (day < 10) day = "0" + day;
|
||||
let hour = now.getHours();
|
||||
if (hour < 10) hour = "0" + hour;
|
||||
let minute = now.getMinutes();
|
||||
if (minute < 10) minute = "0" + minute;
|
||||
let second = now.getSeconds();
|
||||
if (second < 10) second = "0" + second;
|
||||
if (hasYear) {
|
||||
return `${year}/${month}/${day} ${hour}:${minute}:${second}`
|
||||
} else {
|
||||
return `${month}/${day} ${hour}:${minute}:${second}`
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
189bb5ba599aa1bbad682331a0fec7c0e31ac7aa
|
||||
Loading…
Reference in New Issue