feat: 首页获取登录态
This commit is contained in:
2
dist/pages/home/index.js
vendored
2
dist/pages/home/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -50,8 +50,21 @@ const Home = () => {
|
|||||||
const [openid, setopenid] = useState();
|
const [openid, setopenid] = useState();
|
||||||
const [isIn, setisIn] = useState(false);
|
const [isIn, setisIn] = useState(false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const onChange = (e) => {};
|
const onChange = (e) => {};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getLogin();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const getLogin = async () => {
|
||||||
|
let isLogin: any = await phoneLogin();
|
||||||
|
console.log('isLogin',isLogin)
|
||||||
|
setisIn(isLogin);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
Taro.useShareAppMessage((res) => {
|
Taro.useShareAppMessage((res) => {
|
||||||
if (res.from === "button") {
|
if (res.from === "button") {
|
||||||
// 来自页面内转发按钮
|
// 来自页面内转发按钮
|
||||||
@@ -374,10 +387,7 @@ const Home = () => {
|
|||||||
className="iconStyle"
|
className="iconStyle"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
// getLocation();
|
// getLocation();
|
||||||
let isin: any = await phoneLogin();
|
if (isIn) {
|
||||||
setisIn(true);
|
|
||||||
console.log("isin", isin);
|
|
||||||
if (isin) {
|
|
||||||
// 获取定位信息
|
// 获取定位信息
|
||||||
Taro.getLocation({
|
Taro.getLocation({
|
||||||
type: "gcj02", //返回可以用于 Taro.openLocation的经纬度
|
type: "gcj02", //返回可以用于 Taro.openLocation的经纬度
|
||||||
|
|||||||
Reference in New Issue
Block a user