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
16dc8f30
authored
Aug 20, 2019
by
lirandong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'weapp' into rn
parents
80b31e2e
63e1dcf2
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
62 additions
and
36 deletions
+62
-36
src/assets/styles/mixins.scss
+1
-1
src/common/utils.ts
+13
-5
src/conpoments/modal/index.scss
+2
-1
src/pages/home/device/add/index.tsx
+2
-2
src/pages/home/device/device_bind/index.tsx
+2
-2
src/pages/home/device/device_list/index.tsx
+7
-7
src/pages/home/device/film_list/index.tsx
+2
-2
src/pages/home/tempaltes/conpoments/temp_item/index.scss
+3
-3
src/pages/home/tempaltes/conpoments/temp_item/temp_item.tsx
+2
-1
src/pages/home/tempaltes/detail.tsx
+16
-5
src/pages/home/tempaltes/film_detail.tsx
+1
-0
src/pages/home/tempaltes/scss/detail.scss
+7
-1
src/pages/home/tempaltes/scss/index.scss
+2
-3
src/pages/login/index.tsx
+2
-2
src/reducers/counter.ts
+0
-1
No files found.
src/assets/styles/mixins.scss
View file @
16dc8f30
...
...
@@ -28,7 +28,7 @@
/* rn 特定样式 */
@mixin
rn
(
$attr
,
$value
)
{
/* #ifdef
%RN%
*/
/* #ifdef
rn
*/
#{
$attr
}
:
$
value
;
/* #endif */
...
...
src/common/utils.ts
View file @
16dc8f30
import
Taro
from
'@tarojs/taro'
import
{
Header
}
from
'react-navigation'
import
AsyncStorage
from
'@react-native-community/async-storage'
/** 连接参数 */
...
...
@@ -31,11 +32,18 @@ export function checkPhone(phone) {
return
/^1
[
3456789
]\d{9}
$/
.
test
(
phone
.
toString
())
}
export
function
showMyToast
({
result
,
ti
ps
}:
{
result
?:
any
;
tips
?:
string
})
{
if
(
!
result
&&
!
ti
ps
)
return
Taro
.
showToast
({
icon
:
'none'
,
title
:
result
&&
result
.
msg
?
result
.
msg
:
ti
ps
})
export
function
showMyToast
({
result
,
ti
tle
}:
{
result
?:
any
;
title
?:
string
})
{
if
(
!
result
&&
!
ti
tle
)
return
Taro
.
showToast
({
icon
:
'none'
,
title
:
result
&&
result
.
msg
?
result
.
msg
:
ti
tle
})
}
export
function
getStatusBarHeight
()
{
return
Taro
.
getSystemInfoSync
().
statusBarHeight
+
46
// export function getStatusBarHeight() {
// return Taro.getSystemInfoSync().statusBarHeight + 46
// }
/** 获取屏幕可用高度 */
export
function
getWindiwHeight
()
{
const
{
windowHeight
}
=
Taro
.
getSystemInfoSync
()
const
HeaderHeight
=
process
.
env
.
TARO_ENV
===
'rn'
?
Header
.
HEIGHT
:
0
return
windowHeight
-
HeaderHeight
}
src/conpoments/modal/index.scss
View file @
16dc8f30
...
...
@@ -13,13 +13,14 @@
&
-wrapper
{
width
:
580px
;
// height: 600px;
display
:
flex
;
margin-top
:
-50px
;
padding-top
:
36px
;
border-radius
:
8px
;
flex-direction
:
column
;
background-color
:
white
;
// height: auto;
@include
rn
(
height
,
600px
);
}
&
-title
{
...
...
src/pages/home/device/add/index.tsx
View file @
16dc8f30
...
...
@@ -44,10 +44,10 @@ class AddDevicePIN extends Component {
if
(
!
PIN
)
return
try
{
await
api
.
common
.
addDevicePIN
(
PIN
)
showMyToast
({
ti
ps
:
'添加成功~'
})
showMyToast
({
ti
tle
:
'添加成功~'
})
// console.log({ res })
}
catch
(
error
)
{
showMyToast
({
result
:
error
,
ti
ps
:
'添加失败~'
})
showMyToast
({
result
:
error
,
ti
tle
:
'添加失败~'
})
console
.
error
(
error
)
}
}
...
...
src/pages/home/device/device_bind/index.tsx
View file @
16dc8f30
...
...
@@ -90,11 +90,11 @@ class DeviceSelect extends Component {
if
(
!
filmId
)
return
try
{
await
api
.
common
.
updateEquipmentBinding
([...
checked
],
filmId
)
showMyToast
({
ti
ps
:
'修改成功~'
})
showMyToast
({
ti
tle
:
'修改成功~'
})
Taro
.
navigateBack
()
}
catch
(
error
)
{
console
.
error
(
error
)
showMyToast
({
ti
ps
:
'修改失败~'
})
showMyToast
({
ti
tle
:
'修改失败~'
})
}
}
...
...
src/pages/home/device/device_list/index.tsx
View file @
16dc8f30
...
...
@@ -116,10 +116,10 @@ class MyDevice extends Component {
try
{
await
api
.
common
.
removeDevice
(
equipmentId
)
this
.
getDate
()
showMyToast
({
ti
ps
:
'删除成功~'
})
showMyToast
({
ti
tle
:
'删除成功~'
})
}
catch
(
error
)
{
console
.
error
(
error
)
showMyToast
({
result
:
error
,
ti
ps
:
'失败成功~'
})
showMyToast
({
result
:
error
,
ti
tle
:
'失败成功~'
})
}
}
})
...
...
@@ -137,10 +137,10 @@ class MyDevice extends Component {
// })
// await this.bluetooth(result)
// await api.common.addDeviceToken(result)
// showMyToast({ ti
ps
: '添加成功~' })
// showMyToast({ ti
tle
: '添加成功~' })
// this.getDate()
}
catch
(
error
)
{
showMyToast
({
result
:
error
,
ti
ps
:
'添加失败~'
})
showMyToast
({
result
:
error
,
ti
tle
:
'添加失败~'
})
console
.
error
(
error
)
}
}
...
...
@@ -160,7 +160,7 @@ class MyDevice extends Component {
const
{
deviceId
}
=
item
await
Taro
.
createBLEConnection
({
deviceId
})
Taro
.
stopBluetoothDevicesDiscovery
()
showMyToast
({
ti
ps
:
'蓝牙连接成功~'
})
showMyToast
({
ti
tle
:
'蓝牙连接成功~'
})
Taro
.
showLoading
({
title
:
'获取蓝牙参数...'
})
const
{
services
}
=
await
Taro
.
getBLEDeviceServices
({
deviceId
})
// 获取服务列表
...
...
@@ -182,7 +182,7 @@ class MyDevice extends Component {
await
Taro
.
readBLECharacteristicValue
({
deviceId
,
serviceId
,
characteristicId
})
// setTimeout(async () => {
// Taro.closeBLEConnection({ deviceId })
// showMyToast({ ti
ps
: '连接已断开~' })
// showMyToast({ ti
tle
: '连接已断开~' })
// }, 10000)
}
}
...
...
@@ -194,7 +194,7 @@ class MyDevice extends Component {
Taro
.
stopBluetoothDevicesDiscovery
()
const
{
errCode
}
=
error
if
(
errCode
===
10001
)
{
showMyToast
({
ti
ps
:
'请打开手机蓝牙~'
})
showMyToast
({
ti
tle
:
'请打开手机蓝牙~'
})
}
}
}
...
...
src/pages/home/device/film_list/index.tsx
View file @
16dc8f30
...
...
@@ -76,10 +76,10 @@ class Films extends Component {
try
{
await
api
.
common
.
removeFilm
(
filmId
)
this
.
getData
()
showMyToast
({
ti
ps
:
'删除成功~'
})
showMyToast
({
ti
tle
:
'删除成功~'
})
}
catch
(
error
)
{
console
.
error
(
error
)
showMyToast
({
ti
ps
:
'失败成功~'
})
showMyToast
({
ti
tle
:
'失败成功~'
})
}
}
})
...
...
src/pages/home/tempaltes/conpoments/temp_item/index.scss
View file @
16dc8f30
...
...
@@ -14,13 +14,13 @@
}
.temp-name
{
@include
eject
(
display
,
block
);
@include
eject
(
box-sizing
,
border-box
);
width
:
100%
;
font-size
:
28px
;
padding-top
:
10px
;
background-color
:
white
;
@include
eject
(
display
,
block
);
@include
eject
(
box-sizing
,
border-box
);
}
.equipment-count
{
...
...
src/pages/home/tempaltes/conpoments/temp_item/temp_item.tsx
View file @
16dc8f30
...
...
@@ -14,14 +14,15 @@ interface PageOwnProps {}
interface
TempItem
{
props
:
IProps
state
:
PageState
// "navigateTo:fail page "pages/home/tempaltes/pages/home/tempaltes/detail?templateId=%5Bobject%20Object%5D&__key_=15656132800593" is not found"
}
class
TempItem
extends
Component
{
goDetail
=
()
=>
{
const
{
templateId
,
filmId
}
=
this
.
props
// Taro.navigateTo({ url: '/pages/home/device/my_film/index' })
if
(
filmId
)
{
Taro
.
navigateTo
({
url
:
`/pages/home/tempaltes/film_detail?filmId=
${
filmId
}
`
})
// Taro.navigateTo({ url: `/pages/home/device/my_film/index` })
}
else
{
Taro
.
navigateTo
({
url
:
`/pages/home/tempaltes/detail?templateId=
${
templateId
}
`
})
}
...
...
src/pages/home/tempaltes/detail.tsx
View file @
16dc8f30
...
...
@@ -7,7 +7,10 @@ import { ComponentClass } from 'react'
import
Taro
,
{
Component
,
Config
}
from
'@tarojs/taro'
import
{
View
,
Text
,
ScrollView
,
Button
,
Input
}
from
'@tarojs/components'
import
{
Header
}
from
'react-navigation'
import
'./scss/detail.scss'
import
{
getWindiwHeight
,
showMyToast
}
from
'@/common/utils'
type
PageOwnProps
=
{}
export
interface
IDetailData
{
...
...
@@ -28,6 +31,7 @@ type PageState = {
showModal
:
boolean
templateId
:
string
filmDataList
:
any
[]
windowHeight
:
number
createFilmName
:
string
createFilmDescribe
:
string
}
...
...
@@ -52,12 +56,14 @@ class TempDetail extends Component {
showModal
:
false
,
filmDataList
:
[],
createFilmName
:
''
,
createFilmDescribe
:
''
createFilmDescribe
:
''
,
windowHeight
:
getWindiwHeight
()
}
}
componentWillMount
()
{
this
.
getData
()
// console.log('object', Taro.get)
}
async
getData
()
{
...
...
@@ -89,13 +95,17 @@ class TempDetail extends Component {
inputConfirm
=
async
()
=>
{
const
{
createFilmDescribe
,
createFilmName
,
templateId
}
=
this
.
state
if
(
!
createFilmName
)
{
showMyToast
({
title
:
'视片名称不能为空~'
})
return
}
try
{
await
api
.
common
.
createFilm
(
createFilmDescribe
,
createFilmName
,
templateId
)
this
.
getData
()
this
.
cancelModal
()
Taro
.
showToast
({
title
:
'创建成功'
,
icon
:
'none
'
})
showMyToast
({
title
:
'创建成功
'
})
}
catch
(
error
)
{
Taro
.
showToast
({
title
:
'创建失败'
,
icon
:
'none
'
})
showMyToast
({
title
:
'创建失败
'
})
}
}
...
...
@@ -116,9 +126,10 @@ class TempDetail extends Component {
}
render
()
{
const
{
detailData
,
filmDataList
,
showModal
}
=
this
.
state
const
{
detailData
,
filmDataList
,
showModal
,
windowHeight
}
=
this
.
state
return
(
<
View
className=
"temp-detail"
>
<
View
className=
"temp-detail"
style=
{
{
height
:
windowHeight
}
}
>
<
View
className=
"temp-detail-scroll"
>
<
ScrollView
scrollY
className=
"temp-detail-scroll-view"
>
<
DetailTop
{
...
detailData
}
/>
...
...
src/pages/home/tempaltes/film_detail.tsx
View file @
16dc8f30
...
...
@@ -69,6 +69,7 @@ class FilmDetail extends Component {
}
chengDevice
()
{
console
.
log
(
'chengDevice'
)
const
{
filmId
}
=
this
.
state
const
url
=
`/pages/home/device/device_bind/index?filmId=
${
filmId
}
`
Taro
.
navigateTo
({
url
})
...
...
src/pages/home/tempaltes/scss/detail.scss
View file @
16dc8f30
...
...
@@ -2,14 +2,15 @@
.temp-detail
{
width
:
100%
;
height
:
100%
;
display
:
flex
;
position
:
relative
;
flex-direction
:
column
;
background-color
:
white
;
&
-scroll
{
flex
:
1
;
overflow
:
hidden
;
padding-bottom
:
90px
;
&
-view
{
height
:
100%
;
...
...
@@ -28,13 +29,18 @@
&
-content
{
display
:
flex
;
flex-wrap
:
wrap
;
flex-direction
:
row
;
justify-content
:
space-between
;
}
}
&
-bottom-btn
{
left
:
0
;
bottom
:
0
;
width
:
100%
;
height
:
90px
;
border-radius
:
0
;
position
:
absolute
;
background-color
:
$primary-color
;
}
}
...
...
src/pages/home/tempaltes/scss/index.scss
View file @
16dc8f30
...
...
@@ -34,15 +34,14 @@
&
-scroll
{
width
:
100%
;
height
:
100%
;
padding-top
:
20px
;
padding-left
:
20px
;
padding-right
:
20px
;
padding
:
20px
20px
0
;
@include
eject
(
box-sizing
,
border-box
);
&
-list
{
display
:
flex
;
flex-wrap
:
wrap
;
flex-direction
:
row
;
justify-content
:
space-between
;
}
}
...
...
src/pages/login/index.tsx
View file @
16dc8f30
...
...
@@ -83,7 +83,7 @@ class Login extends Component {
},
1000
)
}
catch
(
error
)
{
// console.warn('获取验证码失败~', error)
showMyToast
({
result
:
error
,
ti
ps
:
'获取验证码失败~'
})
showMyToast
({
result
:
error
,
ti
tle
:
'获取验证码失败~'
})
}
// Taro.hideLoading()
}
...
...
@@ -102,7 +102,7 @@ class Login extends Component {
}
}
catch
(
error
)
{
// console.warn('用户登录出错~', error)
showMyToast
({
result
:
error
,
ti
ps
:
'用户登录出错~'
})
showMyToast
({
result
:
error
,
ti
tle
:
'用户登录出错~'
})
}
}
...
...
src/reducers/counter.ts
View file @
16dc8f30
import
{
ADD_TEMP_LIST
,
ADD_FILM_LIST
,
ADD_DEVICE_LIST
}
from
'../constants/counter'
import
{
number
}
from
'prop-types'
export
interface
ITempItem
{
filmId
:
string
...
...
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