Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meme_image
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘续中
meme_image
Commits
cde532c2
Commit
cde532c2
authored
Jul 08, 2024
by
web
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
up
parent
e013c5a4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
625 additions
and
759 deletions
+625
-759
package-lock.json
package-lock.json
+37
-6
Header.vue
src/components/Header.vue
+1
-1
Index.vue
src/views/Index.vue
+107
-93
yarn.lock
yarn.lock
+480
-659
No files found.
package-lock.json
View file @
cde532c2
...
@@ -11,8 +11,10 @@
...
@@ -11,8 +11,10 @@
"aonweb"
:
"^1.0.13"
,
"aonweb"
:
"^1.0.13"
,
"aos"
:
"^2.3.4"
,
"aos"
:
"^2.3.4"
,
"axios"
:
"^1.6.8"
,
"axios"
:
"^1.6.8"
,
"canvas-text-wrapper"
:
"^0.10.2"
,
"element-plus"
:
"^2.7.5"
,
"element-plus"
:
"^2.7.5"
,
"pinia"
:
"^2.1.7"
,
"pinia"
:
"^2.1.7"
,
"uuid"
:
"^10.0.0"
,
"vant"
:
"^4.9.1"
,
"vant"
:
"^4.9.1"
,
"vue"
:
"^3.4.21"
,
"vue"
:
"^3.4.21"
,
"vue-router"
:
"^4.3.0"
,
"vue-router"
:
"^4.3.0"
,
...
@@ -1867,6 +1869,18 @@
...
@@ -1867,6 +1869,18 @@
"web3-eth-accounts"
:
"^4.1.2"
"web3-eth-accounts"
:
"^4.1.2"
}
}
},
},
"node_modules/aonweb/node_modules/uuid"
:
{
"version"
:
"9.0.1"
,
"resolved"
:
"https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz"
,
"integrity"
:
"sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="
,
"funding"
:
[
"https://github.com/sponsors/broofa"
,
"https://github.com/sponsors/ctavan"
],
"bin"
:
{
"uuid"
:
"dist/bin/uuid"
}
},
"node_modules/aos"
:
{
"node_modules/aos"
:
{
"version"
:
"2.3.4"
,
"version"
:
"2.3.4"
,
"resolved"
:
"https://registry.npmjs.org/aos/-/aos-2.3.4.tgz"
,
"resolved"
:
"https://registry.npmjs.org/aos/-/aos-2.3.4.tgz"
,
...
@@ -2052,6 +2066,11 @@
...
@@ -2052,6 +2066,11 @@
}
}
]
]
},
},
"node_modules/canvas-text-wrapper"
:
{
"version"
:
"0.10.2"
,
"resolved"
:
"https://registry.npmjs.org/canvas-text-wrapper/-/canvas-text-wrapper-0.10.2.tgz"
,
"integrity"
:
"sha512-nFnN8q8ydtkBUWVn/dAdetpwNOkz3KtyD6jTI2HGD43ant2FQcnLugAVaGLJloyRTNK/exn7efpYy2zPV5bHiQ=="
},
"node_modules/chalk"
:
{
"node_modules/chalk"
:
{
"version"
:
"2.4.2"
,
"version"
:
"2.4.2"
,
"resolved"
:
"https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz"
,
"resolved"
:
"https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz"
,
...
@@ -3807,9 +3826,9 @@
...
@@ -3807,9 +3826,9 @@
}
}
},
},
"node_modules/uuid"
:
{
"node_modules/uuid"
:
{
"version"
:
"
9.0.1
"
,
"version"
:
"
10.0.0
"
,
"resolved"
:
"https://registry.npmjs.org/uuid/-/uuid-
9.0.1
.tgz"
,
"resolved"
:
"https://registry.npmjs.org/uuid/-/uuid-
10.0.0
.tgz"
,
"integrity"
:
"sha512-
b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA
=="
,
"integrity"
:
"sha512-
8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ
=="
,
"funding"
:
[
"funding"
:
[
"https://github.com/sponsors/broofa"
,
"https://github.com/sponsors/broofa"
,
"https://github.com/sponsors/ctavan"
"https://github.com/sponsors/ctavan"
...
@@ -5698,6 +5717,13 @@
...
@@ -5698,6 +5717,13 @@
"uuid"
:
"^9.0.1"
,
"uuid"
:
"^9.0.1"
,
"web3"
:
"^4.8.0"
,
"web3"
:
"^4.8.0"
,
"web3-eth-accounts"
:
"^4.1.2"
"web3-eth-accounts"
:
"^4.1.2"
},
"dependencies"
:
{
"uuid"
:
{
"version"
:
"9.0.1"
,
"resolved"
:
"https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz"
,
"integrity"
:
"sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="
}
}
}
},
},
"aos"
:
{
"aos"
:
{
...
@@ -5818,6 +5844,11 @@
...
@@ -5818,6 +5844,11 @@
"integrity"
:
"sha512-bMg2vmr8XBsbL6Lr0UHXy/21m84FTxDLWn2FSqMd5PrlbMxwJlQnC2YWYxVgp66PZE+BBNF2jYQUBKCo1FDeZg=="
,
"integrity"
:
"sha512-bMg2vmr8XBsbL6Lr0UHXy/21m84FTxDLWn2FSqMd5PrlbMxwJlQnC2YWYxVgp66PZE+BBNF2jYQUBKCo1FDeZg=="
,
"dev"
:
true
"dev"
:
true
},
},
"canvas-text-wrapper"
:
{
"version"
:
"0.10.2"
,
"resolved"
:
"https://registry.npmjs.org/canvas-text-wrapper/-/canvas-text-wrapper-0.10.2.tgz"
,
"integrity"
:
"sha512-nFnN8q8ydtkBUWVn/dAdetpwNOkz3KtyD6jTI2HGD43ant2FQcnLugAVaGLJloyRTNK/exn7efpYy2zPV5bHiQ=="
},
"chalk"
:
{
"chalk"
:
{
"version"
:
"2.4.2"
,
"version"
:
"2.4.2"
,
"resolved"
:
"https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz"
,
"resolved"
:
"https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz"
,
...
@@ -6995,9 +7026,9 @@
...
@@ -6995,9 +7026,9 @@
}
}
},
},
"uuid"
:
{
"uuid"
:
{
"version"
:
"
9.0.1
"
,
"version"
:
"
10.0.0
"
,
"resolved"
:
"https://registry.npmjs.org/uuid/-/uuid-
9.0.1
.tgz"
,
"resolved"
:
"https://registry.npmjs.org/uuid/-/uuid-
10.0.0
.tgz"
,
"integrity"
:
"sha512-
b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA
=="
"integrity"
:
"sha512-
8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ
=="
},
},
"vant"
:
{
"vant"
:
{
"version"
:
"4.9.1"
,
"version"
:
"4.9.1"
,
...
...
src/components/Header.vue
View file @
cde532c2
...
@@ -127,7 +127,7 @@ onMounted(() => {
...
@@ -127,7 +127,7 @@ onMounted(() => {
text-align
:
left
;
text-align
:
left
;
font-style
:
normal
;
font-style
:
normal
;
text-transform
:
none
;
text-transform
:
none
;
margin-left
:
2.13vw
;
/* margin-left: 2.13vw; */
}
}
.right
{
.right
{
...
...
src/views/Index.vue
View file @
cde532c2
...
@@ -9,15 +9,22 @@
...
@@ -9,15 +9,22 @@
<p>
Customize your clothing logo and generate a 3D avatar
</p>
<p>
Customize your clothing logo and generate a 3D avatar
</p>
</div>
-->
</div>
-->
<div>
<div>
<van-cell-group
title=
"输入一个职业或概念:"
>
<
!--
<
van-cell-group
title=
"输入一个职业或概念:"
>
<van-field
v-model=
"projectName"
autosize
label=
""
placeholder=
"请输入"
/>
<van-field
v-model=
"projectName"
autosize
label=
""
placeholder=
"请输入"
/>
-->
<!--
<van-cell
title=
"角色"
>
<!--
<van-cell
title=
"角色"
>
<van-radio-group
v-model=
"checked"
direction=
"horizontal"
class=
"custom-radio-group"
>
<van-radio-group
v-model=
"checked"
direction=
"horizontal"
class=
"custom-radio-group"
>
<van-radio
name=
"1"
class=
"custom-radio"
>
英俊男子
</van-radio>
<van-radio
name=
"1"
class=
"custom-radio"
>
英俊男子
</van-radio>
<van-radio
name=
"2"
class=
"custom-radio"
>
漂亮女孩
</van-radio>
<van-radio
name=
"2"
class=
"custom-radio"
>
漂亮女孩
</van-radio>
</van-radio-group>
</van-radio-group>
</van-cell>
-->
</van-cell>
-->
</van-cell-group>
<!--
</van-cell-group>
-->
<div
class=
"uni-form-item uni-column"
>
<div
class=
"title"
>
输入一个职业或概念:
</div>
<div
class=
"content"
>
<input
v-model=
"projectName"
name=
"input"
placeholder=
"请输入"
/>
</div>
</div>
<!--
<van-cell-group
title=
"角色"
>
<!--
<van-cell-group
title=
"角色"
>
<van-cell>
<van-cell>
...
@@ -27,7 +34,7 @@
...
@@ -27,7 +34,7 @@
</van-radio-group>
</van-radio-group>
</van-cell>
</van-cell>
</van-cell-group>
-->
</van-cell-group>
-->
<!--
<div
class=
"title"
>
Upload your photos
</div>
<!--
<div
class=
"title"
>
Upload your photos
</div>
...
@@ -60,7 +67,7 @@
...
@@ -60,7 +67,7 @@
<div
class=
"uni-form-item uni-column"
>
<div
class=
"uni-form-item uni-column"
>
<canvas
ref=
"canvasRef"
:width=
"canvasWidth"
:height=
"canvasHeight"
></canvas>
<canvas
ref=
"canvasRef"
:width=
"canvasWidth"
:height=
"canvasHeight"
></canvas>
</div>
</div>
<!--
<div
class=
"uni-form-item uni-column"
>
<!--
<div
class=
"uni-form-item uni-column"
>
<div
class=
"title"
>
选择一个地点
</div>
<div
class=
"title"
>
选择一个地点
</div>
...
@@ -79,7 +86,7 @@
...
@@ -79,7 +86,7 @@
<!--
<div
class=
"uni-form-item error-text"
v-if=
"showError"
>
<!--
<div
class=
"uni-form-item error-text"
v-if=
"showError"
>
<div
class=
"content"
>
Please Upload your photos
</div>
<div
class=
"content"
>
Please Upload your photos
</div>
</div>
-->
</div>
-->
<div
class=
"bottom_btn"
>
<div
class=
"bottom_btn"
>
<!--
<div
class=
"spendCount"
>
<!--
<div
class=
"spendCount"
>
<img
class=
"icon"
src=
"../assets/icons/money.png"
mode=
""
></img>
<img
class=
"icon"
src=
"../assets/icons/money.png"
mode=
""
></img>
...
@@ -151,8 +158,8 @@ Rules: go deep, be specific. Find hilarious tragedy. Do not be racist. For obvio
...
@@ -151,8 +158,8 @@ Rules: go deep, be specific. Find hilarious tragedy. Do not be racist. For obvio
const
maxSize
=
30
*
1024
*
1024
;
const
maxSize
=
30
*
1024
*
1024
;
function
goToComplete
(
url
,
quotes
,
headline
)
{
function
goToComplete
(
url
,
quotes
,
headline
)
{
const
query
=
{
url
:
url
,
quotes
:
quotes
,
headline
:
headline
}
const
query
=
{
url
:
url
,
quotes
:
quotes
,
headline
:
headline
}
router
.
push
({
router
.
push
({
path
:
'
/created
'
,
path
:
'
/created
'
,
query
query
...
@@ -211,16 +218,16 @@ async function instruct() {
...
@@ -211,16 +218,16 @@ async function instruct() {
// AI 使用方法
// AI 使用方法
const
ai_options
=
new
AIOptions
({
const
ai_options
=
new
AIOptions
({
appId
:
'
k3ebyfaSz8b87xJb_VyEGXx_AJ0MM8ngqU7Ym3AKeW8A
'
,
appId
:
'
k3ebyfaSz8b87xJb_VyEGXx_AJ0MM8ngqU7Ym3AKeW8A
'
,
ai_server
:
"
http://localhost:8088
"
ai_server
:
"
http://localhost:8088
"
})
})
const
aonet
=
new
AI
(
ai_options
)
const
aonet
=
new
AI
(
ai_options
)
let
temp_input
=
{
let
temp_input
=
{
"
prompt
"
:
`
${
system_prompt
}
\n\n
${
user_prompt
}
`
,
"
prompt
"
:
`
${
system_prompt
}
\n\n
${
user_prompt
}
`
,
"
max_new_tokens
"
:
512
,
"
max_new_tokens
"
:
512
,
"
prompt_template
"
:
"
{prompt}
"
"
prompt_template
"
:
"
{prompt}
"
}
}
const
data
=
{
const
data
=
{
input
:
temp_input
input
:
temp_input
...
@@ -261,14 +268,14 @@ async function grenerate(image_description) {
...
@@ -261,14 +268,14 @@ async function grenerate(image_description) {
// AI 使用方法
// AI 使用方法
const
ai_options
=
new
AIOptions
({
const
ai_options
=
new
AIOptions
({
appId
:
'
k3ebyfaSz8b87xJb_VyEGXx_AJ0MM8ngqU7Ym3AKeW8A
'
,
appId
:
'
k3ebyfaSz8b87xJb_VyEGXx_AJ0MM8ngqU7Ym3AKeW8A
'
,
ai_server
:
"
http://localhost:8088
"
ai_server
:
"
http://localhost:8088
"
})
})
const
aonet
=
new
AI
(
ai_options
)
const
aonet
=
new
AI
(
ai_options
)
let
temp_input
=
{
let
temp_input
=
{
"
prompt
"
:
image_description
,
"
prompt
"
:
image_description
,
"
scheduler
"
:
"
K_EULER
"
"
scheduler
"
:
"
K_EULER
"
}
}
const
data
=
{
const
data
=
{
...
@@ -306,29 +313,29 @@ async function grenerate(image_description) {
...
@@ -306,29 +313,29 @@ async function grenerate(image_description) {
async
function
getImage
(
url
)
{
async
function
getImage
(
url
)
{
try
{
try
{
console
.
log
(
"
getImage url =
"
,
url
)
console
.
log
(
"
getImage url =
"
,
url
)
const
response
=
await
fetch
(
url
);
const
response
=
await
fetch
(
url
);
if
(
!
response
.
ok
)
{
if
(
!
response
.
ok
)
{
return
null
return
null
}
}
console
.
log
(
"
getImage response =
"
,
response
)
console
.
log
(
"
getImage response =
"
,
response
)
// let data = await response.arrayBuffer()
// let data = await response.arrayBuffer()
const
blob
=
await
response
.
blob
();
const
blob
=
await
response
.
blob
();
console
.
log
(
"
getImage data =
"
,
blob
)
console
.
log
(
"
getImage data =
"
,
blob
)
const
base64ImageData
=
await
new
Promise
((
resolve
,
reject
)
=>
{
const
base64ImageData
=
await
new
Promise
((
resolve
,
reject
)
=>
{
const
reader
=
new
FileReader
();
const
reader
=
new
FileReader
();
reader
.
onloadend
=
()
=>
resolve
(
reader
.
result
);
reader
.
onloadend
=
()
=>
resolve
(
reader
.
result
);
reader
.
onerror
=
reject
;
reader
.
onerror
=
reject
;
reader
.
readAsDataURL
(
blob
);
reader
.
readAsDataURL
(
blob
);
});
});
// var base64ImageData = 'data:image/png;base64,' + btoa(String.fromCharCode.apply(null, new Uint8Array(data)));
// var base64ImageData = 'data:image/png;base64,' + btoa(String.fromCharCode.apply(null, new Uint8Array(data)));
console
.
log
(
"
getImage base64ImageData =
"
,
base64ImageData
)
console
.
log
(
"
getImage base64ImageData =
"
,
base64ImageData
)
return
base64ImageData
return
base64ImageData
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'
Error fetching image:
'
,
error
);
console
.
error
(
'
Error fetching image:
'
,
error
);
return
null
return
null
}
}
}
}
async
function
downloadImage
()
{
async
function
downloadImage
()
{
...
@@ -354,64 +361,64 @@ async function downloadImage() {
...
@@ -354,64 +361,64 @@ async function downloadImage() {
}
}
function
createImage
(
headline
,
quotes
,
url
)
{
function
createImage
(
headline
,
quotes
,
url
)
{
// const canvas = this.$refs.canvas;
// const canvas = this.$refs.canvas;
const
canvas
=
canvasRef
.
value
;
const
canvas
=
canvasRef
.
value
;
console
.
log
(
"
createImage canvas =
"
,
canvas
,
base_img
)
console
.
log
(
"
createImage canvas =
"
,
canvas
,
base_img
)
const
ctx
=
canvas
.
getContext
(
'
2d
'
);
const
ctx
=
canvas
.
getContext
(
'
2d
'
);
const
image
=
new
Image
();
const
image
=
new
Image
();
image
.
onload
=
()
=>
{
image
.
onload
=
()
=>
{
ctx
.
drawImage
(
image
,
0
,
0
,
canvasWidth
,
canvasHeight
);
ctx
.
drawImage
(
image
,
0
,
0
,
canvasWidth
,
canvasHeight
);
drawOverlay
(
ctx
,
headline
,
quotes
,
url
);
drawOverlay
(
ctx
,
headline
,
quotes
,
url
);
};
};
image
.
src
=
base_img
;
image
.
src
=
base_img
;
// ctx.drawImage(generated_img, img_x, img_y, 250, 250);
// ctx.drawImage(generated_img, img_x, img_y, 250, 250);
//
//
}
}
function
wrapText
(
context
,
text
,
x
,
y
,
maxWidth
,
lineHeight
)
{
function
wrapText
(
context
,
text
,
x
,
y
,
maxWidth
,
lineHeight
)
{
if
(
typeof
text
!=
'
string
'
||
typeof
x
!=
'
number
'
||
typeof
y
!=
'
number
'
)
{
if
(
typeof
text
!=
'
string
'
||
typeof
x
!=
'
number
'
||
typeof
y
!=
'
number
'
)
{
return
;
return
;
}
}
var
canvas
=
context
.
canvas
;
var
canvas
=
context
.
canvas
;
if
(
typeof
maxWidth
==
'
undefined
'
)
{
if
(
typeof
maxWidth
==
'
undefined
'
)
{
maxWidth
=
(
canvas
&&
canvas
.
width
)
||
300
;
maxWidth
=
(
canvas
&&
canvas
.
width
)
||
300
;
}
}
if
(
typeof
lineHeight
==
'
undefined
'
)
{
if
(
typeof
lineHeight
==
'
undefined
'
)
{
lineHeight
=
(
canvas
&&
parseInt
(
window
.
getComputedStyle
(
canvas
).
lineHeight
))
||
parseInt
(
window
.
getComputedStyle
(
document
.
body
).
lineHeight
);
lineHeight
=
(
canvas
&&
parseInt
(
window
.
getComputedStyle
(
canvas
).
lineHeight
))
||
parseInt
(
window
.
getComputedStyle
(
document
.
body
).
lineHeight
);
}
}
// 字符分隔为数组
// 字符分隔为数组
var
arrText
=
text
.
split
(
''
);
var
arrText
=
text
.
split
(
''
);
var
line
=
''
;
var
line
=
''
;
for
(
var
n
=
0
;
n
<
arrText
.
length
;
n
++
)
{
for
(
var
n
=
0
;
n
<
arrText
.
length
;
n
++
)
{
var
testLine
=
line
+
arrText
[
n
];
var
testLine
=
line
+
arrText
[
n
];
var
metrics
=
context
.
measureText
(
testLine
);
var
metrics
=
context
.
measureText
(
testLine
);
var
testWidth
=
metrics
.
width
;
var
testWidth
=
metrics
.
width
;
if
(
testWidth
>
maxWidth
&&
n
>
0
)
{
if
(
testWidth
>
maxWidth
&&
n
>
0
)
{
context
.
fillText
(
line
,
x
,
y
);
context
.
fillText
(
line
,
x
,
y
);
line
=
arrText
[
n
];
line
=
arrText
[
n
];
y
+=
lineHeight
;
y
+=
lineHeight
;
}
else
{
}
else
{
line
=
testLine
;
line
=
testLine
;
}
}
}
}
context
.
fillText
(
line
,
x
,
y
);
context
.
fillText
(
line
,
x
,
y
);
};
};
async
function
drawOverlay
(
ctx
,
headline
,
quotes
,
url
)
{
async
function
drawOverlay
(
ctx
,
headline
,
quotes
,
url
)
{
console
.
log
(
"
drawOverlay url =
"
,
headline
,
quotes
,
url
)
console
.
log
(
"
drawOverlay url =
"
,
headline
,
quotes
,
url
)
let
font_size
=
18
let
font_size
=
18
ctx
.
font
=
font_size
+
'
px Arial
'
;
ctx
.
font
=
font_size
+
'
px Arial
'
;
ctx
.
textBaseline
=
'
top
'
;
ctx
.
textBaseline
=
'
top
'
;
wrapText
(
ctx
,
headline
,
530
,
50
,
240
);
wrapText
(
ctx
,
headline
,
530
,
50
,
240
);
const
positions
=
[
const
positions
=
[
{
x
:
30
,
y
:
140
},
{
x
:
530
,
y
:
140
},
{
x
:
30
,
y
:
250
},
{
x
:
30
,
y
:
140
},
{
x
:
530
,
y
:
140
},
{
x
:
30
,
y
:
250
},
...
@@ -420,14 +427,14 @@ async function drawOverlay(ctx,headline,quotes,url) {
...
@@ -420,14 +427,14 @@ async function drawOverlay(ctx,headline,quotes,url) {
];
];
for
(
let
i
=
0
;
i
<
quotes
.
length
&&
i
<
positions
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
quotes
.
length
&&
i
<
positions
.
length
;
i
++
)
{
wrapText
(
ctx
,
quotes
[
i
],
positions
[
i
].
x
,
positions
[
i
].
y
,
240
);
wrapText
(
ctx
,
quotes
[
i
],
positions
[
i
].
x
,
positions
[
i
].
y
,
240
);
}
}
const
img_x
=
(
canvasWidth
.
value
-
250
)
/
2
;
const
img_x
=
(
canvasWidth
.
value
-
250
)
/
2
;
const
img_y
=
(
canvasHeight
.
value
-
250
)
/
2
;
const
img_y
=
(
canvasHeight
.
value
-
250
)
/
2
;
const
image1
=
new
Image
();
const
image1
=
new
Image
();
image1
.
onload
=
()
=>
{
image1
.
onload
=
()
=>
{
console
.
log
(
"
drawOverlay image1 =
"
,
image1
,
img_x
,
img_y
)
console
.
log
(
"
drawOverlay image1 =
"
,
image1
,
img_x
,
img_y
)
ctx
.
drawImage
(
image1
,
img_x
,
img_y
,
250
,
250
);
ctx
.
drawImage
(
image1
,
img_x
,
img_y
,
250
,
250
);
};
};
let
imagedata
=
await
getImage
(
url
)
let
imagedata
=
await
getImage
(
url
)
...
@@ -436,13 +443,13 @@ async function drawOverlay(ctx,headline,quotes,url) {
...
@@ -436,13 +443,13 @@ async function drawOverlay(ctx,headline,quotes,url) {
const
formSubmit
=
async
()
=>
{
const
formSubmit
=
async
()
=>
{
console
.
log
(
projectName
)
console
.
log
(
projectName
)
if
(
!
(
projectName
&&
projectName
.
value
&&
projectName
.
value
.
length
))
{
if
(
!
(
projectName
&&
projectName
.
value
&&
projectName
.
value
.
length
))
{
showError
.
value
=
true
showError
.
value
=
true
setTimeout
(()
=>
{
setTimeout
(()
=>
{
showError
.
value
=
false
showError
.
value
=
false
},
3000
)
},
3000
)
return
return
}
}
showLoading
.
value
=
true
showLoading
.
value
=
true
...
@@ -463,12 +470,12 @@ const formSubmit = async () => {
...
@@ -463,12 +470,12 @@ const formSubmit = async () => {
for
(
let
i
=
0
;
i
<
output_lines
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
output_lines
.
length
;
i
++
)
{
let
str
=
output_lines
[
i
]
let
str
=
output_lines
[
i
]
// console.log("str before =",str)
// console.log("str before =",str)
let
temp
=
str
.
replaceAll
(
"
"
,
""
)
let
temp
=
str
.
replaceAll
(
"
"
,
""
)
// console.log("temp after =",temp)
// console.log("temp after =",temp)
if
(
temp
.
startsWith
(
"
-
"
)
||
temp
.
startsWith
(
"
-
"
))
{
if
(
temp
.
startsWith
(
"
-
"
)
||
temp
.
startsWith
(
"
-
"
))
{
quotes
.
push
(
str
)
quotes
.
push
(
str
)
if
(
i
>
0
&&
!
headline
)
{
if
(
i
>
0
&&
!
headline
)
{
headline
=
output_lines
[
i
-
1
]
headline
=
output_lines
[
i
-
1
]
}
}
}
}
if
(
temp
.
startsWith
(
"
Image:
"
)
||
temp
.
startsWith
(
"
Image:
"
))
{
if
(
temp
.
startsWith
(
"
Image:
"
)
||
temp
.
startsWith
(
"
Image:
"
))
{
...
@@ -480,23 +487,23 @@ const formSubmit = async () => {
...
@@ -480,23 +487,23 @@ const formSubmit = async () => {
if
(
image_description
.
indexOf
(
'
Image
'
)
>
-
1
)
{
if
(
image_description
.
indexOf
(
'
Image
'
)
>
-
1
)
{
image_description
=
image_description
.
replace
(
"
Image:
"
,
""
).
trim
()
image_description
=
image_description
.
replace
(
"
Image:
"
,
""
).
trim
()
}
}
console
.
log
(
"
image_description =
"
,
image_description
)
console
.
log
(
"
image_description =
"
,
image_description
)
let
output
=
await
grenerate
(
image_description
)
let
output
=
await
grenerate
(
image_description
)
if
(
output
&&
output
.
length
)
{
if
(
output
&&
output
.
length
)
{
createImage
(
headline
,
quotes
,
output
[
0
])
createImage
(
headline
,
quotes
,
output
[
0
])
}
}
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
showLoading
.
value
=
false
showLoading
.
value
=
false
// showToast('AI processing failed')
// showToast('AI processing failed')
console
.
log
(
"
formSubmit error =
"
,
error
)
console
.
log
(
"
formSubmit error =
"
,
error
)
if
(
error
&&
typeof
error
==
'
string
'
)
{
if
(
error
&&
typeof
error
==
'
string
'
)
{
showToast
(
error
);
showToast
(
error
);
}
else
{
}
else
{
showToast
(
error
.
message
);
showToast
(
error
.
message
);
}
}
}
}
}
}
async
function
getTemplateList
()
{
async
function
getTemplateList
()
{
...
@@ -505,7 +512,7 @@ async function getTemplateList() {
...
@@ -505,7 +512,7 @@ async function getTemplateList() {
templateList
.
value
=
list
templateList
.
value
=
list
prompt
.
value
=
list
[
0
].
prompt
prompt
.
value
=
list
[
0
].
prompt
location
.
value
=
list
[
0
].
title
location
.
value
=
list
[
0
].
title
console
.
log
(
"
getTemplateList
"
,
list
[
0
])
console
.
log
(
"
getTemplateList
"
,
list
[
0
])
let
imageUrl
=
list
[
0
].
image
let
imageUrl
=
list
[
0
].
image
if
(
imageUrl
.
indexOf
(
"
localhost
"
)
<
0
||
imageUrl
.
indexOf
(
"
127.0.0.1
"
)
<
0
)
{
if
(
imageUrl
.
indexOf
(
"
localhost
"
)
<
0
||
imageUrl
.
indexOf
(
"
127.0.0.1
"
)
<
0
)
{
image
.
value
=
imageUrl
image
.
value
=
imageUrl
...
@@ -515,8 +522,8 @@ async function getTemplateList() {
...
@@ -515,8 +522,8 @@ async function getTemplateList() {
}
}
}
}
function
selectTemplate
(
id
,
imageUrl
,
prompt_
,
title
)
{
function
selectTemplate
(
id
,
imageUrl
,
prompt_
,
title
)
{
console
.
log
(
"
selectTemplate =
"
,
id
,
imageUrl
,
prompt_
)
console
.
log
(
"
selectTemplate =
"
,
id
,
imageUrl
,
prompt_
)
templateId
.
value
=
id
templateId
.
value
=
id
prompt
.
value
=
prompt_
prompt
.
value
=
prompt_
location
.
value
=
title
location
.
value
=
title
...
@@ -529,7 +536,7 @@ async function login_108() {
...
@@ -529,7 +536,7 @@ async function login_108() {
try
{
try
{
let
time
=
new
Date
().
getTime
()
let
time
=
new
Date
().
getTime
()
console
.
log
(
`demo index login in time =
${
time
}
`
)
console
.
log
(
`demo index login in time =
${
time
}
`
)
let
user
=
new
User
()
let
user
=
new
User
()
let
temp
=
await
user
.
islogin
()
let
temp
=
await
user
.
islogin
()
console
.
log
(
`demo index islogin res time =
${
new
Date
().
getTime
()
-
time
}
`
)
console
.
log
(
`demo index islogin res time =
${
new
Date
().
getTime
()
-
time
}
`
)
...
@@ -575,7 +582,7 @@ async function login_108() {
...
@@ -575,7 +582,7 @@ async function login_108() {
}
}
function
sleep
(
ms
)
{
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
}
async
function
login_1012
()
{
async
function
login_1012
()
{
...
@@ -593,13 +600,13 @@ async function login_1012() {
...
@@ -593,13 +600,13 @@ async function login_1012() {
});
});
console
.
log
(
`demo index showLoadingToast end time =
${
time
}
`
)
console
.
log
(
`demo index showLoadingToast end time =
${
time
}
`
)
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
// console.log("getOwnedUsers i = ",i)
// console.log("getOwnedUsers i = ",i)
let
result
=
await
user
.
getOwnedUsers
()
let
result
=
await
user
.
getOwnedUsers
()
let
userid
=
result
&&
result
.
_userIds
&&
result
.
_userIds
.
length
&&
result
.
_userIds
[
0
]
let
userid
=
result
&&
result
.
_userIds
&&
result
.
_userIds
.
length
&&
result
.
_userIds
[
0
]
if
(
userid
&&
userid
.
length
)
{
if
(
userid
&&
userid
.
length
)
{
break
break
}
}
await
sleep
(
300
)
await
sleep
(
300
)
}
}
closeToast
();
closeToast
();
temp
=
await
user
.
islogin
()
temp
=
await
user
.
islogin
()
...
@@ -634,20 +641,26 @@ onMounted(() => {
...
@@ -634,20 +641,26 @@ onMounted(() => {
<
style
scoped
>
<
style
scoped
>
.custom-radio-group
{
.custom-radio-group
{
display
:
flex
;
display
:
flex
;
justify-content
:
flex-start
;
/* 确保 radio 组内项目从左对齐 */
justify-content
:
flex-start
;
/* 确保 radio 组内项目从左对齐 */
}
}
.custom-radio
{
.custom-radio
{
display
:
flex
;
display
:
flex
;
align-items
:
center
;
/* 确保 radio 和文字在垂直方向居中 */
align-items
:
center
;
justify-content
:
flex-start
;
/* 确保内容在水平方向左对齐 */
/* 确保 radio 和文字在垂直方向居中 */
margin-right
:
16px
;
/* 添加间距 */
justify-content
:
flex-start
;
flex
:
none
;
/* 防止 radio 项目拉伸 */
/* 确保内容在水平方向左对齐 */
margin-right
:
16px
;
/* 添加间距 */
flex
:
none
;
/* 防止 radio 项目拉伸 */
}
}
.van-radio__label
{
.van-radio__label
{
text-align
:
left
;
/* 强制标签文本左对齐 */
text-align
:
left
;
/* 强制标签文本左对齐 */
}
}
.banner
{
.banner
{
...
@@ -704,6 +717,7 @@ onMounted(() => {
...
@@ -704,6 +717,7 @@ onMounted(() => {
.uni-form-item
{
.uni-form-item
{
margin-bottom
:
8.53vw
;
margin-bottom
:
8.53vw
;
overflow
:
scroll
;
}
}
.uni-form-item
.content
{
.uni-form-item
.content
{
...
...
yarn.lock
View file @
cde532c2
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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