feat: 获取路由参数
This commit is contained in:
BIN
src/images/meetup/a1.jpg
Normal file
BIN
src/images/meetup/a1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
BIN
src/images/meetup/a2.jpg
Normal file
BIN
src/images/meetup/a2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
BIN
src/images/meetup/a3.jpg
Normal file
BIN
src/images/meetup/a3.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
BIN
src/images/meetup/a4.png
Normal file
BIN
src/images/meetup/a4.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 244 KiB |
BIN
src/images/meetup/a5.jpg
Normal file
BIN
src/images/meetup/a5.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
BIN
src/images/meetup/a6.jpg
Normal file
BIN
src/images/meetup/a6.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
@@ -8,6 +8,14 @@ import guangzhou from "@/images/city/guangzhou.jpg";
|
||||
import shanghai from "@/images/city/shanghai.jpg";
|
||||
import shenzhen from "@/images/city/shenzhen.jpg";
|
||||
import touxiang from "@/images/index/touxiang.jpg";
|
||||
|
||||
import a1 from "@/images/meetup/a1.jpg";
|
||||
import a2 from "@/images/meetup/a2.jpg";
|
||||
import a3 from "@/images/meetup/a3.jpg";
|
||||
import a4 from "@/images/meetup/a4.png";
|
||||
import a5 from "@/images/meetup/a5.jpg";
|
||||
import a6 from "@/images/meetup/a6.jpg";
|
||||
|
||||
import TabbarCom from "@/componments/TabbarCom";
|
||||
import QrCode from "@/componments/QrCode";
|
||||
|
||||
@@ -16,13 +24,37 @@ import { useEffect, useState } from "react";
|
||||
|
||||
export default function Index() {
|
||||
// 用户基本信息
|
||||
const [userInfo, setuserInfo] = useState({});
|
||||
const [userInfo, setuserInfo] = useState({
|
||||
wxid: null,
|
||||
openId: null,
|
||||
});
|
||||
const [isOpened, setisOpened] = useState(false);
|
||||
|
||||
useLoad(() => {
|
||||
console.log("Page loaded.");
|
||||
});
|
||||
|
||||
// 获取用户标识符
|
||||
useEffect(() => {
|
||||
// 获取路由参数
|
||||
const params = Taro.getCurrentInstance().router.params;
|
||||
console.log("params", params);
|
||||
// const [wxid, openId] = params;
|
||||
setuserInfo({
|
||||
wxid: params?.wxid, //个人号wxid
|
||||
// openId: params?.openId, //小程序openid
|
||||
});
|
||||
if (wxid) {
|
||||
// 本地存储
|
||||
try {
|
||||
Taro.setStorage({
|
||||
wxid: wxid,
|
||||
openId: openId,
|
||||
});
|
||||
} catch (e) {}
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
// 更新分享-minipro
|
||||
Taro.updateShareMenu({
|
||||
@@ -57,21 +89,20 @@ export default function Index() {
|
||||
}}
|
||||
>
|
||||
<View className="CustomHeader">🥂加入微信群-meetup</View>
|
||||
{/* <View className="CustomAvatar">
|
||||
<AtAvatar
|
||||
className="AtAvatar"
|
||||
circle
|
||||
image={touxiang}
|
||||
size="small"
|
||||
></AtAvatar>
|
||||
</View> */}
|
||||
<View className="CustomAvatar">
|
||||
{[1, 2, 3, 4, 5, 6, 7].map((item, index) => {
|
||||
{[
|
||||
{ imagePath: a1 },
|
||||
{ imagePath: a2 },
|
||||
{ imagePath: a3 },
|
||||
{ imagePath: a4 },
|
||||
{ imagePath: a5 },
|
||||
{ imagePath: a6 },
|
||||
].map((item, index) => {
|
||||
return (
|
||||
<AtAvatar
|
||||
className="AtAvatar"
|
||||
circle
|
||||
image={touxiang}
|
||||
image={item.imagePath}
|
||||
size="small"
|
||||
></AtAvatar>
|
||||
);
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
margin-right: 5px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,11 @@ import TabbarCom from "@/componments/TabbarCom";
|
||||
import { useEffect, useState } from "react";
|
||||
const my = () => {
|
||||
const [open, setopen] = useState(false);
|
||||
useEffect(()=>{
|
||||
// 获取路由参数
|
||||
const params= Taro.getCurrentInstance().router.params
|
||||
console.log('params',params)
|
||||
},[])
|
||||
|
||||
const handleClick = (value) => {
|
||||
setopen(true);
|
||||
|
||||
Reference in New Issue
Block a user