Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
ai-card
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit fcf9e283
authored
Sep 28, 2022
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
调整生成卡片逻辑
1 parent
93cbfafe
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
17 deletions
pages/tab/index/index.js
pages/tab/index/index.wxml
pages/tab/index/index.js
View file @
fcf9e28
...
@@ -217,7 +217,6 @@ Page({
...
@@ -217,7 +217,6 @@ Page({
};
};
},
},
setShareInfo
(
data
=
{})
{
setShareInfo
(
data
=
{})
{
console
.
log
(
1111
,
data
)
const
canvasWidth
=
208
,
const
canvasWidth
=
208
,
canvasHeight
=
166
,
canvasHeight
=
166
,
textBaseline
=
"top"
;
textBaseline
=
"top"
;
...
@@ -229,6 +228,9 @@ Page({
...
@@ -229,6 +228,9 @@ Page({
// });
// });
const
drawCard
=
(
callBack
)
=>
{
const
drawCard
=
(
callBack
)
=>
{
// let index = 0;
// let index = 0;
const
canvasWidth
=
208
,
canvasHeight
=
166
,
textBaseline
=
"top"
;
const
iconWidth
=
9
,
const
iconWidth
=
9
,
iconHeight
=
9
,
iconHeight
=
9
,
iconX
=
18
,
iconX
=
18
,
...
@@ -314,8 +316,8 @@ Page({
...
@@ -314,8 +316,8 @@ Page({
lineHeight
:
9
,
lineHeight
:
9
,
},
},
];
];
this
.
setData
({
posterConfig
:
{
width
:
208
,
this
.
setData
({
posterConfig
:
{
width
:
canvasWidth
,
height
:
166
,
texts
:
textList
,
images
:
imgList
}
},
()
=>
{
height
:
canvasHeight
,
texts
:
textList
,
images
:
imgList
}
},
()
=>
{
Poster
.
create
();
Poster
.
create
();
});
});
// const drawImages = (callBack) => {
// const drawImages = (callBack) => {
...
@@ -352,21 +354,14 @@ Page({
...
@@ -352,21 +354,14 @@ Page({
*/
*/
onPosterSuccess
(
src
)
{
onPosterSuccess
(
src
)
{
const
{
detail
}
=
src
;
const
{
detail
}
=
src
;
// wx.previewImage({
// current: detail,
// urls: [detail]
// })
this
.
setData
({
this
.
setData
({
shareImg
:
detail
,
shareImg
:
detail
,
}
);
}
,()
=>
{
wx
.
hideLoading
()
wx
.
hideLoading
()
wx
.
showShareMenu
({
wx
.
showShareMenu
({
menus
:
[
'shareAppMessage'
,
'shareTimeline'
]
menus
:
[
'shareAppMessage'
,
'shareTimeline'
]
})
})
// setData配置数据
});
// this.setData({ posterConfig: {...} }, () => {
// Poster.create();
// });
},
},
// 获取用户昵称
// 获取用户昵称
getUserProfile
(
e
)
{
getUserProfile
(
e
)
{
...
@@ -413,10 +408,12 @@ Page({
...
@@ -413,10 +408,12 @@ Page({
duration
:
2000
duration
:
2000
})
})
}
}
const
cardInfo
=
data
||
this
.
data
.
defaultInfo
this
.
setData
({
this
.
setData
({
cardInfo
:
data
||
this
.
data
.
defaultInfo
cardInfo
},()
=>
{
this
.
setShareInfo
(
cardInfo
);
})
})
this
.
setShareInfo
(
this
.
data
.
cardInfo
);
});
});
},
},
});
});
pages/tab/index/index.wxml
View file @
fcf9e28
...
@@ -4,9 +4,7 @@
...
@@ -4,9 +4,7 @@
<import src="../../template/menu/menu.wxml" />
<import src="../../template/menu/menu.wxml" />
<import src="index.skeleton.wxml"/>
<import src="index.skeleton.wxml"/>
<template is="skeleton" wx:if="true" />
<template is="skeleton" wx:if="true" />
<poster id="poster" config="{{posterConfig}}" bind:success="onPosterSuccess" bind:fail="onPosterFail">
<poster id="poster" config="{{posterConfig}}" bind:success="onPosterSuccess" bind:fail="onPosterFail"></poster>
<button>点击生成海报</button>
</poster>
<view class="main-box" wx:if="{{cardInfo}}" >
<view class="main-box" wx:if="{{cardInfo}}" >
<user-info data-skeleton-hide="cardInfo" shareDisabled="{{shareDisabled}}" cardInfo="{{cardInfo}}"></user-info>
<user-info data-skeleton-hide="cardInfo" shareDisabled="{{shareDisabled}}" cardInfo="{{cardInfo}}"></user-info>
<view class="main-bottom">
<view class="main-bottom">
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment