From ed11d780dd2ba07df35215c31b82671c698e46d8 Mon Sep 17 00:00:00 2001 From: hackrobot Date: Thu, 21 Mar 2024 08:47:24 +0800 Subject: [PATCH] =?UTF-8?q?debug:=20=E5=88=A0=E9=99=A4wxid=3Dtoast?= =?UTF-8?q?=E8=B0=83=E8=AF=95=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/index.jsx | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/pages/index/index.jsx b/src/pages/index/index.jsx index b4fec36..1007a06 100644 --- a/src/pages/index/index.jsx +++ b/src/pages/index/index.jsx @@ -1,7 +1,14 @@ import { View, Text, Image } from "@tarojs/components"; import { useLoad } from "@tarojs/taro"; import Taro from "@tarojs/taro"; -import { AtAvatar, AtTag, AtIcon, AtTabBar, AtButton } from "taro-ui"; +import { + AtAvatar, + AtTag, + AtIcon, + AtTabBar, + AtButton, + AtMessage, +} from "taro-ui"; import "./index.scss"; import beijing from "@/images/city/beijing.jpg"; import guangzhou from "@/images/city/guangzhou.jpg"; @@ -40,17 +47,16 @@ export default function Index() { 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) { + + if (params.wxid) { + setuserInfo({ + wxid: params?.wxid, //个人号wxid + // openId: params?.openId, //小程序openid + }); // 本地存储 + try { - Taro.setStorage({ - wxid: wxid, - openId: openId, - }); + Taro.setStorageSync("wxid", params?.wxid ?? ""); } catch (e) {} } }, []); @@ -197,7 +203,15 @@ export default function Index() { return ["北京", "上海", "广东", "浙江", "湖北"].map((item, index) => { return ( - + { + Taro.redirectTo({ + url: "/pages/index/index?wxid=1111111", + }); + }} + type="primary" + circle + > {item} @@ -232,6 +246,7 @@ export default function Index() { + ); }