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
0bf20de0
authored
Aug 15, 2019
by
lirandong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 目录
parent
606437a5
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
236 additions
and
164 deletions
+236
-164
config/index.js
+3
-2
src/api/axios.ts
+2
-2
src/api/common.ts
+8
-0
src/app.tsx
+9
-8
src/assets/images/device.png
+0
-0
src/assets/images/device_ac.png
+0
-0
src/assets/images/market.png
+0
-0
src/assets/images/market_ac.png
+0
-0
src/assets/images/personal.png
+0
-0
src/assets/images/personal_ac.png
+0
-0
src/assets/styles/var.scss
+0
-0
src/common/token.ts
+0
-0
src/common/utils.ts
+1
-1
src/conpoments/film_list_item/index.scss
+25
-0
src/conpoments/film_list_item/index.tsx
+52
-0
src/constants/components/pageView.tsx
+0
-35
src/constants/components/scss/pageView.scss
+0
-5
src/pages/home/device/add/index.tsx
+3
-3
src/pages/home/device/device_list/index.scss
+15
-10
src/pages/home/device/device_list/index.tsx
+25
-18
src/pages/home/device/device_select/index.scss
+1
-0
src/pages/home/device/device_select/index.tsx
+5
-13
src/pages/home/device/film_list/index.scss
+1
-25
src/pages/home/device/film_list/index.tsx
+45
-14
src/pages/home/device/index.tsx
+16
-12
src/pages/home/device/my_device/index.tsx
+4
-1
src/pages/home/tempaltes/index.tsx
+2
-3
src/pages/home/user/index.tsx
+14
-7
src/pages/index/index.tsx
+1
-1
src/pages/login/index.tsx
+4
-4
No files found.
config/index.js
View file @
0bf20de0
...
@@ -10,7 +10,7 @@ const sassImporter = function (url) {
...
@@ -10,7 +10,7 @@ const sassImporter = function (url) {
const
reg
=
/^@styles
\/(
.*
)
/
const
reg
=
/^@styles
\/(
.*
)
/
return
{
return
{
file
:
reg
.
test
(
url
)
?
path
.
resolve
(
__dirname
,
'..'
,
'src/
constan
ts/styles'
,
url
.
match
(
reg
)[
1
])
:
url
file
:
reg
.
test
(
url
)
?
path
.
resolve
(
__dirname
,
'..'
,
'src/
asse
ts/styles'
,
url
.
match
(
reg
)[
1
])
:
url
}
}
}
}
...
@@ -29,10 +29,11 @@ const config = {
...
@@ -29,10 +29,11 @@ const config = {
'@/'
:
path
.
resolve
(
__dirname
,
'..'
,
'src'
),
'@/'
:
path
.
resolve
(
__dirname
,
'..'
,
'src'
),
'@/api'
:
path
.
resolve
(
__dirname
,
'..'
,
'src/api'
),
'@/api'
:
path
.
resolve
(
__dirname
,
'..'
,
'src/api'
),
'@/pages'
:
path
.
resolve
(
__dirname
,
'..'
,
'src/pages'
),
'@/pages'
:
path
.
resolve
(
__dirname
,
'..'
,
'src/pages'
),
'@/common'
:
path
.
resolve
(
__dirname
,
'..'
,
'src/common'
),
'@/actions'
:
path
.
resolve
(
__dirname
,
'..'
,
'src/actions'
),
'@/actions'
:
path
.
resolve
(
__dirname
,
'..'
,
'src/actions'
),
'@/constants'
:
path
.
resolve
(
__dirname
,
'..'
,
'src/constants'
),
'@/constants'
:
path
.
resolve
(
__dirname
,
'..'
,
'src/constants'
),
'@/conpoments'
:
path
.
resolve
(
__dirname
,
'..'
,
'src/conpoments'
),
'@/conpoments'
:
path
.
resolve
(
__dirname
,
'..'
,
'src/conpoments'
),
'@styles'
:
path
.
resolve
(
__dirname
,
'..'
,
'src/
constan
ts/styles'
),
'@styles'
:
path
.
resolve
(
__dirname
,
'..'
,
'src/
asse
ts/styles'
),
},
},
plugins
:
{
plugins
:
{
babel
:
{
babel
:
{
...
...
src/api/axios.ts
View file @
0bf20de0
// import users from '@api/users'
// import users from '@api/users'
// import { concatParam } from '@/utils/utils'
// import { concatParam } from '@/utils/utils'
import
{
concatParam
}
from
'../co
nstants
/utils'
import
{
concatParam
}
from
'../co
mmon
/utils'
// import $config, { message, requestCode, tokens } from '@/config'
// import $config, { message, requestCode, tokens } from '@/config'
import
{
axios
,
CancelTokenStatic
,
AxiosInstance
}
from
'taro-axios'
import
{
axios
,
CancelTokenStatic
,
AxiosInstance
}
from
'taro-axios'
import
{
BASE_URL
,
FETCH_TIME_OUT
,
INTERFACE_REPEAT
}
from
'../constants/counter'
import
{
BASE_URL
,
FETCH_TIME_OUT
,
INTERFACE_REPEAT
}
from
'../constants/counter'
import
token
from
'../co
nstants
/token'
import
token
from
'../co
mmon
/token'
const
concatParamMethod
=
new
Set
([
'post'
,
'put'
])
const
concatParamMethod
=
new
Set
([
'post'
,
'put'
])
// let refreshTokenState = false // 刷新 token的状态
// let refreshTokenState = false // 刷新 token的状态
...
...
src/api/common.ts
View file @
0bf20de0
...
@@ -61,6 +61,14 @@ class UsersApi extends ApiClient {
...
@@ -61,6 +61,14 @@ class UsersApi extends ApiClient {
url
:
`/myequipment/del/info/
${
equipmentId
}
`
url
:
`/myequipment/del/info/
${
equipmentId
}
`
})
})
}
}
/** 删除设备 */
removeFilm
(
filmId
:
string
)
{
return
this
.
request
({
method
:
'GET'
,
url
:
`/template/del/film/info/
${
filmId
}
`
})
}
}
}
export
default
new
UsersApi
()
export
default
new
UsersApi
()
src/app.tsx
View file @
0bf20de0
...
@@ -5,7 +5,7 @@ import { Provider } from '@tarojs/redux'
...
@@ -5,7 +5,7 @@ import { Provider } from '@tarojs/redux'
import
Index
from
'./pages/index'
import
Index
from
'./pages/index'
import
configStore
from
'./store'
import
configStore
from
'./store'
import
token
from
'./co
nstants
/token'
import
token
from
'./co
mmon
/token'
import
'./app.scss'
import
'./app.scss'
// import 'taro-ui/dist/style/index.scss'
// import 'taro-ui/dist/style/index.scss'
...
@@ -34,10 +34,11 @@ class App extends Component {
...
@@ -34,10 +34,11 @@ class App extends Component {
*/
*/
config
:
Config
=
{
config
:
Config
=
{
pages
:
[
pages
:
[
'pages/home/user/index'
,
'pages/home/device/my_device/index'
,
'pages/home/device/index'
,
'pages/home/device/index'
,
'pages/home/device/add/index'
,
'pages/home/device/add/index'
,
'pages/home/device/my_film/index'
,
'pages/home/device/my_film/index'
,
'pages/home/user/index'
,
'pages/home/tempaltes/film_detail'
,
'pages/home/tempaltes/film_detail'
,
'pages/home/tempaltes/detail'
,
'pages/home/tempaltes/detail'
,
'pages/home/tempaltes/index'
,
'pages/home/tempaltes/index'
,
...
@@ -56,20 +57,20 @@ class App extends Component {
...
@@ -56,20 +57,20 @@ class App extends Component {
{
{
pagePath
:
'pages/home/tempaltes/index'
,
pagePath
:
'pages/home/tempaltes/index'
,
text
:
'模板市场'
,
text
:
'模板市场'
,
iconPath
:
'./
constan
ts/images/market.png'
,
iconPath
:
'./
asse
ts/images/market.png'
,
selectedIconPath
:
'./
constan
ts/images/market_ac.png'
selectedIconPath
:
'./
asse
ts/images/market_ac.png'
},
},
{
{
pagePath
:
'pages/home/device/index'
,
pagePath
:
'pages/home/device/index'
,
text
:
'设备与视片'
,
text
:
'设备与视片'
,
iconPath
:
'./
constan
ts/images/device.png'
,
iconPath
:
'./
asse
ts/images/device.png'
,
selectedIconPath
:
'./
constan
ts/images/device_ac.png'
selectedIconPath
:
'./
asse
ts/images/device_ac.png'
},
},
{
{
pagePath
:
'pages/home/user/index'
,
pagePath
:
'pages/home/user/index'
,
text
:
'个人中心'
,
text
:
'个人中心'
,
iconPath
:
'./
constan
ts/images/personal.png'
,
iconPath
:
'./
asse
ts/images/personal.png'
,
selectedIconPath
:
'./
constan
ts/images/personal_ac.png'
selectedIconPath
:
'./
asse
ts/images/personal_ac.png'
}
}
]
]
}
}
...
...
src/
constan
ts/images/device.png
→
src/
asse
ts/images/device.png
View file @
0bf20de0
File moved
src/
constan
ts/images/device_ac.png
→
src/
asse
ts/images/device_ac.png
View file @
0bf20de0
File moved
src/
constan
ts/images/market.png
→
src/
asse
ts/images/market.png
View file @
0bf20de0
File moved
src/
constan
ts/images/market_ac.png
→
src/
asse
ts/images/market_ac.png
View file @
0bf20de0
File moved
src/
constan
ts/images/personal.png
→
src/
asse
ts/images/personal.png
View file @
0bf20de0
File moved
src/
constan
ts/images/personal_ac.png
→
src/
asse
ts/images/personal_ac.png
View file @
0bf20de0
File moved
src/
constan
ts/styles/var.scss
→
src/
asse
ts/styles/var.scss
View file @
0bf20de0
File moved
src/co
nstants
/token.ts
→
src/co
mmon
/token.ts
View file @
0bf20de0
File moved
src/co
nstants
/utils.ts
→
src/co
mmon
/utils.ts
View file @
0bf20de0
...
@@ -31,7 +31,7 @@ export function checkPhone(phone) {
...
@@ -31,7 +31,7 @@ export function checkPhone(phone) {
return
/^1
[
3456789
]\d{9}
$/
.
test
(
phone
.
toString
())
return
/^1
[
3456789
]\d{9}
$/
.
test
(
phone
.
toString
())
}
}
export
function
myShow
Toast
({
result
,
tips
}:
{
result
?:
any
;
tips
?:
string
})
{
export
function
showMy
Toast
({
result
,
tips
}:
{
result
?:
any
;
tips
?:
string
})
{
if
(
!
result
&&
!
tips
)
return
if
(
!
result
&&
!
tips
)
return
Taro
.
showToast
({
icon
:
'none'
,
title
:
result
&&
result
.
msg
?
result
.
msg
:
tips
})
Taro
.
showToast
({
icon
:
'none'
,
title
:
result
&&
result
.
msg
?
result
.
msg
:
tips
})
}
}
...
...
src/conpoments/film_list_item/index.scss
0 → 100644
View file @
0bf20de0
@import
'@styles/var.scss'
;
.films-item-wrapper
{
padding
:
20px
;
display
:
flex
;
// margin-bottom: 40px;
flex-direction
:
row
;
background-color
:
white
;
}
.img-box
{
width
:
320px
;
}
.films-item-img
{
width
:
100%
;
height
:
180px
;
}
.films-item-info
{
flex
:
1
;
display
:
flex
;
padding-left
:
20px
;
flex-direction
:
column
;
}
src/conpoments/film_list_item/index.tsx
0 → 100644
View file @
0bf20de0
import
{
ComponentClass
}
from
'react'
import
Taro
,
{
Component
}
from
'@tarojs/taro'
import
{
View
,
Text
,
Image
}
from
'@tarojs/components'
import
{
IMilmListItme
}
from
'@/pages/home/device/film_list'
import
'./index.scss'
type
PageStateProps
=
{}
type
PageDispatchProps
=
{}
interface
PageOwnProps
extends
IMilmListItme
{
// filmName: string
// templateUrl: string
// equipmentCount: string
onClick
:
()
=>
void
}
type
PageState
=
{
name
:
string
}
type
IProps
=
PageStateProps
&
PageDispatchProps
&
PageOwnProps
interface
FilmListItem
{
props
:
IProps
state
:
PageState
}
class
FilmListItem
extends
Component
{
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
name
:
'小红'
}
}
render
()
{
const
{
templateUrl
,
filmName
,
equipmentCount
,
onClick
}
=
this
.
props
return
(
<
View
className=
"films-item-wrapper"
onClick=
{
onClick
}
>
<
View
className=
"img-box"
>
<
Image
className=
"films-item-img"
src=
{
templateUrl
}
/>
</
View
>
<
View
className=
"films-item-info"
>
<
Text
>
{
filmName
}
</
Text
>
<
Text
>
播放设备数量:
{
equipmentCount
}
</
Text
>
</
View
>
</
View
>
)
}
}
export
default
FilmListItem
as
ComponentClass
<
PageOwnProps
,
PageState
>
src/constants/components/pageView.tsx
deleted
100644 → 0
View file @
606437a5
import
{
ComponentClass
}
from
'react'
import
{
View
}
from
'@tarojs/components'
import
Taro
,
{
Component
}
from
'@tarojs/taro'
import
{
getStatusBarHeight
}
from
'../utils'
import
'./scss/pageView.scss'
type
PageStateProps
=
{}
type
PageDispatchProps
=
{}
type
PageOwnProps
=
{
children
:
any
}
type
PageState
=
{}
type
IProps
=
PageStateProps
&
PageDispatchProps
&
PageOwnProps
interface
PageView
{
props
:
IProps
state
:
PageState
}
class
PageView
extends
Component
{
render
()
{
const
StatusBarHeight
=
getStatusBarHeight
()
return
(
<
View
className=
"pageView"
style=
{
{
paddingTop
:
`${StatusBarHeight}px`
}
}
>
{
this
.
props
.
children
}
</
View
>
)
}
}
export
default
PageView
as
ComponentClass
<
PageOwnProps
,
PageState
>
src/constants/components/scss/pageView.scss
deleted
100644 → 0
View file @
606437a5
.pageView
{
width
:
100%
;
height
:
100%
;
box-sizing
:
border-box
;
}
src/pages/home/device/add/index.tsx
View file @
0bf20de0
...
@@ -2,8 +2,8 @@ import api from '@/api/index'
...
@@ -2,8 +2,8 @@ import api from '@/api/index'
import
{
ComponentClass
}
from
'react'
import
{
ComponentClass
}
from
'react'
import
Taro
,
{
Component
,
Config
}
from
'@tarojs/taro'
import
Taro
,
{
Component
,
Config
}
from
'@tarojs/taro'
import
{
View
,
Text
,
Input
,
Button
}
from
'@tarojs/components'
import
{
View
,
Text
,
Input
,
Button
}
from
'@tarojs/components'
import
{
showMyToast
}
from
'@/common/utils'
import
'./index.scss'
import
'./index.scss'
import
{
myShowToast
}
from
'@/constants/utils'
type
PageStateProps
=
{}
type
PageStateProps
=
{}
...
@@ -44,10 +44,10 @@ class AddDevicePIN extends Component {
...
@@ -44,10 +44,10 @@ class AddDevicePIN extends Component {
if
(
!
PIN
)
return
if
(
!
PIN
)
return
try
{
try
{
await
api
.
common
.
addDevicePIN
(
PIN
)
await
api
.
common
.
addDevicePIN
(
PIN
)
myShow
Toast
({
tips
:
'添加成功~'
})
showMy
Toast
({
tips
:
'添加成功~'
})
// console.log({ res })
// console.log({ res })
}
catch
(
error
)
{
}
catch
(
error
)
{
myShow
Toast
({
result
:
error
,
tips
:
'添加失败~'
})
showMy
Toast
({
result
:
error
,
tips
:
'添加失败~'
})
console
.
error
(
error
)
console
.
error
(
error
)
}
}
}
}
...
...
src/pages/home/device/device_list/index.scss
View file @
0bf20de0
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
.my-device
{
.my-device
{
width
:
100%
;
width
:
100%
;
height
:
10
36px
;
height
:
10
0%
;
position
:
relative
;
position
:
relative
;
}
}
...
@@ -19,20 +19,25 @@
...
@@ -19,20 +19,25 @@
background-color
:
$bgColor
;
background-color
:
$bgColor
;
}
}
.select-modal
{
.select-modal
-wrapper
{
top
:
20%
;
top
:
0
;
left
:
50%
;
left
:
0
;
width
:
400px
;
width
:
100%
;
// height: 160px
;
height
:
100%
;
display
:
flex
;
display
:
flex
;
position
:
absolute
;
position
:
absolute
;
// margin-top: -150px;
margin-left
:
-200px
;
align-items
:
center
;
align-items
:
center
;
flex-direction
:
column
;
flex-direction
:
column
;
justify-content
:
center
;
justify-content
:
center
;
border
:
solid
#ccc
1px
;
background-color
:
rgba
(
$color
:
#000
,
$alpha
:
0
.7
);
// background-color: rgba($color: #000, $alpha: 0.7);
z-index
:
2
;
}
.select-modal
{
width
:
400px
;
padding
:
0
20px
;
border-radius
:
6px
;
background-color
:
white
;
}
}
.select-item
{
.select-item
{
...
...
src/pages/home/device/device_list/index.tsx
View file @
0bf20de0
...
@@ -3,7 +3,7 @@ import { ComponentClass } from 'react'
...
@@ -3,7 +3,7 @@ import { ComponentClass } from 'react'
import
{
AtSwipeAction
}
from
'taro-ui'
import
{
AtSwipeAction
}
from
'taro-ui'
import
Taro
,
{
Component
}
from
'@tarojs/taro'
import
Taro
,
{
Component
}
from
'@tarojs/taro'
import
DeviceItem
from
'@/conpoments/device_item'
import
DeviceItem
from
'@/conpoments/device_item'
import
{
myShowToast
}
from
'@/constants
/utils'
import
{
showMyToast
}
from
'@/common
/utils'
import
{
View
,
Text
,
ScrollView
}
from
'@tarojs/components'
import
{
View
,
Text
,
ScrollView
}
from
'@tarojs/components'
import
'./index.scss'
import
'./index.scss'
...
@@ -28,9 +28,9 @@ type PageOwnProps = {}
...
@@ -28,9 +28,9 @@ type PageOwnProps = {}
type
PageState
=
{
type
PageState
=
{
page
:
number
page
:
number
count
:
number
count
:
number
deviceList
:
IDeviceItem
[]
deviceCode
:
string
deviceCode
:
string
showModal
:
boolean
showModal
:
boolean
deviceList
:
IDeviceItem
[]
}
}
type
IProps
=
PageStateProps
&
PageDispatchProps
&
PageOwnProps
type
IProps
=
PageStateProps
&
PageDispatchProps
&
PageOwnProps
...
@@ -51,6 +51,7 @@ class MyDevice extends Component {
...
@@ -51,6 +51,7 @@ class MyDevice extends Component {
showModal
:
false
showModal
:
false
}
}
this
.
scanCode
=
this
.
scanCode
.
bind
(
this
)
this
.
scanCode
=
this
.
scanCode
.
bind
(
this
)
this
.
cancelModal
=
this
.
cancelModal
.
bind
(
this
)
this
.
selectAddDevice
=
this
.
selectAddDevice
.
bind
(
this
)
this
.
selectAddDevice
=
this
.
selectAddDevice
.
bind
(
this
)
}
}
...
@@ -87,14 +88,18 @@ class MyDevice extends Component {
...
@@ -87,14 +88,18 @@ class MyDevice extends Component {
const
{
equipmentId
}
=
item
const
{
equipmentId
}
=
item
if
(
text
===
'编辑'
)
{
if
(
text
===
'编辑'
)
{
}
else
if
(
text
===
'删除'
)
{
}
else
if
(
text
===
'删除'
)
{
try
{
Taro
.
showModal
({
content
:
'确定要删除?'
}).
then
(
async
({
confirm
})
=>
{
await
api
.
common
.
removeDevice
(
equipmentId
)
if
(
confirm
)
{
this
.
getDate
()
try
{
myShowToast
({
tips
:
'删除成功~'
})
await
api
.
common
.
removeDevice
(
equipmentId
)
}
catch
(
error
)
{
this
.
getDate
()
console
.
error
(
error
)
showMyToast
({
tips
:
'删除成功~'
})
myShowToast
({
result
:
error
,
tips
:
'失败成功~'
})
}
catch
(
error
)
{
}
console
.
error
(
error
)
showMyToast
({
result
:
error
,
tips
:
'失败成功~'
})
}
}
})
}
}
}
}
...
@@ -107,10 +112,10 @@ class MyDevice extends Component {
...
@@ -107,10 +112,10 @@ class MyDevice extends Component {
scanType
:
[
'qrCode'
,
'barCode'
]
scanType
:
[
'qrCode'
,
'barCode'
]
})
})
await
api
.
common
.
addDeviceToken
(
result
)
await
api
.
common
.
addDeviceToken
(
result
)
myShow
Toast
({
tips
:
'添加成功~'
})
showMy
Toast
({
tips
:
'添加成功~'
})
this
.
getDate
()
this
.
getDate
()
}
catch
(
error
)
{
}
catch
(
error
)
{
myShow
Toast
({
result
:
error
,
tips
:
'添加失败~'
})
showMy
Toast
({
result
:
error
,
tips
:
'添加失败~'
})
console
.
error
(
error
)
console
.
error
(
error
)
}
}
}
}
...
@@ -165,12 +170,14 @@ class MyDevice extends Component {
...
@@ -165,12 +170,14 @@ class MyDevice extends Component {
</AtModalContent>
</AtModalContent>
</AtModal> */
}
</AtModal> */
}
{
showModal
?
(
{
showModal
?
(
<
View
className=
"select-modal"
>
<
View
className=
"select-modal-wrapper"
onClick=
{
this
.
cancelModal
}
>
<
View
className=
"select-item"
onClick=
{
this
.
scanCode
}
>
<
View
className=
"select-modal"
>
<
Text
>
扫码添加设备
</
Text
>
<
View
className=
"select-item"
onClick=
{
this
.
scanCode
}
>
</
View
>
<
Text
>
扫码添加设备
</
Text
>
<
View
className=
"select-item"
onClick=
{
()
=>
this
.
selectItem
(
''
)
}
>
</
View
>
<
Text
>
输入PIN码添加设备
</
Text
>
<
View
className=
"select-item"
onClick=
{
()
=>
this
.
selectItem
(
''
)
}
>
<
Text
>
输入PIN码添加设备
</
Text
>
</
View
>
</
View
>
</
View
>
</
View
>
</
View
>
)
:
null
}
)
:
null
}
...
...
src/pages/home/device/device_select/index.scss
0 → 100644
View file @
0bf20de0
@import
'@styles/var.scss'
;
src/
conpoments/test11
/index.tsx
→
src/
pages/home/device/device_select
/index.tsx
View file @
0bf20de0
import
{
ComponentClass
}
from
'react'
import
{
ComponentClass
}
from
'react'
import
Taro
,
{
Component
}
from
'@tarojs/taro'
import
Taro
,
{
Component
}
from
'@tarojs/taro'
import
{
View
,
Text
}
from
'@tarojs/components'
import
{
View
,
Text
}
from
'@tarojs/components'
// import './Text1.le
ss'
import
'./index.sc
ss'
type
PageStateProps
=
{}
type
PageStateProps
=
{}
...
@@ -15,33 +15,25 @@ type PageState = {
...
@@ -15,33 +15,25 @@ type PageState = {
type
IProps
=
PageStateProps
&
PageDispatchProps
&
PageOwnProps
type
IProps
=
PageStateProps
&
PageDispatchProps
&
PageOwnProps
interface
Text1
{
interface
DeviceSelect
{
props
:
IProps
props
:
IProps
state
:
PageState
state
:
PageState
}
}
class
Text1
extends
Component
{
class
DeviceSelect
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
this
.
state
=
{
this
.
state
=
{
name
:
'小红'
name
:
'小红'
}
}
}
}
componentWillReceiveProps
(
nextProps
)
{}
componentWillUnmount
()
{}
componentDidShow
()
{}
componentDidHide
()
{}
render
()
{
render
()
{
console
.
log
(
'111111'
)
return
(
return
(
<
View
className=
"
Text1
"
>
<
View
className=
"
DeviceSelect
"
>
<
Text
>
hello world
</
Text
>
<
Text
>
hello world
</
Text
>
</
View
>
</
View
>
)
)
}
}
}
}
export
default
Text1
as
ComponentClass
<
PageOwnProps
,
PageState
>
export
default
DeviceSelect
as
ComponentClass
<
PageOwnProps
,
PageState
>
src/pages/home/device/film_list/index.scss
View file @
0bf20de0
...
@@ -2,34 +2,10 @@
...
@@ -2,34 +2,10 @@
.films
{
.films
{
width
:
100%
;
width
:
100%
;
height
:
10
36px
;
height
:
10
0%
;
background-color
:
$bgColor
;
background-color
:
$bgColor
;
}
}
.films-item-wrapper
{
padding
:
20px
;
display
:
flex
;
margin-bottom
:
40px
;
flex-direction
:
row
;
background-color
:
white
;
}
.img-box
{
width
:
320px
;
}
.films-item-img
{
width
:
100%
;
height
:
180px
;
}
.films-item-info
{
flex
:
1
;
display
:
flex
;
padding-left
:
20px
;
flex-direction
:
column
;
}
.scroll-view
{
.scroll-view
{
height
:
100%
;
height
:
100%
;
}
}
src/pages/home/device/film_list/index.tsx
View file @
0bf20de0
import
api
from
'@/api/index'
import
api
from
'@/api/index'
import
{
ComponentClass
}
from
'react'
import
{
ComponentClass
}
from
'react'
import
{
AtSwipeAction
}
from
'taro-ui'
import
Taro
,
{
Component
}
from
'@tarojs/taro'
import
Taro
,
{
Component
}
from
'@tarojs/taro'
import
{
showMyToast
}
from
'@/common/utils'
import
FilmListItem
from
'@/conpoments/film_list_item'
import
{
View
,
Text
,
ScrollView
,
Image
}
from
'@tarojs/components'
import
{
View
,
Text
,
ScrollView
,
Image
}
from
'@tarojs/components'
import
'./index.scss'
import
'./index.scss'
...
@@ -11,10 +14,17 @@ type PageDispatchProps = {}
...
@@ -11,10 +14,17 @@ type PageDispatchProps = {}
type
PageOwnProps
=
{}
type
PageOwnProps
=
{}
type
PageState
=
{
export
interface
IMilmListItme
{
filmId
:
string
filmName
:
string
templateUrl
:
string
equipmentCount
:
number
}
interface
PageState
{
page
:
number
page
:
number
count
:
number
count
:
number
flimListData
:
any
[]
flimListData
:
IMilmListItme
[]
}
}
type
IProps
=
PageStateProps
&
PageDispatchProps
&
PageOwnProps
type
IProps
=
PageStateProps
&
PageDispatchProps
&
PageOwnProps
...
@@ -35,6 +45,10 @@ class Films extends Component {
...
@@ -35,6 +45,10 @@ class Films extends Component {
}
}
async
componentWillMount
()
{
async
componentWillMount
()
{
this
.
getData
()
}
async
getData
()
{
try
{
try
{
const
{
page
}
=
this
.
state
const
{
page
}
=
this
.
state
const
{
count
,
list
}
=
await
api
.
common
.
getMyFilmsList
(
page
)
const
{
count
,
list
}
=
await
api
.
common
.
getMyFilmsList
(
page
)
...
@@ -53,7 +67,22 @@ class Films extends Component {
...
@@ -53,7 +67,22 @@ class Films extends Component {
return
flimListData
!==
FD
return
flimListData
!==
FD
}
}
goDetail
({
filmId
}:
any
)
{
async
handleItem
({
filmId
}:
IMilmListItme
)
{
Taro
.
showModal
({
content
:
'确定要删除?'
}).
then
(
async
({
confirm
})
=>
{
if
(
confirm
)
{
try
{
await
api
.
common
.
removeFilm
(
filmId
)
this
.
getData
()
showMyToast
({
tips
:
'删除成功~'
})
}
catch
(
error
)
{
console
.
error
(
error
)
showMyToast
({
tips
:
'失败成功~'
})
}
}
})
}
goDetail
({
filmId
}:
IMilmListItme
)
{
Taro
.
navigateTo
({
url
:
`/pages/home/tempaltes/film_detail?filmId=
${
filmId
}
`
})
Taro
.
navigateTo
({
url
:
`/pages/home/tempaltes/film_detail?filmId=
${
filmId
}
`
})
}
}
...
@@ -63,19 +92,21 @@ class Films extends Component {
...
@@ -63,19 +92,21 @@ class Films extends Component {
<
View
className=
"films"
>
<
View
className=
"films"
>
<
ScrollView
className=
"scroll-view"
scrollY
>
<
ScrollView
className=
"scroll-view"
scrollY
>
{
flimListData
.
map
(
item
=>
(
{
flimListData
.
map
(
item
=>
(
<
View
<
AtSwipeAction
className=
"films-item-wrapper"
autoClose
key=
{
item
.
filmId
}
key=
{
item
.
filmId
}
onClick=
{
()
=>
this
.
goDetail
(
item
)
}
onClick=
{
()
=>
this
.
handleItem
(
item
)
}
options=
{
[
{
text
:
'删除'
,
style
:
{
backgroundColor
:
'#FF4949'
}
}
]
}
>
>
<
View
className=
"img-box"
>
<
FilmListItem
onClick=
{
()
=>
this
.
goDetail
(
item
)
}
{
...
item
}
/>
<
Image
className=
"films-item-img"
src=
{
item
.
templateUrl
}
/>
</
AtSwipeAction
>
</
View
>
<
View
className=
"films-item-info"
>
<
Text
>
{
item
.
filmName
}
</
Text
>
<
Text
>
播放设备数量:
{
item
.
equipmentCount
}
</
Text
>
</
View
>
</
View
>
))
}
))
}
</
ScrollView
>
</
ScrollView
>
</
View
>
</
View
>
...
...
src/pages/home/device/index.tsx
View file @
0bf20de0
import
FilmList
from
'./film_list'
import
FilmList
from
'./film_list'
import
MyDevice
from
'./my_device
'
import
DeviceList
from
'./device_list
'
import
{
ComponentClass
}
from
'react'
import
{
ComponentClass
}
from
'react'
import
{
AtTabs
,
AtTabsPane
}
from
'taro-ui'
import
{
AtTabs
,
AtTabsPane
}
from
'taro-ui'
import
Taro
,
{
Component
,
Config
}
from
'@tarojs/taro'
import
Taro
,
{
Component
,
Config
}
from
'@tarojs/taro'
import
'./index.scss'
import
'./index.scss'
import
{
View
}
from
'@tarojs/components'
type
PageStateProps
=
{}
type
PageStateProps
=
{}
...
@@ -14,6 +15,7 @@ type PageOwnProps = {}
...
@@ -14,6 +15,7 @@ type PageOwnProps = {}
type
PageState
=
{
type
PageState
=
{
current
:
number
current
:
number
windowHeight
:
number
}
}
type
IProps
=
PageStateProps
&
PageDispatchProps
&
PageOwnProps
type
IProps
=
PageStateProps
&
PageDispatchProps
&
PageOwnProps
...
@@ -31,8 +33,11 @@ class Device extends Component {
...
@@ -31,8 +33,11 @@ class Device extends Component {
}
}
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
const
{
windowHeight
}
=
Taro
.
getSystemInfoSync
()
this
.
state
=
{
this
.
state
=
{
current
:
1
current
:
1
,
windowHeight
:
windowHeight
-
43
}
}
}
}
...
@@ -41,19 +46,18 @@ class Device extends Component {
...
@@ -41,19 +46,18 @@ class Device extends Component {
}
}
render
()
{
render
()
{
const
{
current
}
=
this
.
state
const
{
current
,
windowHeight
}
=
this
.
state
return
(
return
(
<
AtTabs
<
AtTabs
current=
{
current
}
tabList=
{
tabList
}
onClick=
{
this
.
changePage
}
swipeable=
{
false
}
>
current=
{
current
}
<
AtTabsPane
current=
{
current
}
index=
{
0
}
>
tabList=
{
tabList
}
<
View
style=
{
{
height
:
`${windowHeight}px`
}
}
>
onClick=
{
this
.
changePage
}
<
FilmList
/>
className=
"at-tabs-wrapper"
</
View
>
>
<
AtTabsPane
className=
"at-tabs-page"
current=
{
current
}
index=
{
0
}
>
<
FilmList
/>
</
AtTabsPane
>
</
AtTabsPane
>
<
AtTabsPane
className=
"at-tabs-page"
current=
{
current
}
index=
{
1
}
>
<
AtTabsPane
className=
"at-tabs-page"
current=
{
current
}
index=
{
1
}
>
<
MyDevice
/>
<
View
style=
{
{
height
:
`${windowHeight}px`
}
}
>
<
DeviceList
/>
</
View
>
</
AtTabsPane
>
</
AtTabsPane
>
</
AtTabs
>
</
AtTabs
>
)
)
...
...
src/pages/home/device/my_device/index.tsx
View file @
0bf20de0
import
{
ComponentClass
}
from
'react'
import
{
ComponentClass
}
from
'react'
import
DeviceList
from
'../device_list'
import
DeviceList
from
'../device_list'
import
Taro
,
{
Component
}
from
'@tarojs/taro'
import
Taro
,
{
Component
,
Config
}
from
'@tarojs/taro'
// import { View, Text } from '@tarojs/components'
// import { View, Text } from '@tarojs/components'
import
'./index.scss'
import
'./index.scss'
...
@@ -20,6 +20,9 @@ interface MyDevice {
...
@@ -20,6 +20,9 @@ interface MyDevice {
}
}
class
MyDevice
extends
Component
{
class
MyDevice
extends
Component
{
config
:
Config
=
{
navigationBarTitleText
:
'我的设备'
}
render
()
{
render
()
{
return
<
DeviceList
/>
return
<
DeviceList
/>
}
}
...
...
src/pages/home/tempaltes/index.tsx
View file @
0bf20de0
import
{
ComponentClass
}
from
'react'
import
{
ComponentClass
}
from
'react'
import
TempItem
from
'./conpoments/temp_item/temp_item'
import
Taro
,
{
Component
,
Config
}
from
'@tarojs/taro'
import
Taro
,
{
Component
,
Config
}
from
'@tarojs/taro'
import
PageView
from
'@/constants/components/pageView
'
import
TempItem
from
'./conpoments/temp_item/temp_item
'
import
{
View
,
Text
,
Input
,
ScrollView
,
Image
}
from
'@tarojs/components'
import
{
View
,
Text
,
Input
,
ScrollView
,
Image
}
from
'@tarojs/components'
import
'./scss/index.scss'
import
'./scss/index.scss'
import
api
from
'@/api/index'
import
api
from
'@/api/index'
import
token
from
'@/co
nstants
/token'
import
token
from
'@/co
mmon
/token'
type
PageStateProps
=
{}
type
PageStateProps
=
{}
...
...
src/pages/home/user/index.tsx
View file @
0bf20de0
...
@@ -38,11 +38,15 @@ class User extends Component {
...
@@ -38,11 +38,15 @@ class User extends Component {
}
}
async
getUserInfo
()
{
async
getUserInfo
()
{
if
(
process
.
env
.
TARO_ENV
===
'weapp'
)
{
if
(
process
.
env
.
TARO_ENV
!==
'rn'
)
{
const
{
try
{
userInfo
:
{
avatarUrl
,
nickName
}
const
{
}
=
await
Taro
.
getUserInfo
()
userInfo
:
{
avatarUrl
,
nickName
}
this
.
setState
({
avatarUrl
,
nickName
})
}
=
await
Taro
.
getUserInfo
()
this
.
setState
({
avatarUrl
,
nickName
})
}
catch
(
error
)
{
console
.
error
(
error
)
}
}
}
}
}
...
@@ -66,12 +70,15 @@ class User extends Component {
...
@@ -66,12 +70,15 @@ class User extends Component {
</
View
>
</
View
>
<
View
className=
"item-wrapper"
>
<
View
className=
"item-wrapper"
>
<
View
<
View
onClick=
{
()
=>
this
.
goPage
(
'/pages/home/device/my_film/index'
)
}
className=
"item-view"
className=
"item-view"
onClick=
{
()
=>
this
.
goPage
(
'/pages/home/device/my_film/index'
)
}
>
>
<
Text
>
我的视片
</
Text
>
<
Text
>
我的视片
</
Text
>
</
View
>
</
View
>
<
View
className=
"item-view"
>
<
View
className=
"item-view"
onClick=
{
()
=>
this
.
goPage
(
'/pages/home/device/my_device/index'
)
}
>
<
Text
>
我的设备
</
Text
>
<
Text
>
我的设备
</
Text
>
</
View
>
</
View
>
</
View
>
</
View
>
...
...
src/pages/index/index.tsx
View file @
0bf20de0
...
@@ -2,7 +2,7 @@ import Home from '../home/'
...
@@ -2,7 +2,7 @@ import Home from '../home/'
import
Login
from
'../login'
import
Login
from
'../login'
import
{
ComponentClass
}
from
'react'
import
{
ComponentClass
}
from
'react'
import
{
View
}
from
'@tarojs/components'
import
{
View
}
from
'@tarojs/components'
import
token
from
'../../co
nstants
/token'
import
token
from
'../../co
mmon
/token'
import
Taro
,
{
Component
,
Config
}
from
'@tarojs/taro'
import
Taro
,
{
Component
,
Config
}
from
'@tarojs/taro'
class
Index
extends
Component
{
class
Index
extends
Component
{
...
...
src/pages/login/index.tsx
View file @
0bf20de0
...
@@ -2,9 +2,9 @@ import api from '../../api'
...
@@ -2,9 +2,9 @@ import api from '../../api'
import
{
ComponentClass
}
from
'react'
import
{
ComponentClass
}
from
'react'
import
{
CheckBox
}
from
'react-native'
import
{
CheckBox
}
from
'react-native'
import
{
connect
}
from
'@tarojs/redux'
import
{
connect
}
from
'@tarojs/redux'
import
token
from
'../../co
nstants
/token'
import
token
from
'../../co
mmon
/token'
import
{
HONE
}
from
'../../constants/router'
import
{
HONE
}
from
'../../constants/router'
import
{
checkPhone
,
myShowToast
}
from
'../../constants
/utils'
import
{
checkPhone
,
showMyToast
}
from
'../../common
/utils'
import
Taro
,
{
Component
,
Config
}
from
'@tarojs/taro'
import
Taro
,
{
Component
,
Config
}
from
'@tarojs/taro'
import
{
View
,
Text
,
Input
,
Button
,
Checkbox
,
Label
}
from
'@tarojs/components'
import
{
View
,
Text
,
Input
,
Button
,
Checkbox
,
Label
}
from
'@tarojs/components'
...
@@ -83,7 +83,7 @@ class Login extends Component {
...
@@ -83,7 +83,7 @@ class Login extends Component {
},
1000
)
},
1000
)
}
catch
(
error
)
{
}
catch
(
error
)
{
// console.warn('获取验证码失败~', error)
// console.warn('获取验证码失败~', error)
myShow
Toast
({
result
:
error
,
tips
:
'获取验证码失败~'
})
showMy
Toast
({
result
:
error
,
tips
:
'获取验证码失败~'
})
}
}
// Taro.hideLoading()
// Taro.hideLoading()
}
}
...
@@ -102,7 +102,7 @@ class Login extends Component {
...
@@ -102,7 +102,7 @@ class Login extends Component {
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
// console.warn('用户登录出错~', error)
// console.warn('用户登录出错~', error)
myShow
Toast
({
result
:
error
,
tips
:
'用户登录出错~'
})
showMy
Toast
({
result
:
error
,
tips
:
'用户登录出错~'
})
}
}
}
}
...
...
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