diff --git a/.claude/settings.local.json b/.claude/settings.local.json
index 41d5d9a..31d4cd5 100644
--- a/.claude/settings.local.json
+++ b/.claude/settings.local.json
@@ -7,7 +7,8 @@
"Bash(git -C \"D:/WebUI/Kexue/操作平台/AI_Painting_V2.0\" log --oneline --all -- src/stores/display.js)",
"Bash(git -C \"D:/WebUI/Kexue/操作平台/AI_Painting_V2.0\" log --oneline --all -- src/components/dialogBox/index.vue)",
"Bash(git -C \"D:/WebUI/Kexue/操作平台/AI_Painting_V2.0\" log --all --oneline --follow -p -- src/stores/display.js)",
- "Bash(git -C \"D:/WebUI/Kexue/操作平台/AI_Painting_V2.0\" log --all --oneline -p -- src/components/dialogBox/index.vue)"
+ "Bash(git -C \"D:/WebUI/Kexue/操作平台/AI_Painting_V2.0\" log --all --oneline -p -- src/components/dialogBox/index.vue)",
+ "Bash(npx eslint *)"
]
}
}
diff --git a/src/apis/auth/auth.js b/src/apis/auth/auth.js
index 3671381..7854b21 100644
--- a/src/apis/auth/auth.js
+++ b/src/apis/auth/auth.js
@@ -43,5 +43,5 @@ export const getUserInfo = () => {
}
export const checkUsertoken = () => {
- return service.post(`/login/validateToken`)
+ return service.post('/login/validateToken')
}
diff --git a/src/components/Popover/index.vue b/src/components/Popover/index.vue
index aa3c7c4..80aba29 100644
--- a/src/components/Popover/index.vue
+++ b/src/components/Popover/index.vue
@@ -1,6 +1,6 @@
-
-
+
+
@@ -143,10 +143,10 @@ const handleClickOutside = (e) => {
const contentEl = contentRef.value
if (
- triggerEl &&
- !triggerEl.contains(e.target) &&
- contentEl &&
- !contentEl.contains(e.target)
+ triggerEl
+ && !triggerEl.contains(e.target)
+ && contentEl
+ && !contentEl.contains(e.target)
) {
visible.value = false
window.__currentOpenPopoverId__ = null
diff --git a/src/components/Select/index.vue b/src/components/Select/index.vue
index 7d57928..e870d59 100644
--- a/src/components/Select/index.vue
+++ b/src/components/Select/index.vue
@@ -377,7 +377,7 @@ onBeforeUnmount(() => {
.option-group {
/* margin-bottom: 10px; */
-
+
&:last-child {
margin-bottom: 0;
}
diff --git a/src/components/canvas/index.vue b/src/components/canvas/index.vue
index 7d75b30..7229846 100644
--- a/src/components/canvas/index.vue
+++ b/src/components/canvas/index.vue
@@ -9,8 +9,8 @@
@@ -32,8 +32,8 @@
ref="editableDivRef"
contenteditable="true"
class="custom-textarea"
- @input="handleInput"
:data-placeholder="!inputText ? '请输入提示词或使用圆形/矩形工具' : ''"
+ @input="handleInput"
>
@@ -48,7 +48,7 @@
@click="currentShape = 'rectangle'"
>
@@ -59,7 +59,7 @@
@click="currentShape = 'circle'"
>
@@ -68,22 +68,22 @@
@@ -103,8 +103,8 @@
请输入替换内容描述
@@ -114,8 +114,8 @@
ref="brushTextareaRef"
contenteditable="true"
class="brush-textarea"
- @input="handleBrushInput"
:data-placeholder="!currentShapeDescription ? '请输入描述...' : ''"
+ @input="handleBrushInput"
>
@@ -135,7 +135,7 @@
@@ -145,7 +145,7 @@
@click="handleUploadReference"
>
@@ -160,10 +160,10 @@
@@ -62,20 +62,20 @@ const selectedIcon = computed(() => {
border-radius: 10px;
border: 1px solid #E8E9EB;
background: #f5f6f7;
-
+
&:hover {
background: #e9eaeb;
}
}
-
+
:deep(.select-text) {
font-size: 14px;
}
-
+
:deep(.dropdown-menu) {
min-width: 140px;
}
-
+
:deep(.dropdown-item) {
min-width: 80px;
justify-content: start;
diff --git a/src/platforms/video/controls/proportion.vue b/src/platforms/video/controls/proportion.vue
index 0aeafae..c6d7407 100644
--- a/src/platforms/video/controls/proportion.vue
+++ b/src/platforms/video/controls/proportion.vue
@@ -4,8 +4,8 @@
选择比例
-
选择分辨率
-
{
const [w, h] = value.split(':').map(Number)
const aspectRatio = w / h
const baseSize = 20
-
+
if (aspectRatio > 1) {
return {
'--width': `${baseSize}px`,
@@ -148,11 +148,11 @@ const getProportionStyle = (value) => {
.section{
margin-bottom: 20px;
border-radius: 20px;
-
+
&:last-child{
margin-bottom: 0;
}
-
+
h3{
font-family: "Microsoft YaHei";
font-size: 12px;
@@ -185,7 +185,7 @@ const getProportionStyle = (value) => {
border-radius: 5px;
text-align: bottom;
color: #999;
-
+
&::before{
content: '';
width: var(--width, 20px);
@@ -195,11 +195,11 @@ const getProportionStyle = (value) => {
transition: all 0.2s ease;
border: 2px solid #999;
}
-
+
&:hover{
background: #e0e0e0;
}
-
+
&.active{
color: #000F33;
background: #ffffff;
@@ -228,11 +228,11 @@ const getProportionStyle = (value) => {
text-align: center;
transition: all 0.2s ease;
color: #666;
-
+
&:hover{
background: #e0e0e0;
}
-
+
&.active{
background: #ffffff;
color: #000000;
diff --git a/src/platforms/video/controls/time.vue b/src/platforms/video/controls/time.vue
index 7acfe1a..394b565 100644
--- a/src/platforms/video/controls/time.vue
+++ b/src/platforms/video/controls/time.vue
@@ -53,20 +53,20 @@ const quantityOptions = computed(() => props.options)
border-radius: 10px;
border: 1px solid #E8E9EB;
background: #f5f6f7;
-
+
&:hover {
background: #e9eaeb;
}
}
-
+
:deep(.select-text) {
font-size: 14px;
}
-
+
:deep(.dropdown-menu) {
min-width: 136px;
}
-
+
:deep(.dropdown-item) {
min-width: 80px;
justify-content: center;
diff --git a/src/platforms/video/imageUploader.vue b/src/platforms/video/imageUploader.vue
index 4c7c708..5be156d 100644
--- a/src/platforms/video/imageUploader.vue
+++ b/src/platforms/video/imageUploader.vue
@@ -25,9 +25,9 @@
props.modelValue, async (newVal) => {
if (isUploading.value) {
return
}
-
+
imageList.value = [...newVal]
-
+
const newPreviewList = []
for (const img of newVal) {
let previewImg = { ...img }
@@ -140,16 +140,16 @@ const beforeUpload = (rawFile) => {
const handleSuccess = (response, uploadFile, index) => {
ElMessage.success('上传成功')
-
+
isUploading.value = true
-
+
const localUrl = URL.createObjectURL(uploadFile.raw)
-
+
const newImage = {
uid: uploadFile.uid,
url: response.url
}
-
+
if (imageList.value[index]) {
const previewItem = localPreviewList.value[index]
if (previewItem && previewItem.url && previewItem.url.startsWith('blob:')) {
@@ -169,9 +169,9 @@ const handleSuccess = (response, uploadFile, index) => {
serverUrl: response.url
}
}
-
+
emit('update:modelValue', [...imageList.value])
-
+
nextTick(() => {
isUploading.value = false
})
@@ -186,7 +186,7 @@ const handleDelete = (index) => {
if (previewItem && previewItem.url && previewItem.url.startsWith('blob:')) {
URL.revokeObjectURL(previewItem.url)
}
-
+
localPreviewList.value.splice(index, 1)
imageList.value.splice(index, 1)
emit('update:modelValue', [...imageList.value])
diff --git a/src/platforms/video/modelSelector.vue b/src/platforms/video/modelSelector.vue
index 7fa0dee..4edbc59 100644
--- a/src/platforms/video/modelSelector.vue
+++ b/src/platforms/video/modelSelector.vue
@@ -44,15 +44,14 @@ const fetchConfig = async () => {
}
}
-
fetchConfig()
watch(() => videoConfig.value, (newConfig) => {
const models = newConfig[props.videoPattern] || []
if (models.length > 0) {
- const enabledModels = models.filter(m => !m.disabled)
+ const enabledModels = models.filter((m) => !m.disabled)
if (enabledModels.length > 0) {
- const currentModelExists = enabledModels.find(m => m.value === props.modelValue)
+ const currentModelExists = enabledModels.find((m) => m.value === props.modelValue)
if (!currentModelExists) {
model.value = enabledModels[0].value
}
@@ -60,7 +59,6 @@ watch(() => videoConfig.value, (newConfig) => {
}
}, { deep: true })
-
const model = computed({
get: () => props.modelValue,
set: (value) => {
@@ -91,9 +89,9 @@ const getModelType = (value) => {
watch(() => props.videoPattern, (newPattern) => {
const models = videoConfig.value[newPattern] || []
if (models.length > 0) {
- const enabledModels = models.filter(m => !m.disabled)
+ const enabledModels = models.filter((m) => !m.disabled)
if (enabledModels.length > 0) {
- const currentModelExists = enabledModels.find(m => m.value === props.modelValue)
+ const currentModelExists = enabledModels.find((m) => m.value === props.modelValue)
if (!currentModelExists) {
model.value = enabledModels[0].value
}
@@ -103,9 +101,9 @@ watch(() => props.videoPattern, (newPattern) => {
watch(() => props.modelValue, (newValue) => {
const models = videoConfig.value[props.videoPattern] || []
- const currentModel = models.find(m => m.value === newValue)
+ const currentModel = models.find((m) => m.value === newValue)
if (currentModel && currentModel.disabled) {
- const enabledModels = models.filter(m => !m.disabled)
+ const enabledModels = models.filter((m) => !m.disabled)
if (enabledModels.length > 0) {
model.value = enabledModels[0].value
}
@@ -121,24 +119,24 @@ watch(() => props.modelValue, (newValue) => {
border-radius: 10px;
border: 1px solid #E8E9EB;
background: #f5f6f7;
-
+
&:hover {
background: #e9eaeb;
}
}
-
+
:deep(.select-text) {
font-size: 14px;
}
-
+
:deep(.dropdown-menu) {
max-height: 510px;
overflow-y: auto;
}
-
+
:deep(.dropdown-item) {
min-width: 120px;
-
+
&.active {
background: rgba(0, 15, 51, 0.10);
color: #000F33;
diff --git a/src/router/index.js b/src/router/index.js
index 3949417..07594ff 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,5 +1,5 @@
import { createRouter, createWebHistory } from 'vue-router'
-import { useDisplayStore, useUserStore } from '@/stores'
+import { useUserStore } from '@/stores'
import { getToken, setToken } from '@/utils/auth'
const routes = [
@@ -30,7 +30,7 @@ const router = createRouter({
})
router.beforeEach(async (to, from) => {
- if(to.query.token){
+ if (to.query.token) {
setToken(to.query.token)
} else {
// 检查是否有 token
diff --git a/src/stores/display.js b/src/stores/display.js
index f6caf3e..ed95e26 100644
--- a/src/stores/display.js
+++ b/src/stores/display.js
@@ -8,12 +8,12 @@ const DisplayStoreSetup = () => {
const isLoading = ref(false)
const currentResultData = ref(null)
const dialogBoxRef = ref(null)
-
+
const canvasVisible = ref(false)
const canvasImage = ref('')
const canvasReferenceImages = ref([])
const canvasSource = ref('')
-
+
const addGeneratingItem = (item) => {
const newItem = {
id: item.taskId || crypto.randomUUID(),
@@ -26,29 +26,29 @@ const DisplayStoreSetup = () => {
tempList.value.unshift(newItem)
return newItem
}
-
+
const updateItemToSuccess = (taskId, fileUrls) => {
- const index = tempList.value.findIndex(item => item.id === taskId)
+ const index = tempList.value.findIndex((item) => item.id === taskId)
if (index !== -1) {
tempList.value[index].status = 'success'
tempList.value[index].files = Array.isArray(fileUrls) ? fileUrls : [fileUrls]
}
}
-
+
const initHistoryList = (historyList) => {
tempList.value = historyList
currentPage.value = 1
hasMoreData.value = true
}
-
+
const prependHistoryList = (historyList) => {
tempList.value = [...historyList, ...tempList.value]
}
-
+
const appendHistoryList = (historyList) => {
tempList.value = [...tempList.value, ...historyList]
}
-
+
const resetPagination = () => {
currentPage.value = 0
hasMoreData.value = true
@@ -56,26 +56,26 @@ const DisplayStoreSetup = () => {
}
const deleteHistoryItem = (id) => {
- const index = tempList.value.findIndex(item => item.id === id)
+ const index = tempList.value.findIndex((item) => item.id === id)
if (index !== -1) {
tempList.value.splice(index, 1)
}
}
-
+
const scrollToBottom = async () => {
const refValue = scrollerRef.value
-
+
if (!refValue) {
return
}
-
+
try {
if (typeof refValue.scrollToBottom === 'function') {
await nextTick()
refValue.scrollToBottom()
return
}
-
+
const scrollerEl = refValue.$el
if (scrollerEl) {
const viewport = scrollerEl.querySelector('.vue-recycle-scroller__viewport')
@@ -83,7 +83,7 @@ const DisplayStoreSetup = () => {
viewport.scrollTop = viewport.scrollHeight
}
}
-
+
if (typeof refValue.scrollToItem === 'function' && tempList.value && tempList.value.length > 0) {
await nextTick()
refValue.scrollToItem(tempList.value.length - 1)
@@ -92,28 +92,28 @@ const DisplayStoreSetup = () => {
console.error('滚动出错:', error)
}
}
-
+
const setResultData = (data) => {
currentResultData.value = data
}
-
+
const setDialogBoxRef = (ref) => {
dialogBoxRef.value = ref
}
-
+
const triggerGenerateWithResult = async () => {
if (dialogBoxRef.value && currentResultData.value) {
await dialogBoxRef.value.fillParamsFromResult(currentResultData.value)
await dialogBoxRef.value.handleStart()
}
}
-
+
const fillParamsForEdit = () => {
if (dialogBoxRef.value && currentResultData.value) {
dialogBoxRef.value.fillParamsFromResult(currentResultData.value)
}
}
-
+
const openCanvas = (data) => {
if (typeof data === 'string') {
canvasImage.value = data
diff --git a/src/stores/param.js b/src/stores/param.js
index 704fced..be930d4 100644
--- a/src/stores/param.js
+++ b/src/stores/param.js
@@ -1,5 +1,4 @@
const ParamStoreSetup = () => {
-
return {
}
}
diff --git a/src/utils/downloadImage.js b/src/utils/downloadImage.js
index d17e6c3..285fdd9 100644
--- a/src/utils/downloadImage.js
+++ b/src/utils/downloadImage.js
@@ -7,7 +7,7 @@ export async function generateFilename(url, prefix = 'image') {
// 如果URL中没有文件名或扩展名,根据类型生成
if (!filename || !filename.includes('.')) {
- const timestamp = new Date().getTime()
+ const timestamp = Date.now()
// 根据URL内容推断文件类型,否则默认为png
const extension = url.includes('.jpg') || url.includes('.jpeg')
? '.jpg'
@@ -21,7 +21,7 @@ export async function generateFilename(url, prefix = 'image') {
} catch (error) {
console.error('URL解析失败:', error)
// 如果URL解析失败,生成默认文件名
- const timestamp = new Date().getTime()
+ const timestamp = Date.now()
return `${prefix}_${timestamp}.png`
}
}
diff --git a/src/views/home/display/components/set.vue b/src/views/home/display/components/set.vue
index f2acb22..3d26cb4 100644
--- a/src/views/home/display/components/set.vue
+++ b/src/views/home/display/components/set.vue
@@ -1,21 +1,20 @@
-
-
-
-
+
+
+
{{ props.item.generateData.prompt || '生成图片' }}
-
+
-
+
{{ props.item.generateData.model }}
{{ props.item.generateData.proportion }}
-
+
{{ props.item.generateData.model }}
{{ props.item.generateData.proportion }}
@@ -49,7 +48,7 @@
-
+
![index]()
@@ -58,14 +57,14 @@
-
+
-