|
|
@@ -27,7 +27,7 @@ const getCanvasSize = () => {
|
|
|
// 设计宽度是 210*170 ,实际需要放大到 占满屏宽 375 * 300
|
|
|
const designWidth = 375;
|
|
|
const designHeight = 300;
|
|
|
-
|
|
|
+
|
|
|
// 为了清晰度,宽高放大一倍
|
|
|
const canvasWidth = screenWidth * 2;
|
|
|
const canvasHeight = (screenWidth / designWidth) * designHeight * 2;
|
|
|
@@ -50,13 +50,13 @@ export default (props: Props) => {
|
|
|
const { canvasWidth, canvasHeight, ratio } = getCanvasSize();
|
|
|
const isLogin = useIsLogin()
|
|
|
let stage: Stage|null;
|
|
|
-
|
|
|
+
|
|
|
// character = useCurrentCharacter
|
|
|
const agent = props.agent
|
|
|
const initCanvas = async () => {
|
|
|
// console.log('share:', character)
|
|
|
if(!agent){
|
|
|
- return
|
|
|
+ return
|
|
|
}
|
|
|
const app = new Application(
|
|
|
"#myShareCanvas",
|
|
|
@@ -69,7 +69,7 @@ export default (props: Props) => {
|
|
|
}
|
|
|
|
|
|
let avatarImg = agent.avatarLogo ?? DEFAULT_AVATAR_SHARE_BG
|
|
|
-
|
|
|
+
|
|
|
stage.backgroundColor = 'white'
|
|
|
|
|
|
// 如果有头像,加载头像图片先
|
|
|
@@ -83,10 +83,10 @@ export default (props: Props) => {
|
|
|
src: 'https://cdn.wehome.cn/cmn/png/221/META-H8UKXHWU-X0WXBKY1C0G0QA1DIH762-NSP5OMEM-IK.png',
|
|
|
},
|
|
|
]
|
|
|
-
|
|
|
+
|
|
|
const loader = new ImgLoader(stage.canvas, imgArr);
|
|
|
await loader.load();
|
|
|
-
|
|
|
+
|
|
|
|
|
|
// 头像
|
|
|
const avatarTexture = loader.get("avatar");
|
|
|
@@ -96,9 +96,9 @@ export default (props: Props) => {
|
|
|
dHeight: (canvasWidth / avatarTexture.width) * avatarTexture.height,
|
|
|
});
|
|
|
// 如果有头像,则需要上提,以显示出头像,如果是默认图则无需上提
|
|
|
- if(agent.avatarLogo){
|
|
|
- avatar.y = -56 * ratio;
|
|
|
- }
|
|
|
+ // if(agent.avatarLogo){
|
|
|
+ // avatar.y = ;
|
|
|
+ // }
|
|
|
const avatarWrapper = new Container()
|
|
|
avatarWrapper.width = canvasWidth
|
|
|
avatarWrapper.height = 100
|
|
|
@@ -106,10 +106,10 @@ export default (props: Props) => {
|
|
|
avatarWrapper.addChild(avatar)
|
|
|
stage.addChild(avatar)
|
|
|
|
|
|
-
|
|
|
+
|
|
|
const blurBgTexture = loader.get("blurBg");
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
// 毛玻璃背景
|
|
|
const dHeight = 56 * ratio
|
|
|
const blurBg = new DuduImage({
|
|
|
@@ -158,17 +158,17 @@ export default (props: Props) => {
|
|
|
companyName.color = "rgba(17,17,17, .65)";
|
|
|
infoList.addChild(companyName);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
stage.addChild(infoList)
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
stage.update();
|
|
|
};
|
|
|
|
|
|
|
|
|
// 您好,这是xxx的智能体主页!
|
|
|
const shareTitle = '快和我的智能体聊聊吧' // '想了解我?快和我的AI聊聊吧',
|
|
|
-
|
|
|
+
|
|
|
useShareAppMessage(async () => {
|
|
|
const agentId = agent?.agentId;
|
|
|
const path = `/pages/profile/index?agentId=${agentId}`
|
|
|
@@ -194,7 +194,7 @@ export default (props: Props) => {
|
|
|
}
|
|
|
}
|
|
|
const reponse = await getSharePromise(agentId, shareTitle, tmpImage)
|
|
|
-
|
|
|
+
|
|
|
return reponse;
|
|
|
});
|
|
|
|