|
@@ -1,16 +1,13 @@
|
1
|
|
-import React from "react";
|
|
1
|
+import React, { useState, useEffect } from "react";
|
2
|
2
|
import { View, ScrollView } from "@tarojs/components";
|
3
|
3
|
import "./index.scss";
|
4
|
4
|
import useUser from "../store/user";
|
5
|
5
|
|
6
|
6
|
const IsLogin = ({ children }) => {
|
7
|
7
|
const { user } = useUser();
|
8
|
|
- console.log(user, "user");
|
9
|
8
|
|
10
|
|
- return user && user.userId
|
11
|
|
- ? children
|
12
|
|
- : <View style={{textAlign:'center', marginTop: '200px', fontSize: '0.7em', color: '#888'}}>您暂无权限访问当前页面</View>
|
13
|
|
- ;
|
|
9
|
+ return user && user.userId ? children :
|
|
10
|
+ (<View className="no-rights">您暂无权限访问当前页面</View>)
|
14
|
11
|
};
|
15
|
12
|
|
16
|
13
|
export default IsLogin;
|