Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wx-program
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈玉桐
wx-program
Commits
5e5b7bc2
Commit
5e5b7bc2
authored
Oct 15, 2019
by
陈玉桐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
未绑定设备不刷新图片
parent
72295a2e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
125 additions
and
110 deletions
+125
-110
index.js
pages/index/index.js
+113
-108
index.wxml
pages/index/index.wxml
+3
-2
index.wxss
pages/index/index.wxss
+9
-0
No files found.
pages/index/index.js
View file @
5e5b7bc2
...
...
@@ -508,112 +508,116 @@ Page({
gender
:
'../../assets/icon_boy.png'
})
}
console
.
log
(
res
.
data
.
data
.
bindDeviceStatus
)
// 未绑定设备不刷新图片
if
(
res
.
data
.
data
.
bindDeviceStatus
==
1
){
//获取当前时间戳
var
timestamp
=
Date
.
parse
(
new
Date
());
timestamp
=
timestamp
/
1000
;
//获取当前时间戳
var
timestamp
=
Date
.
parse
(
new
Date
());
timestamp
=
timestamp
/
1000
;
wx
.
request
({
url
:
app
.
globalData
.
apiUrl
+
'devices/watchingPic'
,
method
:
'POST'
,
data
:
{
token
:
wx
.
getStorageSync
(
'token'
),
nowTime
:
timestamp
// 当前时间戳,服务端会获取大于当前时间戳的图片信息
},
success
:
function
(
res
)
{
// 请求成功后关闭Loading
wx
.
hideLoading
();
if
(
res
.
data
.
errno
==
200
){
if
(
res
.
data
.
data
){
me
.
setData
({
trainingStatus
:
res
.
data
.
data
.
trainingStatus
,
//训练状态 1正在训练 0:未训练
checkImg
:
res
.
data
.
data
.
thumb
,
trainingTime
:
0
})
}
else
{
// 加载中
me
.
setData
({
trainingStatus
:
2
,
//训练状态 1正在训练 0:未训练
checkImg
:
'../../assets/indexDefault.png'
})
let
times
=
1
let
indexTimer
=
setInterval
(
function
(){
// console.log(timestamp)
times
++
console
.
log
(
times
)
if
(
times
>
4
){
me
.
setData
({
watchImgText
:
'正在加载,马上就好了...'
,
})
}
else
{
me
.
setData
({
watchImgText
:
'加载中'
,
})
}
if
(
times
>
16
){
clearInterval
(
indexTimer
)
// 获取失败
me
.
setData
({
trainingStatus
:
4
,
//1正在训练 0:未训练 2加载中 3未在线 4获取失败
checkImg
:
'../../assets/indexDefault.png'
})
wx
.
showModal
({
title
:
'提示'
,
showCancel
:
false
,
content
:
'监控画面加载失败,请您手动刷新'
})
}
wx
.
request
({
url
:
app
.
globalData
.
apiUrl
+
'devices/watchingPic'
,
method
:
'POST'
,
data
:
{
token
:
wx
.
getStorageSync
(
'token'
),
nowTime
:
timestamp
// 当前时间戳,服务端会获取大于当前时间戳的图片信息
},
success
:
function
(
res
)
{
if
(
res
.
data
.
errno
==
200
){
if
(
res
.
data
.
data
){
wx
.
request
({
url
:
app
.
globalData
.
apiUrl
+
'devices/watchingPic'
,
method
:
'POST'
,
data
:
{
token
:
wx
.
getStorageSync
(
'token'
),
nowTime
:
timestamp
// 当前时间戳,服务端会获取大于当前时间戳的图片信息
},
success
:
function
(
res
)
{
// 请求成功后关闭Loading
wx
.
hideLoading
();
if
(
res
.
data
.
errno
==
200
){
if
(
res
.
data
.
data
){
me
.
setData
({
trainingStatus
:
res
.
data
.
data
.
trainingStatus
,
//训练状态 1正在训练 0:未训练
checkImg
:
res
.
data
.
data
.
thumb
,
trainingTime
:
0
})
}
else
{
// 加载中
me
.
setData
({
trainingStatus
:
2
,
//训练状态 1正在训练 0:未训练
checkImg
:
'../../assets/indexDefault.png'
})
let
times
=
1
let
indexTimer
=
setInterval
(
function
(){
// console.log(timestamp)
times
++
console
.
log
(
times
)
if
(
times
>
4
){
me
.
setData
({
watchImgText
:
'正在加载,马上就好了...'
,
})
}
else
{
me
.
setData
({
watchImgText
:
'加载中'
,
})
}
if
(
times
>
16
){
clearInterval
(
indexTimer
)
// 获取失败
me
.
setData
({
trainingStatus
:
4
,
//1正在训练 0:未训练 2加载中 3未在线 4获取失败
checkImg
:
'../../assets/indexDefault.png'
})
wx
.
showModal
({
title
:
'提示'
,
showCancel
:
false
,
content
:
'监控画面加载失败,请您手动刷新'
})
}
wx
.
request
({
url
:
app
.
globalData
.
apiUrl
+
'devices/watchingPic'
,
method
:
'POST'
,
data
:
{
token
:
wx
.
getStorageSync
(
'token'
),
nowTime
:
timestamp
// 当前时间戳,服务端会获取大于当前时间戳的图片信息
},
success
:
function
(
res
)
{
if
(
res
.
data
.
errno
==
200
){
if
(
res
.
data
.
data
){
me
.
setData
({
trainingStatus
:
res
.
data
.
data
.
trainingStatus
,
//训练状态 1正在训练 0:未训练
checkImg
:
res
.
data
.
data
.
thumb
,
trainingTime
:
res
.
data
.
data
.
nowTrainingDuration
})
clearInterval
(
indexTimer
)
}
}
else
{
// wx.showModal({
// title: '提示',
// showCancel: false,
// content: res.data.msg
// })
// 设备未在线
me
.
setData
({
trainingStatus
:
res
.
data
.
data
.
trainingStatus
,
//训练状态 1正在训练 0:未训练
checkImg
:
res
.
data
.
data
.
thumb
,
trainingTime
:
res
.
data
.
data
.
nowTrainingDuration
trainingStatus
:
3
,
//训练状态 1正在训练 0:未训练
checkImg
:
'../../assets/indexDefault.png'
})
clearInterval
(
indexTimer
)
}
}
else
{
// wx.showModal({
// title: '提示',
// showCancel: false,
// content: res.data.msg
// })
// 设备未在线
me
.
setData
({
trainingStatus
:
3
,
//训练状态 1正在训练 0:未训练
checkImg
:
'../../assets/indexDefault.png'
})
clearInterval
(
indexTimer
)
}
}
})
},
1000
)
me
.
setData
({
indexTimer
:
indexTimer
})
},
1000
)
}
}
else
{
// wx.showModal({
// title: '提示',
// showCancel: false,
// content: res.data.msg
// })
// 设备未在线
me
.
setData
({
indexTimer
:
indexTimer
trainingStatus
:
3
,
//训练状态 1正在训练 0:未训练
checkImg
:
'../../assets/indexDefault.png'
})
}
}
else
{
// wx.showModal({
// title: '提示',
// showCancel: false,
// content: res.data.msg
// })
// 设备未在线
me
.
setData
({
trainingStatus
:
3
,
//训练状态 1正在训练 0:未训练
checkImg
:
'../../assets/indexDefault.png'
})
}
}
})
})
}
me
.
setData
({
imgUrls
:
res
.
data
.
data
.
focusMap
,
...
...
@@ -1084,17 +1088,17 @@ Page({
url
:
'/pages/out/out?url='
+
e
.
currentTarget
.
dataset
.
url
})
},
onReachBottom
()
{
// 上拉触底
let
me
=
this
console
.
log
(
'上拉触底'
)
me
.
setData
({
isLoading
:
true
})
setTimeout
(
function
(){
me
.
setData
({
isLoading
:
false
})
},
1000
)
}
//
onReachBottom() {
//
// 上拉触底
//
let me = this
//
console.log('上拉触底')
//
me.setData({
//
isLoading: true
//
})
//
setTimeout(function(){
//
me.setData({
//
isLoading: false
//
})
//
},1000)
//
}
})
\ No newline at end of file
pages/index/index.wxml
View file @
5e5b7bc2
...
...
@@ -48,7 +48,8 @@
<!-- 监控 -->
<view class="checkCon">
<view class="checkDes">
<text id="trainTime" wx:if="{{trainingStatus==2 || trainingStatus==5}}">{{watchImgText}}</text>
<text id="trainTime" wx:if="{{bindDeviceStatus==0}}">设备未绑定</text>
<text id="trainTime" wx:elif="{{trainingStatus==2 || trainingStatus==5}}">{{watchImgText}}</text>
<text id="trainTime" wx:elif="{{trainingStatus==3}}">设备未在线</text>
<text id="trainTime" wx:elif="{{trainingStatus==4}}">监控画面加载失败,请您手动刷新</text>
<text id="trainTime" wx:else>设备使用中,今日已训练{{trainingTime}}分钟</text>
...
...
@@ -244,7 +245,7 @@
</view>
</view>
<view id="indexBottom"></view>
<
view id="indexBottomText" hidden="{{!isLoading}}">底下没有了~</view
>
<
!-- <view id="indexBottomText" hidden="{{!isLoading}}">底下没有了~</view> --
>
<!-- 更新训练计划弹窗 -->
<view id="mustUpdate" catchtouchmove="preventTouchMove" hidden="{{mustUpdate}}">
...
...
pages/index/index.wxss
View file @
5e5b7bc2
...
...
@@ -8,6 +8,9 @@
height: 230rpx;
background-color: #e6ece5;
}
page{
background: #e6ece5;
}
/* .swiperCon{
border-radius:20rpx;
} */
...
...
@@ -106,6 +109,7 @@
}
#userBox{
background-color: #fff;
display: flex;
position: relative;
padding: 10rpx 0 10rpx 50rpx;
...
...
@@ -154,6 +158,7 @@
/* 训练计划按钮 */
#userBtnBox{
background-color: #fff;
padding: 30rpx 20rpx;
display: flex;
justify-content: space-between;
...
...
@@ -168,6 +173,7 @@
/* 监控 */
.checkCon{
background-color: #fff;
padding: 30rpx 20rpx;
}
.checkDes{
...
...
@@ -275,6 +281,7 @@
/* 训练报告 */
.report{
background-color: #fff;
padding: 0 25rpx;
}
.reportTitle{
...
...
@@ -392,6 +399,7 @@
#trainSort,#resultSort{
color: #666;
font-size: 32rpx;
background-color: #fff;
}
.trainSortTitle,.resultSortTitle{
display: flex;
...
...
@@ -464,6 +472,7 @@
#achieve{
color: #555;
padding: 0 20rpx;
background-color: #fff;
}
.achieveTitle{
display: flex;
...
...
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