Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ai_web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haojie
ai_web
Commits
de3c4e82
Commit
de3c4e82
authored
Apr 11, 2023
by
haojie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
8aeb6fa1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
41 deletions
+39
-41
src/pages/ImgToImg/components/Dialog/index.vue
+8
-8
src/pages/ImgToImg/components/UploadImg/index.tsx
+6
-18
src/pages/ImgToImg/index.tsx
+13
-8
src/pages/Login/components/login.vue
+7
-2
src/utils/api/userApi.ts
+1
-1
src/utils/tool.ts
+2
-2
vite.config.ts
+2
-2
No files found.
src/pages/ImgToImg/components/Dialog/index.vue
View file @
de3c4e82
...
@@ -12,13 +12,13 @@
...
@@ -12,13 +12,13 @@
<
template
#
body
>
<
template
#
body
>
<div
class=
"custom-dialog-body"
>
<div
class=
"custom-dialog-body"
>
<div
class=
"content narrow-scrollbar"
>
<div
class=
"content narrow-scrollbar"
>
<div
v-for=
"(item, index) in list"
:key=
"item.i
mg
"
>
<div
v-for=
"(item, index) in list"
:key=
"item.i
d
"
>
<div
class=
"img-box"
>
<div
class=
"img-box"
>
<img
class=
"img"
:src=
"item.img"
alt=
""
/>
<img
class=
"img"
:src=
"item.img"
alt=
""
/>
<template
v-if=
"item.split_img"
>
<template
v-if=
"item.split_img"
>
<img
class=
"split-img img"
:src=
"item.split_img"
alt=
""
/>
<img
class=
"split-img img"
:src=
"item.split_img"
alt=
""
/>
</
template
>
</
template
>
<
template
v-else
>
<
template
v-else
-if=
"item.loading"
>
<div
class=
"split_img_loading"
>
<div
class=
"split_img_loading"
>
<t-loading
size=
"24px"
></t-loading>
<t-loading
size=
"24px"
></t-loading>
</div>
</div>
...
@@ -49,7 +49,7 @@ import {
...
@@ -49,7 +49,7 @@ import {
Button
as
TButton
,
Button
as
TButton
,
Loading
as
TLoading
,
Loading
as
TLoading
,
}
from
'tdesign-vue-next'
;
}
from
'tdesign-vue-next'
;
import
{
ref
,
watch
}
from
'vue'
;
import
{
PropType
,
ref
,
watch
}
from
'vue'
;
import
Animation
from
'@/components/Animation.vue'
;
import
Animation
from
'@/components/Animation.vue'
;
const
btns
=
[
const
btns
=
[
{
{
...
@@ -69,11 +69,11 @@ const btns = [
...
@@ -69,11 +69,11 @@ const btns = [
value
:
4
,
value
:
4
,
},
},
];
];
const
props
=
defineProps
<
{
const
props
=
defineProps
(
{
modelValue
:
boolean
;
modelValue
:
Boolean
,
list
:
any
[];
list
:
Array
as
PropType
<
any
[]
>
,
dialogloading
:
boolean
;
dialogloading
:
Boolean
,
}
>
(
);
});
const
emit
=
defineEmits
([
'update:modelValue'
,
'SubmitSplit'
]);
const
emit
=
defineEmits
([
'update:modelValue'
,
'SubmitSplit'
]);
const
visible
=
ref
(
props
.
modelValue
);
const
visible
=
ref
(
props
.
modelValue
);
const
to_split
=
(
prompt_id
:
number
,
click_id
:
number
,
index
:
number
)
=>
{
const
to_split
=
(
prompt_id
:
number
,
click_id
:
number
,
index
:
number
)
=>
{
...
...
src/pages/ImgToImg/components/UploadImg/index.tsx
View file @
de3c4e82
...
@@ -6,6 +6,8 @@ import {
...
@@ -6,6 +6,8 @@ import {
Button
as
TButton
,
Button
as
TButton
,
Upload
as
TUpload
,
Upload
as
TUpload
,
Progress
as
TProgress
,
Progress
as
TProgress
,
UploadFile
,
RequestMethodResponse
,
}
from
'tdesign-vue-next'
;
}
from
'tdesign-vue-next'
;
import
{
useStore
}
from
'vuex'
;
import
{
useStore
}
from
'vuex'
;
import
{
getUserCookie
}
from
'@/utils/api/userApi'
;
import
{
getUserCookie
}
from
'@/utils/api/userApi'
;
...
@@ -54,11 +56,6 @@ export default defineComponent({
...
@@ -54,11 +56,6 @@ export default defineComponent({
const
handleFail
=
({
file
}:
any
)
=>
{
const
handleFail
=
({
file
}:
any
)
=>
{
MessagePlugin
.
error
(
`文件
${
file
.
name
}
上传失败`
);
MessagePlugin
.
error
(
`文件
${
file
.
name
}
上传失败`
);
};
};
// 第一个上传链接
const
formatResponseOne
=
(
response
:
any
,
context
:
any
)
=>
{
console
.
log
(
response
);
// return { name: 'FileName', url: response.url };
};
// 上传成功回调
// 上传成功回调
const
UploadSuccessCallback
=
(
uuid
:
any
,
url
:
any
)
=>
{
const
UploadSuccessCallback
=
(
uuid
:
any
,
url
:
any
)
=>
{
// 关闭定时器
// 关闭定时器
...
@@ -120,9 +117,9 @@ export default defineComponent({
...
@@ -120,9 +117,9 @@ export default defineComponent({
});
});
};
};
// 外网上传-func
// 外网上传-func
const
ExtranetUpload
=
(
file
:
any
,
config
:
any
)
=>
{
const
ExtranetUpload
=
(
file
:
any
)
=>
{
openpercentage
();
openpercentage
();
return
new
Promise
((
resolve
)
=>
{
return
new
Promise
<
RequestMethodResponse
>
((
resolve
)
=>
{
let
uuid
=
v4
();
let
uuid
=
v4
();
// 上传中状态
// 上传中状态
Curfile
.
status
=
1
;
Curfile
.
status
=
1
;
...
@@ -169,16 +166,8 @@ export default defineComponent({
...
@@ -169,16 +166,8 @@ export default defineComponent({
},
1000
);
},
1000
);
});
});
};
};
const
requestSuccessMethod
=
async
(
file
:
any
)
=>
{
const
requestSuccessMethod
=
async
(
file
:
UploadFile
|
UploadFile
[])
=>
{
// if (uploadStrategy.value.oss) {
return
ExtranetUpload
(
file
);
// // 外网
// return ExtranetUpload(file, uploadStrategy.value.config);
// } else {
// // 内网
// return IntranetUpload(file);
// }
//
return
ExtranetUpload
(
file
,
uploadStrategy
.
value
.
config
);
};
};
// 未上传
// 未上传
const
notUploadHtml
=
()
=>
{
const
notUploadHtml
=
()
=>
{
...
@@ -197,7 +186,6 @@ export default defineComponent({
...
@@ -197,7 +186,6 @@ export default defineComponent({
multiple
multiple
max=
{
1
}
max=
{
1
}
draggable=
{
true
}
draggable=
{
true
}
formatResponse=
{
formatResponseOne
}
onfail=
{
handleFail
}
onfail=
{
handleFail
}
>
>
<
div
class=
"custom-upload-click-box"
>
<
div
class=
"custom-upload-click-box"
>
...
...
src/pages/ImgToImg/index.tsx
View file @
de3c4e82
import
{
defineComponent
,
onMounted
,
reactive
,
ref
,
watch
}
from
'vue'
;
import
{
defineComponent
,
onMounted
,
reactive
,
ref
}
from
'vue'
;
import
'./index.less'
;
import
'./index.less'
;
import
EnterKeywords
from
'./components/EnterKeywords'
;
import
EnterKeywords
from
'./components/EnterKeywords'
;
import
{
useStore
}
from
'vuex'
;
import
{
useStore
}
from
'vuex'
;
...
@@ -21,7 +21,9 @@ export default defineComponent({
...
@@ -21,7 +21,9 @@ export default defineComponent({
let
split_interval
:
any
=
null
;
let
split_interval
:
any
=
null
;
const
task_id
=
ref
();
const
task_id
=
ref
();
const
prompt_num
=
ref
();
const
prompt_num
=
ref
();
const
task_result_list
=
reactive
({
const
task_result_list
=
reactive
<
{
list
:
any
[];
}
>
({
list
:
[],
list
:
[],
});
});
// 关键词
// 关键词
...
@@ -32,6 +34,8 @@ export default defineComponent({
...
@@ -32,6 +34,8 @@ export default defineComponent({
const
Img_url
=
ref
(
''
);
const
Img_url
=
ref
(
''
);
// 弹窗状态
// 弹窗状态
const
DialogVisible
=
ref
(
false
);
const
DialogVisible
=
ref
(
false
);
// 测试
const
test_num
=
ref
(
1
);
onMounted
(()
=>
{
onMounted
(()
=>
{
store
.
dispatch
(
'user/AdminConfig'
);
store
.
dispatch
(
'user/AdminConfig'
);
});
});
...
@@ -47,11 +51,10 @@ export default defineComponent({
...
@@ -47,11 +51,10 @@ export default defineComponent({
item
.
loading
=
false
;
item
.
loading
=
false
;
}
}
});
});
// 合并去重
if
(
res
.
data
.
length
>
task_result_list
.
list
.
length
)
{
task_result_list
.
list
=
filterRepeatTimestamp
(
// 合并去重
task_result_list
.
list
,
filterRepeatTimestamp
(
task_result_list
.
list
,
res
.
data
);
res
.
data
}
);
if
(
prompt_num
.
value
==
task_result_list
.
list
.
length
)
{
if
(
prompt_num
.
value
==
task_result_list
.
list
.
length
)
{
// 关闭定时器
// 关闭定时器
closeInterval
();
closeInterval
();
...
@@ -74,6 +77,7 @@ export default defineComponent({
...
@@ -74,6 +77,7 @@ export default defineComponent({
// 切割成功--找到list对应的id,将cut_img添加进去
// 切割成功--找到list对应的id,将cut_img添加进去
task_result_list
.
list
.
forEach
((
item
:
any
)
=>
{
task_result_list
.
list
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
id
==
res
.
data
.
id
)
{
if
(
item
.
id
==
res
.
data
.
id
)
{
console
.
log
(
'我执行了'
);
item
.
split_img
=
res
.
data
.
cut_img
;
item
.
split_img
=
res
.
data
.
cut_img
;
item
.
loading
=
false
;
item
.
loading
=
false
;
}
}
...
@@ -114,10 +118,11 @@ export default defineComponent({
...
@@ -114,10 +118,11 @@ export default defineComponent({
if
(
!
keywords
.
value
)
{
if
(
!
keywords
.
value
)
{
return
;
return
;
}
}
// prompt_img需要传数组
let
params
:
any
=
{
let
params
:
any
=
{
type
:
Img_url
.
value
?
Tasks
.
img_to_img
:
Tasks
.
text_to_img
,
type
:
Img_url
.
value
?
Tasks
.
img_to_img
:
Tasks
.
text_to_img
,
prompt
:
keywords
.
value
,
prompt
:
keywords
.
value
,
prompt_img
:
Img_url
.
value
,
prompt_img
:
[
Img_url
.
value
]
,
prompt_num
:
5
,
prompt_num
:
5
,
};
};
try
{
try
{
...
...
src/pages/Login/components/login.vue
View file @
de3c4e82
...
@@ -56,6 +56,7 @@ import {
...
@@ -56,6 +56,7 @@ import {
FormItem
as
TFormItem
,
FormItem
as
TFormItem
,
Input
as
TInput
,
Input
as
TInput
,
Button
as
TButton
,
Button
as
TButton
,
FormRule
,
}
from
'tdesign-vue-next'
;
}
from
'tdesign-vue-next'
;
import
{
DesktopIcon
,
LockOnIcon
}
from
'tdesign-icons-vue-next'
;
import
{
DesktopIcon
,
LockOnIcon
}
from
'tdesign-icons-vue-next'
;
import
{
UserLogin
}
from
'@/utils/api/userApi'
;
import
{
UserLogin
}
from
'@/utils/api/userApi'
;
...
@@ -71,8 +72,12 @@ const formData = reactive({
...
@@ -71,8 +72,12 @@ const formData = reactive({
});
});
const
FORM_RULES
=
computed
(()
=>
{
const
FORM_RULES
=
computed
(()
=>
{
return
{
return
{
account
:
[{
required
:
true
,
messgae
:
'账号不能为空'
,
type
:
'error'
}],
account
:
[
password
:
[{
required
:
true
,
message
:
'密码不能为空'
,
type
:
'error'
}],
{
required
:
true
,
message
:
'账号不能为空'
,
type
:
'error'
},
]
as
FormRule
[],
password
:
[
{
required
:
true
,
message
:
'密码不能为空'
,
type
:
'error'
},
]
as
FormRule
[],
};
};
});
});
const
onReset
=
()
=>
{
const
onReset
=
()
=>
{
...
...
src/utils/api/userApi.ts
View file @
de3c4e82
...
@@ -83,7 +83,7 @@ export const SubmitSplitImgTask = (data: any) => {
...
@@ -83,7 +83,7 @@ export const SubmitSplitImgTask = (data: any) => {
// 轮询获取图片切割任务状态
// 轮询获取图片切割任务状态
export
const
get_split_img_status
=
(
data
:
any
)
=>
{
export
const
get_split_img_status
=
(
data
:
any
)
=>
{
return
request
.
get
(
'/api/users/
task/callback
'
,
{
return
request
.
get
(
'/api/users/
split/status
'
,
{
params
:
data
,
params
:
data
,
headers
:
{
headers
:
{
authorization
:
`Bearer
${
getUserCookie
()}
`
,
authorization
:
`Bearer
${
getUserCookie
()}
`
,
...
...
src/utils/tool.ts
View file @
de3c4e82
...
@@ -406,8 +406,8 @@ export const filterRepeatTimestamp = (list: any, newList: any) => {
...
@@ -406,8 +406,8 @@ export const filterRepeatTimestamp = (list: any, newList: any) => {
let
index
=
list
.
findIndex
((
item
:
any
)
=>
item
.
id
==
newList
[
i
].
id
);
let
index
=
list
.
findIndex
((
item
:
any
)
=>
item
.
id
==
newList
[
i
].
id
);
if
(
index
==
-
1
)
{
if
(
index
==
-
1
)
{
// 没找到重复的
// 没找到重复的
NewData
.
push
(
newList
[
i
]);
list
.
push
(
newList
[
i
]);
}
}
}
}
return
NewData
;
return
list
;
};
};
vite.config.ts
View file @
de3c4e82
...
@@ -12,7 +12,7 @@ export default defineConfig(({ command, mode }) => {
...
@@ -12,7 +12,7 @@ export default defineConfig(({ command, mode }) => {
let
newDate
=
`
${
date
.
getFullYear
()}
-
${
let
newDate
=
`
${
date
.
getFullYear
()}
-
${
date
.
getMonth
()
+
1
date
.
getMonth
()
+
1
}
-
${
date
.
getDate
()}
--
${
date
.
getHours
()}
.
${
date
.
getMinutes
()}
`
;
}
-
${
date
.
getDate
()}
--
${
date
.
getHours
()}
.
${
date
.
getMinutes
()}
`
;
let
api
=
0
?
'http://42.194.143.229:90'
:
'http://
gpt.test
'
;
let
api
=
0
?
'http://42.194.143.229:90'
:
'http://
test.phpgpt.com
'
;
return
{
return
{
base
:
'/'
,
base
:
'/'
,
resolve
:
{
resolve
:
{
...
@@ -52,7 +52,7 @@ export default defineConfig(({ command, mode }) => {
...
@@ -52,7 +52,7 @@ export default defineConfig(({ command, mode }) => {
terserOptions
:
{
terserOptions
:
{
compress
:
{
compress
:
{
//生产环境时移除console
//生产环境时移除console
drop_console
:
tru
e
,
drop_console
:
fals
e
,
// drop_debugger: true,
// drop_debugger: true,
},
},
output
:
{
output
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment