Commit 7dd0edf6 by 陈玉桐

add 所有页面

parent eb6149a6
{ {
"pages": [ "pages": [
"pages/index/index",
"pages/historyDetail/historyDetail",
"pages/user/user",
"pages/mine/mine", "pages/mine/mine",
"pages/idea/idea", "pages/idea/idea",
"pages/index/index", "pages/message/message",
"pages/childInfo/childInfo",
"pages/getCodeIndex/getCodeIndex",
"pages/login/login",
"pages/setting/setting",
"pages/ruleSet/ruleSet",
"pages/mustUpdate/mustUpdate",
"pages/bindEquipment/bindEquipment",
"pages/targetList/targetList",
"pages/updatePlan/updatePlan", "pages/updatePlan/updatePlan",
"pages/plan/plan", "pages/plan/plan",
"pages/historyDetail/historyDetail", "pages/trainReport/trainReport",
"pages/trainHistory/trainHistory", "pages/starSort/starSort",
"pages/trainSort/trainSort",
"pages/eyesight/eyesight", "pages/eyesight/eyesight",
"pages/whiteList/whiteList" "pages/setting/setting",
"pages/whiteList/whiteList",
"pages/childInfo/childInfo",
"pages/targetList/targetList"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
......
assets/arrow_down.png

4.19 KB | W: | H:

assets/arrow_down.png

264 Bytes | W: | H:

assets/arrow_down.png
assets/arrow_down.png
assets/arrow_down.png
assets/arrow_down.png
  • 2-up
  • Swipe
  • Onion skin
assets/gameIcon.png

1.5 KB | W: | H:

assets/gameIcon.png

412 Bytes | W: | H:

assets/gameIcon.png
assets/gameIcon.png
assets/gameIcon.png
assets/gameIcon.png
  • 2-up
  • Swipe
  • Onion skin
assets/happyIcon.png

430 Bytes | W: | H:

assets/happyIcon.png

488 Bytes | W: | H:

assets/happyIcon.png
assets/happyIcon.png
assets/happyIcon.png
assets/happyIcon.png
  • 2-up
  • Swipe
  • Onion skin
assets/manage_game.png

1.5 KB | W: | H:

assets/manage_game.png

406 Bytes | W: | H:

assets/manage_game.png
assets/manage_game.png
assets/manage_game.png
assets/manage_game.png
  • 2-up
  • Swipe
  • Onion skin
assets/manage_study.png

1.08 KB | W: | H:

assets/manage_study.png

561 Bytes | W: | H:

assets/manage_study.png
assets/manage_study.png
assets/manage_study.png
assets/manage_study.png
  • 2-up
  • Swipe
  • Onion skin
assets/manage_video.png

430 Bytes | W: | H:

assets/manage_video.png

462 Bytes | W: | H:

assets/manage_video.png
assets/manage_video.png
assets/manage_video.png
assets/manage_video.png
  • 2-up
  • Swipe
  • Onion skin
assets/power.png

1023 Bytes | W: | H:

assets/power.png

864 Bytes | W: | H:

assets/power.png
assets/power.png
assets/power.png
assets/power.png
  • 2-up
  • Swipe
  • Onion skin
assets/studyIcon.png

1.08 KB | W: | H:

assets/studyIcon.png

643 Bytes | W: | H:

assets/studyIcon.png
assets/studyIcon.png
assets/studyIcon.png
assets/studyIcon.png
  • 2-up
  • Swipe
  • Onion skin
assets/task_incomplete.png

619 Bytes | W: | H:

assets/task_incomplete.png

652 Bytes | W: | H:

assets/task_incomplete.png
assets/task_incomplete.png
assets/task_incomplete.png
assets/task_incomplete.png
  • 2-up
  • Swipe
  • Onion skin
<view id="bind">
<!-- 步骤进度 -->
<view id="bindTabWrap">
<view id="bindTab">
<text class="bindTabSelected">绑定设备</text>
<!-- <image src="../../assets/arrow_right.png" />
<text>链接网络</text> -->
<image src="../../assets/arrow_right.png" />
<text>完善信息</text>
</view>
</view>
<view id="bindBox">
<image id="bindBoxBg" src="../../assets/bind_bg.png" />
<view id="equipmentIdCon">
<text>设备编号:</text>
<text id="equipmentId">{{equipmentId}}</text>
</view>
</view>
<view id="bindTip">
<view>温馨提示:</view>
<view>使用家长端绑定SeeX,让您实时查看孩子的训练情况,由您掌控孩子的训练计划,使用的应用等</view>
</view>
<view id="bindBtn">
<button class="noBindBtn" bindtap='noBind'>暂不绑定</button>
<button class="nowBindBtn" bindtap="bindEquipment">绑定设备</button>
</view>
</view>
#bind{
background: #EFEFF4;
min-height: 100vh;
}
#bindTabWrap{
padding: 40rpx 30rpx;
}
#bindTab{
background: #fff;
display: flex;
align-items: center;
justify-content: center;
border-radius: 52rpx;
height: 104rpx;
padding: 0 55rpx;
}
#bindTab>text{
color: #CDCDCD;
font-size: 34rpx;
}
#bindTab>image{
width: 34rpx;
height: 34rpx;
margin: 0 90rpx;
}
#bindTab>.bindTabSelected{
color: #33D1C4;
}
/* 设备号背景 */
#bindBox{
height: 579rpx;
position: relative;
}
#bindBoxBg{
width: 100%;
height: 100%;
}
#equipmentIdCon{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width:570rpx;
height: 170rpx;
line-height: 170rpx;
text-align: center;
font-size: 34rpx;
color: #F8F8F8;
border: 2rpx solid #F8F8F8;
border-radius: 10rpx;
}
/* 提示 */
#bindTip{
font-size: 28rpx;
color: #4F5051;
padding: 30rpx 30rpx 0;
}
#bindBtn{
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 100rpx;
padding: 0 40rpx;
}
#bindBtn .noBindBtn,#bindBtn .nowBindBtn{
width: 315rpx;
height: 94rpx;
line-height: 94rpx;
font-size: 36rpx;
border-radius: 10rpx;
margin: 0;
}
button::after{
border: 0;
}
#bindBtn .noBindBtn{
color: #000000;
color: #555;
background: #F8F8F8;
border: 2rpx solid rgba(5,5,5,0.10);
}
#bindBtn .nowBindBtn{
background: #33D1C4;
color: #fff;
}
\ No newline at end of file
...@@ -4,23 +4,12 @@ Page({ ...@@ -4,23 +4,12 @@ Page({
name: '',//姓名 name: '',//姓名
date: '2010-01-01',// 生日 date: '2010-01-01',// 生日
sex: 1,// 性别 sex: 1,// 性别
school: '',// 学校
class: '',// 班级
sexList: [{ id: 1, checked: true, name: '男孩' }, { id: 2, name: '女孩' }], sexList: [{ id: 1, checked: true, name: '男孩' }, { id: 2, name: '女孩' }],
// adapterSource: , //本地匹配源
// bindSource: [], //绑定到页面的数据,根据用户输入动态变化
// hideScroll: true,
isNull: false isNull: false
}, },
onLoad: function (options) { onLoad: function (options) {
let me = this; let me = this;
}, },
childInfoBack: function() {
let me = this;
wx.navigateTo({
url: '/pages/network/network'
})
},
bindDateChange: function(e) { bindDateChange: function(e) {
this.setData({ this.setData({
date: e.detail.value date: e.detail.value
...@@ -33,92 +22,49 @@ Page({ ...@@ -33,92 +22,49 @@ Page({
}) })
console.log(e.detail.value) console.log(e.detail.value)
}, },
// schoolInput: function (e) {
// let me = this;
// // 检测拼音输入结束后
// if(e.detail.cursor != me.data.cursor){
// me.setData({
// cursor: e.detail.cursor
// });
// //用户实时输入值
// var prefix = e.detail.value
// // console.log(prefix)
// // 假设现在需要检测到用户输入的值,用户 400 毫秒内没有继续输入就将该值打印出来
// me.throttle(me.queryData, null, 400, prefix);
// }
// },
// // 节流
//   throttle: function(fn, context, delay, text) {
//     clearTimeout(fn.timeoutId);
//     fn.timeoutId = setTimeout(function () {
//       fn.call(context, text);
//     }, delay);
//   },
// //匹配的结果
// queryData: function(prefix){
// let me = this;
// console.log(prefix)// 此处打印出来的就是 用户输入的值
// if(prefix==''){
// me.setData({
// // 输入内容为空,关闭下拉列表
// hideScroll: true,
// bindSource: []
// })
// return
// }
// // 如果匹配结果存在,那么将其返回,相反则返回空数组
// // 模拟请求获取newSource
// setTimeout(function(){
// var newSource = ["weixin", "wechat", "wechatandroid", "wechat程序", "wechat众号", "wechat工具"]
// if (newSource.length != 0) {
// me.setData({
// // 匹配结果存在,显示自动联想词下拉列表
// hideScroll: false,
// bindSource: newSource,
// arrayHeight: newSource.length * 71
// })
// } else {
// me.setData({
// // 匹配无结果,不现实下拉列表
// hideScroll: true,
// bindSource: []
// })
// }
// },100)
// },
// 用户点击选择某个联想字符串时,获取该联想词,并清空提醒联想词数组
// itemtap: function (e) {
// this.setData({
// // .id在wxml中被赋值为{{item}},即当前遍历的元素值
// school: e.target.id,
// // 当用户选择某个联想词,隐藏下拉列表
// hideScroll: true,
// bindSource: []
// })
// },
ccctap: function (e) {
if(e.target.id==''||e.target.id=='childInfo'||e.target.id=='childInfoNext'||e.target.id=='bindTab'||e.target.id=='childInfoTips'||e.target.id=='childInfoBox'||e.target.id=='childInfoBack'){
this.setData({
hideScroll: true,
bindSource: []
})
}
},
nameInput: function (e) { nameInput: function (e) {
this.setData({ this.setData({
isNull: false, isNull: false,
name: e.detail.value name: e.detail.value
}) })
}, },
classInput: function (e) {
this.setData({
class: e.detail.value
})
},
// 下一步 // 下一步
childInfoNext: function () { childInfoNext: function (e) {
console.log(11111)
// 授权
if(e.detail.errMsg!='getUserInfo:ok'){
//拒绝授权
console.log(e.detail.errMsg)
return
}
//授权成功后
console.log(e.detail.userInfo)
wx.request({
url: app.globalData.apiUrl + '/users/addSmallProgramUser',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
avatarUrl: e.detail.userInfo.avatarUrl,
city: e.detail.userInfo.city,
country: e.detail.userInfo.country,
gender: e.detail.userInfo.gender,
language: e.detail.userInfo.language,
nickName: e.detail.userInfo.nickName,
province: e.detail.userInfo.province
},
success: function (res) {
if(res.data.errno==200){
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
let me = this; let me = this;
if(me.data.name==''){// 没填姓名高亮 if(me.data.name==''){// 没填姓名高亮
me.setData({ me.setData({
...@@ -142,8 +88,6 @@ Page({ ...@@ -142,8 +88,6 @@ Page({
name: me.data.name, name: me.data.name,
birthday: me.data.date, birthday: me.data.date,
gender: me.data.sex,//性别 gender: me.data.sex,//性别
schoolName: me.data.school,//学校
classesName: me.data.class//班级
}, },
success: function (res) { success: function (res) {
// 请求成功后关闭Loading // 请求成功后关闭Loading
...@@ -169,5 +113,5 @@ Page({ ...@@ -169,5 +113,5 @@ Page({
} }
}) })
} }
} },
}) })
\ No newline at end of file
<view id="childInfo" bindtap="ccctap"> <view id="childInfo">
<!-- 导航 --> <!-- 步骤进度 -->
<view id="bindTabWrap"> <view id="tabWrap">
<view id="bindTab"> <view id="tab">
<text>绑定设备</text> <text class="tabSelected">完善信息</text>
<image src="../../assets/arrow_right.png" /> <image src="../../assets/arrow_right.png" />
<text class="bindTabSelected">完善信息</text> <text>初始视力</text>
<image src="../../assets/arrow_right.png" />
<text>训练设置</text>
</view>
</view> </view>
<!-- 背景 -->
<view id="infoBg">
<image src="../../assets/pic_kv.png"></image>
</view> </view>
<!-- 基本信息 --> <!-- 基本信息 -->
<view id="childInfoListTitle">基本信息</view>
<view id="childInfoList"> <view id="childInfoList">
<view class="childInfoListItem"> <view class="childInfoListItem">
<view class="childInfoListItemTitle {{isNull?'redTitle':''}}"><text>*</text>姓名</view> <view class="childInfoListItemTitle {{isNull?'redTitle':''}}"><text>* </text>姓名</view>
<input class="nameInput rightInput" placeholder-style="color:#CDCDCD;" bindinput="nameInput" placeholder="请输入您的孩子的真实姓名" /> <input class="nameInput rightInput" maxlength="20" placeholder-style="color:#CDCDCD;" bindinput="nameInput" placeholder="请输入您的孩子的真实姓名" />
</view> </view>
<!-- 生日 --> <!-- 生日 -->
<view class="childInfoListItem"> <view class="childInfoListItem">
<view class="childInfoListItemTitle"><text>*</text>生日</view> <view class="childInfoListItemTitle"><text>* </text>生日</view>
<picker mode="date" value="{{date}}" start="1990-09-01" end="2025-09-01" bindchange="bindDateChange"> <picker mode="date" value="{{date}}" start="1990-09-01" end="2025-09-01" bindchange="bindDateChange">
<view class="birthdaypPicker rightInput"> <view class="birthdaypPicker rightInput">
{{date}} {{date}}
...@@ -25,41 +30,17 @@ ...@@ -25,41 +30,17 @@
</view> </view>
<!-- 性别 --> <!-- 性别 -->
<view class="childInfoListItem"> <view class="childInfoListItem">
<view class="childInfoListItemTitle"><text>*</text>性别</view> <view class="childInfoListItemTitle"><text>* </text>性别</view>
<radio-group id="sexRadioBox" class="rightInput" bindchange="sexTap"> <radio-group id="sexRadioBox" class="rightInput" bindchange="sexTap">
<label class="sexRadio" wx:for="{{sexList}}" wx:key="sexList"> <label class="sexRadio" wx:for="{{sexList}}" wx:key="sexList">
<radio color="#fff" value="{{item.id}}" checked="{{item.checked}}"/>{{item.name}} <radio color="#fff" value="{{item.id}}" checked="{{item.checked}}"/>{{item.name}}
</label> </label>
</radio-group> </radio-group>
</view> </view>
<!-- 学校 -->
<view class="childInfoListItem">
<text class="childInfoListItemTitle">学校</text>
<view class="childInfoListSchool rightInput">
<view>
<input class="textinput rightInput" cursor-spacing="200" placeholder-style="color:#CDCDCD;" value="{{school}}" placeholder="例:省市-区县-校名(选填)" />
</view>
<!-- <scroll-view scroll-y="true" class="locationPull rightInput" hidden="{{hideScroll}}" style="{{arrayHeight>280?'height:280rpx':''}}">
<view class="locationPullItem" id="{{item}}" bindtap="itemtap" wx:for="{{bindSource}}" wx:key="bindSource">
{{item}}
</view>
</scroll-view> -->
</view>
</view>
<!-- 班级 -->
<view class="childInfoListItem">
<text class="childInfoListItemTitle">班级</text>
<input class="rightInput" placeholder-style="color:#CDCDCD;" bindinput="classInput" placeholder="例:三年级5班(选填)" />
</view>
</view>
<!-- 提示 -->
<view id="childInfoTips">
请您如实填写本页信息,这将帮助我们为您或您的孩子提供更科学有效的眼部健康管理。
</view> </view>
<view id="childInfoBoxCon"> <view id="childInfoBoxCon">
<view id="childInfoBox"> <view id="childInfoBox">
<button id="childInfoBack" bindtap='childInfoBack'>上一步</button> <button id="childInfoNext" open-type="getUserInfo" lang="zh_CN" bindgetuserinfo='childInfoNext'>下一步</button>
<button id="childInfoNext" bindtap='childInfoNext'>下一步</button>
</view> </view>
</view> </view>
</view> </view>
...@@ -2,42 +2,49 @@ ...@@ -2,42 +2,49 @@
background: #EFEFF4; background: #EFEFF4;
min-height: 100vh; min-height: 100vh;
} }
/* 导航 */ /* 导航 */
#bindTabWrap{ #tabWrap{
padding: 40rpx 30rpx; padding: 40rpx 25rpx;
} }
#bindTab{ #tab{
background: #fff; background: #fff;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border-radius: 52rpx; border-radius: 52rpx;
height: 104rpx; height: 104rpx;
padding: 0 55rpx; padding: 0 30rpx;
} }
#bindTab>text{ #tab>text{
color: #CDCDCD;
font-size: 34rpx; font-size: 34rpx;
color: #4F5051;
} }
#bindTab>image{ #tab>image{
width: 34rpx; width: 34rpx;
height: 34rpx; height: 34rpx;
margin: 0 90rpx; margin: 0 20rpx;
} }
#bindTab>.bindTabSelected{ #tab>.tabSelected{
color: #33D1C4; color: #33D1C4;
} }
/* 背景 */
#infoBg{
padding-bottom: 20rpx;
}
#infoBg>image{
width: 100%;
height: 430rpx;
}
/* 信息列表 */ /* 信息列表 */
#childInfoList{ #childInfoList{
background: #fff; background: #fff;
padding-left: 25rpx; padding-left: 25rpx;
} }
#childInfoListTitle{
font-size: 28rpx;
color: #4F5051;
padding: 0 0 20rpx 25rpx;
}
.childInfoListItem{ .childInfoListItem{
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -81,7 +88,7 @@ radio .wx-radio-input.wx-radio-input-checked::before{ ...@@ -81,7 +88,7 @@ radio .wx-radio-input.wx-radio-input-checked::before{
.childInfoListItem .childInfoListItemTitle{ .childInfoListItem .childInfoListItemTitle{
font-size: 34rpx; font-size: 34rpx;
color: #4F5051; color: #4F5051;
width: 100rpx; width: 115rpx;
text-align: right; text-align: right;
margin-right: 52rpx; margin-right: 52rpx;
} }
...@@ -126,9 +133,8 @@ radio .wx-radio-input.wx-radio-input-checked::before{ ...@@ -126,9 +133,8 @@ radio .wx-radio-input.wx-radio-input-checked::before{
/* 按钮组 */ /* 按钮组 */
#childInfoBoxCon{ #childInfoBoxCon{
position: absolute;
bottom: 80rpx;
width: 100%; width: 100%;
padding: 40rpx 0;
} }
#childInfoBox{ #childInfoBox{
display: flex; display: flex;
...@@ -136,17 +142,12 @@ radio .wx-radio-input.wx-radio-input-checked::before{ ...@@ -136,17 +142,12 @@ radio .wx-radio-input.wx-radio-input-checked::before{
padding:0 40rpx; padding:0 40rpx;
} }
#childInfoBox>button{ #childInfoBox>button{
width: 315rpx; width: 100%;
height: 94rpx; height: 94rpx;
line-height: 94rpx; line-height: 94rpx;
font-size: 36rpx; font-size: 36rpx;
border-radius: 10rpx; border-radius: 10rpx;
} }
#childInfoBack{
background: #F8F8F8;
border: 2rpx solid rgba(5,5,5,0.10);
color: #000000;
}
#childInfoNext{ #childInfoNext{
color: #fff; color: #fff;
background: #33D1C4; background: #33D1C4;
......
...@@ -7,9 +7,9 @@ Page({ ...@@ -7,9 +7,9 @@ Page({
luoData: {left: '',right: ''},//裸眼视力 luoData: {left: '',right: ''},//裸眼视力
jiaoData: {left: '',right: ''},//矫正视力 jiaoData: {left: '',right: ''},//矫正视力
glassData: {left: '',right: ''},//眼镜度数 glassData: {left: '',right: ''},//眼镜度数
ruoData: {left: '',right: ''},// 弱视 ruoData: {left: '无',right: '无'},// 弱视
xieData: {left: '',right: ''},// 斜视 xieData: {left: '无',right: '无'},// 斜视
sanData: {left: '',right: ''},// 散光 sanData: {left: '无',right: '无'},// 散光
luoeyeArray: [ luoeyeArray: [
['4.0','4.1','4.2','4.3','4.4','4.5','4.6','4.7','4.8','4.9','-','5.0','5.1','5.2','5.3'], ['4.0','4.1','4.2','4.3','4.4','4.5','4.6','4.7','4.8','4.9','-','5.0','5.1','5.2','5.3'],
['4.0','4.1','4.2','4.3','4.4','4.5','4.6','4.7','4.8','4.9','-','5.0','5.1','5.2','5.3'] ['4.0','4.1','4.2','4.3','4.4','4.5','4.6','4.7','4.8','4.9','-','5.0','5.1','5.2','5.3']
...@@ -46,6 +46,9 @@ Page({ ...@@ -46,6 +46,9 @@ Page({
allLeftStatus: 0,// 多个集合左(状态) allLeftStatus: 0,// 多个集合左(状态)
allRightStatus: 0,// 多个集合右(状态) allRightStatus: 0,// 多个集合右(状态)
first: true,// 是否第一次点击下一步 first: true,// 是否第一次点击下一步
isClass: 0, //是否配镜
date: '2012-01-01',// 配镜日期
}, },
onLoad: function (options) { onLoad: function (options) {
let me = this; let me = this;
...@@ -97,7 +100,7 @@ Page({ ...@@ -97,7 +100,7 @@ Page({
// 第一次点击没有视觉缺陷 // 第一次点击没有视觉缺陷
console.log('第一次没有----下一步') console.log('第一次没有----下一步')
me.next(); me.next();
}, 2000) }, 50)
} }
}else{ }else{
// 请求前加Loading // 请求前加Loading
...@@ -113,17 +116,54 @@ Page({ ...@@ -113,17 +116,54 @@ Page({
// 弹窗后----下一步 // 弹窗后----下一步
console.log('弹窗后----下一步') console.log('弹窗后----下一步')
me.next(); me.next();
}, 2000) }, 50)
} }
}, },
// 下一步请求 // 下一步请求
next: function(e){ next: function(e){
let me = this; let me = this;
// 请求前加Loading // 请求前加Loading
wx.showLoading({ // wx.showLoading({
title: '加载中', // title: '加载中',
mask: true // mask: true
// })
if(me.data.ruoData.left=='无'){
me.setData({
ruoData:{left: '',right: me.data.ruoData.right}
})
}
if(me.data.ruoData.right=='无'){
me.setData({
ruoData:{left: me.data.ruoData.left,right: ''}
})
}
if(me.data.xieData.left=='无'){
me.setData({
xieData:{left: '',right: me.data.xieData.right}
})
}
if(me.data.xieData.right=='无'){
me.setData({
xieData:{left: me.data.xieData.left,right: ''}
}) })
}
if(me.data.sanData.left=='无'){
me.setData({
sanData:{left: '',right: me.data.sanData.right}
})
}
if(me.data.sanData.right=='无'){
me.setData({
sanData:{left: me.data.sanData.left,right: ''}
})
}
let nearsightedTime = ''
if(me.data.isClass==0){
nearsightedTime = ''
}else{
nearsightedTime = me.data.date
}
wx.request({ wx.request({
url: app.globalData.apiUrl + 'teenages/vision', url: app.globalData.apiUrl + 'teenages/vision',
method: 'POST', method: 'POST',
...@@ -142,7 +182,9 @@ Page({ ...@@ -142,7 +182,9 @@ Page({
leftLeerEye: me.data.xieData.left,// 左眼斜视情况 leftLeerEye: me.data.xieData.left,// 左眼斜视情况
rightLeerEye: me.data.xieData.right,// 右眼斜视情况 rightLeerEye: me.data.xieData.right,// 右眼斜视情况
leftCylEye: me.data.sanData.left,// 左眼散光度数 leftCylEye: me.data.sanData.left,// 左眼散光度数
rightCylEye: me.data.sanData.right// 右眼散光度数 rightCylEye: me.data.sanData.right,// 右眼散光度数
nearsightedStatus: me.data.isClass,// 佩戴眼镜情况 1:戴眼镜; 0:未戴眼镜
nearsightedTime: nearsightedTime// 配镜时间
}, },
success: function (res) { success: function (res) {
// 请求成功后关闭Loading // 请求成功后关闭Loading
...@@ -164,6 +206,37 @@ Page({ ...@@ -164,6 +206,37 @@ Page({
showCancel: false, showCancel: false,
content: res.data.msg content: res.data.msg
}) })
if(me.data.ruoData.left==''){
me.setData({
ruoData:{left: '无',right: me.data.ruoData.right}
})
}
if(me.data.ruoData.right==''){
me.setData({
ruoData:{left: me.data.ruoData.left,right: '无'}
})
}
if(me.data.xieData.left==''){
me.setData({
xieData:{left: '无',right: me.data.xieData.right}
})
}
if(me.data.xieData.right==''){
me.setData({
xieData:{left: me.data.xieData.left,right: '无'}
})
}
if(me.data.sanData.left==''){
me.setData({
sanData:{left: '无',right: me.data.sanData.right}
})
}
if(me.data.sanData.right==''){
me.setData({
sanData:{left: me.data.sanData.left,right: '无'}
})
}
} }
} }
}) })
...@@ -283,4 +356,22 @@ Page({ ...@@ -283,4 +356,22 @@ Page({
}) })
} }
}, },
// 是否配镜开关
classSwitch(e) {
console.log('是否配镜', e.detail.value)
if(e.detail.value){
this.setData({
isClass: 1
})
}else{
this.setData({
isClass: 0
})
}
},
bindDateChange: function(e) {
this.setData({
date: e.detail.value
})
},
}) })
\ No newline at end of file
<view id="eyesight"> <view id="eyesight">
<!-- 导航 --> <!-- 步骤进度 -->
<view id="bindTabWrap"> <view id="tabWrap">
<view id="bindTab"> <view id="tab">
<text>绑定设备</text> <text>完善信息</text>
<image src="../../assets/arrow_right.png" /> <image src="../../assets/arrow_right.png" />
<text class="bindTabSelected">完善信息</text> <text class="tabSelected">初始视力</text>
<image src="../../assets/arrow_right.png" />
<text>训练设置</text>
</view> </view>
</view> </view>
<view id="eyesightConWrap"> <view id="eyesightConWrap">
...@@ -25,24 +27,6 @@ ...@@ -25,24 +27,6 @@
</view> </view>
</picker> </picker>
</view> </view>
<view class="eyesightConItem">
<view class="eyesightConLeft">矫正视力</view>
<picker mode="multiSelector" class="selectorPicker" bindchange="jiaoChange" value="{{jiaoIndex}}" range="{{jiaoArray}}">
<view class="eyesightConRight">
<view class="selItem">{{jiaoArray[0][jiaoIndex[0]]}}</view>
<view class="selItem">{{jiaoArray[1][jiaoIndex[1]]}}</view>
</view>
</picker>
</view>
<view class="eyesightConItem">
<view class="eyesightConLeft">眼镜度数</view>
<picker mode="multiSelector" class="selectorPicker" bindchange="glassChange" value="{{glassIndex}}" range="{{glassArray}}">
<view class="eyesightConRight">
<view class="selItem">{{glassArray[0][glassIndex[0]]}}</view>
<view class="selItem">{{glassArray[1][glassIndex[1]]}}</view>
</view>
</picker>
</view>
<view class="eyesightConItem" bindtap="showList"> <view class="eyesightConItem" bindtap="showList">
<view class="eyesightConLeft">弱视、斜视、散光</view> <view class="eyesightConLeft">弱视、斜视、散光</view>
<view class="eyesightConRight"> <view class="eyesightConRight">
...@@ -50,7 +34,6 @@ ...@@ -50,7 +34,6 @@
<text class="selItem">{{allRight}}</text> <text class="selItem">{{allRight}}</text>
</view> </view>
</view> </view>
</view>
<view id="eyesightLast" hidden="{{!show}}"> <view id="eyesightLast" hidden="{{!show}}">
<view class="eyesightConItem"> <view class="eyesightConItem">
<view class="eyesightConLeft">· 弱视程度</view> <view class="eyesightConLeft">· 弱视程度</view>
...@@ -80,8 +63,49 @@ ...@@ -80,8 +63,49 @@
</picker> </picker>
</view> </view>
</view> </view>
<view class="eyesightConItem {{isClass==1 ? '' : 'eyesightConItemLast'}}">
<view class="eyesightConLeft">是否配镜</view>
<view class="eyesightConRight classConRight">
<switch color="#33D1C4" checked="{{isClass==1}}" bindchange="classSwitch"/>
</view>
</view>
<view hidden="{{isClass==0}}">
<view class="eyesightConItem">
<view class="eyesightConLeft">· 矫正视力</view>
<picker mode="multiSelector" class="selectorPicker" bindchange="jiaoChange" value="{{jiaoIndex}}" range="{{jiaoArray}}">
<view class="eyesightConRight">
<view class="selItem">{{jiaoArray[0][jiaoIndex[0]]}}</view>
<view class="selItem">{{jiaoArray[1][jiaoIndex[1]]}}</view>
</view>
</picker>
</view>
<view class="eyesightConItem">
<view class="eyesightConLeft">· 眼镜度数</view>
<picker mode="multiSelector" class="selectorPicker" bindchange="glassChange" value="{{glassIndex}}" range="{{glassArray}}">
<view class="eyesightConRight">
<view class="selItem">{{glassArray[0][glassIndex[0]]}}</view>
<view class="selItem">{{glassArray[1][glassIndex[1]]}}</view>
</view>
</picker>
</view>
<view class="eyesightConItem eyesightConItemLast">
<view class="eyesightConLeft">· 配镜日期</view>
<picker mode="date" value="{{date}}" start="1990-09-01" end="2025-09-01" class="selectorPicker" bindchange="bindDateChange">
<view class="eyesightConRight">
{{date}}
</view>
</picker>
</view>
</view>
</view>
</view>
<!-- 提示 -->
<view id="childInfoTips">
<view><image src="../../assets/icon_tips_s.png"></image></view>
<view>请您如实填写本页信息,这将帮助我们为您或您的孩子提供更科学有效的眼部健康管理。</view>
</view> </view>
<view class="{{show?'eyesightBom':'eyesightPos'}}"> <!-- <view class="{{show?'eyesightBom':'eyesightPos'}}"> -->
<view class="eyesightPos">
<view id="eyesightBox"> <view id="eyesightBox">
<button id="eyesightBack" bindtap='eyesightBack'>上一步</button> <button id="eyesightBack" bindtap='eyesightBack'>上一步</button>
<button id="eyesightNext" bindtap='eyesightNext'>下一步</button> <button id="eyesightNext" bindtap='eyesightNext'>下一步</button>
......
#eyesight{ #eyesight{
background:#EFEFF4; background:#EFEFF4;
min-height: 100vh; min-height: 100vh;
position: relative;
} }
/* 导航 */ /* 导航 */
#bindTabWrap{ #tabWrap{
padding: 40rpx 30rpx; padding: 40rpx 25rpx;
} }
#bindTab{ #tab{
background: #fff; background: #fff;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border-radius: 52rpx; border-radius: 52rpx;
height: 104rpx; height: 104rpx;
padding: 0 55rpx; padding: 0 30rpx;
} }
#bindTab>text{ #tab>text{
color: #CDCDCD;
font-size: 34rpx; font-size: 34rpx;
color: #4F5051;
} }
#bindTab>image{ #tab>image{
width: 34rpx; width: 34rpx;
height: 34rpx; height: 34rpx;
margin: 0 90rpx; margin: 0 20rpx;
} }
#bindTab>.bindTabSelected{ #tab>.tabSelected{
color: #33D1C4; color: #33D1C4;
} }
#eyesightCon{
#eyesightCon,#eyesightLast{
color: #4F5051; color: #4F5051;
font-size: 34rpx; font-size: 34rpx;
background: #fff; background: #fff;
padding-left: 25rpx; padding-left: 25rpx;
} }
#eyesightLast{
color: #4F5051;
font-size: 34rpx;
background: #fff;
}
#eyesightCon{ #eyesightCon{
border-bottom: 2rpx solid #E5E5E5; border-bottom: 1rpx solid #E5E5E5;
} }
.eyesightConTitle{ .eyesightConTitle{
font-size: 32rpx; font-size: 32rpx;
padding-bottom: 20rpx; padding: 20rpx 0;
display: flex; display: flex;
padding-left: 25rpx; padding-left: 25rpx;
font-size: 28rpx; font-size: 28rpx;
...@@ -52,10 +57,10 @@ ...@@ -52,10 +57,10 @@
.eyesightConItem{ .eyesightConItem{
display: flex; display: flex;
padding-bottom: 52rpx; padding-bottom: 52rpx;
border-bottom: 2rpx solid #E5E5E5; border-bottom: 1rpx solid #E5E5E5;
padding: 32rpx 0 30rpx; padding: 32rpx 0 30rpx;
} }
.eyesightConItem:last-child{ .eyesightConItemLast{
border: 0; border: 0;
} }
.eyesightConLeft{ .eyesightConLeft{
...@@ -82,6 +87,13 @@ ...@@ -82,6 +87,13 @@
padding-right:30rpx; padding-right:30rpx;
} }
.classConRight{
justify-content: flex-end;
}
switch{
transform:scale(0.9);
}
/* 弹窗 */ /* 弹窗 */
#eyesightPopup{ #eyesightPopup{
position: absolute; position: absolute;
...@@ -121,13 +133,28 @@ ...@@ -121,13 +133,28 @@
line-height: 60rpx; line-height: 60rpx;
} }
/* 提示 */
#childInfoTips{
font-size: 28rpx;
color: #666;
padding-left: 25rpx;
margin-top: 30rpx;
display: flex;
}
#childInfoTips image{
width: 28rpx;
height: 28rpx;
margin-right: 10rpx;
margin-top: 4rpx;
}
/* 按钮组 */ /* 按钮组 */
.eyesightBom{ .eyesightBom{
padding: 20rpx 0 80rpx; padding: 20rpx 0 80rpx;
} }
.eyesightPos{ .eyesightPos{
position: absolute; padding: 40rpx 0;
bottom: 80rpx;
width: 100%; width: 100%;
} }
#eyesightBox{ #eyesightBox{
......
var app = getApp();
Page({
data: {
},
onLoad: function () {
},
// 扫码绑定
scanBind: function (e) {
let me = this;
wx.scanCode({ //扫描API
success(res) { //扫描成功
console.log(res.result)
wx.request({
url: app.globalData.apiUrl + 'devices/seexSn',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
url: res.result
},
success: function (res) {
if(res.data.errno==200){
console.log(res.data.data.seexSn)
// 获取设备码后跳转到绑定页面
wx.navigateTo({
url: '/pages/bindEquipment/bindEquipment?equipmentId='+res.data.data.seexSn
})
}else{
// 打印错误信息
console.log(res.data.msg)
wx.showToast({
title: res.data.msg,
// mask: true,
icon: 'none',
duration: 2000
});
}
}
})
}
})
},
// 手动绑定
handBind: function (e) {
// 跳转到输入SN码页面
wx.navigateTo({
url: '/pages/handBind/handBind'
})
}
})
<view id="getCode">
<!-- 背景图片 -->
<view id="scanBtnBgBox">
<image id="scanBtnBg" src="../../assets/bg_linkdevice.png" />
<!-- 提示语 -->
<view id="getCodeTip">
<view>您好!</view>
<view>请绑定已购买设备。</view>
</view>
<!-- 提示图片 -->
<image id="tipIcon" src="../../assets/qrtips.png" />
<!-- 按钮 -->
<view id="getCodeBtnBox">
<button class="getCodeBtn" id="scanBtn" bindtap="scanBind">扫码绑定</button>
<button class="getCodeBtn" id="handBtn" bindtap="handBind">手动绑定</button>
</view>
</view>
</view>
#getCode{
background: #97979C;
min-height: 100vh;
}
#scanBtnBgBox{
position:absolute;
left:30rpx;
top:30rpx;
right:30rpx;
bottom:0;
height:87%;
}
#scanBtnBg{
width: 100%;
height: 100%;
}
#getCodeBtnBox{
position: absolute;
bottom: 60rpx;
width: 100%;
}
#scanBtn{
margin-bottom: 30rpx;
}
.getCodeBtn{
width:91%;
height: 94rpx;
line-height: 94rpx;
font-size: 36rpx;
color: #FFFFFF;
background: #33D1C4;
border-radius: 10rpx;
}
/* 提示语 */
#getCodeTip{
position: absolute;
top: 0;
left: 0;
font-size: 38rpx;
color: #30C0D1;
padding-left: 30rpx;
padding-top: 60rpx;
}
/* 提示图片 */
#tipIcon{
width: 220rpx;
height: 60rpx;
position: absolute;
top: 196rpx;
left: 50%;
transform: translateX(-50%);
}
\ No newline at end of file
<view id="handBind">
<view id="handBindCon">
<view id="handBindInputBox">
<view id="handBindTitle">请输入您的设备SN码</view>
<input id="snInput" bindinput="snChange" placeholder-style="color:#888;" bindinput="snChange" maxlength="20" type="text" placeholder="SN码由13位数字和字母组合而成" />
</view>
</view>
<!-- 提示 -->
<view id="handBindTip">
<view id="handBindTipTitle">
<image src="../../assets/tips.png" />
<text>在哪可以找到我的SN码</text>
</view>
<view class="handBindTipItem">
• 开启眼保仪 > 我的 > 关于我们,最下方写着SN
<view>码的字母数字组合;</view>
</view>
<view class="handBindTipItem">• 眼保仪的外包装盒。</view>
</view>
<!-- 开始绑定按钮 -->
<view id="handBindBtnCon">
<view id="handBindBtnBox">
<button id="bindBtn" bindtap="bind">开始绑定</button>
</view>
</view>
</view>
#handBind{
background: #EFEFF4;
min-height: 100vh;
}
/* 输入框 */
#handBindCon{
padding: 30rpx;
}
#handBindInputBox{
background: #FFFFFF;
padding: 60rpx 30rpx;
border-radius: 10rpx;
}
#handBindTitle{
font-size: 38rpx;
color: #4F5051;
margin-bottom: 30rpx;
}
#snInput{
font-size: 32rpx;
color: #4F5051;
padding: 20rpx 24rpx;
background: #EFEFF4;
border-radius: 4rpx;
}
/* 提示 */
#handBindTip{
padding: 0 60rpx;
margin-top: 40rpx;
}
#handBindTipTitle{
display: flex;
align-items: center;
font-size: 32rpx;
color: #4F5051;
margin-bottom: 20rpx;
}
#handBindTipTitle>image{
width: 29rpx;
height: 29rpx;
margin-right: 7rpx;
}
.handBindTipItem{
font-size: 28rpx;
color: #888888;
margin-bottom: 20rpx;
}
.handBindTipItem>view{
margin-left: 24rpx;
}
/* 按钮 */
#handBindBtnCon{
position: absolute;
width: 100%;
bottom: 80rpx;
}
#handBindBtnBox{
padding: 0 36rpx;
}
#bindBtn{
width: 100%;
height: 94rpx;
line-height: 94rpx;
font-size: 36rpx;
color: #FFFFFF;
background: #33D1C4;
border-radius: 10rpx;
}
\ No newline at end of file
import * as echarts from '../../component/ec-canvas/echarts'; import * as echarts from '../../component/ec-canvas/echarts';
// 饼状图 // 饼状图
let chartPie = null; let itemGap = 15;
function pieInitChart(canvas, width, height) { function pieInitChart(chart, legendList, ydata) {
chartPie = echarts.init(canvas, null, {
width: width,
height: height
});
canvas.setChart(chartPie);
var option = { var option = {
tooltip: { tooltip: {
show: false show: false
}, },
color:['#54585f','#7a8088','#979faa'], color:['#ffa16d','#ffd560','#33edcf','#4dc8f9','#7485f5','#d643f6','#ff6d6d'],
legend: { legend: {
left: 'center', left: 'center',
top: 10, top: 'center',
orient: 'vertical',
// top: 10,
textStyle:{ textStyle:{
color: '#555', color: '#4f5051',
fontSize: 10 fontSize: 11
}, },
icon: "circle", icon: "circle",
itemWidth: 8, itemWidth: 8,
itemHeight: 8, itemHeight: 8,
itemGap: 30, itemGap: itemGap,//图例间隔
data: ['动态训练','静态训练','单次训练'] data: legendList
}, },
series: [ series: [
{ {
// silent: true,//不响应和触发鼠标事件 // silent: true,//不响应和触发鼠标事件
hoverAnimation: false,//是否开启 hover 在拐点标志上的提示动画效果。 hoverAnimation: false,//是否开启 hover 在拐点标志上的提示动画效果。
type: 'pie', type: 'pie',
radius : '80%', // radius : '80%',
center: ['50%', '60%'], radius: ['52%', '100%'],
data:[ // center: ['50%', '60%'],
{value:35, name:'动态训练'}, // data:[
{value:45, name:'静态训练'}, // {value:48, name:'静态训练'},
{value:20, name:'单次训练'} // {value:28, name:'动态训练'},
], // {value:24, name:'单词训练'}
// ],
data: ydata,
label:{//饼图图形上的文本标签 label:{//饼图图形上的文本标签
normal:{ normal:{
  show: true,   show: true,
position: 'outside', //标签的位置 position: 'inner', //标签的位置
textStyle : { textStyle : {
fontWeight : 300 , fontWeight : 300 ,
fontSize : 12//文字的字体大小 fontSize : 14//文字的字体大小
    },     },
formatter: '{d}%' formatter: '{d}%'
} }
...@@ -54,30 +52,106 @@ function pieInitChart(canvas, width, height) { ...@@ -54,30 +52,106 @@ function pieInitChart(canvas, width, height) {
] ]
}; };
chartPie.setOption(option); chart.setOption(option);
return chartPie;
} }
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
avatar: "https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJgjIlZNw29LLpbQJYlmjib7AuaqROweKxUib78ibPbp0M6mGKvRXNnpT1M4XkwDwFPAypwOFLXko0zQ/132",
teenageName: '小明',
pieChart: { pieChart: {
onInit: pieInitChart // onInit: pieInitChart
lazyLoad: true
}, },
historyList: { beginDay: '',
id: 0, endDay: '',
date:'5月27日 至 5月20日', weekNumber: '',
finish: 1,//训练是否完成 finishedStatus: '',
minute: 125,// 训练分钟 weekDuration: '',
type: 1,// 视力升高或降低 rightEye: '',
degrees: '4.5 | 4.4', leftEye: '',
dyn: '20%', weekLeftEye: '',
static: '60%', weekRightEye: '',
word: '20%' rightGlassesDegree: '',
} leftGlassesDegree: '',
leftCorrectedEye: '',
rightCorrectedEye: '',
leftWeekEye: '',
rightWeekEye: '',
leftLeerEye: '',
rightLeerEye: '',
appList: [],
}, },
onLoad: function (options) { onLoad: function (options) {
// console.log(options.historyId) let me = this;
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'Reports/detail',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
// historyId: options.historyId
historyId: 12
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
name: res.data.data.name,
avatar: res.data.data.avatar,
beginDay: res.data.data.beginDay,
endDay: res.data.data.endDay,
weekNumber: res.data.data.weekNumber,
finishedStatus: res.data.data.finishedStatus,
weekDuration: res.data.data.weekDuration,
rightEye: res.data.data.rightEye,
leftEye: res.data.data.leftEye,
weekLeftEye: res.data.data.weekLeftEye,
weekRightEye: res.data.data.weekRightEye,
rightGlassesDegree: res.data.data.rightGlassesDegree,
leftGlassesDegree: res.data.data.rightGlassesDegree,
leftCorrectedEye: res.data.data.leftCorrectedEye,
rightCorrectedEye: res.data.data.rightCorrectedEye,
leftWeekEye: res.data.data.leftWeekEye,
rightWeekEye: res.data.data.rightWeekEye,
leftLeerEye: res.data.data.leftLeerEye,
rightLeerEye: res.data.data.rightLeerEye,
appList: res.data.data.appList,
})
let legendList = []
let pieList = []
res.data.data.typeTrainingList.map((item)=>{
legendList.push(item.title)
pieList.push({value: item.trainingDuration,name: item.title})
})
if(legendList.length>5){
itemGap = 5
}else{
itemGap = 15
}
me.selectComponent('#reprotPieChart').init((canvas, width, height) => {
const chart = echarts.init(canvas, null, {
width: width,
height: height
});
pieInitChart(chart, legendList, pieList)
me.chart = chart;
return chart;
});
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
} }
}) })
{ {
"navigationBarTitleText": "训练历史", "navigationBarTitleText": "训练报告",
"usingComponents": { "usingComponents": {
"ec-canvas": "../../component/ec-canvas/ec-canvas" "ec-canvas": "../../component/ec-canvas/ec-canvas"
} }
......
...@@ -2,13 +2,15 @@ ...@@ -2,13 +2,15 @@
<!-- 头像、用户名时间等 --> <!-- 头像、用户名时间等 -->
<view id="top"> <view id="top">
<view id="topLeft"> <view id="topLeft">
<image src="../../assets/head.png" /> <image src="{{ avatar }}" />
<text>用户名</text> <view>{{teenageName}}</view>
</view> </view>
<view id="topRight"> <view id="topRight">
<view>5月12日~5月18日<text>(周为单位)</text></view> <view id="topRightTime">第{{weekNumber}}周 <text>{{beginDay}}~{{endDay}}</text></view>
<view>上周共训练<text>150</text>分钟,目标已完成!</view> <view id="topRightTitle">上周共训练</view>
<view>并且右眼提升<text>0.1</text></view> <view id="topRightTrain"><text>{{we.toFixed(weekDuration/60)}}</text> 分钟,目标 <text id="topRightTrainStatus" wx:if="{{finishedStatus==1}}">已完成!</text><text id="topRightTrainStatusNo" wx:else>未完成!</text></view>
<view id="topRightTitle">当前视力</view>
<view id="topRightTrain">右眼 <text id="leftEye">{{rightEye}}</text>左眼 <text>{{leftEye}}</text></view>
</view> </view>
</view> </view>
<!-- 视力情况 --> <!-- 视力情况 -->
...@@ -18,65 +20,96 @@ ...@@ -18,65 +20,96 @@
<view class="eyesightItemRight"><text>左</text><text>右</text></view> <view class="eyesightItemRight"><text>左</text><text>右</text></view>
</view> </view>
<view class="eyesightItem"> <view class="eyesightItem">
<view class="eyesightItemLeft">裸眼视力</view> <view class="eyesightItemLeft">初测视力</view>
<view class="eyesightItemRight"> <view class="eyesightItemRight">
<text>4.5</text> <text>{{leftEye}}</text>
<text>3.5</text> <text>{{rightEye}}</text>
</view>
</view>
<view class="eyesightItem">
<view class="eyesightItemLeft">本次视力</view>
<view class="eyesightItemRight eyesightItemRightNowBox">
<view class="eyesightItemRightNow">
<text>{{weekLeftEye}}</text>
<view wx:if="{{weekLeftEye>leftEye}}">
<image src="../../assets/up.png"></image>
<text>{{weekLeftEye-leftEye}}</text>
</view>
<view wx:elif="{{weekLeftEye<leftEye}}">
<image src="../../assets/down.png"></image>
<text>{{leftEye-weekLeftEye}}</text>
</view>
<view wx:else></view>
</view>
<view class="eyesightItemRightNow">
<text>{{weekRightEye}}</text>
<view wx:if="{{weekRightEye>rightEye}}">
<image src="../../assets/up.png"></image>
<text>{{weekRightEye-rightEye}}</text>
</view>
<view wx:elif="{{weekRightEye<rightEye}}">
<image src="../../assets/down.png"></image>
<text>{{rightEye-weekRightEye}}</text>
</view>
<view wx:else></view>
</view>
</view> </view>
</view> </view>
<view class="eyesightItem"> <view class="eyesightItem">
<view class="eyesightItemLeft">矫正视力</view> <view class="eyesightItemLeft">矫正视力</view>
<view class="eyesightItemRight"> <view class="eyesightItemRight">
<text>4.0↓-0.5</text> <text>{{leftCorrectedEye}}</text>
<text>4.0↑+0.5</text> <text>{{rightCorrectedEye}}</text>
</view> </view>
</view> </view>
<view class="eyesightItem"> <view class="eyesightItem" wx:if="{{leftGlassesDegree!=''&&rightGlassesDegree!=''}}">
<view class="eyesightItemLeft">眼镜度数</view> <view class="eyesightItemLeft">眼镜度数</view>
<view class="eyesightItemRight"> <view class="eyesightItemRight">
<text>150</text> <text wx:if="{{leftGlassesDegree!=''}}">{{leftGlassesDegree}}</text>
<text>100</text> <text wx:if="{{leftGlassesDegree==''}}">-</text>
<text wx:if="{{rightGlassesDegree!=''}}">{{rightGlassesDegree}}</text>
<text wx:if="{{rightGlassesDegree==''}}">-</text>
</view> </view>
</view> </view>
<view class="eyesightItem"> <view class="eyesightItem" wx:if="{{leftWeekEye!='无'&&rightWeekEye!='无'}}">
<view class="eyesightItemLeft">斜视、弱视、散光</view> <view class="eyesightItemLeft">弱视</view>
<view class="eyesightItemRight"> <view class="eyesightItemRight">
<text>有</text> <text>{{leftWeekEye}}</text>
<text>无</text> <text>{{rightWeekEye}}</text>
</view>
</view>
<view class="eyesightItem" wx:if="{{leftLeerEye!='无'&&rightLeerEye!='无'}}">
<view class="eyesightItemLeft">斜视</view>
<view class="eyesightItemRight">
<text>{{leftLeerEye}}</text>
<text>{{rightLeerEye}}</text>
</view> </view>
</view> </view>
</view> </view>
<!-- 训练图 --> <!-- 训练图 -->
<view class="pieChart"> <view class="pieChart">
<ec-canvas ec="{{ pieChart }}"></ec-canvas> <ec-canvas id="reprotPieChart" ec="{{ pieChart }}"></ec-canvas>
</view> </view>
<view id="shareBox"> <!-- <view id="shareBox">
<text id="share">分享</text> <text id="share">分享</text>
</view> </view> -->
<!-- 常用应用 --> <!-- 常用应用 -->
<view id="common"> <view id="common">
<view id="commonTitle">常用应用</view> <view id="commonTitle">常用应用</view>
<view id="commonList"> <view id="commonList">
<view class="commonItem"> <view class="commonItem" wx:for="{{appList}}" wx:key>
<image src="../../assets/appIcon.png" /> <image src="{{item.icon}}" />
<text>应用名称111</text> <text>{{item.title}}</text>
</view>
<view class="commonItem">
<image src="../../assets/appIcon.png" />
<text>应用名称222</text>
</view>
<view class="commonItem">
<image src="../../assets/appIcon.png" />
<text>应用名称333</text>
</view>
<view class="commonItem">
<image src="../../assets/appIcon.png" />
<text>应用名称444</text>
</view>
<view class="commonItem">
<image src="../../assets/appIcon.png" />
<text>应用名称555</text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<wxs module="we">
var toFixed = function (value) {
return Math.floor(value);
}
module.exports = {
toFixed :toFixed
}
</wxs>
\ No newline at end of file
#historyDetail{ #historyDetail{
background: #EFEFF4; background: #ffffff;
min-height: 100vh; min-height: 100vh;
} }
#top{ #top{
padding: 30rpx 25rpx; padding-top: 40rpx;
display: flex; display: flex;
border-bottom: 2rpx solid #A7A7A8;
} }
#topLeft{ #topLeft{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
margin-right: 50rpx; padding: 20rpx 40rpx 0 60rpx;
} }
#topLeft>image{ #topLeft>image{
width: 100rpx; display: block;
height: 100rpx; height: 120rpx;
width: 120rpx;
border-radius: 50%;
} }
#topLeft>text{ #topLeft>view{
font-size: 30rpx; font-size: 28rpx;
color: #4F5051;
margin-top: 6rpx; margin-top: 6rpx;
text-align: center;
width: 100%;
} }
#topRight{ #topRight{
font-size: 28rpx;
color: #A7A7A8;
display: flex; display: flex;
flex-direction:column; flex-direction: column;
justify-content:space-around; justify-content: space-around;
border-left: 1rpx solid #E5ECE5;
padding-left: 40rpx;
padding-top: 10rpx;
}
#topRightTime{
font-size: 32rpx;
color: #33D1C4;
margin-bottom: 35rpx;
}
#topRightTime text{
font-size: 28rpx;
}
#topRightTitle{
font-size: 22rpx;
color: #999;
margin-bottom: -5rpx;
}
#topRightTrain{
font-size: 32rpx;
color: #999;
padding-bottom: 25rpx;
}
#topRightTrain text{
font-size: 64rpx;
color: #111111;
}
#topRightTrain #topRightTrainStatus{
font-size: 32rpx;
color: #F7B500;
}
#topRightTrain #topRightTrainStatusNo{
font-size: 32rpx;
color: #33D1C4;
}
#leftEye{
margin-right: 34rpx;
} }
/*  */ /*  */
#eyesight{ /* #eyesight{
padding: 30rpx;
border-bottom: 2rpx solid #A7A7A8; border-bottom: 2rpx solid #A7A7A8;
} } */
#eyesightTitle{ #eyesightTitle{
display: flex; display: flex;
font-size: 28rpx; font-size: 28rpx;
color: #4F5051; color: #666;
background: #A7A7A8; padding: 30rpx 25rpx;
border-radius: 100rpx;
padding: 20rpx 30rpx;
} }
.eyesightItem{ .eyesightItem{
display: flex; display: flex;
font-size: 28rpx; font-size: 28rpx;
color: #A7A7A8; color: #999;
padding: 20rpx 30rpx; padding: 39rpx 25rpx;
border-top: 1rpx solid #E5ECE5;
} }
.eyesightItemLeft{ .eyesightItemLeft{
width: 42%; width: 42%;
...@@ -63,7 +100,24 @@ ...@@ -63,7 +100,24 @@
.pieChart { .pieChart {
width: 100%; width: 100%;
height: 400rpx; height: 540rpx;
margin-top: 40rpx;
padding-bottom: 40rpx;
}
.eyesightItemRightNowBox{
display: flex;
}
.eyesightItemRightNow{
display: flex;
align-items: center;
width: 35%;
padding-left: 15%;
}
.eyesightItemRightNow image{
width: 26rpx;
height: 24rpx;
margin: 0 4rpx;
} }
/* 分享 */ /* 分享 */
...@@ -78,24 +132,27 @@ ...@@ -78,24 +132,27 @@
/* 常用应用 */ /* 常用应用 */
#common{
padding: 0 50rpx;
}
#commonList{ #commonList{
display: flex; display: flex;
padding: 40rpx;
} }
#commonTitle{ #commonTitle{
padding: 10rpx 30rpx; font-size: 32rpx;
color: #111111;
padding: 30rpx 0;
} }
.commonItem{ .commonItem{
display: flex; display: flex;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
font-size: 26rpx; font-size: 24rpx;
color: #A7A7A8; color: #4F5051;
/* padding: 0 20rpx; */
width: 20%; width: 20%;
} }
.commonItem>image{ .commonItem>image{
width: 60rpx; width: 106rpx;
height: 60rpx; height: 106rpx;
margin-bottom: 10rpx; margin-bottom: 10rpx;
} }
\ No newline at end of file
var app = getApp();
Page({ Page({
data: { data: {
idea: '', idea: '',
...@@ -18,15 +18,41 @@ Page({ ...@@ -18,15 +18,41 @@ Page({
}) })
return return
} }
let me = this
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'users/feedback',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
content: me.data.idea
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
wx.redirectTo({ wx.redirectTo({
url: '/pages/mine/mine' url: '/pages/mine/mine'
}) })
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}, },
// 输入 // 输入
inputchange(e) { inputchange(e) {
this.setData({ this.setData({
idea: e.detail.value, idea: e.detail.value,
contentLength: this.data.idea.length contentLength: e.detail.value.length
}) })
}, },
}) })
\ No newline at end of file
/* 提交 */ /* 提交 */
#submitBtn{ #submitBtn{
padding: 75rpx 30rpx 80rpx; padding: 75rpx 40rpx 80rpx;
} }
#submit{ #submit{
background: #33D1C4; background: #33D1C4;
border-radius: 10rpx; border-radius: 47rpx;
font-size: 36rpx; font-size: 36rpx;
color: #FFFFFF; color: #FFFFFF;
height: 94rpx; height: 94rpx;
......
...@@ -2,14 +2,7 @@ var app = getApp(); ...@@ -2,14 +2,7 @@ var app = getApp();
import * as echarts from '../../component/ec-canvas/echarts'; import * as echarts from '../../component/ec-canvas/echarts';
// 柱状图 // 柱状图
let chartWeek = null; function weekInitChart(chart, xdata, ydata) {
function weekInitChart(canvas, width, height) {
chartWeek = echarts.init(canvas, null, {
width: width,
height: height
});
canvas.setChart(chartWeek);
var option = { var option = {
color: ['#54585f'], color: ['#54585f'],
tooltip: { tooltip: {
...@@ -18,9 +11,9 @@ function weekInitChart(canvas, width, height) { ...@@ -18,9 +11,9 @@ function weekInitChart(canvas, width, height) {
grid: { grid: {
left: 5, left: 5,
right: 5, right: 5,
bottom: 15, bottom: 10,
top: 30, top: 10,
height: 150, // height: 150,
// show: true, // show: true,
containLabel: true, containLabel: true,
// borderColor: '#c9f1ce' // borderColor: '#c9f1ce'
...@@ -28,17 +21,19 @@ function weekInitChart(canvas, width, height) { ...@@ -28,17 +21,19 @@ function weekInitChart(canvas, width, height) {
xAxis: [ xAxis: [
{ {
type: 'category', type: 'category',
data: ['周日\n5.11', '周一\n5.12', '周二\n5.13', '周三\n5.14', '周四\n5.15', '周五\n5.16', '周六\n5.17'], // data: ['周日\n5.11', '周一\n5.12', '周二\n5.13', '周三\n5.14', '周四\n5.15', '周五\n5.16', '周六\n5.17'],
data: xdata,
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: '#c9f1ce' color: '#10d9b8',
width: 0.5
} }
}, },
axisTick:{ axisTick:{
length:0 length:0
}, },
axisLabel: { axisLabel: {
color: '#4f5051', color: '#666',
fontSize: 11, fontSize: 11,
lineHeight: 15 lineHeight: 15
} }
...@@ -54,12 +49,12 @@ function weekInitChart(canvas, width, height) { ...@@ -54,12 +49,12 @@ function weekInitChart(canvas, width, height) {
}, },
splitLine:{ splitLine:{
lineStyle:{ lineStyle:{
color: ['#c9f1ce'], color: ['#10d9b8'],
width: 1 width: 0.5
} }
}, },
axisLabel: { axisLabel: {
color: '#4f5051', color: '#666',
fontSize: 11 fontSize: 11
} }
} }
...@@ -75,7 +70,7 @@ function weekInitChart(canvas, width, height) { ...@@ -75,7 +70,7 @@ function weekInitChart(canvas, width, height) {
position: 'top', position: 'top',
// position: 'inside', // position: 'inside',
// offset: [0,-6], // offset: [0,-6],
color: '#60d4c6', color: '#10d9b8',
// formatter: function (params) { // formatter: function (params) {
// if (params.value > 0) { // if (params.value > 0) {
// return params.value; // return params.value;
...@@ -87,39 +82,33 @@ function weekInitChart(canvas, width, height) { ...@@ -87,39 +82,33 @@ function weekInitChart(canvas, width, height) {
}, },
itemStyle: { itemStyle: {
normal: { normal: {
color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{ color: "#10d9b8",
offset: 0, // color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
color: "#60d4c6" // 0% 处的颜色 // offset: 0,
},{ // color: "#60d4c6" // 0% 处的颜色
offset: 1, // },{
color: "#6be89b" // 100% 处的颜色 // offset: 1,
}], false), // color: "#6be89b" // 100% 处的颜色
// }], false),
barBorderRadius: [3, 3, 0, 0] //(顺时针左上,右上,右下,左下) barBorderRadius: [3, 3, 0, 0] //(顺时针左上,右上,右下,左下)
} }
}, },
data: [30, 3, 35, 45, 17, 22, 0] data: ydata
} }
] ]
}; };
chartWeek.setOption(option); chart.setOption(option)
return chartWeek;
} }
// 饼状图 // 饼状图
let chartPie = null; let itemGap = 15;
function pieInitChart(canvas, width, height) { function pieInitChart(chart, legendList, ydata) {
chartPie = echarts.init(canvas, null, {
width: width,
height: height
});
canvas.setChart(chartPie);
var option = { var option = {
tooltip: { tooltip: {
show: false show: false
}, },
color:['#6debc2','#5bc8ee','#5c7ce7'], color:['#ffa16d','#ffd560','#33edcf','#4dc8f9','#7485f5','#d643f6','#ff6d6d'],
legend: { legend: {
left: 'center', left: 'center',
top: 'center', top: 'center',
...@@ -132,8 +121,8 @@ function pieInitChart(canvas, width, height) { ...@@ -132,8 +121,8 @@ function pieInitChart(canvas, width, height) {
icon: "circle", icon: "circle",
itemWidth: 8, itemWidth: 8,
itemHeight: 8, itemHeight: 8,
itemGap: 15,//图例间隔 itemGap: itemGap,//图例间隔
data: ['静态训练','动态训练','单词训练'] data: legendList
}, },
series: [ series: [
{ {
...@@ -143,11 +132,12 @@ function pieInitChart(canvas, width, height) { ...@@ -143,11 +132,12 @@ function pieInitChart(canvas, width, height) {
// radius : '80%', // radius : '80%',
radius: ['52%', '100%'], radius: ['52%', '100%'],
// center: ['50%', '60%'], // center: ['50%', '60%'],
data:[ // data:[
{value:48, name:'静态训练'}, // {value:48, name:'静态训练'},
{value:28, name:'动态训练'}, // {value:28, name:'动态训练'},
{value:24, name:'单词训练'} // {value:24, name:'单词训练'}
], // ],
data: ydata,
label:{//饼图图形上的文本标签 label:{//饼图图形上的文本标签
normal:{ normal:{
  show: true,   show: true,
...@@ -163,19 +153,11 @@ function pieInitChart(canvas, width, height) { ...@@ -163,19 +153,11 @@ function pieInitChart(canvas, width, height) {
] ]
}; };
chartPie.setOption(option); chart.setOption(option);
return chartPie;
} }
// 左眼视力图 // 左眼视力图
let leftEyeChart = null; function leftEyeInitChart(chart, dayList, leftVisionList, leftForecastVision) {
function leftEyeInitChart(canvas, width, height) {
leftEyeChart = echarts.init(canvas, null, {
width: width,
height: height
});
canvas.setChart(leftEyeChart);
var option = { var option = {
tooltip: { tooltip: {
show: false show: false
...@@ -197,11 +179,12 @@ function leftEyeInitChart(canvas, width, height) { ...@@ -197,11 +179,12 @@ function leftEyeInitChart(canvas, width, height) {
length: 0, length: 0,
}, },
axisLabel:{ axisLabel:{
color: '#333', color: '#666',
fontSize: 11 fontSize: 11
}, },
boundaryGap: true, boundaryGap: true,
data: ["12.31", "1.1", "1.2", "1.3", "1.4", "1.5", "1.5"] // data: ["12.31", "1.1", "1.2", "1.3", "1.4", "1.5", "1.5", "1.1", "1.2", "1.3", "1.4", "1.5", "1.5"]
data: dayList
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',
...@@ -217,7 +200,7 @@ function leftEyeInitChart(canvas, width, height) { ...@@ -217,7 +200,7 @@ function leftEyeInitChart(canvas, width, height) {
} }
}, },
axisLabel: { axisLabel: {
color: '#333', color: '#666',
fontSize: 10, fontSize: 10,
showMinLabel: false //显示最小值 showMinLabel: false //显示最小值
}, },
...@@ -234,7 +217,7 @@ function leftEyeInitChart(canvas, width, height) { ...@@ -234,7 +217,7 @@ function leftEyeInitChart(canvas, width, height) {
// silent: true,//不响应和触发鼠标事件 // silent: true,//不响应和触发鼠标事件
hoverAnimation: false,//是否开启 hover 在拐点标志上的提示动画效果。 hoverAnimation: false,//是否开启 hover 在拐点标志上的提示动画效果。
type:'line', type:'line',
color:['#33d1c4'], color:['#33D1C4'],
symbolSize: 13, symbolSize: 13,
lineStyle: { lineStyle: {
width: 4 width: 4
...@@ -242,7 +225,8 @@ function leftEyeInitChart(canvas, width, height) { ...@@ -242,7 +225,8 @@ function leftEyeInitChart(canvas, width, height) {
itemStyle:{ itemStyle:{
borderWidth: 2//拐点圆边框 borderWidth: 2//拐点圆边框
}, },
data:[4.7, 4.7, 4.9, 4.9, 5.1, 5.1, 5.1] // data:[4.7, 4.7, 4.9, 4.9, 5.1, 5.1, 5.1, 4.7, 4.9, 4.9, 5.1, 5.1, 5.1]
data:leftVisionList
}, },
{ {
name: '未训练', name: '未训练',
...@@ -260,23 +244,16 @@ function leftEyeInitChart(canvas, width, height) { ...@@ -260,23 +244,16 @@ function leftEyeInitChart(canvas, width, height) {
borderColor:'#f7b500', //拐点边框颜色 borderColor:'#f7b500', //拐点边框颜色
} }
}, },
data:[4.7, 4.5, 4.5, 4.3, 4.3, 4.1, 4.1] // data:[4.7, 4.5, 4.5, 4.3, 4.3, 4.1, 4.1, 4.5, 4.5, 4.3, 4.3, 4.1, 4.1]
data: leftForecastVision
} }
] ]
}; };
leftEyeChart.setOption(option); chart.setOption(option);
return leftEyeChart;
} }
// 右眼视力图 // 右眼视力图
let rightEyeChart = null; function rightEyeInitChart(chart, dayList, rightVisionList, rightForecastVision) {
function rightEyeInitChart(canvas, width, height) {
rightEyeChart = echarts.init(canvas, null, {
width: width,
height: height
});
canvas.setChart(rightEyeChart);
var option = { var option = {
tooltip: { tooltip: {
show: false show: false
...@@ -298,11 +275,11 @@ function rightEyeInitChart(canvas, width, height) { ...@@ -298,11 +275,11 @@ function rightEyeInitChart(canvas, width, height) {
length:0, length:0,
}, },
axisLabel:{ axisLabel:{
color: '#333', color: '#666',
fontSize: 11 fontSize: 11
}, },
boundaryGap: true, boundaryGap: true,
data: ["12.31", "1.1", "1.2", "1.3", "1.4", "1.5", "1.5"] data: dayList
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',
...@@ -335,7 +312,7 @@ function rightEyeInitChart(canvas, width, height) { ...@@ -335,7 +312,7 @@ function rightEyeInitChart(canvas, width, height) {
// silent: true,//不响应和触发鼠标事件 // silent: true,//不响应和触发鼠标事件
hoverAnimation: false,//是否开启 hover 在拐点标志上的提示动画效果。 hoverAnimation: false,//是否开启 hover 在拐点标志上的提示动画效果。
type:'line', type:'line',
color:['#33d1c4'], color:['#33D1C4'],
symbolSize: 13, symbolSize: 13,
lineStyle: { lineStyle: {
width: 4 width: 4
...@@ -343,7 +320,7 @@ function rightEyeInitChart(canvas, width, height) { ...@@ -343,7 +320,7 @@ function rightEyeInitChart(canvas, width, height) {
itemStyle:{ itemStyle:{
borderWidth: 2 borderWidth: 2
}, },
data:[4.7, 4.7, 4.9, 4.9, 5.1, 5.1, 5.1] data: rightVisionList
}, },
{ {
name: '未训练', name: '未训练',
...@@ -361,13 +338,12 @@ function rightEyeInitChart(canvas, width, height) { ...@@ -361,13 +338,12 @@ function rightEyeInitChart(canvas, width, height) {
borderColor:'#f7b500', //拐点边框颜色 borderColor:'#f7b500', //拐点边框颜色
} }
}, },
data:[4.7, 4.5, 4.5, 4.3, 4.3, 4.1, 4.1] data: rightForecastVision
} }
] ]
}; };
rightEyeChart.setOption(option); chart.setOption(option);
return rightEyeChart;
} }
Page({ Page({
...@@ -375,67 +351,75 @@ Page({ ...@@ -375,67 +351,75 @@ Page({
teenageName: '', teenageName: '',
gender: '', gender: '',
age: '', age: '',
className: '',
avatar: '', avatar: '',
imgUrls: [ rightEye: '',
'../../assets/h1.jpg', leftEye: '',
'../../assets/h2.jpg' imgUrls: [],
],
indicatorDots: true, indicatorDots: true,
autoplay: false, autoplay: false,
interval: 5000, interval: 5000,
circular: true, circular: true,
weekChart: { weekChart: {
onInit: weekInitChart // onInit: weekInitChart
lazyLoad: true
}, },
pieChart: { pieChart: {
onInit: pieInitChart // onInit: pieInitChart
lazyLoad: true
}, },
leftEyeChart: { leftEyeChart: {
onInit: leftEyeInitChart // onInit: leftEyeInitChart
lazyLoad: true
}, },
rightEyeChart: { rightEyeChart: {
onInit: rightEyeInitChart // onInit: rightEyeInitChart
}, lazyLoad: true
leftYear: '2018', },
rightYear: '2019', trainSortList:[],
trainSortList:[ userRanking: '',
{ id: 14, name: "豆包", self: false, time: '283分钟' }, resultSortList:[],
{ id: 15, name: "雪诺", self: false, time: '280分钟' },
{ id: 16, name: "我", self: true, time: '158分钟' },
{ id: 17, name: "甜甜", self: false, time: '188分钟' }
],
resultSortList:[
{ id: 1, name: "豆包", self: false, type: 'up',eye:'左', num: '0.5' },
{ id: 2, name: "雪诺", self: false, type: 'down',eye:'右', num: '0.4' },
{ id: 3, name: "甜甜", self: false, type: 'none',eye:'双', num: '0.3' },
{ id: 15, name: "我", self: true, type: 'up',eye:'双', num: '0.2' },
{ id: 4, name: "11甜", self: false, type: 'down',eye:'左', num: '0.3' },
{ id: 5, name: "3333", self: false, type: 'up',eye:'右', num: '0.3' }
],
timerId: '',// 定时器id timerId: '',// 定时器id
iswifi: true, checkImg: '../../assets/indexDefault.png',
checkImg: '../../assets/h2.jpg',
mustUpdate: true, mustUpdate: true,
status: 1, status: 1,
currentSwiper: 0,
isRun: false,//训练状态
beginDay: '',
endDay: '',
weekDuration: '',//周训练时长
continuousWeeks: '',//连续训练周数
surpassRatio: '',//超过人数%
finishedStatus: '',//训练报告完成状态
visionAdvice: '',//训练建议
beginYear: '',//训练成就年数
totalTrainingDays: '',//训练成就天数
lastVision: '',//训练成就旧视力
nowVision: '',//训练成就新视力
}, },
onShow() { onShow() {
},
swiperChange: function(e) {
this.setData({
currentSwiper: e.detail.current
})
},
onReady() {
// setTimeout(function () {
// // 获取 chartWeek 实例的方式
// console.log(chartWeek)
// }, 2000);
let me = this; let me = this;
console.log('从子页面返回首页')
// this.setData({
// status: 1,
// mustUpdate: false
// })
// 请求前加Loading // 请求前加Loading
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',
mask: true mask: true
}) })
wx.request({ wx.request({
url: app.globalData.apiUrl + 'Users/index', url: app.globalData.apiUrl + 'users/index',
method: 'POST', method: 'POST',
data: { data: {
token: wx.getStorageSync('token') token: wx.getStorageSync('token')
...@@ -444,73 +428,145 @@ Page({ ...@@ -444,73 +428,145 @@ Page({
// 请求成功后关闭Loading // 请求成功后关闭Loading
wx.hideLoading(); wx.hideLoading();
if(res.data.errno==200){ if(res.data.errno==200){
// 锁定设备警告状态
// 1:正常使用设备;
if(res.data.data.lockDeviceStatus==2){
// 2:首日警告即将锁定设备提醒;
me.setData({ me.setData({
teenageName: res.data.data.teenageName, status: 2,
gender: res.data.data.gender, mustUpdate: false
age: res.data.data.age,
avatar: res.data.data.avatar,
}) })
if(res.data.data.schoolName||res.data.data.classesName){ }else if(res.data.data.lockDeviceStatus==3) {
// 3:锁定设备提醒
me.setData({ me.setData({
className: res.data.data.schoolName+res.data.data.classesName status: 3,
mustUpdate: false
}) })
}else{ }
if(res.data.data.gender=='2'){//女
me.setData({ me.setData({
className: '无' avatar: '../../assets/head_girl.png',
gender: '../../assets/icon_girl.png'
}) })
}
}else{ }else{
wx.showModal({ me.setData({
title: '提示', avatar: '../../assets/head_boy.png',
showCancel: false, gender: '../../assets/icon_boy.png'
content: res.data.msg
}) })
} }
}
})
// 获取网络类型
wx.getNetworkType({
success (res) {
console.log(res.networkType)
// wifi : wifi 网络显示提示
if(res.networkType == 'wifi'){
me.setData({ me.setData({
iswifi: true imgUrls: res.data.data.focusMap,
teenageName: res.data.data.teenageList[0].name,
gender: res.data.data.teenageList[0].gender,
age: res.data.data.teenageList[0].age,
rightEye: res.data.data.teenageList[0].rightEye,
leftEye: res.data.data.teenageList[0].leftEye,
continuousWeeks: res.data.data.reports.continuousWeeks,//连续训练周数
weekNumber: res.data.data.reports.weekNumber,//第几周
beginDay: res.data.data.reports.beginDay,
endDay: res.data.data.reports.endDay,
weekDuration: res.data.data.reports.weekDuration,//周训练时长
surpassRatio: res.data.data.reports.surpassRatio,//超过人数%
finishedStatus: res.data.data.reports.finishedStatus,//训练报告完成状态,1:完成;0:未完成
visionAdvice: res.data.data.reports.visionAdvice,//训练建议
beginYear: res.data.data.achievements.beginYear,//训练成就年份
totalTrainingDays: res.data.data.achievements.totalTrainingDays,//训练成就天数
lastVision: res.data.data.achievements.lastVision,//训练成就旧视力
nowVision: res.data.data.achievements.nowVision,//训练成就新视力
trainSortList: res.data.data.trainRanking.rankList,//训练排行
userRanking: res.data.data.trainRanking.userRanking,//训练排行本人
resultSortList: res.data.data.effectedRanking,//光明之星
})
let dayTrainingDateList = []
// let dayTrainingDurationList = [30, 3, 35, 45, 17, 22, 0]
let dayTrainingDurationList = []
res.data.data.reports.dayTrainingList.map((item)=>{
dayTrainingDateList.push(item.title)
dayTrainingDurationList.push(item.trainingDuration)
})
me.selectComponent('#reprotWeekChart').init((canvas, width, height) => {
const chart = echarts.init(canvas, null, {
width: width,
height: height
});
weekInitChart(chart, dayTrainingDateList, dayTrainingDurationList)
me.chart = chart;
return chart;
});
let legendList = []
let pieList = []
res.data.data.reports.typeTrainingList.map((item)=>{
legendList.push(item.title)
pieList.push({value: item.trainingDuration,name: item.title})
}) })
// WiFi环境 5秒刷新一次
me.timeImg(5000); if(legendList.length>5){
itemGap = 5
}else{ }else{
me.setData({ itemGap = 15
iswifi: false }
me.selectComponent('#reprotPieChart').init((canvas, width, height) => {
const chart = echarts.init(canvas, null, {
width: width,
height: height
});
pieInitChart(chart, legendList, pieList)
me.chart = chart;
return chart;
});
// 训练成就日期
let dayList = res.data.data.achievements.dayList
// 左眼
let leftVisionList = res.data.data.achievements.leftVisionList
let leftForecastVision = res.data.data.achievements.leftForecastVision
me.selectComponent('#leftEyeChart').init((canvas, width, height) => {
const chart = echarts.init(canvas, null, {
width: width,
height: height
});
leftEyeInitChart(chart, dayList, leftVisionList, leftForecastVision)
me.chart = chart;
return chart;
});
// 右眼
let rightVisionList = res.data.data.achievements.rightVisionList
let rightForecastVision = res.data.data.achievements.rightForecastVision
me.selectComponent('#rightEyeChart').init((canvas, width, height) => {
const chart = echarts.init(canvas, null, {
width: width,
height: height
});
rightEyeInitChart(chart, dayList, rightVisionList, rightForecastVision)
me.chart = chart;
return chart;
});
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
}) })
// 非WiFi环境 10秒刷新一次
me.timeImg(10000);
} }
} }
}) })
}, },
onReady() {
// setTimeout(function () {
// // 获取 chartWeek 实例的方式
// console.log(chartWeek)
// }, 2000);
},
onHide() { onHide() {
// 切换页面时,关闭定时器
console.log(this.data.timerId);
clearInterval(this.data.timerId);
}, },
// 权限设置 // 权限设置
ruleSet:function(){
wx.navigateTo({
url: '/pages/setting/setting'
})
},
// 设置
set:function(){ set:function(){
wx.navigateTo({ wx.navigateTo({
url: '/pages/ruleSet/ruleSet' url: '/pages/setting/setting'
}) })
}, },
// 训练计划 // 训练计划
...@@ -527,6 +583,12 @@ Page({ ...@@ -527,6 +583,12 @@ Page({
}, },
// 立即关机 // 立即关机
PowerOff: function () { PowerOff: function () {
wx.showModal({
title: '控制提示',
content: '关机后使用机器时需要再次开机,是否确认关机?',
success (res) {
if (res.confirm) {
// console.log('用户点击确定')
// 请求前加Loading // 请求前加Loading
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',
...@@ -557,23 +619,23 @@ Page({ ...@@ -557,23 +619,23 @@ Page({
} }
} }
}) })
} else if (res.cancel) {
// console.log('用户点击取消')
}
}
})
}, },
// 定时获取设备屏幕图片 // 刷新获取设备屏幕图片
timeImg: function (delay) { refresh: function () {
let me = this;
clearInterval(timer);
var timer = setInterval(function () {
// 暂时不加loading 影响操作(用户体验)
// // 请求前加Loading
// wx.showLoading({
// title: '加载中',
// mask: true
// })
//获取当前时间戳 //获取当前时间戳
var timestamp = Date.parse(new Date()); var timestamp = Date.parse(new Date());
timestamp = timestamp / 1000; timestamp = timestamp / 1000;
console.log("当前时间戳为:" + timestamp); console.log("当前时间戳为:" + timestamp);
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({ wx.request({
url: app.globalData.apiUrl + 'devices/watchingPic', url: app.globalData.apiUrl + 'devices/watchingPic',
method: 'POST', method: 'POST',
...@@ -583,21 +645,16 @@ Page({ ...@@ -583,21 +645,16 @@ Page({
}, },
success: function (res) { success: function (res) {
// // 请求成功后关闭Loading // // 请求成功后关闭Loading
// wx.hideLoading(); wx.hideLoading();
if(res.data.errno==200){ if(res.data.errno==200){
if(res.data.data){
console.log(res.data.data.trainingStatus)//训练状态,1正在训练、0:未训练 console.log(res.data.data.trainingStatus)//训练状态,1正在训练、0:未训练
console.log(res.data.data.thumb) console.log(res.data.data.thumb)
me.setData({ me.setData({
checkImg: res.data.data.thumb checkImg: res.data.data.thumb
}) })
// wx.showToast({ }
// title: '关机成功!',
// mask: true,
// // icon: 'none',
// duration: 2000
// });
}else{ }else{
clearInterval(timer);
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
showCancel: false, showCancel: false,
...@@ -606,10 +663,6 @@ Page({ ...@@ -606,10 +663,6 @@ Page({
} }
} }
}) })
}, delay);
me.setData({
timerId: timer
})
}, },
preventTouchMove() {}, preventTouchMove() {},
// 个人中心 // 个人中心
...@@ -618,6 +671,24 @@ Page({ ...@@ -618,6 +671,24 @@ Page({
url: '/pages/mine/mine' url: '/pages/mine/mine'
}) })
}, },
// 训练报告
trainReport() {
wx.navigateTo({
url: '/pages/trainReport/trainReport'
})
},
// 训练排行
toTrainSort() {
wx.navigateTo({
url: '/pages/trainSort/trainSort'
})
},
// 光明之星
toStarSort() {
wx.navigateTo({
url: '/pages/starSort/starSort'
})
},
// 稍后前往 // 稍后前往
lastGo: function () { lastGo: function () {
// 关闭当前页面 // 关闭当前页面
......
<view> <view>
<!-- 轮播 --> <!-- 轮播 -->
<swiper indicator-dots="{{indicatorDots}}" class="swiperBox" indicator-color="rgba(0,0,0,0.5)" indicator-active-color="#000" <view class='swiper_box'>
<swiper class="swiperBox" current="{{currentSwiper}}" bindchange="swiperChange"
autoplay="{{autoplay}}" interval="{{interval}}" circular="{{ circular }}"> autoplay="{{autoplay}}" interval="{{interval}}" circular="{{ circular }}">
<block wx:for="{{imgUrls}}" wx:key="{{index}}"> <block wx:for="{{imgUrls}}" wx:key="{{index}}">
<swiper-item class="swiperCon"> <swiper-item class="swiperCon">
<image src="{{item}}" class="slideImage"/> <image src="{{item.url}}" class="slideImage"/>
</swiper-item> </swiper-item>
</block> </block>
</swiper> </swiper>
<view class="dots">
<block wx:for="{{imgUrls}}" wx:key>
<view class="dot {{index == currentSwiper ? 'active' : ''}}"></view>
</block>
</view>
</view>
<view id="userTab">
<view class="userTabItem">
<image src="../../assets/back_tap.png"></image>
<text>{{teenageName}}</text>
</view>
<image id="userCenter" src="../../assets/icon_setting.png" bindtap="toMine"></image>
</view>
<!-- 头像、设置 --> <!-- 头像、设置 -->
<view id="userBox"> <view id="userBox">
<view id="userHead" bindtap="toMine"> <view>
<image id="userHead" src="{{ avatar }}" /> <image id="userHead" src="{{ avatar }}" />
</view> </view>
<view id="userInfo" bindtap="toMine"> <view id="userInfo">
<view id="username">{{teenageName}}</view>
<view id="userDetail"> <view id="userDetail">
<text>{{gender}}</text> <image id="userGender" src="{{ gender }}" />
<text class="userDetailLine"></text>
<text>{{age}}岁</text> <text>{{age}}岁</text>
<text class="userDetailLine"></text> <view id="initial">
<text>{{className}}</text> <text>当前视力</text>
<text class="initialIcon">R</text>
<text>{{rightEye}}</text>
<text class="initialIcon">L</text>
<text>{{leftEye}}</text>
</view> </view>
</view> </view>
<image id="setBtn" src="../../assets/set.png" bindtap="set" />
</view>
<view id="userBtnBox">
<view id="btnWrap">
<view id="planBtnBox">
<image class="btnIcon" src="../../assets/plan.png" />
<text id="planBtn" bindtap="plan">训练计划</text>
</view>
<text id="userBtnBoxLine"></text>
<view id="setBtnBox">
<image class="btnIcon" src="../../assets/manage.png" />
<text id="ruleSetBtn" bindtap="ruleSet">权限设置</text>
</view> </view>
</view> </view>
<view id="userBtnBox">
<image src="../../assets/btn_trainplan_nor.png" bindtap="plan"></image>
<image src="../../assets/btn_trainset_nor.png" bindtap="set"></image>
</view> </view>
<!-- 监控 --> <!-- 监控 -->
<view class="checkCon"> <view class="checkCon">
<view class="checkDes"> <view class="checkDes">
<text id="trainTime">训练中,已训练5分钟32秒</text> <text id="trainTime">设备使用中,今日已训练0分钟</text>
<view id="powerBox"> <view id="powerBox" bindtap="PowerOff">
<text class="PowerOff">立即关机</text>
<image src="../../assets/power.png" /> <image src="../../assets/power.png" />
<text class="PowerOff" bindtap="PowerOff">立即关机</text>
</view> </view>
</view> </view>
<view class="checkImg"> <view class="checkImg">
<image src="{{checkImg}}" /> <view id="checkImgNo" wx:if="{{!isRun}}">
<view class="wifi" hidden="{{iswifi}}">当前您使用的是非WIFI网络,系统已为您降低刷新频率</view> <image src="../../assets/indexDefault.png" />
<view hidden="{{true}}" id="checkImgNoRefreshBox"><text id="checkImgNoRefresh">手动刷新</text></view>
</view>
<view id="checkImgConBox" wx:else>
<image id="checkImgCon" src="{{checkImg}}" />
<image id="btn_refresh" bindtap="refresh" src="../../assets/btn_refresh.png"></image>
</view>
</view> </view>
</view> </view>
<!-- 灰色间隔start --> <!-- 灰色间隔start -->
<view class="grayBlock"></view> <!-- <view class="grayBlock"></view> -->
<!-- 灰色间隔end --> <!-- 灰色间隔end -->
<!-- 适合的目标 --> <!-- 适合的目标 -->
<view class="target" bindtap="target"> <!-- <view class="target" bindtap="target">
<text>适合【佩奇】的小目标</text> <text>适合【佩奇】的小目标</text>
<view class="targetDes"> <view class="targetDes">
<image src="../../assets/cup.png" /> <image src="../../assets/task_complete.png" />
<view>接下来的一周按要求完成训练任务,瓜分<text>9999</text>积分</view> <view>接下来的一周按要求完成训练任务,瓜分<text>9999</text>积分</view>
</view> </view>
</view> </view> -->
<view class="grayBlock"></view> <view class="grayBlock"></view>
<!-- 训练报告 --> <!-- 训练报告 -->
<view class="report"> <view class="report">
<view class="reportTitle"> <view class="reportTitle" bindtap="trainReport">
<view class="reportTitleLeft">训练报告</view> <view class="reportTitleLeft">训练报告</view>
<view class="targetHistory"> <view class="targetHistory">
<text>历史报告</text> <!-- <text>历史报告</text> -->
<image src="../../assets/arrow_right.png"></image> <image src="../../assets/icon_more.png"></image>
</view> </view>
</view> </view>
<view class="reportDes"> <view class="reportDes">
<view id="taskCompleteWrap" hidden="{{false}}"> <view id="taskCompleteWrap" wx:if="{{finishedStatus==1}}">
<view id="taskComplete"> <view id="taskComplete">
<image src="../../assets/task_complete.png" /> <image src="../../assets/task_complete.png" />
上周训练计划完成 上周训练计划完成
</view> </view>
<view id="taskCompleteDes">连续<text>3</text>周完成训练,超过<text>85%</text>的人</view> <view id="taskCompleteDes">连续<text>{{continuousWeeks}}</text>周完成训练,超过<text>{{surpassRatio}}</text>的人</view>
</view> </view>
<view id="taskNocompleteWrap" hidden="{{true}}"> <view id="taskNocompleteWrap" wx:else>
<view id="taskNocomplete"> <view id="taskNocomplete">
<image src="../../assets/task_incomplete.png" /> <image src="../../assets/task_incomplete.png" />
训练计划未完成 训练计划未完成
...@@ -89,60 +102,21 @@ ...@@ -89,60 +102,21 @@
<view id="taskNocompleteDes">请坚持完成训练哦</view> <view id="taskNocompleteDes">请坚持完成训练哦</view>
</view> </view>
</view> </view>
<view class="reprotChartTitle">上周({{beginDay}}~{{endDay}})共训练<text>{{weekDuration}}</text>分钟</view>
<view class="reprotChart"> <view class="reprotChart">
<view class="reprotChartTitle">上周(5月12日~5月18日)共训练<text>125</text>分钟</view>
<view class="reprotWeekChart"> <view class="reprotWeekChart">
<ec-canvas ec="{{ weekChart }}"></ec-canvas> <ec-canvas id="reprotWeekChart" ec="{{ weekChart }}"></ec-canvas>
</view> </view>
<view class="reprotPieChart"> <view class="reprotPieChart">
<ec-canvas ec="{{ pieChart }}"></ec-canvas> <ec-canvas id="reprotPieChart" ec="{{ pieChart }}"></ec-canvas>
</view> </view>
<view class="reprotChartSuggest"> <!-- <view class="reprotChartSuggest">
<view class="reprotChartSuggestTitle">训练建议</view> <view class="reprotChartSuggestTitle">训练建议</view>
<view class="adviseItem"> <view class="adviseItem" wx:for="{{visionAdvice}}" wx:key>
<image src="../../assets/advise.png" /> <image src="../../assets/advise.png" />
<text>多吃钙、蛋白质、维生素和杂粮,糙米,青菜,水果,少吃甜食;</text> <text>{{item}}</text>
</view>
<view class="adviseItem">
<image src="../../assets/advise.png" />
<text>无论看电视或者做功课,时间不可太长,每一个小时左右休息片刻为佳;</text>
</view>
<view class="adviseItem">
<image src="../../assets/advise.png" />
<text>不可弯腰驼背,靠的很近或趴着做功课,这样易造成睫状肌紧张过度而引起近视;</text>
</view>
<view class="adviseItem">
<image src="../../assets/advise.png" />
<text>经常做眼保健操,课间休息的时候记得远望和揉眼睛观望周围环境。</text>
</view>
</view>
</view>
</view>
<!-- 灰色间隔start -->
<view class="grayBlock"></view>
<!-- 灰色间隔end -->
<!-- 训练排行 -->
<view id="trainSort">
<view class="trainSortTitle">
<view class="trainSortTitleLeft">训练排行</view>
<view class="trainSortTitleRight">
<text>完整排行</text>
<image src="../../assets/arrow_right.png"></image>
</view>
</view>
<view id="trainSortList">
<view class="trainSortListItemWrap {{item.self?'trainSortListItemSelf':''}}" wx:for="{{trainSortList}}" wx:key="{{index}}">
<view class="trainSortListItem">
<view class="trainSortListItemLeft">
<text>{{item.id}}</text>
<view class="trainSortListItemInfo">
<image src="../../assets/sort_common.png" />
<text>{{item.name}}</text>
</view>
</view>
<text>{{item.time}}</text>
</view>
</view> </view>
</view> -->
</view> </view>
</view> </view>
<!-- 灰色间隔start --> <!-- 灰色间隔start -->
...@@ -152,10 +126,21 @@ ...@@ -152,10 +126,21 @@
<view id="achieve"> <view id="achieve">
<view class="achieveTitle"> <view class="achieveTitle">
<text>训练成就</text> <text>训练成就</text>
<image src="../../assets/arrow_right.png"></image> <!-- <image src="../../assets/icon_more.png"></image> -->
</view>
<view class="achieveTime">累计训练<text>{{totalTrainingDays}}</text>天</view>
<view class="achieveChange">
视力从<text>{{lastVision}}</text>
<text wx:if="{{lastVision<nowVision}}">提升到</text><text wx:elif="{{lastVision==nowVision}}">保持在</text><text wx:else>降低到</text>
<text>{{nowVision}}</text>
</view>
<view class="reprotChartSuggest">
<view class="reprotChartSuggestTitle">训练建议</view>
<view class="adviseItem" wx:for="{{visionAdvice}}" wx:key>
<image src="../../assets/advise.png" />
<text>{{item}}</text>
</view>
</view> </view>
<view class="achieveTime">累计训练<text>365</text>天</view>
<view class="achieveChange">视力从<text>4.5</text>提升到<text>4.7</text>度</view>
<view id="leftEyeChartBox"> <view id="leftEyeChartBox">
<view class="eyeChartName">左眼视力</view> <view class="eyeChartName">左眼视力</view>
<view class="legend_box"> <view class="legend_box">
...@@ -170,8 +155,8 @@ ...@@ -170,8 +155,8 @@
</view> </view>
</view> </view>
<view class="leftEyeChart"> <view class="leftEyeChart">
<ec-canvas ec="{{ leftEyeChart }}"></ec-canvas> <ec-canvas id="leftEyeChart" ec="{{ leftEyeChart }}"></ec-canvas>
<text id="leftYear">{{leftYear}}</text> <text id="leftYear">{{beginYear}}</text>
</view> </view>
<view id="rightEyeChartBox"> <view id="rightEyeChartBox">
<view class="eyeChartName">右眼视力</view> <view class="eyeChartName">右眼视力</view>
...@@ -187,39 +172,67 @@ ...@@ -187,39 +172,67 @@
</view> </view>
</view> </view>
<view class="rightEyeChart"> <view class="rightEyeChart">
<ec-canvas ec="{{ rightEyeChart }}"></ec-canvas> <ec-canvas id="rightEyeChart" ec="{{ rightEyeChart }}"></ec-canvas>
<text id="rightYear">{{rightYear}}</text> <text id="rightYear">{{beginYear}}</text>
</view>
</view>
<!-- 灰色间隔start -->
<view class="grayBlock"></view>
<!-- 灰色间隔end -->
<!-- 训练排行 -->
<view id="trainSort">
<view class="trainSortTitle" bindtap="toTrainSort">
<view class="trainSortTitleLeft">训练排行</view>
<view class="trainSortTitleRight">
<!-- <text>完整排行</text> -->
<image src="../../assets/icon_more.png"></image>
</view>
</view>
<view id="trainSortList">
<view class="trainSortListItemWrap {{item.ranking==userRanking?'trainSortListItemSelf':''}}" wx:for="{{trainSortList}}" wx:key="{{index}}">
<view class="trainSortListItem">
<view class="trainSortListItemLeft">
<text>{{item.ranking}}</text>
<view class="trainSortListItemInfo">
<image src="{{item.avatar}}" />
<text>{{item.name}}</text>
</view>
</view>
<text>{{we.toFixed(item.duration/60)}}分钟</text>
</view>
</view>
</view> </view>
</view> </view>
<!-- 灰色间隔start --> <!-- 灰色间隔start -->
<view class="grayBlock"></view> <view class="grayBlock"></view>
<!-- 灰色间隔end --> <!-- 灰色间隔end -->
<!-- 效果排行 --> <!-- 光明之星 -->
<view id="resultSort"> <view id="resultSort">
<view class="resultSortTitle"> <view class="resultSortTitle" bindtap="toStarSort">
<view class="resultSortTitleLeft">效果排行</view> <view class="resultSortTitleLeft">光明之星</view>
<view class="resultSortTitleRight"> <view class="resultSortTitleRight">
<text>完整排行</text> <!-- <text>完整排行</text> -->
<image src="../../assets/arrow_right.png"></image> <image src="../../assets/icon_more.png"></image>
</view> </view>
</view> </view>
<view id="resultSortList"> <view id="resultSortList">
<view class="resultSortListItemWrap {{item.self?'resultSortListItemSelf':''}}" wx:for="{{resultSortList}}" wx:key="{{index}}"> <view class="resultSortListItemWrap" wx:for="{{resultSortList}}" wx:key="{{index}}">
<view class="resultSortListItem"> <view class="resultSortListItem">
<view class="resultSortListItemLeft"> <view class="resultSortListItemLeft">
<text>{{item.id}}</text> <text>{{item.ranking}}</text>
<view class="resultSortListItemInfo"> <view class="resultSortListItemInfo">
<image src="../../assets/sort_common.png" /> <image src="{{item.avatar}}" />
<text>{{item.name}}</text> <text>{{item.name}}</text>
</view> </view>
</view> </view>
<view class="resultSortListItemRight"> <view class="resultSortListItemRight">
<image wx:if="{{item.type=='up'}}" src="../../assets/up.png" /> <image src="../../assets/up.png" />
<image wx:elif="{{item.type=='down'}}" src="../../assets/down.png" /> <!-- <image wx:if="{{item.type=='up'}}" src="../../assets/up.png" /> -->
<image wx:else src="../../assets/none.png" /> <!-- <image wx:elif="{{item.type=='down'}}" src="../../assets/down.png" /> -->
<!-- <image wx:else src="../../assets/none.png" /> -->
<view class="resultSortListItemRightEyeBox"> <view class="resultSortListItemRightEyeBox">
<text>{{item.num}}</text> <text>{{item.degree}}</text>
<text class="resultSortListItemRightEye">{{item.eye}}</text> <text class="resultSortListItemRightEye">{{item.promoteMode}}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -229,7 +242,7 @@ ...@@ -229,7 +242,7 @@
<!-- 更新训练计划弹窗 --> <!-- 更新训练计划弹窗 -->
<view id="mustUpdate" catchtouchmove="preventTouchMove" hidden="{{mustUpdate}}"> <view id="mustUpdate" catchtouchmove="preventTouchMove" hidden="{{mustUpdate}}">
<view id="mustUpdateBox" wx:if="{{status==1}}"> <view id="mustUpdateBox" wx:if="{{status==2}}">
<!-- 内容 --> <!-- 内容 -->
<view id="mustUpdateCon"> <view id="mustUpdateCon">
<view id="mustUpdateTitle">尊敬的家长您好</view> <view id="mustUpdateTitle">尊敬的家长您好</view>
...@@ -255,3 +268,12 @@ ...@@ -255,3 +268,12 @@
</view> </view>
</view> </view>
</view> </view>
<wxs module="we">
var toFixed = function (value) {
return Math.floor(value);
}
module.exports = {
toFixed :toFixed
}
</wxs>
\ No newline at end of file
.grayBlock{ .grayBlock{
background: #efeff4; background: #e6ece5;
width: 100%; width: 100%;
height: 20rpx; height: 20rpx;
} }
.swiperBox{ .swiperBox{
padding: 30rpx 25rpx; padding: 20rpx 20rpx;
height: 180rpx; height: 180rpx;
background-color: #e6ece5;
} }
.swiperCon{ .swiperCon{
border-radius:20rpx; border-radius:20rpx;
...@@ -14,11 +15,96 @@ ...@@ -14,11 +15,96 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.swiper_box {
position: relative;
}
/*用来包裹所有的小圆点 */
.dots {
width: 100%;
display: flex;
flex-direction: row;
position: absolute;
justify-content: center;
bottom: 35rpx;
}
/*未选中时的小圆点样式 */
.dot {
width: 20rpx;
height: 4rpx;
border-radius: 14rpx;
margin-right: 5rpx;
background-color: rgba(255, 255, 255, 0.5);
}
/*选中以后的小圆点样式 */
.active {
width: 40rpx;
height: 4rpx;
background-color: #fff;
}
#userTab{
display: flex;
background-color: #e6ece5;
padding-top: 30rpx;
position: relative;
}
.userTabItem{
position: relative;
margin-left: 10rpx;
}
.userTabItem image{
width: 200rpx;
height: 60rpx;
display: block;
}
.userTabItem text{
position: absolute;
display: block;
left: 0;
bottom: 0;
width: 100%;
text-align: center;
line-height: 60rpx;
color: #111;
font-size: 28rpx;
}
/* .userTabItem:first-child{
margin-left: -10rpx;
} */
#userCenter{
display: block;
position: absolute;
right: 20rpx;
top: 20rpx;
width: 48rpx;
height: 48rpx;
}
/* 头像设置 */ /* 头像设置 */
#initial{
margin-left: 30rpx;
display: flex;
align-items: center;
}
.initialIcon{
display: inline-block;
width: 22rpx;
height: 22rpx;
font-size: 18rpx;
text-align: center;
line-height: 22rpx;
border-radius: 50%;
background-color: #000;
color: #fff;
}
#userBox{ #userBox{
display: flex; display: flex;
position: relative; position: relative;
padding-left: 50rpx; padding: 10rpx 0 20rpx 50rpx;
border-bottom: 1rpx solid #dfdfdf;
} }
#setBtn{ #setBtn{
height: 36rpx; height: 36rpx;
...@@ -47,65 +133,45 @@ ...@@ -47,65 +133,45 @@
} }
#userDetail{ #userDetail{
font-size: 28rpx; font-size: 28rpx;
color: #A7A7A8; color: #999;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.userDetailLine{ #userDetail text{
margin-right: 10rpx;
}
#userGender{
display: block; display: block;
width: 2rpx; width: 22rpx;
height: 23rpx; height: 22rpx;
background: #A7A7A8; margin-right: 10rpx;
margin: 0 20rpx;
} }
/* 训练计划按钮 */ /* 训练计划按钮 */
#userBtnBox{ #userBtnBox{
padding: 0 25rpx; padding: 30rpx 20rpx;
margin-top: 30rpx;
}
#btnWrap{
display: flex;
justify-content: center;
align-items: center;
font-size: 38rpx;
color: #fff;
padding: 35rpx 0;
background: linear-gradient(to right, #60d4c6, #6be89b);
border-radius:100rpx;
}
#planBtnBox{
display: flex;
align-items: center;
}
#setBtnBox{
display: flex; display: flex;
align-items: center; justify-content: space-between;
border-bottom: 1rpx solid #dfdfdf;
} }
.btnIcon{ #userBtnBox image{
display: block; display: block;
width: 64rpx; width: 345rpx;
height: 64rpx; height: 90rpx;
margin-right: 6rpx;
}
#userBtnBoxLine{
height: 42rpx;
width: 2rpx;
background: #fff;
margin: 0 60rpx;
} }
/* 监控 */ /* 监控 */
.checkCon{ .checkCon{
padding: 50rpx 25rpx 30rpx; padding: 30rpx 20rpx;
} }
.checkDes{ .checkDes{
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding-bottom: 20rpx;
} }
#trainTime{ #trainTime{
color: #4f5051; color: #999;
font-size: 28rpx; font-size: 28rpx;
} }
#powerBox{ #powerBox{
...@@ -114,34 +180,58 @@ ...@@ -114,34 +180,58 @@
} }
#powerBox>image{ #powerBox>image{
display: block; display: block;
width: 36rpx; width: 48rpx;
height: 36rpx; height: 48rpx;
margin-right: 6rpx; margin-left: 10rpx;
} }
.PowerOff{ .PowerOff{
color: #fa6400; color: #10d9b8;
font-size: 32rpx; font-size: 28rpx;
/* text-decoration: underline; */
} }
.checkImg{ .checkImg{
position: relative; position: relative;
} }
.checkImg>image{ /* .checkImg>image{
margin-top: 20rpx;
display: block; display: block;
width: 100%; width: 100%;
height: 392rpx; height: 100rpx;
} */
#checkImgConBox{
position: relative;
} }
.wifi{ #checkImgCon{
display: block;
height: 400rpx;
width: 100%; width: 100%;
color: #bababa; }
font-size: 26rpx; #btn_refresh{
height: 60rpx; width: 48rpx;
line-height: 60rpx; height: 48rpx;
text-align: center; position: absolute;
bottom: 30rpx;
right: 30rpx;
}
#checkImgNo{
position: relative;
}
#checkImgNo>image{
position: relative;
height: 100rpx;
width: 100%;
}
#checkImgNoRefreshBox{
position: absolute; position: absolute;
bottom: 0; bottom: 0;
background: rgba(0, 0, 0, 0.5); width: 100%;
text-align: center;
}
#checkImgNoRefresh{
background: #e6ece5;
border-radius: 10rpx;
padding: 4rpx 10rpx;
color: #10d9b8;
font-size: 28rpx;
} }
/* 目标 */ /* 目标 */
...@@ -181,13 +271,13 @@ ...@@ -181,13 +271,13 @@
.reportTitle{ .reportTitle{
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 25rpx 0; padding: 25rpx 0 10rpx;
} }
.reportTitleLeft,.trainSortTitleLeft,.resultSortTitleLeft{ .reportTitleLeft,.trainSortTitleLeft,.resultSortTitleLeft{
font-size: 38rpx; font-size: 32rpx;
display: flex; display: flex;
align-items:center; align-items:center;
color: #4f5051; color: #111;
} }
.targetHistory,.trainSortTitleRight,.resultSortTitleRight{ .targetHistory,.trainSortTitleRight,.resultSortTitleRight{
display: flex; display: flex;
...@@ -199,23 +289,18 @@ ...@@ -199,23 +289,18 @@
margin-right: 10rpx; margin-right: 10rpx;
} }
.targetHistory>image,.trainSortTitleRight>image,.resultSortTitleRight>image{ .targetHistory>image,.trainSortTitleRight>image,.resultSortTitleRight>image{
width: 36rpx; width: 48rpx;
height: 36rpx; height: 48rpx;
display: block; display: block;
} }
/* 训练报告 */ /* 训练报告 */
.reportDes{
border-bottom: 2rpx solid #E5E5E5;
padding-bottom: 30rpx;
margin-top: 30rpx;
}
#taskComplete{ #taskComplete{
display: flex; display: flex;
align-items: center; align-items: center;
color: #F7B500; color: #F7B500;
font-size: 32rpx; font-size: 32rpx;
margin-bottom: 10rpx; margin-bottom: 20rpx;
} }
#taskComplete>image{ #taskComplete>image{
width: 48rpx; width: 48rpx;
...@@ -225,7 +310,7 @@ ...@@ -225,7 +310,7 @@
#taskNocomplete{ #taskNocomplete{
display: flex; display: flex;
align-items: center; align-items: center;
color: #fa6400; color: #50e3c2;
margin-bottom: 10rpx; margin-bottom: 10rpx;
font-size: 32rpx; font-size: 32rpx;
} }
...@@ -235,28 +320,24 @@ ...@@ -235,28 +320,24 @@
margin-right: 10rpx; margin-right: 10rpx;
} }
#taskNocompleteDes{ #taskNocompleteDes{
color: #4f5051; color: #111;
font-size: 28rpx; font-size: 34rpx;
margin-left: 60rpx;
} }
#taskCompleteDes{ #taskCompleteDes{
color: #4f5051; color: #111;
font-size: 28rpx; font-size: 34rpx;
margin-left: 60rpx;
} }
#taskCompleteDes>text{ #taskCompleteDes>text{
font-size: 36rpx; font-size: 36rpx;
margin: 0 6rpx; margin: 0 6rpx;
} }
.reprotChart{
padding-top: 30rpx;
}
.reprotChartTitle{ .reprotChartTitle{
color: #4f5051; color: #111;
font-size: 28rpx; font-size: 34rpx;
text-align: center; margin-top: 10rpx;
margin-bottom: 20rpx;
} }
.reprotChartTitle>text{ .reprotChartTitle>text{
font-size: 36rpx; font-size: 36rpx;
...@@ -265,28 +346,27 @@ ...@@ -265,28 +346,27 @@
.reprotWeekChart { .reprotWeekChart {
width: 100%; width: 100%;
height: 380rpx; height: 400rpx;
} }
.reprotPieChart { .reprotPieChart {
width: 100%; width: 100%;
height: 540rpx; height: 540rpx;
margin-top: 20rpx; margin-top: 20rpx;
padding-bottom: 30rpx;
} }
.reprotChartSuggest{ .reprotChartSuggest{
border-top: 2rpx solid #E5E5E5;
margin-top: 20rpx;
color: #888; color: #888;
font-size: 28rpx; font-size: 24rpx;
padding-top: 30rpx; padding-top: 10rpx;
} }
.reprotChartSuggestTitle{ .reprotChartSuggestTitle{
font-size: 38rpx; font-size: 28rpx;
color: #4f5051; /* color: #111; */
margin-bottom: 30rpx; margin-bottom: 10rpx;
} }
.adviseItem{ .adviseItem{
display: flex; display: flex;
margin-bottom: 30rpx; margin-bottom: 20rpx;
} }
.adviseItem>image{ .adviseItem>image{
width: 24rpx; width: 24rpx;
...@@ -297,16 +377,16 @@ ...@@ -297,16 +377,16 @@
/* 训练排行 效果排行 */ /* 训练排行 效果排行 */
#trainSort,#resultSort{ #trainSort,#resultSort{
color: #4f5051; color: #666;
font-size: 34rpx; font-size: 32rpx;
} }
.trainSortTitle,.resultSortTitle{ .trainSortTitle,.resultSortTitle{
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 25rpx; padding: 30rpx 20rpx;
} }
.trainSortListItemWrap,.resultSortListItemWrap{ .trainSortListItemWrap,.resultSortListItemWrap{
padding-left: 25rpx; padding: 0 20rpx;
} }
.trainSortListItemLeft, .resultSortListItemLeft{ .trainSortListItemLeft, .resultSortListItemLeft{
display: flex; display: flex;
...@@ -319,20 +399,20 @@ ...@@ -319,20 +399,20 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
border-top: 2rpx solid #E5E5E5; border-top: 1rpx solid #E5E5E5;
padding: 20rpx 25rpx 20rpx 0; padding: 30rpx 20rpx;
} }
.trainSortListItemInfo,.resultSortListItemInfo{ .trainSortListItemInfo,.resultSortListItemInfo{
display: flex; display: flex;
align-items: center; align-items: center;
} }
.trainSortListItemSelf, .resultSortListItemSelf{ .trainSortListItemSelf, .resultSortListItemSelf{
color: #fff; /* background: linear-gradient(to right, #60d4c6, #6be89b); */
background: linear-gradient(to right, #60d4c6, #6be89b); background-color: #dcf9f1;
} }
.trainSortListItemSelf .trainSortListItem,.resultSortListItemSelf .resultSortListItem{ /* .trainSortListItemSelf .trainSortListItem,.resultSortListItemSelf .resultSortListItem{
border: 0; border: 0;
} } */
.trainSortListItemInfo>image, .resultSortListItemInfo>image{ .trainSortListItemInfo>image, .resultSortListItemInfo>image{
width: 50rpx; width: 50rpx;
height: 50rpx; height: 50rpx;
...@@ -360,20 +440,20 @@ ...@@ -360,20 +440,20 @@
#indexBottom{ #indexBottom{
height: 115rpx; height: 115rpx;
width: 100%; width: 100%;
background: #efeff4; background: #e6ece5;
} }
/* 训练成就 */ /* 训练成就 */
#achieve{ #achieve{
color: #555; color: #555;
padding: 0 25rpx; padding: 0 20rpx;
} }
.achieveTitle{ .achieveTitle{
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
font-size: 38rpx; font-size: 32rpx;
align-items:center; align-items:center;
color: #4f5051; color: #111;
padding: 25rpx 0; padding: 25rpx 0;
} }
.achieveTitle>image{ .achieveTitle>image{
...@@ -381,17 +461,26 @@ ...@@ -381,17 +461,26 @@
height: 36rpx; height: 36rpx;
display: block; display: block;
} }
.achieveTime, .achieveChange{ .achieveTime{
font-size: 28rpx; font-size: 34rpx;
padding-top: 10rpx; color: #111;
margin-bottom: 10rpx;
} }
.achieveTime>text, .achieveChange>text{ .achieveTime>text, .achieveChange>text{
font-size: 36rpx; font-size: 36rpx;
margin: 0 10rpx; margin: 0 10rpx;
} }
#suggest{
font-size: 28rpx;
color: #999;
}
.suggestItem{
margin-bottom: 15rpx;
}
.achieveChange{ .achieveChange{
padding-bottom: 35rpx; font-size: 34rpx;
border-bottom: 2rpx solid #e5e5e5; color: #111;
padding-bottom: 20rpx;
} }
.leftEyeChart{ .leftEyeChart{
position: relative; position: relative;
...@@ -409,7 +498,7 @@ ...@@ -409,7 +498,7 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 30rpx 0 0rpx; padding: 20rpx 0 0rpx;
} }
.legend_box{ .legend_box{
display: flex; display: flex;
...@@ -438,8 +527,8 @@ ...@@ -438,8 +527,8 @@
} }
.eyeChartName{ .eyeChartName{
text-align: center; text-align: center;
font-size: 34rpx; font-size: 28rpx;
color: #4f5051; color: #666;
} }
.rightEyeChart{ .rightEyeChart{
padding-bottom: 10rpx; padding-bottom: 10rpx;
......
var app = getApp();
Page({
data: {
trainTip: false,
messageTip: false,
serveTip: false,
isShow: false
},
onLoad() {
let me = this
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'remindings/index',
method: 'POST',
data: {
token: wx.getStorageSync('token')
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
if(res.data.data.smsRemind==1 || res.data.data.wechatRemind==1){
me.setData({
trainTip: true,
isShow: true,
})
}else{
me.setData({
trainTip: false,
isShow: false,
})
}
if(res.data.data.smsRemind==1){//短信提醒状态 1:开启提醒; 0:关闭提醒。
me.setData({
messageTip: true,
})
}else{
me.setData({
messageTip: false,
})
}
if(res.data.data.wechatRemind==1){//微信提醒状态 1:开启提醒; 0:关闭提醒。
me.setData({
serveTip: true,
})
}else{
me.setData({
serveTip: false,
})
}
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
},
// 训练提醒(总开关)
trainTip: function(e) {
let me = this
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
let status = ''
if(e.detail.value){
status = 1
}else{
status = 0
}
wx.request({
url: app.globalData.apiUrl + 'remindings/setRemind',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
type: 3,//提醒类型 1:短信提醒; 2:微信提醒; 3:全部提醒(包括短信和微信)
status: status,//提醒状态 1:开启提醒状态; 0:关闭提醒状态。
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
trainTip: e.detail.value,
messageTip: e.detail.value,
serveTip: e.detail.value,
isShow: e.detail.value
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
},
messageTip: function(e) {
let me = this
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
let status = ''
if(e.detail.value){
status = 1
}else{
status = 0
}
wx.request({
url: app.globalData.apiUrl + 'remindings/setRemind',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
type: 1,//提醒类型 1:短信提醒; 2:微信提醒; 3:全部提醒(包括短信和微信)
status: status,//提醒状态 1:开启提醒状态; 0:关闭提醒状态。
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
messageTip: e.detail.value
})
if(me.data.messageTip || me.data.serveTip){
}else{
me.setData({
trainTip: e.detail.value,
messageTip: e.detail.value,
serveTip: e.detail.value,
isShow: e.detail.value
})
}
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
},
serveTip: function(e) {
let me = this
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
let status = ''
if(e.detail.value){
status = 1
}else{
status = 0
}
wx.request({
url: app.globalData.apiUrl + 'remindings/setRemind',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
type: 2,//提醒类型 1:短信提醒; 2:微信提醒; 3:全部提醒(包括短信和微信)
status: status,//提醒状态 1:开启提醒状态; 0:关闭提醒状态。
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
serveTip: e.detail.value
})
if(me.data.messageTip || me.data.serveTip){
}else{
me.setData({
trainTip: e.detail.value,
messageTip: e.detail.value,
serveTip: e.detail.value,
isShow: e.detail.value
})
}
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
},
})
\ No newline at end of file
{ {
"navigationBarTitleText": "绑定设备", "navigationBarTitleText": "通知提醒",
"usingComponents": {} "usingComponents": {}
} }
\ No newline at end of file
<view id="ruleSet"> <!-- 训练提醒 -->
<!-- 会员卡 --> <view id="trainTip">
<view id="clubCardWrap" hidden="{{true}}">
<view id="clubCard">
<view id="clubCardTop">
<view>
<view id="clubCardTopLeftTitle">我的会员卡</view>
<view id="clubCardScoreLabel">可用积分:<text id="clubCardScore">99999</text></view>
</view>
<image src="../../assets/club_card.png" />
</view>
<view id="clubCardBom">
<image src="../../assets/club_card_QRcode.png" />
<text>点击出示电子会员卡</text>
</view>
</view>
</view>
<!-- 设备编号、网络 -->
<view id="networkInfo">
<view id="networkInfoId">设备编号:{{equipmentId}}</view>
<view id="networkInfoBox">
<text>链接网络:china mobile net 5g</text>
<button id="changeNet" bindtap="changeNet">
<image src="../../assets/wifi.png" />
更改网络
</button>
</view>
</view>
<view id="trainTip">
<view id="trainTipTitle"> <view id="trainTipTitle">
<view id="trainTipLeft">
<image src="../../assets/icon_mine_notice.png" />
<text>训练提醒</text> <text>训练提醒</text>
</view>
<view id="trainTipRight"> <view id="trainTipRight">
<switch color="#33D1C4" checked="{{trainTip}}" bindchange="trainTip"/> <switch color="#33D1C4" checked="{{trainTip}}" bindchange="trainTip"/>
</view> </view>
</view> </view>
</view> </view>
<view id="trainTipBom" hidden="{{!isShow}}"> <view id="trainTipBom" hidden="{{!isShow}}">
<view id="trainTipBomItem"> <view id="trainTipBomItem">
<view class="trainLeft"> <view class="trainLeft">
<image src="../../assets/account_pn.png" /> <image src="../../assets/icon_mine_message.png" />
<text>短信提醒</text> <text>短信提醒</text>
</view> </view>
<view id="trainTipBomRight"> <view id="trainTipBomRight">
...@@ -46,17 +22,11 @@ ...@@ -46,17 +22,11 @@
</view> </view>
<view id="trainTipBomItem"> <view id="trainTipBomItem">
<view class="trainLeft"> <view class="trainLeft">
<image src="../../assets/account_wx.png" /> <image src="../../assets/icon_mine_wechat.png" />
<text>服务号提醒</text> <text>微信提醒</text>
</view> </view>
<view id="trainTipBomRight"> <view id="trainTipBomRight">
<switch color="#33D1C4" checked="{{serveTip}}" bindchange="serveTip"/> <switch color="#33D1C4" checked="{{serveTip}}" bindchange="serveTip"/>
</view> </view>
</view> </view>
</view>
<view id="logoutWrap">
<view id="logoutBox">
<button id="logoutBtn" bindtap='logout'>退出登录</button>
</view>
</view>
</view> </view>
\ No newline at end of file
page{
background-color: #efeff5;
}
/* 训练提醒 */
#trainTip{
padding: 20rpx 30rpx;
background: #fff;
}
#trainTipTitle{
display: flex;
justify-content: space-between;
align-items: center;
font-size: 34rpx;
color: #4F5051;
}
#trainTipLeft{
display: flex;
align-items: center;
}
#trainTipLeft image{
width: 70rpx;
height: 70rpx;
margin-right: 15rpx;
}
switch{
transform:scale(0.9);
}
#trainTipBom{
background: #F8F7F5;
font-size: 34rpx;
color: #4F5051;
}
#trainTipBomItem{
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx 30rpx;
border-top: 1rpx solid #e5e5e5;
}
.trainLeft{
display: flex;
align-items: center;
}
.trainLeft>image{
width: 70rpx;
height: 70rpx;
margin-right: 15rpx;
}
var app = getApp();
Page({ Page({
data: { data: {
teenageName: '小明', teenageName: '',
gender: '男', avatar: "",
age: 9, sn: ''
className: '', },
avatar: "https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJgjIlZNw29LLpbQJYlmjib7AuaqROweKxUib78ibPbp0M6mGKvRXNnpT1M4XkwDwFPAypwOFLXko0zQ/132", onLoad() {
sn: 'sn123541341' let me = this
}, // 请求前加Loading
onReady() { wx.showLoading({
this.setData({ title: '加载中',
className: '无' mask: true
}) })
// setTimeout(function () { wx.request({
// // 获取 chartWeek 实例的方式 url: app.globalData.apiUrl + 'users/personalCenter',
// console.log(chartWeek) method: 'POST',
// }, 2000); data: {
token: wx.getStorageSync('token')
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
avatar: res.data.data.avatar,
teenageName: res.data.data.name,
sn: res.data.data.seexSn,
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}, },
// 解绑 // 解绑
unbundle() { unbundle() {
console.log('解绑') wx.showModal({
title: '删除提示',
content: '删除后无法恢复,是否删除?',
success (res) {
if (res.confirm) {
console.log('用户点击确定')
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'devices/unbind',
method: 'POST',
data: {
token: wx.getStorageSync('token')
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
} else if (res.cancel) {
// console.log('用户点击取消')
}
}
})
},
// 用户
user() {
wx.navigateTo({
url: '/pages/user/user'
})
},
// 通知提醒
message() {
wx.navigateTo({
url: '/pages/message/message'
})
}, },
// 意见与反馈 // 意见与反馈
idea() { idea() {
wx.redirectTo({ wx.navigateTo({
url: '/pages/idea/idea' url: '/pages/idea/idea'
}) })
} },
}) })
\ No newline at end of file
...@@ -4,26 +4,36 @@ ...@@ -4,26 +4,36 @@
</view> </view>
<view id="userInfo"> <view id="userInfo">
<view id="username">{{teenageName}}</view> <view id="username">{{teenageName}}</view>
<view id="userDetail">
<text>{{gender}}</text>
<text class="userDetailLine"></text>
<text>{{age}}岁</text>
<text class="userDetailLine"></text>
<text>{{className}}</text>
</view>
</view> </view>
</view> </view>
<view class="useSettingBox"> <view class="useSettingBox">
<view class="use"> <view class="use">
<image src="../../assets/account_pn.png"></image> <image src="../../assets/icon_mine_device.png"></image>
<text>设备ID:{{sn}}</text> <view class="snCode">设备ID<text>{{sn}}</text></view>
</view>
<view id="unbundleBox" bindtap="unbundle">
<image src="../../assets/icon_unlock.png"></image>
<text>解绑</text>
</view>
</view>
<view class="useSettingBox" bindtap="user">
<view class="use">
<image src="../../assets/icon_mine_user.png"></image>
<text>用户管理</text>
</view>
<image class="arrowDown" src="../../assets/icon_more.png" />
</view>
<view class="useSettingBox" bindtap="message">
<view class="use">
<image src="../../assets/icon_mine_notice.png"></image>
<text>通知提醒</text>
</view> </view>
<text bindtap="unbundle">解绑</text> <image class="arrowDown" src="../../assets/icon_more.png" />
</view> </view>
<view class="useSettingBox" bindtap="idea"> <view class="useSettingBox" bindtap="idea">
<view class="use"> <view class="use">
<image src="../../assets/account_pn.png"></image> <image src="../../assets/icon_mine_feedback.png"></image>
<text>意见反馈</text> <text>意见反馈</text>
</view> </view>
<image class="arrowDown" src="../../assets/arrow_right.png" /> <image class="arrowDown" src="../../assets/icon_more.png" />
</view> </view>
\ No newline at end of file
page{
background-color: #efeff5;
}
/* 头像设置 */ /* 头像设置 */
#userBox{ #userBox{
display: flex; display: flex;
position: relative; position: relative;
padding: 50rpx 0 30rpx 25rpx; padding: 20rpx 30rpx;
background-color: #fff;
} }
#userHead{ #userHead{
display: block; display: block;
height: 120rpx; height: 120rpx;
width: 120rpx; width: 120rpx;
margin-right: 30rpx; margin-right: 20rpx;
border-radius: 50%; border-radius: 50%;
/* overflow: hidden; */ /* overflow: hidden; */
} }
...@@ -19,22 +22,8 @@ ...@@ -19,22 +22,8 @@
justify-content: center; justify-content: center;
} }
#username{ #username{
color: #4f5051; color: #666;
font-size: 38rpx; font-size: 34rpx;
margin-bottom: 10rpx;
}
#userDetail{
font-size: 28rpx;
color: #A7A7A8;
display: flex;
align-items: center;
}
.userDetailLine{
display: block;
width: 2rpx;
height: 23rpx;
background: #A7A7A8;
margin: 0 20rpx;
} }
...@@ -42,21 +31,43 @@ ...@@ -42,21 +31,43 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
font-size: 28rpx; font-size: 34rpx;
color: #A7A7A8; color: #4F5051;
padding: 25rpx; padding: 20rpx 30rpx;
background-color: #fff;
margin-top: 20rpx;
} }
.use{ .use{
display: flex; display: flex;
align-items: center; align-items: center;
} }
.use>image{ .use>image{
width: 50rpx; width: 70rpx;
height: 36rpx; height: 70rpx;
margin-right: 10rpx; margin-right: 15rpx;
} }
.arrowDown{ .arrowDown{
width: 36rpx; width: 48rpx;
height: 36rpx; height: 48rpx;
margin-left: 10rpx; }
.snCode{
display: flex;
align-items: center;
}
.snCode text{
font-size: 28rpx;
color: #999999;
margin-left: 20rpx;
}
#unbundleBox{
display: flex;
align-items: center;
font-size: 34rpx;
color: #33D1C4;
}
#unbundleBox image{
width: 35rpx;
height: 35rpx;
margin-right: 10rpx;
} }
\ No newline at end of file
var app = getApp();
Page({
data: {
status: 2
},
onLoad: function () {
},
// 稍后前往
lastGo: function () {
// 关闭当前页面,跳转到首页
wx.redirectTo({
url: '/pages/index/index'
})
},
// 一键前往
nowGo: function () {
// 关闭当前页面,跳转到 "训练计划"
wx.redirectTo({
url: '/pages/plan/plan'
})
},
})
<view id="mustUpdate">
<view id="mustUpdateBox" wx:if="{{status==1}}">
<!-- 内容 -->
<view id="mustUpdateCon">
<view id="mustUpdateTitle">尊敬的家长您好</view>
<view id="mustUpdateDes">请前往“训练计划”更新训练计划,否则护眼仪将暂时无法正常使用。</view>
</view>
<!-- 按钮组 -->
<view id="mustUpdateBtn">
<text id="lastGoBtn" bindtap="lastGo">稍后前往</text>
<text id="nowGoBtn" bindtap="nowGo">一键前往</text>
</view>
</view>
<view id="mustUpdateBox" wx:else>
<!-- 内容 -->
<view id="mustUpdateCon">
<view id="mustUpdateTitle">尊敬的家长您好</view>
<view id="mustUpdateDes">因您长时间未更新视力信息,眼保仪已被暂时锁定,请您立即前往"训练计划"更新“视力数据”进行解锁!</view>
</view>
<!-- 按钮组 -->
<view id="mustUpdateBtn">
<text id="nowGoBtn" bindtap="nowGo">立即前往</text>
</view>
</view>
</view>
#mustUpdate{
background: rgba(0,0,0,0.5);
min-height: 100vh;
}
#mustUpdateTitle{
font-size: 36rpx;
color: #000000;
padding: 50rpx 0 18rpx;
text-align: center;
}
#mustUpdateDes{
font-size: 30rpx;
color: #888888;
padding: 0 40rpx 30rpx;
text-align: center;
}
#mustUpdateBox{
width: 560rpx;
position: absolute;
left: 50%;
top: 45%;
border-radius: 8rpx;
transform: translate(-50%,-50%);
background: #fff;
}
/* 按钮 */
#mustUpdateBtn{
font-size: 36rpx;
color: #33D1C4;
display: flex;
justify-content: center;
align-items: center;
border-top: 2rpx solid #E5E5E5;
overflow: hidden;
}
#mustUpdateBtn>text{
text-align: center;
width: 49.2%;
padding: 25rpx 0;
}
#lastGoBtn{
border-right: 2rpx solid #E5E5E5;
}
\ No newline at end of file
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
teenageName: '',
avatar: '',
beginTime: '',
endTime: '',
trainingTimes: '',
trainingList: [],
totalDuration: [],
}, },
onLoad: function () { onLoad: function () {
let me = this;
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'Trainings/index',
method: 'POST',
data: {
token: wx.getStorageSync('token')
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
teenageName: res.data.data.teenageName,
avatar: res.data.data.avatar,
beginTime: res.data.data.beginTime,
endTime: res.data.data.endTime,
trainingTimes: res.data.data.trainingTimes,
totalDuration: res.data.data.totalDuration,
trainingList: res.data.data.trainingList,
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}, },
// 更新计划 // 更新计划
update: function () { update: function () {
......
<view id="plan"> <view id="plan">
<!-- 顶部数据 --> <view id="planInfoBox">
<view id="planWrap"> <view id="planInfo">
<view id="planCon"> <view id="planInfoHead">
<view id="planConTitle">训练计划</view> <image id="userHead" src="{{ avatar }}" />
<view class="planConDes">本周(x月x日~x月x日)</view> <view id="username">{{ teenageName }}</view>
<view class="planConDes">每天训练<text>2</text>组,总时长<text>123</text>分钟</view>
<view class="planConDes">其中动态训练<text>2</text>,单词训练<text>123</text>分钟</view>
<view id="planConTip">训练计划随着您的孩子视力情况随机调整,请按时更新孩子视力情况,以便达到最合理的训练安排及最佳的效果哦!</view>
</view>
</view>
<!-- 视力历史 -->
<view id="history">
<view id="historyTitle">视力历史</view>
<view id="historyList">
<view class="historyListItem">
<text>视力情况</text>
<text>左</text>
<text>右</text>
</view>
<view class="historyListItem">
<text>裸眼视力</text>
<text>4.0</text>
<text>4.0</text>
</view>
<view class="historyListItem">
<text>矫正视力</text>
<text>4.5</text>
<text>3.5</text>
</view>
<view class="historyListItem">
<text>眼镜度数</text>
<text>150</text>
<text>200</text>
</view>
<view class="historyListItem">
<text>弱视、散光</text>
<text>有</text>
<text>无</text>
</view> </view>
<view id="planInfoTime">
<view class="planConDes">本周<text>{{beginTime}}~{{endTime}}</text></view>
<view class="planInfoTimeDes">每天训练<text>{{trainingTimes}}</text>组</view>
<view class="planInfoTimeDes">训练总时长<text>{{totalDuration}}</text>分钟</view>
<view class="planInfoTimeDes" wx:for="{{trainingList}}" wx:key>·{{item.type}}<text>{{item.duration}}</text>分钟</view>
</view>
</view>
</view>
<view id="planInfoTip">训练计划随着您的孩子视力情况随机调整,请按时更新孩子视力情况,以便达到最合理的训练安排及最佳的效果!</view>
<view id="planList">
<view class="planListItem">
<view class="planListItemTitle">
<text>第一组</text>
<text>{{trainingList[0].type}}</text>
</view>
<!-- 动态 -->
<view class="planListItemCon" wx:if="{{trainingList[0].type=='动态训练'}}">
<view><image class="planListItemIcon" src="../../assets/pic-dt.png" /></view>
<view class="planListItemText">看视频的同时进行训练,通过丰富的内容画面,模拟真实世界场景,结合设备的远近调节,达到训练10分钟,满足当日长时间望远需要,锻炼睫状肌,缓解疲劳。</view>
</view>
<!-- 静态 -->
<view class="planListItemCon" wx:elif="{{trainingList[0].type=='静态训练'}}">
<view><image class="planListItemIcon" src="../../assets/pic-jt.png" /></view>
<view class="planListItemText">看图片,听音乐进行训练,通过看自然风景,动漫人物, 科幻场景等主题图片来同时锻炼眼外肌和睫状肌的收缩性,改善睫状肌的收缩能力,从而预防和防控近视情况的产生。</view>
</view>
<!-- 单词 -->
<view class="planListItemCon" wx:else>
<view><image class="planListItemIcon" src="../../assets/pic-word.png" /></view>
<view class="planListItemText">学单词的同时进行训练。单词与课本同步,使用艾宾浩斯记忆法,让孩子能够在高效学习单词的同时锻炼睫状肌和外眼肌,保护视力。</view>
</view>
<view class="planListItemTime"><image src="../../assets/icon_traintime.png"></image>训练{{trainingList[0].duration}}分钟</view>
</view>
<view class="planListItem">
<view class="planListItemTitle">
<text>第二组</text>
<text>{{trainingList[1].type}}</text>
</view>
<!-- 动态 -->
<view class="planListItemCon" wx:if="{{trainingList[1].type=='动态训练'}}">
<view><image class="planListItemIcon" src="../../assets/pic-dt.png" /></view>
<view class="planListItemText">看视频的同时进行训练,通过丰富的内容画面,模拟真实世界场景,结合设备的远近调节,达到训练10分钟,满足当日长时间望远需要,锻炼睫状肌,缓解疲劳。</view>
</view>
<!-- 静态 -->
<view class="planListItemCon" wx:elif="{{trainingList[1].type=='静态训练'}}">
<view><image class="planListItemIcon" src="../../assets/pic-jt.png" /></view>
<view class="planListItemText">看图片,听音乐进行训练,通过看自然风景,动漫人物, 科幻场景等主题图片来同时锻炼眼外肌和睫状肌的收缩性,改善睫状肌的收缩能力,从而预防和防控近视情况的产生。</view>
</view>
<!-- 单词 -->
<view class="planListItemCon" wx:else>
<view><image class="planListItemIcon" src="../../assets/pic-word.png" /></view>
<view class="planListItemText">学单词的同时进行训练。单词与课本同步,使用艾宾浩斯记忆法,让孩子能够在高效学习单词的同时锻炼睫状肌和外眼肌,保护视力。</view>
</view>
<view class="planListItemTime"><image src="../../assets/icon_traintime.png"></image>训练{{trainingList[1].duration}}分钟</view>
</view> </view>
</view> </view>
<!-- 按钮组 --> <!-- 按钮组 -->
...@@ -45,3 +65,12 @@ ...@@ -45,3 +65,12 @@
<button id="updatePlan" bindtap='update'>更新计划</button> <button id="updatePlan" bindtap='update'>更新计划</button>
</view> </view>
</view> </view>
<wxs module="we">
var toFixed = function (value) {
return Math.floor(value);
}
module.exports = {
toFixed :toFixed
}
</wxs>
#plan{ #plan{
background: #EFEFF4; background-color: #e6ece5;
min-height: 100vh; min-height: 100vh;
} }
/* 顶部 */
#planWrap{ #planInfoBox{
padding: 30rpx; padding: 20rpx;
}
#planInfo{
background: #fff;
display: flex;
padding: 21rpx 0;
border-radius: 20rpx;
}
#planInfoHead{
padding: 0 40rpx;
border-right: 1rpx solid #E5ECE5;
display: flex;
flex-direction: column;
justify-content: center;
}
#userHead{
display: block;
height: 120rpx;
width: 120rpx;
border-radius: 50%;
} }
#planCon{ #username{
background: #ccc;
padding: 25rpx;
font-size: 28rpx; font-size: 28rpx;
color: #4F5051; color: #4F5051;
border-radius: 10rpx; margin-top: 10rpx;
text-align: center;
}
#planInfoTime{
padding-left: 40rpx;
} }
#planConTitle{ .planConDes{
font-size: 32rpx; font-size: 32rpx;
text-align: center; color: #10D9B8;
padding-top: 20rpx;
} }
.planConDes>text{ .planConDes>text{
font-size: 40rpx; font-size: 28rpx;
margin-left: 20rpx;
}
.planInfoTimeDes{
font-size: 28rpx;
color: #666;
} }
#planConTip{ .planInfoTimeDes text{
padding-top: 30rpx; font-weight: 300;
color: #111;
font-size: 48rpx;
padding: 0 20rpx;
}
#planInfoTip{
font-size: 24rpx; font-size: 24rpx;
color: #666;
padding: 0 20rpx 30rpx;
} }
/* 列表 */ #planList{
#history{ background-color: #fff;
color: #4F5051;
} }
#historyTitle{ .planListItem{
text-align: center; padding: 0 25rpx;
font-size: 26rpx; border-bottom: 1rpx solid #E5ECE5;
} }
.historyListItem{ .planListItemTitle{
border-bottom: 1rpx solid #E5ECE5;
font-size: 32rpx;
color: #111111;
display: flex; display: flex;
justify-content: space-around; justify-content: space-between;
font-size: 24rpx; align-items: center;
padding-top: 15rpx;
}
/* 折线图 */
#eyeChart{
width: 100%;
height: 380rpx;
padding: 30rpx 0; padding: 30rpx 0;
} }
.planListItemCon{
display: flex;
padding: 30rpx 0 20rpx;
}
.planListItemIcon{
display: block;
width: 106rpx;
height: 106rpx;
margin-right: 30rpx;
}
.planListItemText{
font-size: 28rpx;
color: #666;
}
.planListItemTime{
text-align: right;
font-size: 28rpx;
color: #33D1C4;
display: flex;
justify-content: flex-end;
align-items: center;
padding-bottom: 30rpx;
}
.planListItemTime image{
width: 32rpx;
height: 32rpx;
margin-right: 12rpx;
}
/* 按钮 */ /* 按钮 */
#planBtn{ #planBtn{
padding: 75rpx 30rpx 80rpx; padding: 40rpx 50rpx 80rpx;
} }
#updatePlan{ #updatePlan{
background: #33D1C4; background: #33D1C4;
border-radius: 10rpx; border-radius: 47rpx;
font-size: 36rpx; font-size: 36rpx;
color: #FFFFFF; color: #FFFFFF;
height: 94rpx; height: 94rpx;
......
var app = getApp();
Page({
data: {
equipmentId: 'B022I319D384F95',
trainTip: true,
messageTip: true,
serveTip: true,
isShow: true,
},
onLoad: function (options) {
},
// 训练提醒(总开关)
trainTip: function(e) {
this.setData({
trainTip: e.detail.value,
messageTip: e.detail.value,
serveTip: e.detail.value,
isShow: e.detail.value
})
console.log('训练提醒'+this.data.trainTip)
},
messageTip: function(e) {
this.setData({
messageTip: e.detail.value
})
if(this.data.messageTip || this.data.serveTip){
}else{
this.setData({
trainTip: e.detail.value,
messageTip: e.detail.value,
serveTip: e.detail.value,
isShow: e.detail.value
})
}
console.log('短信提醒'+this.data.messageTip)
},
serveTip: function(e) {
this.setData({
serveTip: e.detail.value
})
if(this.data.messageTip || this.data.serveTip){
}else{
this.setData({
trainTip: e.detail.value,
messageTip: e.detail.value,
serveTip: e.detail.value,
isShow: e.detail.value
})
}
console.log('服务号提醒'+this.data.serveTip)
},
// 更改网络
changeNet: function () {
wx.navigateTo({
url: '/pages/network/network'
})
},
// 退出登录
logout: function(e) {
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'users/logout',
method: 'POST',
data: {
token: wx.getStorageSync('token')
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
wx.showToast({
title: '退出登录成功!',
mask: true,
// icon: 'none',
duration: 2000
});
// 关闭所有页面,打开到
wx.reLaunch({
url: '/pages/login/login'
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
},
})
\ No newline at end of file
{
"navigationBarTitleText": "训练设置",
"usingComponents": {}
}
\ No newline at end of file
#ruleSet{
background: #EFEFF4;
min-height: 100vh;
}
#clubCardWrap{
padding: 20rpx 20rpx 0 20rpx;
}
#clubCard{
border-radius: 10rpx;
box-shadow:3px 2px 3px 2px #888;
margin-bottom: 30rpx;
}
#clubCardTop{
padding: 22rpx 24rpx;
position: relative;
background: #333;
color: #d7d7d7;
font-size: 32rpx;
border-top-left-radius: 10rpx;
border-top-right-radius: 10rpx;
}
#clubCardTop>image{
width: 320rpx;
height: 136rpx;
position: absolute;
top: 56rpx;
right: 24rpx;
}
#clubCardTopLeftTitle{
padding-bottom: 30rpx;
}
#clubCardScoreLabel{
font-size: 24rpx;
}
#clubCardScore{
font-size: 32rpx;
}
#clubCardBom{
padding: 20rpx;
color: #333;
font-size: 24rpx;
display: flex;
align-items: center;
background: #d7d7d7;
border-bottom-left-radius: 10rpx;
border-bottom-right-radius: 10rpx;
}
#clubCardBom>image{
height: 60rpx;
width: 60rpx;
margin-right: 24rpx;
}
#networkInfo{
background: #fff;
padding: 20rpx;
}
#networkInfoId{
font-size: 34rpx;
color: #4F5051;
padding: 20rpx 0;
}
#networkInfoBox{
color: #888;
font-size: 28rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
#changeNet{
width: 210rpx;
height: 56rpx;
line-height: 56rpx;
background: #fff;
color: #33D1C4;
border: 2rpx solid #33D1C4;
font-size: 28rpx;
margin:0;
}
#changeNet>image{
width: 24rpx;
height: 24rpx;
}
#trainTip{
padding: 30rpx 25rpx;
background: #fff;
margin-top: 20rpx;
}
#trainTipTitle{
display: flex;
justify-content: space-between;
align-items: center;
font-size: 34rpx;
color: #4F5051;
}
switch{
transform:scale(0.9);
}
#trainTipBom{
background: #fafafc;
padding: 0 25rpx;
font-size: 34rpx;
color: #4F5051;
}
#trainTipBomItem{
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx 0;
border-top: 2rpx solid #e5e5e5;
}
.trainLeft{
display: flex;
align-items: center;
}
.trainLeft>image{
width: 36rpx;
height: 36rpx;
margin-right: 10rpx;
}
/* 退出登录 */
#logoutWrap{
position: absolute;
bottom: 40rpx;
width: 100%;
}
#logoutBox{
padding: 40rpx 30rpx;
}
#logoutBtn{
background: #33D1C4;
border-radius: 10rpx;
font-size: 36rpx;
color: #FFFFFF;
height: 94rpx;
line-height: 94rpx;
}
\ No newline at end of file
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
useArray: ['允许使用','完成当日训练后允许使用','不可使用'], useArray: ['允许使用全部应用','完成训练计划,允许使用应用','不可使用应用'],
useIndex: 0,//使用限制 useIndex: 0,//使用限制
shieldAllArray: ['关闭护眼功能','使用20分钟,强制训练5分钟','使用30分钟,强制训练5分钟','使用40分钟,强制训练5分钟'], shieldArray: ['关闭','使用20分钟,护眼5分钟','使用30分钟,护眼5分钟','使用40分钟,护眼5分钟'],
shieldArray: ['关闭护眼功能','使用20分钟,训练5分钟','使用30分钟,训练5分钟','使用40分钟,训练5分钟'],
shieldIndex: 0,//强制护眼 shieldIndex: 0,//强制护眼
// shieldValue: [0], // shieldValue: [0],
// shield: '', // shield: '',
starting: 0, //开机提醒状态,1、允许、0、不允许
installApp: 0, //安装应用状态,1、允许安装、0、不允许安装 installApp: 0, //安装应用状态,1、允许安装、0、不允许安装
...@@ -23,9 +21,9 @@ Page({ ...@@ -23,9 +21,9 @@ Page({
weakArray: ['关闭','双眼弱视','右眼弱视','左眼弱视'], weakArray: ['关闭','双眼弱视','右眼弱视','左眼弱视'],
weakIndex: 0,//弱视训练 weakIndex: 0,//弱视训练
// shieldAllArray: [{name:'关闭护眼功能'},{name:'使用应用20分钟,强制护眼训练5分钟'},{name:'使用应用30分钟,强制护眼训练5分钟'},{name:'使用应用40分钟,强制护眼训练5分钟'}],//picker 数据 constraintTipShow: false,
// pickerClo: "1",// picker 几列 useLimitShow: false,
installAppTipShow: false,
}, },
onLoad: function () { onLoad: function () {
// this.demopicker = this.selectComponent("#shieldpicker"); // this.demopicker = this.selectComponent("#shieldpicker");
...@@ -36,7 +34,7 @@ Page({ ...@@ -36,7 +34,7 @@ Page({
mask: true mask: true
}) })
wx.request({ wx.request({
url: app.globalData.apiUrl + 'apps/info', url: app.globalData.apiUrl + 'Settings/index',
method: 'POST', method: 'POST',
data: { data: {
token: wx.getStorageSync('token') token: wx.getStorageSync('token')
...@@ -45,11 +43,28 @@ Page({ ...@@ -45,11 +43,28 @@ Page({
// 请求成功后关闭Loading // 请求成功后关闭Loading
wx.hideLoading(); wx.hideLoading();
if(res.data.errno==200){ if(res.data.errno==200){
if(res.data.data.loopTrainingtime==40){
me.setData({
shieldIndex: 3
})
}else if(res.data.data.loopTrainingtime==30){
me.setData({
shieldIndex: 2
})
}else if(res.data.data.loopTrainingtime==20){
me.setData({
shieldIndex: 1
})
}else{
me.setData({
shieldIndex: 0
})
}
me.setData({ me.setData({
useIndex: res.data.data.appManagement-1, useIndex: res.data.data.appLockedStatus-1,
shieldIndex: res.data.data.eyeProtection-1, installApp: res.data.data.moreAppStatus,
installApp: res.data.data.installApp, parallaxIndex: res.data.data.parallaxStatus-1,
// starting: res.data.data.starting weakIndex: res.data.data.redLightStatus-1,
}) })
}else{ }else{
wx.showModal({ wx.showModal({
...@@ -108,17 +123,17 @@ Page({ ...@@ -108,17 +123,17 @@ Page({
title: '加载中', title: '加载中',
mask: true mask: true
}) })
// wx.request({ wx.request({
// url: app.globalData.apiUrl + 'apps/appManagement', url: app.globalData.apiUrl + 'devices/setIntensiveTraining',
// method: 'POST', method: 'POST',
// data: { data: {
// token: wx.getStorageSync('token'), token: wx.getStorageSync('token'),
// status: parallaxStatus status: parallaxStatus
// }, },
// success: function (res) { success: function (res) {
// 请求成功后关闭Loading // 请求成功后关闭Loading
wx.hideLoading(); wx.hideLoading();
// if(res.data.errno==200){ if(res.data.errno==200){
me.setData({ me.setData({
parallaxIndex: parallaxStatus-1 parallaxIndex: parallaxStatus-1
}) })
...@@ -126,21 +141,21 @@ Page({ ...@@ -126,21 +141,21 @@ Page({
wx.showModal({ wx.showModal({
title: '重要提示', title: '重要提示',
showCancel: false, showCancel: false,
content: '训练仅适用于双眼视差大于0.2的情况' content: '视差训练仅适用于双眼视差大于0.2的情况'
}) })
} }
// }else{ }else{
// me.setData({ me.setData({
// parallaxIndex: me.data.parallaxIndex parallaxIndex: me.data.parallaxIndex
// }) })
// wx.showModal({ wx.showModal({
// title: '提示', title: '提示',
// showCancel: false, showCancel: false,
// content: res.data.msg content: res.data.msg
// }) })
// } }
// } }
// }) })
}, },
weakChange: function (e) {// 弱视训练 weakChange: function (e) {// 弱视训练
let me = this, let me = this,
...@@ -152,17 +167,17 @@ Page({ ...@@ -152,17 +167,17 @@ Page({
title: '加载中', title: '加载中',
mask: true mask: true
}) })
// wx.request({ wx.request({
// url: app.globalData.apiUrl + 'apps/appManagement', url: app.globalData.apiUrl + 'devices/setRedLightTraining',
// method: 'POST', method: 'POST',
// data: { data: {
// token: wx.getStorageSync('token'), token: wx.getStorageSync('token'),
// status: weakStatus status: weakStatus
// }, },
// success: function (res) { success: function (res) {
// 请求成功后关闭Loading // 请求成功后关闭Loading
wx.hideLoading(); wx.hideLoading();
// if(res.data.errno==200){ if(res.data.errno==200){
me.setData({ me.setData({
weakIndex: weakStatus-1 weakIndex: weakStatus-1
}) })
...@@ -170,21 +185,21 @@ Page({ ...@@ -170,21 +185,21 @@ Page({
wx.showModal({ wx.showModal({
title: '重要提示', title: '重要提示',
showCancel: false, showCancel: false,
content: '如无弱视情况,请勿开启此训练!' content: '如无弱视情况,请勿开启此训练!\r\n(原理:使用红灯闪烁的方式,激活黄斑区视觉细胞感光能力)'
}) })
} }
// }else{ }else{
// me.setData({ me.setData({
// weakIndex: me.data.weakIndex weakIndex: me.data.weakIndex
// }) })
// wx.showModal({ wx.showModal({
// title: '提示', title: '提示',
// showCancel: false, showCancel: false,
// content: res.data.msg content: res.data.msg
// }) })
// } }
// } }
// }) })
}, },
shieldChange: function (e) {// 强制护眼 shieldChange: function (e) {// 强制护眼
let me = this, let me = this,
...@@ -223,88 +238,6 @@ Page({ ...@@ -223,88 +238,6 @@ Page({
} }
}) })
}, },
// 训练提醒(总开关)
trainTip: function(e) {
this.setData({
trainTip: e.detail.value,
messageTip: e.detail.value,
serveTip: e.detail.value,
isShow: e.detail.value
})
console.log('训练提醒'+this.data.trainTip)
},
messageTip: function(e) {
this.setData({
messageTip: e.detail.value
})
if(this.data.messageTip || this.data.serveTip){
}else{
this.setData({
trainTip: e.detail.value,
messageTip: e.detail.value,
serveTip: e.detail.value,
isShow: e.detail.value
})
}
console.log('短信提醒'+this.data.messageTip)
},
serveTip: function(e) {
this.setData({
serveTip: e.detail.value
})
if(this.data.messageTip || this.data.serveTip){
}else{
this.setData({
trainTip: e.detail.value,
messageTip: e.detail.value,
serveTip: e.detail.value,
isShow: e.detail.value
})
}
console.log('服务号提醒'+this.data.serveTip)
},
starting: function (e) {// 开机提醒
console.log('开机提醒', e.detail.value)
let me = this,
startingStatus = 0;
if(e.detail.value){
// 安装应用状态,1、允许安装、0、不允许安装
startingStatus = 1
}else{
startingStatus = 0
}
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
// wx.request({
// url: app.globalData.apiUrl + 'apps/installApp',
// method: 'POST',
// data: {
// token: wx.getStorageSync('token'),
// status: startingStatus
// },
// success: function (res) {
// // 请求成功后关闭Loading
wx.hideLoading();
// if(res.data.errno==200){
me.setData({
starting: startingStatus
})
// }else{
// me.setData({
// starting: me.data.starting
// })
// wx.showModal({
// title: '提示',
// showCancel: false,
// content: res.data.msg
// })
// }
// }
// })
},
installApp: function (e) {// 安装应用 installApp: function (e) {// 安装应用
console.log('安装应用', e.detail.value) console.log('安装应用', e.detail.value)
let me = this, let me = this,
...@@ -349,26 +282,35 @@ Page({ ...@@ -349,26 +282,35 @@ Page({
}, },
// 使用限制疑问 // 使用限制疑问
useLimit: function () { useLimit: function () {
wx.showModal({ this.setData({
title: '提示', useLimitShow: true
showCancel: false, })
content: '您可以根据情况设置是否完成训练计划才可以使用其他应用或功能' },
closeUseLimit: function () {
this.setData({
useLimitShow: false
}) })
}, },
// 强制护眼疑问 // 强制护眼疑问
constraint: function () { constraint: function () {
wx.showModal({ this.setData({
title: '提示', constraintTipShow: true
showCancel: false, })
content: '您可以根据选项设置使用时长的强制护眼训练' },
closeConstraintTip: function () {
this.setData({
constraintTipShow: false
}) })
}, },
// 安装应用疑问 // 安装应用疑问
installAppTip: function () { installAppTip: function () {
wx.showModal({ this.setData({
title: '提示', installAppTipShow: true
showCancel: false, })
content: '打开该设置可以允许自主下载更多应用' },
closeInstallAppTip: function () {
this.setData({
installAppTipShow: false
}) })
}, },
toWhiteList: function(e) { toWhiteList: function(e) {
...@@ -408,5 +350,4 @@ Page({ ...@@ -408,5 +350,4 @@ Page({
// // this.demopicker.hiddePicker(); // // this.demopicker.hiddePicker();
// }, // },
}) })
...@@ -3,72 +3,43 @@ ...@@ -3,72 +3,43 @@
<view class="useSetting"> <view class="useSetting">
<view class="useSettingTip" bindtap='useLimit'> <view class="useSettingTip" bindtap='useLimit'>
<text class="useSettingTitle">使用限制</text> <text class="useSettingTitle">使用限制</text>
<view class="useSettingTipIcon">
<image src="../../assets/tips.png" /> <image src="../../assets/tips.png" />
<view class='invite' hidden="{{!useLimitShow}}">
您可以设置是否完成训练计划后,才允许使用「娱乐」「游戏」「视频」等应用
</view>
</view>
</view> </view>
<picker bindchange="useChange" value="{{useIndex}}" range="{{useArray}}"> <picker bindchange="useChange" value="{{useIndex}}" range="{{useArray}}">
<view class="useSettingBox"> <view class="useSettingBox">
<view class="use">{{useArray[useIndex]}}</view> <view class="use">{{useArray[useIndex]}}</view>
<image class="arrowDown" src="../../assets/arrow_right.png" /> <image class="arrowDown" src="../../assets/icon_more.png" />
</view> </view>
</picker> </picker>
</view> </view>
<view class="useSetting"> <view class="useSetting">
<view class="useSettingTip" bindtap='constraint'> <view class="useSettingTip" bindtap='constraint'>
<text class="useSettingTitle">强制护眼</text> <text class="useSettingTitle">强制护眼</text>
<view class="useSettingTipIcon">
<image src="../../assets/tips.png" /> <image src="../../assets/tips.png" />
<view class='invite' hidden="{{!constraintTipShow}}">
未训练的使用时长达到设定时间后,系统将自动进行护眼训练
</view>
</view> </view>
<picker bindchange="shieldChange" value="{{shieldIndex}}" range="{{shieldAllArray}}"> </view>
<picker bindchange="shieldChange" value="{{shieldIndex}}" range="{{shieldArray}}">
<view class="useSettingBox"> <view class="useSettingBox">
<view class="use">{{shieldArray[shieldIndex]}}</view> <view class="use">{{shieldArray[shieldIndex]}}</view>
<image class="arrowDown" src="../../assets/arrow_right.png" /> <image class="arrowDown" src="../../assets/icon_more.png" />
</view> </view>
</picker> </picker>
<!-- <view class="useSettingBox" catchtap="shieldTap">
<view class="use">{{shieldArray[shieldValue]}}</view>
<image class="arrowDown" src="../../assets/arrow_right.png" />
<my-picker id='shieldpicker' column="{{pickerClo}}" list="{{shieldAllArray}}" value="{{shieldValue}}" bind:confirm='confirm'></my-picker>
</view> -->
</view>
<!-- 开机提醒 -->
<view class="useSetting useSettingInstall">
<text class="useSettingTitle">开机提醒</text>
<switch color="#33D1C4" checked="{{starting==1}}" bindchange="starting"/>
</view>
<!-- 训练提醒 -->
<view id="trainTip">
<view id="trainTipTitle">
<text>训练提醒</text>
<view id="trainTipRight">
<switch color="#33D1C4" checked="{{trainTip}}" bindchange="trainTip"/>
</view>
</view>
</view>
<view id="trainTipBom" hidden="{{!isShow}}">
<view id="trainTipBomItem">
<view class="trainLeft">
<image src="../../assets/account_pn.png" />
<text>短信提醒</text>
</view>
<view id="trainTipBomRight">
<switch color="#33D1C4" checked="{{messageTip}}" bindchange="messageTip"/>
</view>
</view>
<view id="trainTipBomItem">
<view class="trainLeft">
<image src="../../assets/account_wx.png" />
<text>服务号提醒</text>
</view>
<view id="trainTipBomRight">
<switch color="#33D1C4" checked="{{serveTip}}" bindchange="serveTip"/>
</view>
</view>
</view> </view>
<view class="useSetting parallaxBox"> <view class="useSetting parallaxBox">
<text class="useSettingTitle">视差训练</text> <text class="useSettingTitle">视差训练</text>
<picker bindchange="parallaxChange" value="{{parallaxIndex}}" range="{{parallaxArray}}"> <picker bindchange="parallaxChange" value="{{parallaxIndex}}" range="{{parallaxArray}}">
<view class="useSettingBox"> <view class="useSettingBox">
<view class="use">{{parallaxArray[parallaxIndex]}}</view> <view class="use">{{parallaxArray[parallaxIndex]}}</view>
<image class="arrowDown" src="../../assets/arrow_right.png" /> <image class="arrowDown" src="../../assets/icon_more.png" />
</view> </view>
</picker> </picker>
</view> </view>
...@@ -77,14 +48,19 @@ ...@@ -77,14 +48,19 @@
<picker bindchange="weakChange" value="{{weakIndex}}" range="{{weakArray}}"> <picker bindchange="weakChange" value="{{weakIndex}}" range="{{weakArray}}">
<view class="useSettingBox"> <view class="useSettingBox">
<view class="use">{{weakArray[weakIndex]}}</view> <view class="use">{{weakArray[weakIndex]}}</view>
<image class="arrowDown" src="../../assets/arrow_right.png" /> <image class="arrowDown" src="../../assets/icon_more.png" />
</view> </view>
</picker> </picker>
</view> </view>
<view class="useSetting useSettingInstall"> <view class="useSetting useSettingInstall">
<view class="useSettingTip" bindtap='installAppTip'> <view class="useSettingTip" bindtap='installAppTip'>
<text class="useSettingTitle">允许自由安装更多应用</text> <text class="useSettingTitle">允许自由安装更多应用</text>
<view class="useSettingTipIcon">
<image src="../../assets/tips.png" /> <image src="../../assets/tips.png" />
<view class='inviteSmall' hidden="{{!installAppTipShow}}">
打开该设置可以允许自主下载更多应用
</view>
</view>
</view> </view>
<switch color="#33D1C4" checked="{{installApp==1}}" bindchange="installApp"/> <switch color="#33D1C4" checked="{{installApp==1}}" bindchange="installApp"/>
</view> </view>
...@@ -113,5 +89,7 @@ ...@@ -113,5 +89,7 @@
<view id="settingBtn"> <view id="settingBtn">
<button id="settingDone" bindtap='settingDone'>保存</button> <button id="settingDone" bindtap='settingDone'>保存</button>
</view> </view>
<!-- <navigator hover-class="none" target="miniProgram" open-type="exit"> 退出当前小程序</navigator> --> <view class="dialogBg" hidden="{{!useLimitShow}}" bindtap="closeUseLimit"></view>
<view class="dialogBg" hidden="{{!constraintTipShow}}" bindtap="closeConstraintTip"></view>
<view class="dialogBg" hidden="{{!installAppTipShow}}" bindtap="closeInstallAppTip"></view>
</view> </view>
\ No newline at end of file
...@@ -10,7 +10,11 @@ ...@@ -10,7 +10,11 @@
background: #fff; background: #fff;
margin-bottom: 21rpx; margin-bottom: 21rpx;
} }
.useSettingTip>image{ .useSettingTipIcon{
display: inline;
position: relative;
}
.useSettingTipIcon>image{
width: 29rpx; width: 29rpx;
height: 29rpx; height: 29rpx;
margin-left: 7rpx; margin-left: 7rpx;
...@@ -33,8 +37,8 @@ ...@@ -33,8 +37,8 @@
color: #A7A7A8; color: #A7A7A8;
} }
.arrowDown{ .arrowDown{
width: 36rpx; width: 48rpx;
height: 36rpx; height: 48rpx;
margin-left: 10rpx; margin-left: 10rpx;
} }
switch{ switch{
...@@ -77,8 +81,8 @@ switch{ ...@@ -77,8 +81,8 @@ switch{
border-bottom: 4rpx solid #33D1C4; border-bottom: 4rpx solid #33D1C4;
} }
.whiteListTabItem>image{ .whiteListTabItem>image{
width: 60rpx; width: 64rpx;
height: 60rpx; height: 54rpx;
margin-bottom: 6rpx; margin-bottom: 6rpx;
} }
.centerTabItem{ .centerTabItem{
...@@ -100,42 +104,66 @@ switch{ ...@@ -100,42 +104,66 @@ switch{
line-height: 94rpx; line-height: 94rpx;
} }
/* 训练提醒 */ .dialogBg{
#trainTip{ position: absolute;
padding: 30rpx 25rpx; z-index: 1;
background: #fff; top: 0;
} left: 0;
#trainTipTitle{ bottom: 0;
display: flex; right: 0;
justify-content: space-between;
align-items: center;
font-size: 34rpx;
color: #4F5051;
}
switch{
transform:scale(0.9);
} }
#trainTipBom{ .invite {
background: #fafafc; /* display: none; */
padding: 0 25rpx; width: 450rpx;
font-size: 34rpx; font-size: 25rpx;
color: #4F5051; /* height: 50rpx; */
} line-height: 50rpx;
#trainTipBomItem{ padding-left: 20rpx;
display: flex; position: absolute;
justify-content: space-between; background-color: #FFF0F5;
align-items: center; border: 1px solid #FFB5C5;
padding: 30rpx 0; border-radius: 5px;
border-top: 2rpx solid #e5e5e5; top: 50rpx;
left: -10rpx;
z-index: 2;
}
.invite:after {
content: '';
width: 20rpx;
height: 20rpx;
position: absolute;
top: -11rpx;
left: 20rpx;
transform: rotate(45deg);
background-color: #FFF0F5;
border: 1px #FFB5C5;
border-style: solid none none solid ;
}
.inviteSmall {
/* display: none; */
width: 300rpx;
font-size: 25rpx;
/* height: 50rpx; */
line-height: 50rpx;
padding-left: 20rpx;
position: absolute;
background-color: #FFF0F5;
border: 1px solid #FFB5C5;
border-radius: 5px;
top: 50rpx;
left: -10rpx;
z-index: 2;
}
.inviteSmall:after {
content: '';
width: 20rpx;
height: 20rpx;
position: absolute;
top: -11rpx;
left: 20rpx;
transform: rotate(45deg);
background-color: #FFF0F5;
border: 1px #FFB5C5;
border-style: solid none none solid ;
} }
.trainLeft{
display: flex;
align-items: center;
}
.trainLeft>image{
width: 36rpx;
height: 36rpx;
margin-right: 10rpx;
}
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
equipmentId: '' sortList: [],
noThreeSortList: [],
}, },
onLoad: function (options) { onLoad: function () {
console.log(options.equipmentId)
this.setData({
equipmentId: options.equipmentId
})
},
noBind: function() {
// 暂不绑定,关闭所有页面,返回扫码页面
wx.reLaunch({
url: '/pages/getCodeIndex/getCodeIndex'
})
},
bindEquipment: function() {
let me = this; let me = this;
// 请求前加Loading // 请求前加Loading
wx.showLoading({ wx.showLoading({
...@@ -23,26 +12,19 @@ Page({ ...@@ -23,26 +12,19 @@ Page({
mask: true mask: true
}) })
wx.request({ wx.request({
url: app.globalData.apiUrl + 'devices/bind', url: app.globalData.apiUrl + 'ranks/effectedRanking',
method: 'POST', method: 'POST',
data: { data: {
token: wx.getStorageSync('token'), token: wx.getStorageSync('token')
seexSn: me.data.equipmentId
}, },
success: function (res) { success: function (res) {
// 请求成功后关闭Loading // 请求成功后关闭Loading
wx.hideLoading(); wx.hideLoading();
if(res.data.errno==200){ if(res.data.errno==200){
// 绑定成功 let newArr = res.data.data.filter(item => item.ranking > 3)
wx.showToast({ me.setData({
title: '绑定成功', sortList: res.data.data,
mask: true, noThreeSortList: newArr,
// icon: 'none',
duration: 2000
});
//跳转完善信息
wx.navigateTo({
url: '/pages/childInfo/childInfo'
}) })
}else{ }else{
wx.showModal({ wx.showModal({
...@@ -53,5 +35,5 @@ Page({ ...@@ -53,5 +35,5 @@ Page({
} }
} }
}) })
} },
}) })
\ No newline at end of file
{ {
"navigationBarTitleText": "扫码绑定", "navigationBarTitleText": "光明之星",
"usingComponents": {} "usingComponents": {}
} }
\ No newline at end of file
<view id="sortBg">
<view id="sortTop">
<view id="sortTop2" class="sortTopItem" wx:if="{{sortList[1]}}">
<image src="{{sortList[1].avatar}}"></image>
<view class="sortPlanName">{{sortList[1].name}}</view>
</view>
<view id="sortTop2" class="sortTopItem" wx:if="{{!sortList[1]}}">
</view>
<view id="sortTop1" class="sortTopItem" wx:if="{{sortList[0]}}">
<image src="{{sortList[0].avatar}}"></image>
<view class="sortPlanName">{{sortList[0].name}}</view>
</view>
<view id="sortTop1" class="sortTopItem" wx:if="{{!sortList[0]}}">
</view>
<view id="sortTop3" class="sortTopItem" wx:if="{{sortList[2]}}">
<image src="{{sortList[2].avatar}}"></image>
<view class="sortPlanName">{{sortList[2].name}}</view>
</view>
<view id="sortTop3" class="sortTopItem" wx:if="{{!sortList[2]}}">
</view>
<image id="sortPlanBg" src="../../assets/kv_star.png"></image>
</view>
<view id="sortList">
<view class="sortListItem" wx:for="{{noThreeSortList}}" wx:key="{{index}}">
<view class="sortListItemInfo">
<text>{{item.ranking}}</text>
<image src="{{item.avatar}}"></image>
<view>{{item.name}}</view>
</view>
<view class="sortListItemTime">
<image src="../../assets/up.png"></image>
<text>{{item.degree}}</text>
<text class="sortListItemEye">{{item.promoteMode}}</text>
</view>
</view>
</view>
<view id="sortListBom"></view>
</view>
#sortBg{
background-color: #e6ece5;
min-height: 100vh;
}
#sortTop{
display: flex;
justify-content: center;
position: relative;
padding-top: 60rpx;
height: 306rpx;
}
.sortTopItem{
text-align: center;
font-size: 24rpx;
color: #666666;
z-index: 1;
}
.sortTopItem image{
height: 120rpx;
width: 120rpx;
border-radius: 50%;
}
.sortPlanName{
font-size: 28rpx;
color: #111111;
}
#sortTop1{
width: 180rpx;
}
#sortTop2{
width: 170rpx;
}
#sortTop3{
width: 170rpx;
padding-top: 30rpx;
}
#sortTop1 image{
margin-top: -30rpx;
}
#sortPlanBg{
display: block;
width: 100%;
height: 366rpx;
position: absolute;
top: 0;
left: 0;
}
/* 4名以后 */
#sortList{
padding: 0 30rpx;
background: #F8F7F5;
}
.sortListItem{
display: flex;
align-items: center;
justify-content: space-between;
font-size: 34rpx;
color: #4F5051;
padding: 30rpx 0;
border-bottom: 1rpx solid #e5e5e5;
}
.sortListItemInfo{
display: flex;
align-items: center;
}
.sortListItemInfo text{
width: 44rpx;
margin-right: 10rpx;
}
.sortListItemInfo image{
height: 50rpx;
width: 50rpx;
border-radius: 50%;
margin-right: 20rpx;
}
/* .sortListItemTime{
text-align: right;
} */
.sortListItemTime image{
display: inline-block;
width: 26rpx;
height: 24rpx;
margin-right: 10rpx;
}
.sortListItemEye{
font-size: 24rpx;
color: #4F5051;
margin-left: 10rpx;
}
#sortListBom{
height: 20rpx;
}
\ No newline at end of file
var app = getApp();
import * as echarts from '../../component/ec-canvas/echarts';
// 柱状图
let xDataList = []
let yDataList = []
function setOption(chart, xdata, ydata) {
var option = {
color: ['#54585f'],
tooltip: {
show: false
},
animation: false,
grid: {
left: 5,
right: 5,
bottom: 5,
top: 20,
// show: true,
containLabel: true,
// borderColor: '#c9f1ce'
},
xAxis: [
{
type: 'category',
data: xdata,
axisLine: {
lineStyle: {
color: '#c9f1ce'
}
},
axisTick:{
length:0
},
axisLabel: {
color: '#4F5051',
fontSize: 11,
lineHeight: 15
}
}
],
yAxis: [
{
type: 'value',
interval: 10,//强制间隔
axisTick: { show: false },
axisLine: {
show: false //是否显示轴线
},
splitLine:{
lineStyle:{
color: ['#c9f1ce'],
width: 1
}
},
axisLabel: {
color: '#4F5051',
fontSize: 11
}
}
],
series: [
{
type: 'bar',
// silent: true,//不响应和触发鼠标事件
hoverAnimation: false,//是否开启 hover 在拐点标志上的提示动画效果。
label: {
normal: {
show: true,
position: 'top',
// position: 'inside',
// offset: [0,-6],
color: '#60d4c6',
// formatter: function (params) {
// if (params.value > 0) {
// return params.value;
// } else {
// return '';
// }
// }
}
},
itemStyle: {
normal: {
// color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
// offset: 0,
// color: "#60d4c6" // 0% 处的颜色
// },{
// offset: 1,
// color: "#6be89b" // 100% 处的颜色
// }], false),
color: '#10D9B8',
barBorderRadius: [3, 3, 0, 0] //(顺时针左上,右上,右下,左下)
}
},
data: ydata
}
]
};
chart.setOption(option)
}
Page({
data: {
trainList: [
// { id: 1,ci:'5', time: "5月27日至5月20日", complete: false, xDataList: ['周日\n5.27', '周一\n5.26', '周二\n5.25', '周三\n5.24', '周四\n5.23', '周五\n5.22', '周六\n5.21'] ,yDataList: [3, 30, 3, 45, 37, 2, 20] },
// { id: 2,ci:'4', time: "5月20日至5月13日", complete: true,xDataList: ['周日\n5.20', '周一\n5.19', '周二\n5.18', '周三\n5.17', '周四\n5.16', '周五\n5.15', '周六\n5.14'] ,yDataList: [13, 21, 15, 15, 27, 12, 10] },
// { id: 3,ci:'3', time: "5月13日至5月6日", complete: false,xDataList: ['周日\n5.13', '周一\n5.12', '周二\n5.11', '周三\n5.10', '周四\n5.9', '周五\n5.8', '周六\n5.7'] ,yDataList: [3, 30, 3, 45, 37, 2, 20] },
// { id: 4,ci:'2', time: "5月6日至5月1日", complete: true,xDataList: ['周日\n5.6', '周一\n5.5', '周二\n5.4', '周三\n5.3', '周四\n5.2', '周五\n5.1', '周六\n4.30'] ,yDataList: [30, 3, 35, 45, 17, 22, 0] },
// { id: 5,ci:'1', time: "4月30日至4月23日", complete: false,xDataList: ['周日\n4.30', '周一\n4.29', '周二\n4.28', '周三\n4.27', '周四\n4.26', '周五\n4.25', '周六\n4.24'] ,yDataList: [3, 30, 3, 45, 37, 2, 20] },
],
// interval: 5000,
weekChart: {
// onInit: weekInitChart,
lazyLoad: true
},
// current: '',
currentPage: 1,
isLoading: false,
},
onLoad() {
let me = this;
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'Reports/history',
method: 'POST',
data: {
token: wx.getStorageSync('token')
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
trainList: res.data.data.list
})
for(let i=0;i<me.data.trainList.length;i++){
console.log(me.data.trainList[i].historyId)
me.selectComponent('#mychart-'+i).init((canvas, width, height) => {
const chart = echarts.init(canvas, null, {
width: width,
height: height
});
setOption(chart, me.data.trainList[i].dayTrainingTitleList, me.data.trainList[i].dayTrainingDurationList)
me.chart = chart;
return chart;
});
}
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
},
detail(e){
// console.log(e.currentTarget.dataset.id)
wx.navigateTo({
url: '/pages/historyDetail/historyDetail?historyId='+e.currentTarget.dataset.id
})
},
onPullDownRefresh:function(){
wx.stopPullDownRefresh();//停止当前页面下拉刷新。
},
onReachBottom() {
// 上拉触底
let me = this
console.log('上拉触底')
me.setData({
isLoading: true,
currentPage: me.data.currentPage+1
})
wx.request({
url: app.globalData.apiUrl + 'Reports/history',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
page: me.data.currentPage
},
success: function (res) {
if(res.data.errno==200){
let newList = res.data.data.list
if(!newList){
me.setData({
isLoading: false
})
return
}
me.setData({
isLoading: false,
trainList: me.data.trainList.concat(newList)
})
console.log(me.data.trainList.length-newList.length)
for(let i=me.data.trainList.length-1;i>me.data.trainList.length-newList.length-1;i--){
me.selectComponent('#mychart-'+i).init((canvas, width, height) => {
const chart = echarts.init(canvas, null, {
width: width,
height: height
});
setOption(chart, me.data.trainList[i].dayTrainingTitleList, me.data.trainList[i].dayTrainingDurationList)
me.chart = chart;
return chart;
});
}
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
},
})
\ No newline at end of file
{
"navigationBarTitleText": "训练报告",
"usingComponents": {
"ec-canvas": "../../component/ec-canvas/ec-canvas"
},
"enablePullDownRefresh": true
}
\ No newline at end of file
<view id="reportBox">
<view class="reportItem" wx:for="{{trainList}}" wx:key="{{index}}" data-id="{{item.historyId}}" bindtap="detail">
<view class="reportItemTop">
<view class="reportItemTopTime">
第{{item.weekNumber}}周
<text>{{item.beginDay}}~{{item.endDay}}</text>
</view>
<view id="taskComplete" wx:if="{{ item.finishedStatus==1 }}">
目标达成
<image src="../../assets/task_complete.png" />
</view>
<view id="taskNocomplete" wx:else>
未达成
<image src="../../assets/task_incomplete.png" />
</view>
</view>
<view class="reportItemBox">
<view class="reportItemDes">训练分{{item.trainingTimes}}组,共计 <text>{{we.toFixed(item.weekDuration/60)}}</text> 分钟</view>
<view class="reportItemDes">本次视力 <text>{{item.nowVision}}</text></view>
<view class="reprotWeekChart">
<ec-canvas id="mychart-{{index}}" ec="{{ weekChart }}"></ec-canvas>
</view>
<view class="reportItemChartText">
<view wx:for="{{item.typeTrainingList}}" wx:key>
<text class="dot"></text>
{{item.title}} {{item.trainingDuration}}%
</view>
</view>
</view>
</view>
<view class="loadingBottom" hidden="{{!isLoading}}">
<image src="../../assets/loading.gif"></image>
<text>加载中</text>
</view>
</view>
<wxs module="we">
var toFixed = function (value) {
return Math.floor(value);
}
module.exports = {
toFixed :toFixed
}
</wxs>
page{
background-color: #e6ece5;
}
#reportBox{
padding: 40rpx 20rpx 0;
}
.reportItem{
padding-bottom: 40rpx;
}
.reportItemBox{
background: #fff;
border-radius: 20rpx;
padding: 30rpx 20rpx;
}
.reportItemTop{
display: flex;
justify-content: space-between;
font-size: 38rpx;
color: #111111;
padding-bottom: 30rpx;
}
.reportItemTopTime{
padding-left: 10rpx;
}
.reportItemTopTime text{
font-size: 28rpx;
color: #666;
margin-left: 20rpx;
}
.reportItemDes{
font-size: 38rpx;
color: #111111;
}
.reportItemDes:first-child{
padding-bottom: 20rpx;
}
.reportItemDes text{
color: #000000;
}
.reprotWeekChart {
width: 100%;
height: 420rpx;
}
.reportItemChartText{
font-size: 22rpx;
text-align: center;
color: #10D9B8;
padding-top: 20rpx;
}
.reportItemChartText view{
display: inline-block;
padding-bottom: 10rpx;
}
.dot{
display: inline-block;
height: 12rpx;
width: 12rpx;
background: #10D9B8;
border-radius: 6rpx;
margin: 0 10rpx 0 30rpx;
}
#taskComplete{
display: flex;
align-items: center;
color: #F7B500;
font-size: 28rpx;
margin-bottom: 10rpx;
background: #fff;
padding: 0 28rpx;
border-radius: 34px;
}
#taskComplete>image{
width: 48rpx;
height: 48rpx;
margin-left: 10rpx;
}
#taskNocomplete{
display: flex;
align-items: center;
color: #10D9B8;
margin-bottom: 10rpx;
font-size: 28rpx;
background: #fff;
padding: 0 28rpx;
border-radius: 34px;
}
#taskNocomplete>image{
width: 48rpx;
height: 48rpx;
margin-left: 10rpx;
}
/* loading */
.loadingBottom{
display: flex;
justify-content: center;
align-items: center;
}
.loadingBottom>image{
width: 30rpx;
height: 30rpx;
}
.loadingBottom>text{
margin-left: 10rpx;
color: #999;
}
\ No newline at end of file
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
SN: '' sortList: [],
noThreeSortList: [],
userTraining: '',
userRanking: '',
avatar: '',
name: '',
}, },
onLoad: function () { onLoad: function () {
},
// sn码
snChange: function(e) {
this.setData({
SN: e.detail.value
})
},
// 开始绑定
bind: function(e) {
let me = this; let me = this;
console.log(me.data.SN)
if(me.data.SN==''){
wx.showModal({
title: '提示',
showCancel: false,
content: 'SN码不能为空!'
})
return
}
// 请求前加Loading // 请求前加Loading
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',
mask: true mask: true
}) })
wx.request({ wx.request({
url: app.globalData.apiUrl + 'devices/bind', url: app.globalData.apiUrl + 'ranks/trainRanking',
method: 'POST', method: 'POST',
data: { data: {
token: wx.getStorageSync('token'), token: wx.getStorageSync('token')
seexSn: me.data.SN
}, },
success: function (res) { success: function (res) {
// 请求成功后关闭Loading // 请求成功后关闭Loading
wx.hideLoading(); wx.hideLoading();
if(res.data.errno==200){ if(res.data.errno==200){
// 绑定成功 let newArr = res.data.data.rankList.filter(item => item.ranking > 3)
wx.showToast({ me.setData({
title: '绑定成功', userTraining: res.data.data.userTraining,
mask: true, userRanking: res.data.data.userRanking,
// icon: 'none', sortList: res.data.data.rankList,
duration: 2000 noThreeSortList: newArr,
}); name: res.data.data.name,
wx.navigateTo({ avatar: res.data.data.avatar,
url: '/pages/network/network'
}) })
}else{ }else{
wx.showModal({ wx.showModal({
...@@ -58,5 +43,5 @@ Page({ ...@@ -58,5 +43,5 @@ Page({
} }
} }
}) })
} },
}) })
\ No newline at end of file
{ {
"navigationBarTitleText": "绑定设备", "navigationBarTitleText": "训练排行",
"usingComponents": {} "usingComponents": {}
} }
\ No newline at end of file
<view id="sortBg">
<view id="sortTop">
<view id="sortTop2" class="sortTopItem" wx:if="{{sortList[1]}}">
<image src="{{sortList[1].avatar}}"></image>
<view class="sortPlanName">{{sortList[1].name}}</view>
<view>训练{{we.toFixed(sortList[1].duration/60)}}分钟</view>
</view>
<view id="sortTop2" class="sortTopItem" wx:if="{{!sortList[1]}}">
</view>
<view id="sortTop1" class="sortTopItem" wx:if="{{sortList[0]}}">
<image src="{{sortList[0].avatar}}"></image>
<view class="sortPlanName">{{sortList[0].name}}</view>
<view>训练{{we.toFixed(sortList[0].duration/60)}}分钟</view>
</view>
<view id="sortTop1" class="sortTopItem" wx:if="{{!sortList[0]}}">
</view>
<view id="sortTop3" class="sortTopItem" wx:if="{{sortList[2]}}">
<image src="{{sortList[2].avatar}}"></image>
<view class="sortPlanName">{{sortList[2].name}}</view>
<view>训练{{we.toFixed(sortList[2].duration/60)}}分钟</view>
</view>
<view id="sortTop3" class="sortTopItem" wx:if="{{!sortList[2]}}">
</view>
<image id="sortPlanBg" src="../../assets/kv_plan.png"></image>
</view>
<view id="sortList">
<view class="sortListItem" wx:for="{{noThreeSortList}}" wx:key="{{index}}">
<view class="sortListItemInfo">
<text>{{item.ranking}}</text>
<image src="{{item.avatar}}"></image>
<view>{{item.name}}</view>
</view>
<view class="sortListItemTime">{{we.toFixed(item.duration/60)}}分钟</view>
</view>
</view>
<view id="sortListBom"></view>
<view id="sortListMe">
<view class="sortListMeInfo">
<image src="{{avatar}}"></image>
<view>{{name}}</view>
</view>
<view class="sortListMeDetail">
<view>本周训练 <text>{{we.toFixed(userTraining/60)}}</text> 分钟</view>
<view id="sortListMeDetailSort">本周排名 <text>{{userRanking}}</text></view>
</view>
</view>
</view>
<wxs module="we">
var toFixed = function (value) {
return Math.floor(value);
}
module.exports = {
toFixed :toFixed
}
</wxs>
\ No newline at end of file
#sortBg{
background-color: #e6ece5;
min-height: 100vh;
}
#sortTop{
display: flex;
justify-content: center;
position: relative;
padding-top: 60rpx;
height: 306rpx;
}
.sortTopItem{
text-align: center;
font-size: 24rpx;
color: #666666;
z-index: 1;
}
.sortTopItem image{
height: 120rpx;
width: 120rpx;
border-radius: 50%;
}
.sortPlanName{
font-size: 28rpx;
color: #111111;
}
#sortTop1{
width: 180rpx;
}
#sortTop2{
width: 170rpx;
}
#sortTop3{
width: 170rpx;
padding-top: 30rpx;
}
#sortTop1 image{
margin-top: -30rpx;
}
#sortPlanBg{
display: block;
width: 100%;
height: 366rpx;
position: absolute;
top: 0;
left: 0;
}
/* 4名以后 */
#sortList{
padding: 0 30rpx;
background: #F8F7F5;
}
.sortListItem{
display: flex;
align-items: center;
justify-content: space-between;
font-size: 34rpx;
color: #4F5051;
padding: 30rpx 0;
border-bottom: 1rpx solid #e5e5e5;
}
.sortListItemInfo{
display: flex;
align-items: center;
}
.sortListItemInfo text{
width: 44rpx;
margin-right: 10rpx;
}
.sortListItemInfo image{
height: 50rpx;
width: 50rpx;
border-radius: 50%;
margin-right: 20rpx;
}
.sortListItemTime{
text-align: right;
}
/* 本人排行 */
#sortListMe{
position: fixed;
bottom: 0;
left: 0;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 26rpx;
color: #999;
width: 100%;
background: #fff;
padding: 40rpx 0;
}
.sortListMeInfo{
display: flex;
align-items: center;
font-size: 34rpx;
color: #666666;
padding-left: 20rpx;
}
.sortListMeInfo image{
height: 90rpx;
width: 90rpx;
border-radius: 50%;
margin-right: 20rpx;
}
.sortListMeDetail{
font-size: 28rpx;
color: #666666;
padding-right: 30rpx;
display: flex;
align-items: center;
padding-bottom: 12rpx;
}
.sortListMeDetail text{
font-size: 48rpx;
}
#sortListMeDetailSort{
margin-left: 25rpx;
}
/* 占位 */
#sortListBom{
height: 180rpx;
}
\ No newline at end of file
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
leftEye: '',
rightEye: '',
trainingList: [],
firstTrainType: '',
secondTrainType: '',
luoeyeArray: [ luoeyeArray: [
['4.0','4.1','4.2','4.3','4.4','4.5','4.6','4.7','4.8','4.9','-','5.0','5.1','5.2','5.3'], ['4.0','4.1','4.2','4.3','4.4','4.5','4.6','4.7','4.8','4.9','-','5.0','5.1','5.2','5.3'],
['4.0','4.1','4.2','4.3','4.4','4.5','4.6','4.7','4.8','4.9','-','5.0','5.1','5.2','5.3'] ['4.0','4.1','4.2','4.3','4.4','4.5','4.6','4.7','4.8','4.9','-','5.0','5.1','5.2','5.3']
], ],
luoeyeIndex: [10, 10], luoeyeIndex: [10, 10],
trainArray: ['动态训练','静态训练','单词训练'], trainArray: ['单词训练','动态训练','静态训练'],
DArray: ['训练11分钟','训练16分钟','训练17分钟','训练19分钟','训练21分钟','训练26分钟'], timeArray: ['训练10分钟','训练12分钟','训练14分钟','训练16分钟','训练18分钟','训练20分钟',],
JArray: ['每天观看10分钟'], DArray: [{name:'训练10分钟',time:10},{name:'训练12分钟',time:12},{name:'训练14分钟',time:14},{name:'训练16分钟',time:16},{name:'训练18分钟',time:18},{name:'训练20分钟',time:20},],
JArray: [{name:'训练10分钟',time:10},{name:'训练12分钟',time:12},{name:'训练14分钟',time:14},{name:'训练16分钟',time:16},{name:'训练18分钟',time:18},{name:'训练20分钟',time:20},],
firstTrainIndex: 0,//第一组训练类型 firstTrainIndex: 0,//第一组训练类型
secondTrainIndex: 0,//第二组训练类型 secondTrainIndex: 0,//第二组训练类型
firstDIndex: 0,//第一组动态详细设置 firstDIndex: 0,//第一组动态详细设置
...@@ -16,58 +22,364 @@ Page({ ...@@ -16,58 +22,364 @@ Page({
firstJIndex: 0,//第一组静态详细设置 firstJIndex: 0,//第一组静态详细设置
secondJIndex: 0,//第二组静态详细设置 secondJIndex: 0,//第二组静态详细设置
wordSetShow: false,//单词训练弹窗 wordSetShow: false,//单词训练弹窗
wordNumber: 10,//第一组单词数量
wordNumberSecond: 10,//第二组单词数量
wordType: '',
teachArray: [],
teachIndex: 0,
teachIndexSecond: 0,
bookArray: [],
bookIndex: 0,
bookIndexSecond: 0,
unitArray: [],
unitArraySecond: [],
unitIndex: 0,
unitIndexSecond: 0,
}, },
onLoad: function () { onLoad: function () {
let me = this;
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'Trainings/index',
method: 'POST',
data: {
token: wx.getStorageSync('token')
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
leftEye: res.data.data.leftEye,
rightEye: res.data.data.rightEye,
firstTrainType: res.data.data.trainingList[0].type,
secondTrainType: res.data.data.trainingList[1].type,
trainingList: res.data.data.trainingList,
firstTrainIndex: me.data.trainArray.indexOf(res.data.data.trainingList[0].type),
secondTrainIndex: me.data.trainArray.indexOf(res.data.data.trainingList[1].type),
})
if(res.data.data.trainingList[0].type=='动态训练'){
for(let i=0;i<me.data.timeArray.length;i++){
if(me.data.timeArray[i].indexOf(res.data.data.trainingList[0].duration)<0){
}else{
me.setData({
firstDIndex: i
})
}
}
}
if(res.data.data.trainingList[1].type=='动态训练'){
for(let i=0;i<me.data.timeArray.length;i++){
if(me.data.timeArray[i].indexOf(res.data.data.trainingList[1].duration)<0){
}else{
me.setData({
secondDIndex: i
})
}
}
}
if(res.data.data.trainingList[0].type=='静态训练'){
for(let i=0;i<me.data.timeArray.length;i++){
if(me.data.timeArray[i].indexOf(res.data.data.trainingList[0].duration)<0){
}else{
me.setData({
firstJIndex: i
})
}
}
}
if(res.data.data.trainingList[1].type=='静态训练'){
for(let i=0;i<me.data.timeArray.length;i++){
if(me.data.timeArray[i].indexOf(res.data.data.trainingList[1].duration)<0){
}else{
me.setData({
secondJIndex: i
})
}
}
}
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}, },
luoeyeChange: function (e) {// 本次裸眼视力 luoeyeChange: function (e) {// 本次裸眼视力
let luoData = { let luoData = {
left: this.data.luoeyeArray[0][e.detail.value[0]], left: this.data.luoeyeArray[0][e.detail.value[0]],
right: this.data.luoeyeArray[1][e.detail.value[1]] right: this.data.luoeyeArray[1][e.detail.value[1]]
} }
if(luoData.left=='-'||luoData.right=='-'){
wx.showModal({
title: '提示',
showCancel: false,
content: '请选择裸眼视力'
})
this.setData({
luoeyeIndex: [10,10]
})
}else{
this.setData({ this.setData({
luoeyeIndex: e.detail.value luoeyeIndex: e.detail.value
}) })
console.log('本次裸眼视力:') console.log('本次裸眼视力:')
console.log(luoData) console.log(luoData)
let me = this;
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'Trainings/recommendTime',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
leftEye: luoData.left,
rightEye: luoData.right,
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
wordNumber: res.data.data.newWordsNumber,
wordNumberSecond: res.data.data.newWordsNumber,
})
for(let i=0;i<me.data.timeArray.length;i++){
if(me.data.timeArray[i].indexOf(res.data.data.dynamicTime)<0){
}else{
me.setData({
firstDIndex: i,
secondDIndex: i
})
}
}
for(let i=0;i<me.data.timeArray.length;i++){
if(me.data.timeArray[i].indexOf(res.data.data.staticTime)<0){
}else{
me.setData({
firstJIndex: i,
secondJIndex: i
})
}
}
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}
}, },
// 第一组训练类型 // 第一组训练类型
firstTrainChange: function (e) { firstTrainChange: function (e) {
console.log('第一组训练类型:'+e.detail.value+this.data.trainArray[e.detail.value]) console.log('第一组训练类型:'+e.detail.value+this.data.trainArray[e.detail.value])
this.setData({ this.setData({
firstTrainIndex: e.detail.value firstTrainIndex: e.detail.value,
firstTrainType: this.data.trainArray[e.detail.value]
}) })
if(e.detail.value==0){
let me = this;
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'Trainings/publisher',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
},
success: function (res) {
// // 请求成功后关闭Loading
// wx.hideLoading();
if(res.data.errno==200){
me.setData({
teachArray: res.data.data.list,
})
wx.request({
url: app.globalData.apiUrl + 'Trainings/book',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
publisherId: res.data.data.list[0].id
},
success: function (res) {
// 请求成功后关闭Loading
// wx.hideLoading();
if(res.data.errno==200){
me.setData({
bookArray: res.data.data.data,
})
wx.request({
url: app.globalData.apiUrl + 'Trainings/chapter',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
bookId: res.data.data.data[0].id
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
unitArray: res.data.data.data,
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}
}, },
// 第二组训练类型 // 第二组训练类型
secondTrainChange: function (e) { secondTrainChange: function (e) {
console.log('第二组训练类型:'+e.detail.value+this.data.trainArray[e.detail.value]) console.log('第二组训练类型:'+e.detail.value+this.data.trainArray[e.detail.value])
this.setData({ this.setData({
secondTrainIndex: e.detail.value secondTrainIndex: e.detail.value,
secondTrainType: this.data.trainArray[e.detail.value]
}) })
if(e.detail.value==0){
let me = this;
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'Trainings/publisher',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
},
success: function (res) {
// // 请求成功后关闭Loading
// wx.hideLoading();
if(res.data.errno==200){
me.setData({
teachArray: res.data.data.list,
})
wx.request({
url: app.globalData.apiUrl + 'Trainings/book',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
publisherId: res.data.data.list[0].id
},
success: function (res) {
// 请求成功后关闭Loading
// wx.hideLoading();
if(res.data.errno==200){
me.setData({
bookArray: res.data.data.data,
})
wx.request({
url: app.globalData.apiUrl + 'Trainings/chapter',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
bookId: res.data.data.data[0].id
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
unitArraySecond: res.data.data.data,
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}
}, },
// 第一组动态详细设置 // 第一组动态详细设置
firstDChange: function (e) { firstDChange: function (e) {
console.log('第一组动态详细设置:'+e.detail.value+this.data.DArray[e.detail.value])
this.setData({ this.setData({
firstDIndex: e.detail.value firstDIndex: e.detail.value
}) })
}, },
// 第一组静态详细设置 // 第一组静态详细设置
firstJChange: function (e) { firstJChange: function (e) {
console.log('第一组静态详细设置:'+e.detail.value+this.data.JArray[e.detail.value])
this.setData({ this.setData({
firstJIndex: e.detail.value firstJIndex: e.detail.value
}) })
}, },
// 第二组动态详细设置 // 第二组动态详细设置
secondDChange: function (e) { secondDChange: function (e) {
console.log('第二组动态详细设置:'+e.detail.value+this.data.DArray[e.detail.value])
this.setData({ this.setData({
secondDIndex: e.detail.value secondDIndex: e.detail.value
}) })
}, },
// 第二组静态详细设置 // 第二组静态详细设置
secondJChange: function (e) { secondJChange: function (e) {
console.log('第二组静态详细设置:'+e.detail.value+this.data.JArray[e.detail.value])
this.setData({ this.setData({
secondJIndex: e.detail.value secondJIndex: e.detail.value
}) })
...@@ -76,27 +388,235 @@ Page({ ...@@ -76,27 +388,235 @@ Page({
firstWordSet: function () { firstWordSet: function () {
console.log('第一组单词训练设置') console.log('第一组单词训练设置')
this.setData({ this.setData({
wordSetShow: true wordSetShow: true,
wordType: 'first'
}) })
}, },
// 第二组单词训练设置 // 第二组单词训练设置
secondWordSet: function () { secondWordSet: function () {
console.log('第二组单词训练设置') console.log('第二组单词训练设置')
this.setData({ this.setData({
wordSetShow: true wordSetShow: true,
wordType: 'second'
}) })
}, },
selectWords(e) {
console.log(e.target.dataset.number)
if(this.data.wordType=='first'){
this.setData({
wordNumber: e.target.dataset.number
})
}else{
this.setData({
wordNumberSecond: e.target.dataset.number
})
}
},
// 关闭单词训练设置弹窗 // 关闭单词训练设置弹窗
close: function () { close: function () {
this.setData({ this.setData({
wordSetShow: false wordSetShow: false
}) })
}, },
// 教材选择
teachChange(e) {
console.log('教材:'+e.detail.value+this.data.teachArray[e.detail.value])
if(this.data.wordType=='first'){
this.setData({
teachIndex: e.detail.value
})
}else{
this.setData({
teachIndexSecond: e.detail.value
})
}
},
// 课本选择
bookChange(e) {
console.log('章节:'+e.detail.value+this.data.bookArray[e.detail.value])
if(this.data.wordType=='first'){
this.setData({
bookIndex: e.detail.value
})
let me = this;
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'Trainings/chapter',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
bookId: me.data.bookArray[e.detail.value].id
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
unitArray: res.data.data.data,
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}else{
this.setData({
bookIndexSecond: e.detail.value
})
let me = this;
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'Trainings/chapter',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
bookId: me.data.bookArray[e.detail.value].id
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
unitArraySecond: res.data.data.data,
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}
},
// 章节选择
unitChange(e) {
if(this.data.wordType=='first'){
this.setData({
unitIndex: e.detail.value
})
}else{
this.setData({
unitIndexSecond: e.detail.value
})
}
},
sure() {
if(this.data.wordType=='first'){
console.log(this.data.wordNumber)
console.log(this.data.teachIndex)
console.log(this.data.bookIndex)
console.log(this.data.unitIndex)
this.setData({
wordSetShow: false
})
}else{
console.log(this.data.wordNumberSecond)
console.log(this.data.teachIndexSecond)
console.log(this.data.bookIndexSecond)
console.log(this.data.unitIndexSecond)
this.setData({
wordSetShow: false
})
}
},
// 完成 // 完成
updateDone: function () { updateDone: function () {
// 关闭当前页面,跳转到首页 let me = this;
let trainingTimeFirst = '',
wordNumberFirst = '',
publisherIdFirst = '',
bookIdFirst = '',
chaptersIdFirst = ''
if(parseInt(me.data.firstTrainIndex)+1 == 2){//训练类型 1:单词训练; 2:动态训练; 3:静态训练。
trainingTimeFirst = me.data.DArray[me.data.firstDIndex].time
}else if(parseInt(me.data.firstTrainIndex)+1 == 3){
trainingTimeFirst = me.data.JArray[me.data.firstJIndex].time
}else{
trainingTimeFirst = ''
wordNumberFirst = me.data.wordNumber,
publisherIdFirst = me.data.teachArray[me.data.teachIndex].id,
bookIdFirst = me.data.bookArray[me.data.bookIndex].id,
chaptersIdFirst = me.data.unitArray[me.data.unitIndex].id
}
let trainingTimeSecond = '',
wordNumberSecond = '',
publisherIdSecond = '',
bookIdSecond = '',
chaptersIdSecond = ''
if(parseInt(me.data.secondTrainIndex)+1 == 2){//训练类型 1:单词训练; 2:动态训练; 3:静态训练。
trainingTimeSecond = me.data.DArray[me.data.secondDIndex].time
}else if(parseInt(me.data.secondTrainIndex)+1 == 3){
trainingTimeSecond = me.data.JArray[me.data.secondJIndex].time
}else{
trainingTimeSecond = ''
wordNumberSecond = me.data.wordNumberSecond,
publisherIdSecond = me.data.teachArray[me.data.teachIndexSecond].id,
bookIdSecond = me.data.bookArray[me.data.bookIndexSecond].id,
chaptersIdSecond = me.data.unitArraySecond[me.data.unitIndexSecond].id
}
let trainingData = [
{
trainingType: parseInt(me.data.firstTrainIndex)+1,//训练类型 1:单词训练; 2:动态训练; 3:静态训练。
trainingTime: trainingTimeFirst,//训练时长;
wordNumber: wordNumberFirst,//训练的单词数量;
publisherId: publisherIdFirst,//出版社
bookId: bookIdFirst,//课本
chaptersId: chaptersIdFirst,//章节
},
{
trainingType: parseInt(me.data.secondTrainIndex)+1,//训练类型 1:单词训练; 2:动态训练; 3:静态训练。
trainingTime: trainingTimeSecond,//训练时长;
wordNumber: wordNumberSecond,//训练的单词数量;
publisherId: publisherIdSecond,//出版社
bookId: bookIdSecond,//课本
chaptersId: chaptersIdSecond,//章节
},
]
console.log(trainingData)
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'Trainings/edit',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
trainingData: trainingData
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
// 跳转到训练计划
wx.redirectTo({ wx.redirectTo({
url: '/pages/index/index' url: '/pages/plan/plan'
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
}) })
} }
}) })
...@@ -6,14 +6,17 @@ ...@@ -6,14 +6,17 @@
<view id="sightInfoTop"> <view id="sightInfoTop">
<text class="sightInfoLeft">上次裸眼视力</text> <text class="sightInfoLeft">上次裸眼视力</text>
<view id="sightInfoRight"> <view id="sightInfoRight">
<text class="sightLeft">左眼:4.2</text> <text class="sightLeft">左眼:{{leftEye}}</text>
<text class="sightRight">右眼:4.3</text> <text class="sightRight">右眼:{{rightEye}}</text>
</view> </view>
</view> </view>
<view id="sightInfoBom"> <view id="sightInfoBom">
<text class="sightInfoLeft">本次裸眼视力</text> <text class="sightInfoLeft">本次裸眼视力</text>
<picker mode="multiSelector" class="selectorPicker" bindchange="luoeyeChange" value="{{luoeyeIndex}}" range="{{luoeyeArray}}"> <picker mode="multiSelector" class="selectorPicker" bindchange="luoeyeChange" value="{{luoeyeIndex}}" range="{{luoeyeArray}}">
<view class="eyesightConRight"> <view class="eyesightConRight" wx:if="{{ luoeyeArray[0][luoeyeIndex[0]]=='-'||luoeyeArray[1][luoeyeIndex[1]]=='-' }}">
<text>请选择</text>
</view>
<view class="eyesightConRight" wx:else>
<view class="selItem sightLeft">左眼:{{luoeyeArray[0][luoeyeIndex[0]]}}</view> <view class="selItem sightLeft">左眼:{{luoeyeArray[0][luoeyeIndex[0]]}}</view>
<view class="selItem sightRight">右眼:{{luoeyeArray[1][luoeyeIndex[1]]}}</view> <view class="selItem sightRight">右眼:{{luoeyeArray[1][luoeyeIndex[1]]}}</view>
</view> </view>
...@@ -28,94 +31,228 @@ ...@@ -28,94 +31,228 @@
<view class="train"> <view class="train">
<view class="trainTitle"> <view class="trainTitle">
<text>第一组</text> <text>第一组</text>
<picker bindchange="firstTrainChange" value="{{trainIndex}}" range="{{trainArray}}"> <picker bindchange="firstTrainChange" value="{{firstTrainIndex}}" range="{{trainArray}}">
<text>选择训练</text> <view class="trainTitleSelect">
</picker> <text>{{firstTrainType}}</text>
<image src="../../assets/icon_more.png"></image>
</view> </view>
<view class="trainDes"> </picker>
<view><image class="trainDesIcon" src="../../assets/appIcon.png" /></view>
<view class="trainDesText" hidden="{{firstTrainIndex!=0}}">
<view>动态训练</view>
<text>动态训练描述文字描述文字描述文字描述文字描述文字描述文字描述文字描述文字</text>
</view> </view>
<view class="trainDesText" hidden="{{firstTrainIndex!=1}}"> <!-- 单词 -->
<view>静态训练</view> <view class="trainDes" hidden="{{firstTrainIndex!=0}}">
<text>静态训练描述文字描述文字描述文字描述文字描述文字描述文字描述文字描述文字</text> <view><image class="trainDesIcon" src="../../assets/pic-word.png" /></view>
<view class="trainDesText">学单词的同时进行训练。单词与课本同步,使用艾宾浩斯记忆法,让孩子能够在高效学习单词的同时锻炼睫状肌和外眼肌,保护视力。</view>
</view> </view>
<view class="trainDesText" hidden="{{firstTrainIndex!=2}}"> <!-- 动态 -->
<view>单词训练</view> <view class="trainDes" hidden="{{firstTrainIndex!=1}}">
<text>单词训练描述文字描述文字描述文字描述文字描述文字描述文字描述文字描述文字</text> <view><image class="trainDesIcon" src="../../assets/pic-dt.png" /></view>
<view class="trainDesText">看视频的同时进行训练,通过丰富的内容画面,模拟真实世界场景,结合设备的远近调节,达到训练10分钟,满足当日长时间望远需要,锻炼睫状肌,缓解疲劳。</view>
</view> </view>
<!-- 静态 -->
<view class="trainDes" hidden="{{firstTrainIndex!=2}}">
<view><image class="trainDesIcon" src="../../assets/pic-jt.png" /></view>
<view class="trainDesText">看图片,听音乐进行训练,通过看自然风景,动漫人物, 科幻场景等主题图片来同时锻炼眼外肌和睫状肌的收缩性,改善睫状肌的收缩能力,从而预防和防控近视情况的产生。</view>
</view> </view>
<view class="trainSet" hidden="{{firstTrainIndex!=0}}"> <view class="trainSet" hidden="{{firstTrainIndex!=0}}">
<picker bindchange="firstDChange" value="{{firstDIndex}}" range="{{DArray}}"> <view class="trainSetCon">
<text>详细设置:{{DArray[firstDIndex]}}</text> <view class="trainSetConLeft">
</picker> <image src="../../assets/icon_traintime_0.png"></image>
<text>{{wordNumber}}个新词</text>
</view>
<view class="trainSetConRight" bindtap="firstWordSet">
<text>详细设置</text>
<image src="../../assets/icon_more.png"></image>
</view>
</view>
</view> </view>
<view class="trainSet" hidden="{{firstTrainIndex!=1}}"> <view class="trainSet" hidden="{{firstTrainIndex!=1}}">
<picker bindchange="firstJChange" value="{{firstJIndex}}" range="{{JArray}}"> <picker bindchange="firstDChange" value="{{firstDIndex}}" range="{{DArray}}" range-key="name">
<text>详细设置:{{JArray[firstJIndex]}}</text> <view class="trainSetCon">
<view class="trainSetConLeft">
<image src="../../assets/icon_traintime_0.png"></image>
<text>{{DArray[firstDIndex].name}}</text>
</view>
<view class="trainSetConRight">
<text>详细设置</text>
<image src="../../assets/icon_more.png"></image>
</view>
</view>
</picker> </picker>
</view> </view>
<view class="trainSet" hidden="{{firstTrainIndex!=2}}"> <view class="trainSet" hidden="{{firstTrainIndex!=2}}">
<text bindtap="firstWordSet">详细设置</text> <picker bindchange="firstJChange" value="{{firstJIndex}}" range="{{JArray}}" range-key="name">
<view class="trainSetCon">
<view class="trainSetConLeft">
<image src="../../assets/icon_traintime_0.png"></image>
<text>{{JArray[firstJIndex].name}}</text>
</view>
<view class="trainSetConRight">
<text>详细设置</text>
<image src="../../assets/icon_more.png"></image>
</view>
</view>
</picker>
</view> </view>
</view> </view>
<!-- 第二组 --> <!-- 第二组 -->
<view class="train"> <view class="train">
<view class="trainTitle"> <view class="trainTitle trainSecond">
<text>第二组</text> <text>第二组</text>
<picker bindchange="secondTrainChange" value="{{trainIndex}}" range="{{trainArray}}"> <picker bindchange="secondTrainChange" value="{{secondTrainIndex}}" range="{{trainArray}}">
<text>选择训练</text> <view class="trainTitleSelect">
</picker> <text>{{secondTrainType}}</text>
<image src="../../assets/icon_more.png"></image>
</view> </view>
<view class="trainDes"> </picker>
<view><image class="trainDesIcon" src="../../assets/appIcon.png" /></view>
<view class="trainDesText" hidden="{{secondTrainIndex!=0}}">
<view>动态训练</view>
<text>动态训练描述文字描述文字描述文字描述文字描述文字描述文字描述文字描述文字</text>
</view> </view>
<view class="trainDesText" hidden="{{secondTrainIndex!=1}}"> <!-- 单词 -->
<view>静态训练</view> <view class="trainDes" hidden="{{secondTrainIndex!=0}}">
<text>静态训练描述文字描述文字描述文字描述文字描述文字描述文字描述文字描述文字</text> <view><image class="trainDesIcon" src="../../assets/pic-word.png" /></view>
<view class="trainDesText">学单词的同时进行训练。单词与课本同步,使用艾宾浩斯记忆法,让孩子能够在高效学习单词的同时锻炼睫状肌和外眼肌,保护视力。</view>
</view> </view>
<view class="trainDesText" hidden="{{secondTrainIndex!=2}}"> <!-- 动态 -->
<view>单词训练</view> <view class="trainDes" hidden="{{secondTrainIndex!=1}}">
<text>单词训练描述文字描述文字描述文字描述文字描述文字描述文字描述文字描述文字</text> <view><image class="trainDesIcon" src="../../assets/pic-dt.png" /></view>
<view class="trainDesText">看视频的同时进行训练,通过丰富的内容画面,模拟真实世界场景,结合设备的远近调节,达到训练10分钟,满足当日长时间望远需要,锻炼睫状肌,缓解疲劳。</view>
</view> </view>
<!-- 静态 -->
<view class="trainDes" hidden="{{secondTrainIndex!=2}}">
<view><image class="trainDesIcon" src="../../assets/pic-jt.png" /></view>
<view class="trainDesText">看图片,听音乐进行训练,通过看自然风景,动漫人物, 科幻场景等主题图片来同时锻炼眼外肌和睫状肌的收缩性,改善睫状肌的收缩能力,从而预防和防控近视情况的产生。</view>
</view> </view>
<view class="trainSet" hidden="{{secondTrainIndex!=0}}"> <view class="trainSet" hidden="{{secondTrainIndex!=0}}">
<picker bindchange="secondDChange" value="{{secondDIndex}}" range="{{DArray}}"> <view class="trainSetCon">
<text>详细设置:{{DArray[secondDIndex]}}</text> <view class="trainSetConLeft">
</picker> <image src="../../assets/icon_traintime_0.png"></image>
<text>{{wordNumberSecond}}个新词</text>
</view>
<view class="trainSetConRight" bindtap="secondWordSet">
<text>详细设置</text>
<image src="../../assets/icon_more.png"></image>
</view>
</view>
</view> </view>
<view class="trainSet" hidden="{{secondTrainIndex!=1}}"> <view class="trainSet" hidden="{{secondTrainIndex!=1}}">
<picker bindchange="secondJChange" value="{{secondJIndex}}" range="{{JArray}}"> <picker bindchange="secondDChange" value="{{secondDIndex}}" range="{{DArray}}" range-key="name">
<text>详细设置:{{JArray[secondJIndex]}}</text> <view class="trainSetCon">
<view class="trainSetConLeft">
<image src="../../assets/icon_traintime_0.png"></image>
<text>{{DArray[secondDIndex].name}}</text>
</view>
<view class="trainSetConRight">
<text>详细设置</text>
<image src="../../assets/icon_more.png"></image>
</view>
</view>
</picker> </picker>
</view> </view>
<view class="trainSet" hidden="{{secondTrainIndex!=2}}"> <view class="trainSet" hidden="{{secondTrainIndex!=2}}">
<text bindtap="secondWordSet">详细设置</text> <picker bindchange="secondJChange" value="{{secondJIndex}}" range="{{JArray}}" range-key="name">
<view class="trainSetCon">
<view class="trainSetConLeft">
<image src="../../assets/icon_traintime_0.png"></image>
<text>{{JArray[secondJIndex].name}}</text>
</view>
<view class="trainSetConRight">
<text>详细设置</text>
<image src="../../assets/icon_more.png"></image>
</view>
</view>
</picker>
</view> </view>
</view> </view>
</view> </view>
<!-- 单词训练设置弹窗 --> <!-- 单词训练设置弹窗 -->
<view id="wordSet" hidden="{{!wordSetShow}}"> <view id="wordSet" hidden="{{!wordSetShow}}">
<view id="wordTitleBox"><text id="close" bindtap="close">X</text>单词训练设置</view> <view id="wordTitleBox">
<image id="close" src="../../assets/close.png" bindtap="close"></image>
单词训练设置
</view>
<view id="wordCon">
<view id="wordTop"> <view id="wordTop">
<view class="wordSetTitle">每日学习新单词个数</view> <view class="wordSetTitle">每日学习新单词个数</view>
<view id=""> <view id="wordBox" wx:if="{{wordType=='first'}}">
<text>10个新词(推荐)</text> <view class="wordBoxTen">
<text>15个新词</text> <text bindtap="selectWords" class="{{wordNumber==10?'selectedWord':''}}" data-number="10">10个新词</text>
<text>20个新词</text> <view class="wordBoxTenDes">推荐</view>
</view>
<text bindtap="selectWords" class="{{wordNumber==15?'selectedWord':''}}" data-number="15">15个新词</text>
<text bindtap="selectWords" class="{{wordNumber==20?'selectedWord':''}}" data-number="20">20个新词</text>
</view>
<view id="wordBox" wx:else>
<view class="wordBoxTen">
<text bindtap="selectWords" class="{{wordNumberSecond==10?'selectedWord':''}}" data-number="10">10个新词</text>
<view class="wordBoxTenDes">推荐</view>
</view>
<text bindtap="selectWords" class="{{wordNumberSecond==15?'selectedWord':''}}" data-number="15">15个新词</text>
<text bindtap="selectWords" class="{{wordNumberSecond==20?'selectedWord':''}}" data-number="20">20个新词</text>
</view> </view>
</view> </view>
<view id="wordBom"> <view id="wordBom" wx:if="{{wordType=='first'}}">
<view class="wordSetTitle">单词库设置</view> <view class="wordSetTitle">单词库设置</view>
<view class="wordSetDes">您只要选择孩子要学习的内容,系统会跟随孩子学习的进度自动更新内容。</view> <view class="wordSetDes">您只要选择孩子要学习的内容,系统会跟随孩子学习的进度自动更新内容。</view>
<view id="">请选择【教材】</view> <view class="wordItem">
<view id="">请选择【课本】</view> <picker bindchange="teachChange" value="{{teachIndex}}" range="{{teachArray}}" range-key="name">
<view id="">请选择【章节】</view> <!-- 教材: -->
<view class="wordItemCon">
<text>{{teachArray[teachIndex].name}}</text>
<image src="../../assets/arrow_down.png"></image>
</view>
</picker>
</view>
<view class="wordItem">
<picker bindchange="bookChange" value="{{bookIndex}}" range="{{bookArray}}" range-key="name">
<!-- 课本: -->
<view class="wordItemCon">
<text>{{bookArray[bookIndex].name}}</text>
<image src="../../assets/arrow_down.png"></image>
</view>
</picker>
</view>
<view class="wordItem">
<picker bindchange="unitChange" value="{{unitIndex}}" range="{{unitArray}}" range-key="name">
<!-- 章节: -->
<view class="wordItemCon">
<text>{{unitArray[unitIndex].name}}</text>
<image src="../../assets/arrow_down.png"></image>
</view>
</picker>
</view>
</view>
<view id="wordBom" wx:else>
<view class="wordSetTitle">单词库设置</view>
<view class="wordSetDes">您只要选择孩子要学习的内容,系统会跟随孩子学习的进度自动更新内容。</view>
<view class="wordItem">
<picker bindchange="teachChange" value="{{teachIndexSecond}}" range="{{teachArray}}" range-key="name">
<!-- 教材: -->
<view class="wordItemCon">
<text>{{teachArray[teachIndexSecond].name}}</text>
<image src="../../assets/arrow_down.png"></image>
</view>
</picker>
</view>
<view class="wordItem">
<picker bindchange="bookChange" value="{{bookIndexSecond}}" range="{{bookArray}}" range-key="name">
<!-- 课本: -->
<view class="wordItemCon">
<text>{{bookArray[bookIndexSecond].name}}</text>
<image src="../../assets/arrow_down.png"></image>
</view>
</picker>
</view>
<view class="wordItem">
<picker bindchange="unitChange" value="{{unitIndexSecond}}" range="{{unitArraySecond}}" range-key="name">
<!-- 章节: -->
<view class="wordItemCon">
<text>{{unitArraySecond[unitIndexSecond].name}}</text>
<image src="../../assets/arrow_down.png"></image>
</view>
</picker>
</view>
</view>
</view>
<view id="sureBtn">
<button id="sureDone" bindtap='sure'>确认</button>
</view> </view>
</view> </view>
<!-- 完成按钮 --> <!-- 完成按钮 -->
......
#updatePlan{ #updatePlan{
background: #EFEFF4; background-color: #e6ece5;
min-height: 100vh; min-height: 100vh;
} }
/* 视力信息 */ /* 视力信息 */
#sight{ #sight{
padding: 30rpx 10rpx;
} }
#sightInfo{ #sightInfo{
padding: 0 20rpx; padding: 0 20rpx;
background-color: #FFFFFF;
} }
#sightTitle{ #sightTitle{
color: #4F5051; font-size: 32rpx;
font-size: 46rpx; color: #666666;
padding-bottom: 10rpx; padding: 50rpx 30rpx 20rpx;
} }
#sightInfoTop{ #sightInfoTop{
color: #4F5051; color: #999999;
font-size: 28rpx; font-size: 32rpx;
display: flex; display: flex;
background: #ccc; border-bottom: 1rpx solid #E5ECE5;
border-bottom: 2rpx solid #4F5051;
} }
#sightInfoBom{ #sightInfoBom{
color: #4F5051; color: #999999;
font-size: 28rpx; font-size: 32rpx;
display: flex; display: flex;
background: #ccc;
} }
.sightInfoLeft{ .sightInfoLeft{
padding: 10rpx 20rpx; padding: 40rpx 0;
border-right: 2rpx solid #4F5051; padding-right: 50rpx;
border-right: 1rpx solid #E5ECE5;
} }
#sightInfoRight{ #sightInfoRight{
display: flex; display: flex;
width:69%; width: 60%;
padding: 10rpx 0;
justify-content: center; justify-content: center;
} }
#sightInfoRight .sightLeft{
padding: 40rpx 0;
}#sightInfoRight .sightRight{
padding: 40rpx 0;
}
.sightLeft{ .sightLeft{
border-right: 2rpx solid #4F5051; margin-left: 80rpx;
padding-right: 40rpx;
width: 50%;
text-align: right;
} }
.sightRight{ .sightRight{
padding-left: 40rpx; margin-left: 60rpx;
width: 50%; }
.eyesightConRight text{
padding-left: 80rpx;
font-size: 28rpx;
color: #33D1C4;
} }
.selectorPicker{ .selectorPicker{
width:69%; width: 60%;
padding: 40rpx 0;
} }
.eyesightConRight{ .eyesightConRight{
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 10rpx 0;
} }
/* 训练计划 */ /* 训练计划 */
#plan{ /* #plan{
padding: 0 20rpx; padding: 0 30rpx;
} } */
#planTitle{ #planTitle{
color: #4F5051; font-size: 32rpx;
font-size: 46rpx; color: #666666;
padding-bottom: 10rpx; padding: 50rpx 30rpx 20rpx;
} }
.train{ .train{
padding: 0 20rpx; padding: 0 30rpx;
background: #fff;
} }
.trainTitle{ .trainTitle{
color: #4F5051; font-size: 32rpx;
font-size: 28rpx; color: #111111;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding-bottom: 20rpx; padding: 40rpx 0;
border-bottom: 2rpx solid #4F5051; border-bottom: 1rpx solid #E5ECE5;
margin-bottom: 20rpx; }
.trainSecond{
border-top: 1rpx solid #E5ECE5;
}
.trainTitleSelect{
display: flex;
align-items: center;
font-size: 32rpx;
color: #33D1C4;
}
.trainTitleSelect image{
display: block;
width: 36rpx;
height: 36rpx;
margin-left: 10rpx;
} }
.trainDes{ .trainDes{
color: #4F5051; color: #999999;
font-size: 28rpx; font-size: 28rpx;
display: flex; display: flex;
padding-top: 30rpx;
} }
.trainDesIcon{ .trainDesIcon{
width: 100rpx; width: 106rpx;
height: 100rpx; height: 106rpx;
margin-right: 20rpx; margin-right: 40rpx;
} }
.trainDesText>text{ .trainDesText{
font-size: 24rpx; font-size: 28rpx;
margin-top: 10rpx;
} }
.trainSet{ .trainSet{
padding-top: 30rpx; padding: 30rpx 0 40rpx;
}
.trainSetCon{
display: flex;
justify-content: space-between;
}
.trainSetConLeft{
font-size: 28rpx;
color: #999999;
display: flex;
align-items: center;
}
.trainSetConLeft image{
display: block;
width: 32rpx;
height: 32rpx;
margin-right: 12rpx;
}
.trainSetConRight{
font-size: 32rpx;
color: #33D1C4;
display: flex;
align-items: center;
}
.trainSetConRight image{
display: block;
width: 36rpx;
height: 36rpx;
margin-left: 10rpx;
} }
/* 单词训练弹窗 */ /* 单词训练弹窗 */
#wordSet{ #wordSet{
position: absolute; position: fixed;
left: 0; left: 0;
top: 0; top: 0;
width: 100%; right: 0;
bottom: 0;
height: 100%; height: 100%;
background: rgba(0, 0, 0, .9); background: rgba(0, 0, 0, .8);
color: #fff;
z-index: 999; z-index: 999;
padding: 0 30rpx;
} }
#wordTitleBox{ #wordTitleBox{
font-size: 40rpx; font-size: 38rpx;
text-align: center; text-align: center;
padding: 20rpx 30rpx; padding: 30rpx 30rpx 50rpx;
border-bottom: 2rpx solid #fff; color: #fff;
} }
#close{ #close{
position: absolute; position: absolute;
left: 30rpx; left: 25rpx;
top: 20rpx; top: 40rpx;
width: 35rpx;
height: 35rpx;
}
#wordCon{
background: #fff;
border-radius: 20rpx;
padding: 0 30rpx;
} }
#wordTop{ #wordTop{
padding: 20rpx 30rpx; padding: 30rpx 0 74rpx;
border-bottom: 1px solid #E5ECE5;
} }
#wordBom{ #wordBom{
padding: 20rpx 30rpx; padding: 30rpx 0;
} }
.wordSetTitle{ .wordSetTitle{
font-size: 34rpx; font-size: 32rpx;
padding-bottom: 20rpx; color: #424344;
padding-bottom: 40rpx;
} }
.wordSetDes{ .wordSetDes{
font-size: 28rpx; font-size: 24rpx;
color: #424344;
padding-bottom: 30rpx;
}
.wordItem{
font-size: 32rpx;
color: #424344;
margin-bottom: 30rpx;
background: #F8F7F5;
border: 1rpx solid rgba(151,151,151,0.30);
padding: 25rpx 20rpx;
border-radius: 10rpx;
}
.wordItem:last-child{
margin-bottom: 0;
}
.wordItemCon{
display: flex;
align-items: center;
justify-content: space-between;
}
.wordItemCon image{
width: 19rpx;
height: 11rpx;
}
#wordBox{
display: flex;
justify-content: center;
}
#wordBox>text{
display: block;
width: 200rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
font-size: 32rpx;
color: #33D1C4;
background: #fff;
border-radius: 45rpx;
margin-right: 20rpx;
border: 1rpx solid #33D1C4;
}
#wordBox .selectedWord{
background: #33D1C4;
color: #fff;
}
.wordBoxTen>text{
display: block;
width: 200rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
font-size: 32rpx;
color: #33D1C4;
background: #fff;
border-radius: 45rpx;
margin-right: 20rpx;
border: 1rpx solid #33D1C4;
position: relative;
}
.wordBoxTenDes{
position: absolute;
width: 200rpx;
text-align: center;
font-size: 24rpx;
color: #33D1C4;
padding-top: 5rpx;
}
#sureBtn{
padding: 40rpx 20rpx 50rpx;
}
#sureDone{
background: #33D1C4;
border-radius: 47rpx;
font-size: 36rpx;
color: #fff;
height: 94rpx;
line-height: 94rpx;
} }
/* 完成按钮 */ /* 完成按钮 */
#updateBtn{ #updateBtn{
padding: 75rpx 30rpx 80rpx; padding: 40rpx 50rpx 70rpx;
} }
#updateDone{ #updateDone{
background: #33D1C4; background: #33D1C4;
border-radius: 10rpx; border-radius: 47rpx;
font-size: 36rpx; font-size: 36rpx;
color: #FFFFFF; color: #FFFFFF;
height: 94rpx; height: 94rpx;
......
var app = getApp();
Page({
data: {
userList: []
},
onLoad() {
let me = this
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'teenages/teenageList',
method: 'POST',
data: {
token: wx.getStorageSync('token')
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
userList: res.data.data
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
},
// 设置使用者
setUser: function(e) {
let me = this;
me.setData({
userList: me.data.userList
})
wx.showModal({
title: '提示',
content: '是否选择 '+e.currentTarget.dataset.name+' 为使用者',
success (res) {
if (res.confirm) {
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'teenages/setDefault',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
teenageId: e.currentTarget.dataset.id
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
wx.showToast({
title: '删除成功',
mask: true,
// icon: 'none',
duration: 2000
});
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'teenages/teenageList',
method: 'POST',
data: {
token: wx.getStorageSync('token')
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
userList: res.data.data
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
} else if (res.cancel) {
// console.log('用户点击取消')
}
}
})
},
// 删除使用者
delUser: function(e) {
let me = this;
if(me.data.userList.length==1){
wx.showModal({
title: '提示',
showCancel: false,
content: '删除失败,需要至少保留一个用户'
})
return
}
wx.showModal({
title: '删除提示',
content: '删除后无法恢复,是否删除?',
success (res) {
if (res.confirm) {
console.log('用户点击确定')
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'teenages/delTeenage',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
teenageId: e.currentTarget.dataset.id
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
wx.showToast({
title: '删除成功',
mask: true,
// icon: 'none',
duration: 2000
});
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'teenages/teenageList',
method: 'POST',
data: {
token: wx.getStorageSync('token')
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
userList: res.data.data
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
} else if (res.cancel) {
// console.log('用户点击取消')
}
}
})
},
})
\ No newline at end of file
{ {
"navigationBarTitleText": "更新数据", "navigationBarTitleText": "用户管理",
"usingComponents": {} "usingComponents": {}
} }
\ No newline at end of file
<view id="userBox">
<view class="userItem" wx:for="{{userList}}" wx:key>
<view class="userItemTop">
<view class="userItemTopHead">
<image wx:if="{{item.gender=='男'}}" src="../../assets/head_boy.png"></image>
<image wx:else src="../../assets/head_girl.png"></image>
<text>{{item.name}}</text>
</view>
<view class="userItemTopDes">
<view><text>{{item.gender}}生 </text><text>{{item.age}}岁</text></view>
<view>视力情况:右眼 {{item.rightEye}} | 左眼 {{item.leftEye}}</view>
<view>配镜情况:<text wx:if="{{item.nearsightedStatus==1}}">已配镜</text><text wx:else>未配镜</text></view>
<view>配镜日期:{{item.nearsightedTime}}</view>
</view>
</view>
<view class="userItemBom">
<radio-group class="sexRadioBox" data-id="{{item.id}}" data-name="{{item.name}}" bindchange="setUser">
<label class="sexRadio" wx:if="{{item.defaultStatus==1}}">
<radio color="#fff" value="{{item.id}}" checked="{{item.defaultStatus==1}}"/>当前使用者
</label>
<label class="sexRadio" wx:else>
<radio color="#fff" value="{{item.id}}" checked="{{item.defaultStatus==1}}"/>设为使用者
</label>
</radio-group>
<text data-id="{{item.id}}" bindtap="delUser">删除</text>
</view>
</view>
</view>
\ No newline at end of file
page{
background-color: #efeff5;
}
.userItemTop{
display: flex;
padding: 30rpx 0 40rpx;
}
.userItemTopHead{
display: flex;
flex-direction: column;
align-items: center;
font-size: 28rpx;
color: #4F5051;
margin-bottom: 10rpx;
padding-right: 76rpx;
}
.userItemTopHead image{
width: 120rpx;
height: 120rpx;
}
.userItemTopDes{
font-size: 34rpx;
color: #666666;
}
.userItemTopDes view{
margin-bottom: 20rpx;
}
.userItemTopDes view:last-child{
margin-bottom: 0;
}
.userItem{
background: #fff;
padding: 0 30rpx;
margin-bottom: 10rpx;
}
.userItemBom{
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 35rpx;
}
.userItemBom text{
font-size: 34rpx;
color: #33D1C4;
}
radio .wx-radio-input{
height: 43rpx;
width: 43rpx;
border: 2rpx solid #C9C9C9;
}
radio .wx-radio-input.wx-radio-input-checked::before{
font-size: 40rpx; /* 对勾大小 */
color:#fff; /* 对勾颜色 */
width: 60rpx; /* 选中后对勾大小,不要超过背景的尺寸 */
height: 60rpx; /* 选中后对勾大小,不要超过背景的尺寸 */
background: #33D1C4;
border-radius: 50%;/* 圆角 */
line-height: 60rpx;
text-align: center;
border: 2rpx solid #33D1C4;
margin-top: -2rpx;
}
.sexRadioBox{
display: flex;
}
.sexRadio{
display: flex;
align-items: center;
margin-right: 36rpx;
font-size: 34rpx;
color: #666666;
}
\ No newline at end of file
...@@ -2,17 +2,17 @@ ...@@ -2,17 +2,17 @@
<view id="whiteListCon"> <view id="whiteListCon">
<view id="whiteListTop"> <view id="whiteListTop">
<view id="whiteListTab"> <view id="whiteListTab">
<view bindtap="tabClick" data-tabid="{{0}}" class="whiteListTabItem {{tabId==0?'currentTab':''}}"> <view bindtap="tabClick" data-tabid="{{0}}" class="whiteListTabItem {{tabId==0?'currentTab':''}} happyTab">
<image hidden="{{tabId!=0}}" src="../../assets/happyIcon.png" /> <image hidden="{{tabId!=0}}" src="../../assets/happyIcon.png" />
<image hidden="{{tabId==0}}" src="../../assets/manage_video.png" /> <image hidden="{{tabId==0}}" src="../../assets/manage_video.png" />
<text>娱乐应用</text> <text>娱乐应用</text>
</view> </view>
<view bindtap="tabClick" data-tabid="{{1}}" class="whiteListTabItem centerTabItem {{tabId==1?'currentTab':''}}"> <view bindtap="tabClick" data-tabid="{{1}}" class="whiteListTabItem centerTabItem {{tabId==1?'currentTab':''}} studyTab">
<image hidden="{{tabId!=1}}" src="../../assets/studyIcon.png" /> <image hidden="{{tabId!=1}}" src="../../assets/studyIcon.png" />
<image hidden="{{tabId==1}}" src="../../assets/manage_study.png" /> <image hidden="{{tabId==1}}" src="../../assets/manage_study.png" />
<text>学习应用</text> <text>学习应用</text>
</view> </view>
<view bindtap="tabClick" data-tabid="{{2}}" class="whiteListTabItem {{tabId==2?'currentTab':''}}"> <view bindtap="tabClick" data-tabid="{{2}}" class="whiteListTabItem {{tabId==2?'currentTab':''}} gameTab">
<image hidden="{{tabId!=2}}" src="../../assets/gameIcon.png" /> <image hidden="{{tabId!=2}}" src="../../assets/gameIcon.png" />
<image hidden="{{tabId==2}}" src="../../assets/manage_game.png" /> <image hidden="{{tabId==2}}" src="../../assets/manage_game.png" />
<text>游戏应用</text> <text>游戏应用</text>
......
...@@ -19,13 +19,23 @@ ...@@ -19,13 +19,23 @@
width:33.2%; width:33.2%;
padding: 30rpx 0 25rpx; padding: 30rpx 0 25rpx;
} }
.currentTab{
.happyTab.currentTab{
color: #D172FE;
border-bottom: 4rpx solid #D172FE;
}
.studyTab.currentTab{
color: #33D1C4; color: #33D1C4;
border-bottom: 4rpx solid #33D1C4; border-bottom: 4rpx solid #33D1C4;
} }
.gameTab.currentTab{
color: #FF9A02;
border-bottom: 4rpx solid #FF9A02;
}
.whiteListTabItem>image{ .whiteListTabItem>image{
width: 60rpx; width: 64rpx;
height: 60rpx; height: 54rpx;
margin-bottom: 6rpx; margin-bottom: 6rpx;
} }
.centerTabItem{ .centerTabItem{
...@@ -72,3 +82,7 @@ ...@@ -72,3 +82,7 @@
height: 94rpx; height: 94rpx;
line-height: 94rpx; line-height: 94rpx;
} }
switch{
transform:scale(0.9);
}
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
"checkInvalidKey": true "checkInvalidKey": true
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.8.1", "libVersion": "2.8.3",
"appid": "wx6d4a1ebceaa45d3e", "appid": "wx6d4a1ebceaa45d3e",
"projectname": "wxProgram", "projectname": "wxProgram",
"debugOptions": { "debugOptions": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment