Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
visualcloud
/
Vmatrix-client-taro
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8d86221b
authored
Aug 12, 2019
by
lirandong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
45ac19a1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
37 deletions
+17
-37
src/app.tsx
+12
-33
src/constants/utils.ts
+2
-2
src/pages/index/index.tsx
+3
-2
No files found.
src/app.tsx
View file @
8d86221b
...
@@ -14,9 +14,7 @@ import token from './constants/token'
...
@@ -14,9 +14,7 @@ import token from './constants/token'
/** 初始化 tokne */
/** 初始化 tokne */
!
(
async
()
=>
{
!
(
async
()
=>
{
await
token
.
init
()
await
token
.
init
()
console
.
log
(
'1111'
)
Taro
.
render
(<
App
/>,
document
.
getElementById
(
'app'
))
Taro
.
render
(<
App
/>,
document
.
getElementById
(
'app'
))
console
.
log
(
'done'
)
})()
})()
const
store
=
configStore
()
const
store
=
configStore
()
...
@@ -31,8 +29,8 @@ class App extends Component {
...
@@ -31,8 +29,8 @@ class App extends Component {
config
:
Config
=
{
config
:
Config
=
{
pages
:
[
pages
:
[
'pages/index/index'
,
'pages/index/index'
,
'pages/login/index'
,
//
'pages/login/index',
'pages/home/index'
,
//
'pages/home/index',
'pages/home/device/index'
,
'pages/home/device/index'
,
'pages/home/tempaltes/index'
,
'pages/home/tempaltes/index'
,
'pages/home/user/index'
'pages/home/user/index'
...
@@ -43,47 +41,28 @@ class App extends Component {
...
@@ -43,47 +41,28 @@ class App extends Component {
navigationBarTitleText
:
'Taro Demo'
,
navigationBarTitleText
:
'Taro Demo'
,
navigationBarBackgroundColor
:
'#fff'
navigationBarBackgroundColor
:
'#fff'
},
},
// tabBar: {
tabBar
:
{
// list: [
// {
// pagePath: 'pages/home/tempaltes/index',
// text: '模板市场',
// iconPath: './constants/images/market.png',
// selectedIconPath: './constants/images/market_ac.png'
// },
// {
// pagePath: 'pages/home/device/index',
// text: '设备与视片',
// iconPath: './constants/images/device.png',
// selectedIconPath: './constants/images/device_ac.png'
// },
// {
// pagePath: 'pages/home/user/index',
// text: '个人中心',
// iconPath: './constants/images/personal.png',
// selectedIconPath: './constants/images/personal_ac.png'
// }
// ]
// }
tabBar
:
process
.
env
.
TARO_ENV
!==
'rn'
?
{
list
:
[
list
:
[
{
{
pagePath
:
'pages/home/tempaltes/index'
,
pagePath
:
'pages/home/tempaltes/index'
,
text
:
'模板市场'
text
:
'模板市场'
,
iconPath
:
'./constants/images/market.png'
,
selectedIconPath
:
'./constants/images/market_ac.png'
},
},
{
{
pagePath
:
'pages/home/device/index'
,
pagePath
:
'pages/home/device/index'
,
text
:
'设备与视片'
text
:
'设备与视片'
,
iconPath
:
'./constants/images/device.png'
,
selectedIconPath
:
'./constants/images/device_ac.png'
},
},
{
{
pagePath
:
'pages/home/user/index'
,
pagePath
:
'pages/home/user/index'
,
text
:
'个人中心'
text
:
'个人中心'
,
iconPath
:
'./constants/images/personal.png'
,
selectedIconPath
:
'./constants/images/personal_ac.png'
}
}
]
]
}
}
:
undefined
}
}
// 在 App 类中的 render() 函数没有实际作用
// 在 App 类中的 render() 函数没有实际作用
...
...
src/constants/utils.ts
View file @
8d86221b
...
@@ -10,7 +10,7 @@ export function concatParam(data: any): string {
...
@@ -10,7 +10,7 @@ export function concatParam(data: any): string {
export
const
MyStorage
=
{
export
const
MyStorage
=
{
async
getItem
({
key
})
{
async
getItem
({
key
})
{
if
(
Taro
.
getEnv
()
===
Taro
.
ENV_TYPE
.
RN
)
{
if
(
process
.
env
.
TARO_ENV
===
'rn'
)
{
const
data
=
await
AsyncStorage
.
getItem
(
key
)
const
data
=
await
AsyncStorage
.
getItem
(
key
)
return
Promise
.
resolve
({
data
})
return
Promise
.
resolve
({
data
})
}
else
{
}
else
{
...
@@ -19,7 +19,7 @@ export const MyStorage = {
...
@@ -19,7 +19,7 @@ export const MyStorage = {
},
},
setItem
({
key
,
data
}:
Taro
.
setStorage
.
Param
)
{
setItem
({
key
,
data
}:
Taro
.
setStorage
.
Param
)
{
if
(
Taro
.
getEnv
()
===
Taro
.
ENV_TYPE
.
RN
)
{
if
(
process
.
env
.
TARO_ENV
===
'rn'
)
{
return
AsyncStorage
.
setItem
(
key
,
data
)
return
AsyncStorage
.
setItem
(
key
,
data
)
}
else
{
}
else
{
return
Taro
.
setStorage
({
key
,
data
})
return
Taro
.
setStorage
({
key
,
data
})
...
...
src/pages/index/index.tsx
View file @
8d86221b
...
@@ -11,9 +11,10 @@ class Index extends Component {
...
@@ -11,9 +11,10 @@ class Index extends Component {
}
}
render
()
{
render
()
{
const
isLogin
=
token
.
isLogon
()
return
<
View
/>
// const isLogin = token.isLogon()
// console.log({ isLogin })
// console.log({ isLogin })
return
<
View
style=
{
{
height
:
'100%'
,
width
:
'100%'
}
}
>
{
isLogin
?
<
Home
/>
:
<
Login
/>
}
</
View
>
//
return <View style={{ height: '100%', width: '100%' }}>{isLogin ? <Home /> : <Login />}</View>
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment