feat: 首页获取登录态

This commit is contained in:
eric
2022-11-27 12:07:34 +08:00
parent 00dbe2a236
commit ae1fb6626d
2 changed files with 15 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@@ -50,8 +50,21 @@ const Home = () => {
const [openid, setopenid] = useState();
const [isIn, setisIn] = useState(false);
const onChange = (e) => {};
useEffect(() => {
getLogin();
}, []);
const getLogin = async () => {
let isLogin: any = await phoneLogin();
console.log('isLogin',isLogin)
setisIn(isLogin);
};
Taro.useShareAppMessage((res) => {
if (res.from === "button") {
// 来自页面内转发按钮
@@ -374,10 +387,7 @@ const Home = () => {
className="iconStyle"
onClick={async () => {
// getLocation();
let isin: any = await phoneLogin();
setisIn(true);
console.log("isin", isin);
if (isin) {
if (isIn) {
// 获取定位信息
Taro.getLocation({
type: "gcj02", //返回可以用于 Taro.openLocation的经纬度