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
9005e0d1
authored
Dec 16, 2019
by
hank
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页点击loading
parent
575ae6c1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
12 deletions
+60
-12
src/common/index.ts
+4
-4
src/common/utils.ts
+33
-0
src/pages/home/tempaltes/conpoments/temp_item/index.tsx
+22
-8
src/reducers/counter.ts
+1
-0
No files found.
src/common/index.ts
View file @
9005e0d1
export
const
FETCH_TIME_OUT
=
5000
export
const
FETCH_TIME_OUT
=
5000
export
const
BASE_URL
=
'https://server.bdideal.com'
//
export const BASE_URL = 'https://server.bdideal.com'
export
const
WEBVIEW_URL
=
'https://visual.bdideal.com'
//
export const WEBVIEW_URL = 'https://visual.bdideal.com'
//
export const BASE_URL = 'https://dev-server.bdideal.com'
export
const
BASE_URL
=
'https://dev-server.bdideal.com'
//
export const WEBVIEW_URL = 'https://dev-visual.bdideal.com'
export
const
WEBVIEW_URL
=
'https://dev-visual.bdideal.com'
// export const WEBVIEW_URL = 'http://127.0.0.1:8080'
// export const WEBVIEW_URL = 'http://127.0.0.1:8080'
/** 蓝牙的服务 uuid */
/** 蓝牙的服务 uuid */
...
...
src/common/utils.ts
View file @
9005e0d1
...
@@ -50,6 +50,39 @@ export function concatParam(data: any): string {
...
@@ -50,6 +50,39 @@ export function concatParam(data: any): string {
.
join
(
'&'
)
.
join
(
'&'
)
}
}
export
function
formatTime
(
date
)
{
const
just
=
1000
*
60
*
3
const
minute
=
1000
*
60
const
hour
=
1000
*
60
*
60
const
day
=
hour
*
24
const
month
=
day
*
30
const
year
=
day
*
365
console
.
log
(
typeof
date
)
if
(
typeof
date
===
'string'
)
{
date
=
date
.
replace
(
'-'
,
'/'
)
}
let
times
=
new
Date
(
date
).
getTime
()
const
now
=
new
Date
().
getTime
()
const
value
=
now
-
times
console
.
log
(
times
,
now
,
value
,
just
,
0
<=
value
&&
value
<=
just
)
if
(
0
<=
value
&&
value
<=
just
)
{
return
'刚刚'
}
else
if
(
just
<
value
&&
value
<
hour
)
{
return
Math
.
trunc
(
value
/
minute
)
+
'分钟前'
}
else
if
(
hour
<
value
&&
value
<
day
)
{
return
Math
.
trunc
(
value
/
hour
)
+
'小时前'
}
else
if
(
day
<
value
&&
value
<
month
)
{
return
Math
.
trunc
(
value
/
day
)
+
'天前'
}
else
if
(
month
<
value
&&
value
<
year
)
{
return
Math
.
trunc
(
value
/
month
)
+
'月前'
}
else
if
(
year
<
value
)
{
return
Math
.
trunc
(
value
/
year
)
+
'年前'
}
else
{
return
'未来'
}
}
export
const
MyStorage
=
{
export
const
MyStorage
=
{
async
getItem
({
key
})
{
async
getItem
({
key
})
{
if
(
process
.
env
.
TARO_ENV
===
'rn'
)
{
if
(
process
.
env
.
TARO_ENV
===
'rn'
)
{
...
...
src/pages/home/tempaltes/conpoments/temp_item/index.tsx
View file @
9005e0d1
...
@@ -3,7 +3,7 @@ import { ComponentClass } from 'react'
...
@@ -3,7 +3,7 @@ import { ComponentClass } from 'react'
import
Taro
,
{
Component
}
from
'@tarojs/taro'
import
Taro
,
{
Component
}
from
'@tarojs/taro'
import
{
ITempItem
}
from
'@/reducers/counter'
import
{
ITempItem
}
from
'@/reducers/counter'
import
{
View
,
Text
,
Image
}
from
'@tarojs/components'
import
{
View
,
Text
,
Image
}
from
'@tarojs/components'
import
{
formatTime
}
from
'@/common/utils'
import
'./index.scss'
import
'./index.scss'
import
api
from
'@/api/index'
import
api
from
'@/api/index'
...
@@ -25,15 +25,26 @@ class TempItem extends Component {
...
@@ -25,15 +25,26 @@ class TempItem extends Component {
this
.
isload
=
true
this
.
isload
=
true
if
(
filmId
)
{
if
(
filmId
)
{
Taro
.
navigateTo
({
url
:
`/pages/home/tempaltes/film_detail?filmId=
${
filmId
}
`
})
Taro
.
navigateTo
({
url
:
`/pages/home/tempaltes/film_detail?filmId=
${
filmId
}
`
})
this
.
isload
=
false
// Taro.navigateTo({ url: `/pages/home/device/my_film/index` })
// Taro.navigateTo({ url: `/pages/home/device/my_film/index` })
}
else
{
}
else
{
api
.
tempalte
.
getTempalteFilmCount
(
templateId
).
then
(
res
=>
{
Taro
.
showLoading
({
if
(
res
.
data
===
0
)
{
title
:
'加载中'
,
Taro
.
navigateTo
({
url
:
`/pages/home/tempaltes/film_detail?templateId=
${
templateId
}
`
})
mask
:
true
}
else
{
Taro
.
navigateTo
({
url
:
`/pages/home/tempaltes/detail?templateId=
${
templateId
}
`
})
}
})
})
api
.
tempalte
.
getTempalteFilmCount
(
templateId
)
.
then
(
res
=>
{
if
(
res
.
data
===
0
)
{
Taro
.
navigateTo
({
url
:
`/pages/home/tempaltes/film_detail?templateId=
${
templateId
}
`
})
}
else
{
Taro
.
navigateTo
({
url
:
`/pages/home/tempaltes/detail?templateId=
${
templateId
}
`
})
}
Taro
.
hideLoading
()
})
.
catch
(()
=>
{
Taro
.
hideLoading
()
})
}
}
}
else
{
}
else
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -49,6 +60,7 @@ class TempItem extends Component {
...
@@ -49,6 +60,7 @@ class TempItem extends Component {
templateUrl
:
url
,
templateUrl
:
url
,
filmName
,
filmName
,
equipmentCount
,
equipmentCount
,
updateTime
,
templateShow
,
templateShow
,
filmCount
,
filmCount
,
templateEnvironment
templateEnvironment
...
@@ -64,7 +76,9 @@ class TempItem extends Component {
...
@@ -64,7 +76,9 @@ class TempItem extends Component {
src=
{
url
.
split
(
','
)[
0
]
}
src=
{
url
.
split
(
','
)[
0
]
}
/>
/>
<
View
className=
"temp-name-container"
>
<
View
className=
"temp-name-container"
>
<
Text
className=
"temp-name"
>
{
templateName
||
filmName
}
</
Text
>
<
Text
className=
"temp-name"
>
{
templateName
||
filmName
+
(
' 创建于'
+
formatTime
(
updateTime
))
}
</
Text
>
{
templateName
!==
undefined
?
<
Text
className=
"temp-film-count"
>
{
filmCount
}
</
Text
>
:
null
}
{
templateName
!==
undefined
?
<
Text
className=
"temp-film-count"
>
{
filmCount
}
</
Text
>
:
null
}
</
View
>
</
View
>
{
/* {equipmentCount !== undefined ? (
{
/* {equipmentCount !== undefined ? (
...
...
src/reducers/counter.ts
View file @
9005e0d1
...
@@ -9,6 +9,7 @@ export interface ITempItem {
...
@@ -9,6 +9,7 @@ export interface ITempItem {
equipmentCount
?:
number
equipmentCount
?:
number
filmCount
?:
number
filmCount
?:
number
templateShow
?:
string
templateShow
?:
string
updateTime
?:
string
templateEnvironment
?:
string
templateEnvironment
?:
string
clickItem
?:
()
=>
void
clickItem
?:
()
=>
void
}
}
...
...
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