李志伟 3 年前
父节点
当前提交
da4071b411
共有 5 个文件被更改,包括 8 次插入4 次删除
  1. 1
    0
      src/app.js
  2. 4
    1
      src/layouts/index.jsx
  3. 1
    1
      src/store/models/location.js
  4. 1
    1
      src/store/models/person.js
  5. 1
    1
      src/store/models/phone.js

+ 1
- 0
src/app.js 查看文件

@@ -15,6 +15,7 @@ class App extends Component {
15 15
     console.group('APP Launch')
16 16
     console.debug(options)
17 17
     console.groupEnd()
18
+    
18 19
 
19 20
     const { login } = store.getModel('person').getState()
20 21
       Taro.login({

+ 4
- 1
src/layouts/index.jsx 查看文件

@@ -8,9 +8,12 @@ import { useModel } from '@/store'
8 8
 
9 9
 export default (Child) => (props) => {
10 10
   const {person}=useModel('person')
11
+  const {location,setLocation}=useModel('location')
11 12
   const router = useRouter()
12 13
   
13
-  const location = Taro.getStorageSync('location')
14
+  if (!location) {
15
+    setLocation(Taro.getStorageSync('location'))
16
+  }
14 17
 
15 18
   // 确保执行过 login 方法,拿到了 person
16 19
   const isLoged = useMemo(() => !!person?.personId, [person?.personId])

+ 1
- 1
src/store/models/location.js 查看文件

@@ -1,6 +1,6 @@
1 1
 import { useState } from "react";
2 2
 
3
-export default function useHotel() {
3
+export default function useLocation() {
4 4
   const [location, setLocation] = useState()
5 5
 
6 6
   return {

+ 1
- 1
src/store/models/person.js 查看文件

@@ -9,7 +9,7 @@ export default () => {
9 9
   const login = (params) => {
10 10
     signIn(params).then((res) => {
11 11
       const { person: taPerson,  sessionKey: skey } = res;
12
-      taPerson.phone=null
12
+      // taPerson.phone=null
13 13
       setPerson(taPerson);
14 14
       setSessionKey(skey);
15 15
     })

+ 1
- 1
src/store/models/phone.js 查看文件

@@ -1,6 +1,6 @@
1 1
 import { useState } from "react";
2 2
 
3
-export default function useHotel() {
3
+export default function usePhone() {
4 4
   const [phone, setPhone] = useState()
5 5
 
6 6
   return {