feat: 分享设置

This commit is contained in:
eric
2022-11-27 14:35:46 +08:00
parent ad103dddfc
commit 72bf15b0aa
8 changed files with 129 additions and 28 deletions

View File

@@ -3,8 +3,7 @@
padding: 20px;
background-color: #fafafa;
.RichText{
.RichText {
margin-top: 20px;
background-color: #fafafa;
}
@@ -21,19 +20,27 @@
}
}
.imagesArr{
.imagesArr {
display: flex;
flex-direction: row;
padding: 10px;
align-items: center;
align-items: center;
// justify-content: space-between;
}
.wechatCode{
.wechatCode {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-bottom: 60px;
}
}
.share {
padding: 20px;
color: #52c41a;
display: flex;
flex-direction: row-reverse;
align-items: center;
justify-content: space-between;
}

View File

@@ -1,4 +1,12 @@
import { Button, Cell, Dialog, Skeleton, Toast } from "@antmjs/vantui";
import {
Button,
Cell,
Dialog,
Icon,
ShareSheet,
Skeleton,
Toast,
} from "@antmjs/vantui";
import { Input, RichText, View } from "@tarojs/components";
import Taro, { getCurrentInstance, useShareTimeline } from "@tarojs/taro";
import react, { useEffect, useState } from "react";
@@ -30,9 +38,21 @@ const details = () => {
const [show, setShow] = react.useState(false);
const [canelshow, setcanelshow] = react.useState(false);
const [showShare, setshowShare] = react.useState(false)
const [value, setValue] = react.useState("");
Taro.useShareAppMessage((res) => {
if (res.from === "button") {
// 来自页面内转发按钮
console.log(res.target);
}
return {
title: "活动详情",
path: `/pages/activityList/components/details/index?id=${id}`,
};
});
useEffect(() => {
if (status === "1" || detailStatus !== "1") {
setdisable(true);
@@ -51,8 +71,8 @@ const details = () => {
// 分享到朋友圈
useShareTimeline(() => {
return {
title: "分享朋友圈", //字符串 自定义标题
// query: `id=${this.data.shop.shop_id}`, //页面携带参数
title: "一起来玩吧", //字符串 自定义标题
query: `id=${id}`, //页面携带参数
// imageUrl: moments //图片地址
};
});
@@ -471,6 +491,30 @@ const details = () => {
{/* 调试按钮 */}
{/* <Cell title="组件调用" onClick={() => setShow(true)} /> */}
<View className="share" onClick={() => setshowShare(true)}>
<Icon name="share" size="32px" className="icon"></Icon>
</View>
<View>
<ShareSheet
show={showShare}
description="一起来玩吧 ~"
title="立即分享给好友"
options={[
{
name: "好友",
icon: "wechat",
openType:"share"
},
// {
// name: "朋友圈",
// icon: "weibo",
// openType:"weibo"
// },
]}
onClose={() => setshowShare(false)}
/>
</View>
<View
className={`detailBtn`}
style={{ bottom: `${bottomheight ?? 0}px` }}
@@ -480,7 +524,7 @@ const details = () => {
type={disable ? "warning" : "primary"}
block
// disabled={disable}
onClick={async() => {
onClick={async () => {
if (disable) {
setShow(true);
return false;

View File

@@ -71,15 +71,15 @@ const Home = () => {
console.log(res.target);
}
return {
title: "自定义转发标题",
path: "/page/user?id=123",
title: "cityNew",
path: `/pages/home/index`,
};
});
// 分享到朋友圈
useShareTimeline(() => {
return {
title: "分享朋友圈", //字符串 自定义标题
title: "一起来玩吧", //字符串 自定义标题
// query: `id=${this.data.shop.shop_id}`, //页面携带参数
// imageUrl: moments //图片地址
};
@@ -103,9 +103,9 @@ const Home = () => {
useEffect(() => {
getsystemConfig(); //获取系统配置
setTimeout(() => {
getdetails(); //获取活动详情
}, 300);
// setTimeout(() => {
// getdetails(); //获取活动详情
// }, 800);
}, []);
useEffect(() => {
@@ -138,6 +138,7 @@ const Home = () => {
okFun: async (res: any) => {
console.log("systemConfig--", res);
await setsystemConfig(res?.data ?? []);
await getdetails()
},
};
await getTable(objParams);
@@ -269,7 +270,7 @@ const Home = () => {
getsystemConfig(); //获取系统配置
setTimeout(() => {
getdetails(); //获取活动详情
}, 300);
}, 500);
},
});
};
@@ -550,6 +551,7 @@ const Home = () => {
}}
></OfficialAccount>
</View>
{/* 打开视频号主页-需要开放平台主主体认证 */}
{/* <View