Commit eb6149a6 by 陈玉桐

增加页面

parent a9629885
//app.js
App({
//设置全局请求URL
globalData:{
apiUrl: 'https://seex.inner.iouou.cn/AppApi/',
},
onLaunch: function () {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
let me =this;
// 获取本地缓存的token
wx.getStorage({
key: 'token',
fail (res) {
// 没登录(没有token时)
console.log(res.errMsg)
wx.login({
success: res => {
success (res) {
console.log(res)
if (res.code) {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
wx.request({
url: me.globalData.apiUrl + 'users/token',
method: 'POST',
data: {
code: res.code
},
success: function (res) {
if(res.data.errno==200){
// 获取token并本地缓存
console.log(res.data.data.token)
wx.setStorage({
key: "token",
data: res.data.data.token
})
// 获取用户信息
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: res => {
// 可以将 res 发送给后台解码出 unionId
this.globalData.userInfo = res.userInfo
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(res)
}else{
//打印错误信息
console.log(res.data.msg)
}
}
})
} else {
console.log('登录失败!' + res.errMsg)
}
}
})
},
globalData: {
userInfo: null
}
})
}
})
\ No newline at end of file
{
"pages": [
"pages/mine/mine",
"pages/idea/idea",
"pages/index/index",
"pages/logs/logs"
"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/plan/plan",
"pages/historyDetail/historyDetail",
"pages/trainHistory/trainHistory",
"pages/eyesight/eyesight",
"pages/whiteList/whiteList"
],
"window": {
"backgroundTextStyle": "light",
......@@ -9,5 +24,7 @@
"navigationBarTitleText": "欧欧家长端",
"navigationBarTextStyle": "white"
},
"sitemapLocation": "sitemap.json"
"sitemapLocation": "sitemap.json",
"permission": {
}
}
\ No newline at end of file
/**app.wxss**/
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}
assets/set.png

535 Bytes

assets/up.png

186 Bytes

import WxCanvas from './wx-canvas';
import * as echarts from './echarts';
let ctx;
Component({
properties: {
canvasId: {
type: String,
value: 'ec-canvas'
},
ec: {
type: Object
}
},
data: {
},
ready: function () {
if (!this.data.ec) {
console.warn('组件需绑定 ec 变量,例:<ec-canvas id="mychart-dom-bar" '
+ 'canvas-id="mychart-bar" ec="{{ ec }}"></ec-canvas>');
return;
}
if (!this.data.ec.lazyLoad) {
this.init();
}
},
methods: {
init: function (callback) {
const version = wx.version.version.split('.').map(n => parseInt(n, 10));
const isValid = version[0] > 1 || (version[0] === 1 && version[1] > 9)
|| (version[0] === 1 && version[1] === 9 && version[2] >= 91);
if (!isValid) {
console.error('微信基础库版本过低,需大于等于 1.9.91。'
+ '参见:https://github.com/ecomfe/echarts-for-weixin'
+ '#%E5%BE%AE%E4%BF%A1%E7%89%88%E6%9C%AC%E8%A6%81%E6%B1%82');
return;
}
ctx = wx.createCanvasContext(this.data.canvasId, this);
const canvas = new WxCanvas(ctx, this.data.canvasId);
echarts.setCanvasCreator(() => {
return canvas;
});
var query = wx.createSelectorQuery().in(this);
query.select('.ec-canvas').boundingClientRect(res => {
if (typeof callback === 'function') {
this.chart = callback(canvas, res.width, res.height);
}
else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
this.chart = this.data.ec.onInit(canvas, res.width, res.height);
}
else {
this.triggerEvent('init', {
canvas: canvas,
width: res.width,
height: res.height
});
}
}).exec();
},
canvasToTempFilePath(opt) {
if (!opt.canvasId) {
opt.canvasId = this.data.canvasId;
}
ctx.draw(true, () => {
wx.canvasToTempFilePath(opt, this);
});
},
touchStart(e) {
if (this.chart && e.touches.length > 0) {
var touch = e.touches[0];
var handler = this.chart.getZr().handler;
handler.dispatch('mousedown', {
zrX: touch.x,
zrY: touch.y
});
handler.dispatch('mousemove', {
zrX: touch.x,
zrY: touch.y
});
handler.processGesture(wrapTouch(e), 'start');
}
},
touchMove(e) {
if (this.chart && e.touches.length > 0) {
var touch = e.touches[0];
var handler = this.chart.getZr().handler;
handler.dispatch('mousemove', {
zrX: touch.x,
zrY: touch.y
});
handler.processGesture(wrapTouch(e), 'change');
}
},
touchEnd(e) {
if (this.chart) {
const touch = e.changedTouches ? e.changedTouches[0] : {};
var handler = this.chart.getZr().handler;
handler.dispatch('mouseup', {
zrX: touch.x,
zrY: touch.y
});
handler.dispatch('click', {
zrX: touch.x,
zrY: touch.y
});
handler.processGesture(wrapTouch(e), 'end');
}
}
}
});
function wrapTouch(event) {
for (let i = 0; i < event.touches.length; ++i) {
const touch = event.touches[i];
touch.offsetX = touch.x;
touch.offsetY = touch.y;
}
return event;
}
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<canvas class="ec-canvas" canvas-id="{{ canvasId }}"
bindinit="init"
>
</canvas>
<!-- bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}"
bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}"
bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}" -->
.ec-canvas {
width: 100%;
height: 100%;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
export default class WxCanvas {
constructor(ctx, canvasId) {
this.ctx = ctx;
this.canvasId = canvasId;
this.chart = null;
// this._initCanvas(zrender, ctx);
this._initStyle(ctx);
this._initEvent();
}
getContext(contextType) {
if (contextType === '2d') {
return this.ctx;
}
}
// canvasToTempFilePath(opt) {
// if (!opt.canvasId) {
// opt.canvasId = this.canvasId;
// }
// return wx.canvasToTempFilePath(opt, this);
// }
setChart(chart) {
this.chart = chart;
}
attachEvent () {
// noop
}
detachEvent() {
// noop
}
_initCanvas(zrender, ctx) {
zrender.util.getContext = function () {
return ctx;
};
zrender.util.$override('measureText', function (text, font) {
ctx.font = font || '12px sans-serif';
return ctx.measureText(text);
});
}
_initStyle(ctx) {
var styles = ['fillStyle', 'strokeStyle', 'globalAlpha',
'textAlign', 'textBaseAlign', 'shadow', 'lineWidth',
'lineCap', 'lineJoin', 'lineDash', 'miterLimit', 'fontSize'];
styles.forEach(style => {
Object.defineProperty(ctx, style, {
set: value => {
if (style !== 'fillStyle' && style !== 'strokeStyle'
|| value !== 'none' && value !== null
) {
ctx['set' + style.charAt(0).toUpperCase() + style.slice(1)](value);
}
}
});
});
ctx.createRadialGradient = () => {
return ctx.createCircularGradient(arguments);
};
}
_initEvent() {
this.event = {};
const eventNames = [{
wxName: 'touchStart',
ecName: 'mousedown'
}, {
wxName: 'touchMove',
ecName: 'mousemove'
}, {
wxName: 'touchEnd',
ecName: 'mouseup'
}, {
wxName: 'touchEnd',
ecName: 'click'
}];
eventNames.forEach(name => {
this.event[name.wxName] = e => {
const touch = e.touches[0];
this.chart.getZr().handler.dispatch(name.ecName, {
zrX: name.wxName === 'tap' ? touch.clientX : touch.x,
zrY: name.wxName === 'tap' ? touch.clientY : touch.y
});
};
});
}
}
// components/mypicher/mypicker.js
Component({
// options: {
// multipleSlots: true // 在组件定义时的选项中启用多slot支持
// },
/**
* 组件的属性列表
*/
properties: {
// isShow: {
// type: Boolean, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
// value: false, // 属性初始值(可选),如果未指定则会根据类型选择一个
// },
column: String,
// value: {
// type: Array, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
// value: [0,0,0], // 属性初始值(可选),如果未指定则会根据类型选择一个
// observer: function (newVal, oldVal) { // 属性被改变时执行的函数(可选)
// console.log(newVal, oldVal)
// this.setData({
// value: newVal
// })
// }
// },
// list:{//格式[{name:"",data:[{name:"",data:[]}]}]
// type: Array, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
// value: [], // 属性初始值(可选),如果未指定则会根据类型选择一个
// observer: function (newVal, oldVal) { // 属性被改变时执行的函数(可选)
// let inx = this.data.value
// console.log(newVal)
// console.log(oldVal)
// console.log(this.data.column)
// if (this.data.column=="2"){
// this.setData({
// secondClo: newVal[inx[0]].data
// })
// }
// if (this.data.column == "3") {
// this.setData({
// secondClo: newVal[inx[0]].data,
// thirdClo: newVal[inx[0]].data[inx[1]].data
// })
// }
// }
// }
initValue: { // 初始化日期
type: String,
value: ''
},
list: {
type: Array,
value: []
}
},
/**
* 组件的初始数据
*/
data: {
// isShow: false,
flag: true, //是否显示
secondClo:[],
thirdClo:[],
setValues: [],
},
/**
* 组件的方法列表
*/
methods: {
bindChange: function (e) {
// const newVal = e.detail.value
// const oldVal = this.data.value
// let data = this.data.list
// if (this.data.column == "2") {
// if (oldVal[0] != newVal[0]){
// this.setData({
// secondClo: data[newVal[0]].data
// })
// }
// }
// if (this.data.column == "3") {
// if (oldVal[0] != newVal[0]) {
// this.setData({
// secondClo: data[newVal[0]].data,
// thirdClo: data[newVal[0]].data[0].data
// })
// }
// if (oldVal[1] != newVal[1]) {
// this.setData({
// thirdClo: data[newVal[0]].data[newVal[1]].data
// })
// }
// }
// this.setData({
// value: e.detail.value
// })
this.setData({
setValues: e.detail.value
})
},
// 阻止content冒泡
contentcatchtap: function(){},
//隐藏弹框
hidePicker: function () {
this.setData({
flag: !this.data.flag
})
},
//展示弹框
showPicker() {
this.setData({
flag: !this.data.flag
})
this._getItems()
},
/*
* 内部私有方法建议以下划线开头
* triggerEvent 用于触发事件
*/
_successEvent() {
console.log("_success")
console.log(this.data.list)
console.log(this.data.setValues)
let item = this.data.list[this.data.setValues[0]]
console.log(item)
// //触发成功回调
// var confirmDetail = this.data.value
// // console.log(this.data.value)
this.setData({
flag: !this.data.flag
})
this.triggerEvent('confirm', this.data.setValues)
},
// 获取初始化信息
_getItems(e) {
if (this.data.list.length && this.data.initValue) {
let items = this.data.list
for (let i = 0; i < items.length; i++) {
if (this.data.initValue == items[i].id) {
this.setData({
setValues: [i]
})
return
}
}
}
this.setData({
setValues: [0]
})
},
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='mypicker' hidden="{{flag}}">
<view class='shadow' catchtap='hidePicker'></view>
<view class='content' catchtap='contentcatchtap'>
<view class='picker-head'>
<text class='cancle' catchtap='hidePicker'>取消</text>
<text class='sure' catchtap='_successEvent'>确认</text>
</view>
<picker-view class='picker-view' indicator-style="height: 100rpx;" value="{{value}}" bindchange="bindChange">
<!-- 一列picker -->
<block wx:if="{{column==='1'}}">
<picker-view-column>
<view wx:for="{{list}}" wx:key="{{index}}" style="line-height: 68rpx">{{item.name}}</view>
</picker-view-column>
</block>
<!-- 两列picker -->
<block wx:if="{{column==='2'}}">
<picker-view-column>
<view wx:for="{{list}}" wx:key="{{index}}" style="line-height: 68rpx">{{item.name}}</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{secondClo}}" wx:key="{{index}}" style="line-height: 68rpx">{{item.name}}</view>
</picker-view-column>
</block>
<!-- 三列picker -->
<block wx:if="{{column==='3'}}">
<picker-view-column>
<view wx:for="{{list}}" wx:key="{{index}}" style="line-height: 68rpx">{{item.name}}</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{secondClo}}" wx:key="{{index}}" style="line-height: 68rpx">{{item.name}}</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{thirdClo}}" wx:key="{{index}}" style="line-height: 68rpx">{{item.name}}</view>
</picker-view-column>
</block>
</picker-view>
</view>
</view>
\ No newline at end of file
.mypicker{
width: 100%;
height: 100%;
position: fixed;
left: 0;
top: 0;
z-index: 100;
}
.shadow{
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
background: #000;
opacity: 0.5;
}
.content{
height: 590rpx;
width: 100%;
position: absolute;
left: 0;
bottom: 0;
background: #fff;
}
.picker-view{
text-align: center;
width: 100%;
height: 400rpx;
line-height: 100rpx;
}
.picker-head{
height: 80rpx;
line-height: 80rpx;
font-size: 40rpx;
border-bottom: 2rpx solid #ddd;
padding: 0 40rpx;
}
.cancle{
color: #999;
}
.sure{
color: #3B76D8;
float: right;
}
\ No newline at end of file
Component({
options: {
multipleSlots: true // 在组件定义时的选项中启用多slot支持
},
/**
* 组件的属性列表
*/
properties: {
title: { // 属性名
type: String, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
value: '标题' // 属性初始值(可选),如果未指定则会根据类型选择一个
},
// 弹窗内容
content: {
type: String,
value: '内容'
},
// 弹窗取消按钮文字
btn_no: {
type: String,
value: '取消'
},
// 弹窗确认按钮文字
btn_ok: {
type: String,
value: '确定'
}
},
/**
* 组件的初始数据
*/
data: {
flag: true,
},
/**
* 组件的方法列表
*/
methods: {
//隐藏弹框
hidePopup: function () {
this.setData({
flag: !this.data.flag
})
},
//展示弹框
showPopup () {
this.setData({
flag: !this.data.flag
})
},
/*
* 内部私有方法建议以下划线开头
* triggerEvent 用于触发事件
*/
_error () {
//触发取消回调
this.triggerEvent("error")
},
_success () {
//触发成功回调
this.triggerEvent("success");
}
}
})
\ No newline at end of file
{
"navigationBarTitleText": "查看启动日志",
"usingComponents": {}
}
\ No newline at end of file
<view class="wx-popup" hidden="{{flag}}">
<view class='popup-container'>
<view class="wx-popup-title">{{title}}</view>
<view class="wx-popup-con">{{content}}</view>
<view class="wx-popup-btn">
<text class="btn-no" bindtap='_error'>{{btn_no}}</text>
<text class="btn-ok" bindtap='_success'>{{btn_ok}}</text>
</view>
</view>
</view>
\ No newline at end of file
/* component/popup.wxss */
.wx-popup {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .5);
}
.popup-container {
position: absolute;
left: 50%;
top: 50%;
width: 80%;
max-width: 600rpx;
border: 2rpx solid #ccc;
border-radius: 10rpx;
box-sizing: bordre-box;
transform: translate(-50%, -50%);
overflow: hidden;
background: #fff;
}
.wx-popup-title {
width: 100%;
padding: 20rpx;
text-align: center;
font-size: 40rpx;
border-bottom: 2rpx solid red;
}
.wx-popup-con {
margin: 60rpx 10rpx;
text-align: center;
}
.wx-popup-btn {
display: flex;
justify-content: space-around;
margin-bottom: 40rpx;
}
.wx-popup-btn text {
display: flex;
align-items: center;
justify-content: center;
width: 30%;
height: 88rpx;
border: 2rpx solid #ccc;
border-radius: 88rpx;
}
\ No newline at end of file
var app = getApp();
Page({
data: {
equipmentId: ''
},
onLoad: function (options) {
console.log(options.equipmentId)
this.setData({
equipmentId: options.equipmentId
})
},
noBind: function() {
// 暂不绑定,关闭所有页面,返回扫码页面
wx.reLaunch({
url: '/pages/getCodeIndex/getCodeIndex'
})
},
bindEquipment: function() {
let me = this;
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'devices/bind',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
seexSn: me.data.equipmentId
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
// 绑定成功
wx.showToast({
title: '绑定成功',
mask: true,
// icon: 'none',
duration: 2000
});
//跳转完善信息
wx.navigateTo({
url: '/pages/childInfo/childInfo'
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}
})
\ No newline at end of file
{
"navigationBarTitleText": "绑定设备",
"usingComponents": {}
}
\ No newline at end of file
<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
var app = getApp();
Page({
data: {
name: '',//姓名
date: '2010-01-01',// 生日
sex: 1,// 性别
school: '',// 学校
class: '',// 班级
sexList: [{ id: 1, checked: true, name: '男孩' }, { id: 2, name: '女孩' }],
// adapterSource: , //本地匹配源
// bindSource: [], //绑定到页面的数据,根据用户输入动态变化
// hideScroll: true,
isNull: false
},
onLoad: function (options) {
let me = this;
},
childInfoBack: function() {
let me = this;
wx.navigateTo({
url: '/pages/network/network'
})
},
bindDateChange: function(e) {
this.setData({
date: e.detail.value
})
},
// 改变性别
sexTap: function(e) {
this.setData({
sex: 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) {
this.setData({
isNull: false,
name: e.detail.value
})
},
classInput: function (e) {
this.setData({
class: e.detail.value
})
},
// 下一步
childInfoNext: function () {
let me = this;
if(me.data.name==''){// 没填姓名高亮
me.setData({
isNull: true
})
wx.showToast({
title: '姓名不能为空!',
icon: 'none'
})
} else{
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'teenages/info',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
name: me.data.name,
birthday: me.data.date,
gender: me.data.sex,//性别
schoolName: me.data.school,//学校
classesName: me.data.class//班级
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
// 绑定成功
wx.showToast({
title: '填写成功',
mask: true,
// icon: 'none',
duration: 2000
});
wx.navigateTo({
url: '/pages/eyesight/eyesight'
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}
}
})
\ No newline at end of file
{
"navigationBarTitleText": "完善信息",
"usingComponents": {}
}
\ No newline at end of file
<view id="childInfo" bindtap="ccctap">
<!-- 导航 -->
<view id="bindTabWrap">
<view id="bindTab">
<text>绑定设备</text>
<image src="../../assets/arrow_right.png" />
<text class="bindTabSelected">完善信息</text>
</view>
</view>
<!-- 基本信息 -->
<view id="childInfoListTitle">基本信息</view>
<view id="childInfoList">
<view class="childInfoListItem">
<view class="childInfoListItemTitle {{isNull?'redTitle':''}}"><text>*</text>姓名</view>
<input class="nameInput rightInput" placeholder-style="color:#CDCDCD;" bindinput="nameInput" placeholder="请输入您的孩子的真实姓名" />
</view>
<!-- 生日 -->
<view class="childInfoListItem">
<view class="childInfoListItemTitle"><text>*</text>生日</view>
<picker mode="date" value="{{date}}" start="1990-09-01" end="2025-09-01" bindchange="bindDateChange">
<view class="birthdaypPicker rightInput">
{{date}}
</view>
</picker>
</view>
<!-- 性别 -->
<view class="childInfoListItem">
<view class="childInfoListItemTitle"><text>*</text>性别</view>
<radio-group id="sexRadioBox" class="rightInput" bindchange="sexTap">
<label class="sexRadio" wx:for="{{sexList}}" wx:key="sexList">
<radio color="#fff" value="{{item.id}}" checked="{{item.checked}}"/>{{item.name}}
</label>
</radio-group>
</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 id="childInfoBoxCon">
<view id="childInfoBox">
<button id="childInfoBack" bindtap='childInfoBack'>上一步</button>
<button id="childInfoNext" bindtap='childInfoNext'>下一步</button>
</view>
</view>
</view>
#childInfo{
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;
}
/* 信息列表 */
#childInfoList{
background: #fff;
padding-left: 25rpx;
}
#childInfoListTitle{
font-size: 28rpx;
color: #4F5051;
padding: 0 0 20rpx 25rpx;
}
.childInfoListItem{
display: flex;
align-items: center;
color: #aaa;
font-size: 24rpx;
border-bottom: 1rpx solid #d7d7d7;
padding: 30rpx 0;
}
.childInfoListItem:last-child{
border: none;
}
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;
}
.childInfoListItem .childInfoListItemTitle{
font-size: 34rpx;
color: #4F5051;
width: 100rpx;
text-align: right;
margin-right: 52rpx;
}
.childInfoListItemTitle>text{
color: #FA6400;
margin-right: 7rpx;
}
.rightInput{
width: 500rpx;
font-size: 34rpx;
color: #4F5051;
}
.birthdaypPicker{
color: #4F5051;
}
.childInfoListSchool{
position: relative;
}
.locationPull{
position:absolute;
background:#f5f6f5;
z-index:9999;
padding:0 10rpx;
left:-20rpx;
}
.locationPullItem{
padding: 10rpx;
border-bottom: 0.5rpx solid #ccc;
}
.childInfoListItem .redTitle{
color: red;
}
/* 提示 */
#childInfoTips{
font-size: 28rpx;
color: #4F5051;
padding: 0 50rpx;
line-height: 48rpx;
margin-top:20rpx;
}
/* 按钮组 */
#childInfoBoxCon{
position: absolute;
bottom: 80rpx;
width: 100%;
}
#childInfoBox{
display: flex;
justify-content: space-between;
padding:0 40rpx;
}
#childInfoBox>button{
width: 315rpx;
height: 94rpx;
line-height: 94rpx;
font-size: 36rpx;
border-radius: 10rpx;
}
#childInfoBack{
background: #F8F8F8;
border: 2rpx solid rgba(5,5,5,0.10);
color: #000000;
}
#childInfoNext{
color: #fff;
background: #33D1C4;
}
var app= getApp();
Page({
data: {
flag: true,
second: '',
disabled: true,
luoData: {left: '',right: ''},//裸眼视力
jiaoData: {left: '',right: ''},//矫正视力
glassData: {left: '',right: ''},//眼镜度数
ruoData: {left: '',right: ''},// 弱视
xieData: {left: '',right: ''},// 斜视
sanData: {left: '',right: ''},// 散光
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']
],
luoeyeIndex: [10, 10],
jiaoArray: [
['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']
],
jiaoIndex: [10, 10],
glassArray: [
['-','300度以下','300-600度','600度以上'],
['-','300度以下','300-600度','600度以上']
],
glassIndex: [0, 0],
ruoArray: [// 弱视选项
['无','中度','重度'],
['无','中度','重度']
],
ruoIndex: [0, 0],
xieArray: [// 斜视选项
['无','有'],
['无','有']
],
xieIndex: [0, 0],
sanArray: [// 散光选项
['无','<=100度','>100度'],
['无','<=100度','>100度']
],
sanIndex: [0, 0],
show: false,// 是否显示详细选项
allLeft: "无",// 多个集合左
allRight: "无",// 多个集合右
allLeftStatus: 0,// 多个集合左(状态)
allRightStatus: 0,// 多个集合右(状态)
first: true,// 是否第一次点击下一步
},
onLoad: function (options) {
let me = this;
},
eyesightBack: function() {
let me = this;
wx.navigateTo({
url: '/pages/childInfo/childInfo'
})
},
eyesightNext: function () {
let me = this;
// 是否第一次点击下一步
if(me.data.first){
// 如果是有弱视斜视散光,弹窗
if(me.data.allLeft=='有'||me.data.allRight=='有'){
let num = 5;
me.setData({
flag: false,
disabled: true,
second: '('+num+'s)'
})
let timer = setInterval(function () {
num--;
if (num <= 0) {
clearInterval(timer);
me.setData({
second: '',
disabled: false
})
} else {
me.setData({
second: '('+num+'s)',
disabled: true
})
}
}, 1000)
}else{
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
// 模拟请求
setTimeout(function () {
// 请求成功后关闭Loading
wx.hideLoading()
// 第一次点击没有视觉缺陷
console.log('第一次没有----下一步')
me.next();
}, 2000)
}
}else{
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
// 模拟请求
setTimeout(function () {
// 请求成功后关闭Loading
wx.hideLoading()
// 弹窗后----下一步
console.log('弹窗后----下一步')
me.next();
}, 2000)
}
},
// 下一步请求
next: function(e){
let me = this;
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'teenages/vision',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
leftEye: me.data.luoData.left,// 左眼裸眼视力
rightEye: me.data.luoData.right,// 右眼裸眼视力
leftCorrectedEye: me.data.jiaoData.left,// 左眼矫正视力
rightCorrectedEye: me.data.jiaoData.right,// 右眼矫正视力
leftGlassesDegree: me.data.glassData.left,// 左眼眼镜度数
rightGlassesDegree: me.data.glassData.right,// 右眼眼镜度数
leftOtherEyeStatus: me.data.allLeftStatus,// 左眼弱视、斜视、散光情况,1:有、0:无
rightOtherEyeStatus: me.data.allRightStatus,// 右眼弱视、斜视、散光情况,1:有、0:无
leftWeekEye: me.data.ruoData.left,// 左眼弱视程度
rightWeekEye: me.data.ruoData.right,// 右眼弱视程度
leftLeerEye: me.data.xieData.left,// 左眼斜视情况
rightLeerEye: me.data.xieData.right,// 右眼斜视情况
leftCylEye: me.data.sanData.left,// 左眼散光度数
rightCylEye: me.data.sanData.right// 右眼散光度数
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
// 填写成功
wx.showToast({
title: '填写成功',
mask: true,
// icon: 'none',
duration: 2000
});
wx.navigateTo({
url: '/pages/setting/setting'
});
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
},
showList: function () {
this.setData({
show: !this.data.show
})
},
eyesightKnow: function() {
this.setData({
flag: true,
first: false
})
// let me = this;
},
luoeyeChange: function (e) {// 裸眼视力
let luoData = {
left: this.data.luoeyeArray[0][e.detail.value[0]],
right: this.data.luoeyeArray[1][e.detail.value[1]]
}
this.setData({
luoeyeIndex: e.detail.value,
luoData: luoData
})
console.log('裸眼视力:')
console.log(luoData)
},
jiaoChange: function (e) {// 矫正视力
let jiaoData = {
left: this.data.jiaoArray[0][e.detail.value[0]],
right: this.data.jiaoArray[1][e.detail.value[1]]
}
this.setData({
jiaoIndex: e.detail.value,
jiaoData: jiaoData
})
console.log('矫正视力:')
console.log(this.data.jiaoData)
},
glassChange: function (e) {// 矫正视力
let glassData = {
left: this.data.glassArray[0][e.detail.value[0]],
right: this.data.glassArray[1][e.detail.value[1]]
}
this.setData({
glassIndex: e.detail.value,
glassData: glassData
})
console.log('眼镜度数:')
console.log(this.data.glassData)
},
ruoChange: function (e) {// 弱视
let ruoData = {
left: this.data.ruoArray[0][e.detail.value[0]],
right: this.data.ruoArray[1][e.detail.value[1]]
}
this.setData({
ruoIndex: e.detail.value,
ruoData: ruoData
})
// 调用判断整体状态
this.setAll();
console.log('弱视程度:')
console.log(this.data.ruoData)
},
xieChange: function (e) {// 斜视
let xieData = {
left: this.data.xieArray[0][e.detail.value[0]],
right: this.data.xieArray[1][e.detail.value[1]]
}
this.setData({
xieIndex: e.detail.value,
xieData: xieData
})
// 调用判断整体状态
this.setAll();
console.log('斜视情况:')
console.log(this.data.xieData)
},
sanChange: function (e) {// 散光
let sanData = {
left: this.data.sanArray[0][e.detail.value[0]],
right: this.data.sanArray[1][e.detail.value[1]]
}
this.setData({
sanIndex: e.detail.value,
sanData: sanData
})
// 调用判断整体状态
this.setAll();
console.log('散光度数:')
console.log(this.data.sanData)
},
// 判断弱视斜视散光 有、无 状态
setAll: function (e) {
if(this.data.ruoData.left!="无"||this.data.xieData.left!="无"||this.data.sanData.left!="无"){
this.setData({
allLeft: '有',
allLeftStatus: 1
})
}else{
this.setData({
allLeft: '无',
allLeftStatus: 0
})
}
if(this.data.ruoData.right!="无"||this.data.xieData.right!="无"||this.data.sanData.right!="无"){
this.setData({
allRight: '有',
allRightStatus: 1
})
}else{
this.setData({
allRight: '无',
allRightStatus: 0
})
}
},
})
\ No newline at end of file
{
"navigationBarTitleText": "完善信息",
"usingComponents": {
}
}
\ No newline at end of file
<view id="eyesight">
<!-- 导航 -->
<view id="bindTabWrap">
<view id="bindTab">
<text>绑定设备</text>
<image src="../../assets/arrow_right.png" />
<text class="bindTabSelected">完善信息</text>
</view>
</view>
<view id="eyesightConWrap">
<view class="eyesightConTitle">
<view class="eyesightConLeft">视力情况</view>
<view class="eyesightConRight">
<text class="selItem">左</text>
<text class="selItem">右</text>
</view>
</view>
<view id="eyesightCon">
<view class="eyesightConItem">
<view class="eyesightConLeft">裸眼视力</view>
<picker mode="multiSelector" class="selectorPicker" bindchange="luoeyeChange" value="{{luoeyeIndex}}" range="{{luoeyeArray}}">
<view class="eyesightConRight">
<view class="selItem">{{luoeyeArray[0][luoeyeIndex[0]]}}</view>
<view class="selItem">{{luoeyeArray[1][luoeyeIndex[1]]}}</view>
</view>
</picker>
</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="eyesightConLeft">弱视、斜视、散光</view>
<view class="eyesightConRight">
<text class="selItem">{{allLeft}}</text>
<text class="selItem">{{allRight}}</text>
</view>
</view>
</view>
<view id="eyesightLast" hidden="{{!show}}">
<view class="eyesightConItem">
<view class="eyesightConLeft">· 弱视程度</view>
<picker mode="multiSelector" class="selectorPicker" bindchange="ruoChange" value="{{ruoIndex}}" range="{{ruoArray}}">
<view class="eyesightConRight">
<view class="selItem">{{ruoArray[0][ruoIndex[0]]}}</view>
<view class="selItem">{{ruoArray[1][ruoIndex[1]]}}</view>
</view>
</picker>
</view>
<view class="eyesightConItem">
<view class="eyesightConLeft">· 斜视情况</view>
<picker mode="multiSelector" class="selectorPicker" bindchange="xieChange" value="{{xieIndex}}" range="{{xieArray}}">
<view class="eyesightConRight">
<view class="selItem">{{xieArray[0][xieIndex[0]]}}</view>
<view class="selItem">{{xieArray[1][xieIndex[1]]}}</view>
</view>
</picker>
</view>
<view class="eyesightConItem">
<view class="eyesightConLeft">· 散光度数</view>
<picker mode="multiSelector" class="selectorPicker" bindchange="sanChange" value="{{sanIndex}}" range="{{sanArray}}">
<view class="eyesightConRight">
<view class="selItem">{{sanArray[0][sanIndex[0]]}}</view>
<view class="selItem">{{sanArray[1][sanIndex[1]]}}</view>
</view>
</picker>
</view>
</view>
</view>
<view class="{{show?'eyesightBom':'eyesightPos'}}">
<view id="eyesightBox">
<button id="eyesightBack" bindtap='eyesightBack'>上一步</button>
<button id="eyesightNext" bindtap='eyesightNext'>下一步</button>
</view>
</view>
<view id="eyesightPopup" hidden="{{flag}}">
<view id="eyesightPopupCon">
<view id="eyesightPopupTitle">重要提醒</view>
<view id="eyesightPopupDes">【佩奇】的视力信息包含“弱视、斜视、散光”,训练计划将包含弱视训练,该训练会对一般近视等造成不良影响,如无此情况,请勿选择!</view>
<button id="eyesightKnow" disabled="{{disabled}}" style="{{disabled?'background:#ccc;':''}}" bindtap='eyesightKnow'>知道了{{second}}</button>
</view>
</view>
</view>
#eyesight{
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;
}
#eyesightCon,#eyesightLast{
color: #4F5051;
font-size: 34rpx;
background: #fff;
padding-left: 25rpx;
}
#eyesightCon{
border-bottom: 2rpx solid #E5E5E5;
}
.eyesightConTitle{
font-size: 32rpx;
padding-bottom: 20rpx;
display: flex;
padding-left: 25rpx;
font-size: 28rpx;
color: #4F5051;
}
.eyesightConItem{
display: flex;
padding-bottom: 52rpx;
border-bottom: 2rpx solid #E5E5E5;
padding: 32rpx 0 30rpx;
}
.eyesightConItem:last-child{
border: 0;
}
.eyesightConLeft{
width:45%;
}
.eyesightConRight{
display: flex;
justify-content: space-around;
width:50%;
}
.eyesightConItem .eyesightConRight{
color: #33D1C4;
}
.selectorPicker .eyesightConRight{
width: 100%;
padding-right: 0;
}
.selItem{
width: 50%;
text-align: center;
}
.selectorPicker{
width:50%;
padding-right:30rpx;
}
/* 弹窗 */
#eyesightPopup{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .5);
}
#eyesightPopupCon{
position: absolute;
left: 50%;
top: 50%;
width: 71%;
max-width: 600rpx;
border-radius: 10rpx;
transform: translate(-50%, -50%);
overflow: hidden;
background: #555;
color: #fff;
padding: 44rpx 58rpx;
}
#eyesightPopupTitle{
font-size: 32rpx;
text-align: center;
margin-bottom: 30rpx;
}
#eyesightPopupDes{
font-size: 28rpx;
margin-bottom: 30rpx;
}
#eyesightKnow{
font-size: 26rpx;
color: #555;
width: 220rpx;
height: 60rpx;
line-height: 60rpx;
}
/* 按钮组 */
.eyesightBom{
padding: 20rpx 0 80rpx;
}
.eyesightPos{
position: absolute;
bottom: 80rpx;
width: 100%;
}
#eyesightBox{
display: flex;
justify-content: space-between;
padding:0 40rpx;
}
#eyesightBox>button{
width: 315rpx;
height: 94rpx;
line-height: 94rpx;
font-size: 36rpx;
border-radius: 10rpx;
}
#eyesightBack{
background: #F8F8F8;
border: 2rpx solid rgba(5,5,5,0.10);
color: #000000;
}
#eyesightNext{
color: #fff;
background: #33D1C4;
}
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'
})
}
})
{
"navigationBarTitleText": "扫码绑定",
"usingComponents": {}
}
\ No newline at end of file
<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
var app = getApp();
Page({
data: {
SN: ''
},
onLoad: function () {
},
// sn码
snChange: function(e) {
this.setData({
SN: e.detail.value
})
},
// 开始绑定
bind: function(e) {
let me = this;
console.log(me.data.SN)
if(me.data.SN==''){
wx.showModal({
title: '提示',
showCancel: false,
content: 'SN码不能为空!'
})
return
}
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'devices/bind',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
seexSn: me.data.SN
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
// 绑定成功
wx.showToast({
title: '绑定成功',
mask: true,
// icon: 'none',
duration: 2000
});
wx.navigateTo({
url: '/pages/network/network'
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}
})
{
"navigationBarTitleText": "绑定设备",
"usingComponents": {}
}
\ 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';
// 饼状图
let chartPie = null;
function pieInitChart(canvas, width, height) {
chartPie = echarts.init(canvas, null, {
width: width,
height: height
});
canvas.setChart(chartPie);
var option = {
tooltip: {
show: false
},
color:['#54585f','#7a8088','#979faa'],
legend: {
left: 'center',
top: 10,
textStyle:{
color: '#555',
fontSize: 10
},
icon: "circle",
itemWidth: 8,
itemHeight: 8,
itemGap: 30,
data: ['动态训练','静态训练','单次训练']
},
series: [
{
// silent: true,//不响应和触发鼠标事件
hoverAnimation: false,//是否开启 hover 在拐点标志上的提示动画效果。
type: 'pie',
radius : '80%',
center: ['50%', '60%'],
data:[
{value:35, name:'动态训练'},
{value:45, name:'静态训练'},
{value:20, name:'单次训练'}
],
label:{//饼图图形上的文本标签
normal:{
  show: true,
position: 'outside', //标签的位置
textStyle : {
fontWeight : 300 ,
fontSize : 12//文字的字体大小
    },
formatter: '{d}%'
}
    }
}
]
};
chartPie.setOption(option);
return chartPie;
}
var app = getApp();
Page({
data: {
pieChart: {
onInit: pieInitChart
},
historyList: {
id: 0,
date:'5月27日 至 5月20日',
finish: 1,//训练是否完成
minute: 125,// 训练分钟
type: 1,// 视力升高或降低
degrees: '4.5 | 4.4',
dyn: '20%',
static: '60%',
word: '20%'
}
},
onLoad: function (options) {
// console.log(options.historyId)
}
})
{
"navigationBarTitleText": "训练历史",
"usingComponents": {
"ec-canvas": "../../component/ec-canvas/ec-canvas"
}
}
\ No newline at end of file
<view id="historyDetail">
<!-- 头像、用户名时间等 -->
<view id="top">
<view id="topLeft">
<image src="../../assets/head.png" />
<text>用户名</text>
</view>
<view id="topRight">
<view>5月12日~5月18日<text>(周为单位)</text></view>
<view>上周共训练<text>150</text>分钟,目标已完成!</view>
<view>并且右眼提升<text>0.1</text></view>
</view>
</view>
<!-- 视力情况 -->
<view id="eyesight">
<view id="eyesightTitle">
<view class="eyesightItemLeft">视力情况</view>
<view class="eyesightItemRight"><text>左</text><text>右</text></view>
</view>
<view class="eyesightItem">
<view class="eyesightItemLeft">裸眼视力</view>
<view class="eyesightItemRight">
<text>4.5</text>
<text>3.5</text>
</view>
</view>
<view class="eyesightItem">
<view class="eyesightItemLeft">矫正视力</view>
<view class="eyesightItemRight">
<text>4.0↓-0.5</text>
<text>4.0↑+0.5</text>
</view>
</view>
<view class="eyesightItem">
<view class="eyesightItemLeft">眼镜度数</view>
<view class="eyesightItemRight">
<text>150</text>
<text>100</text>
</view>
</view>
<view class="eyesightItem">
<view class="eyesightItemLeft">斜视、弱视、散光</view>
<view class="eyesightItemRight">
<text>有</text>
<text>无</text>
</view>
</view>
</view>
<!-- 训练图 -->
<view class="pieChart">
<ec-canvas ec="{{ pieChart }}"></ec-canvas>
</view>
<view id="shareBox">
<text id="share">分享</text>
</view>
<!-- 常用应用 -->
<view id="common">
<view id="commonTitle">常用应用</view>
<view id="commonList">
<view class="commonItem">
<image src="../../assets/appIcon.png" />
<text>应用名称111</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>
#historyDetail{
background: #EFEFF4;
min-height: 100vh;
}
#top{
padding: 30rpx 25rpx;
display: flex;
border-bottom: 2rpx solid #A7A7A8;
}
#topLeft{
display: flex;
flex-direction: column;
align-items: center;
margin-right: 50rpx;
}
#topLeft>image{
width: 100rpx;
height: 100rpx;
}
#topLeft>text{
font-size: 30rpx;
margin-top: 6rpx;
}
#topRight{
font-size: 28rpx;
color: #A7A7A8;
display: flex;
flex-direction:column;
justify-content:space-around;
}
/*  */
#eyesight{
padding: 30rpx;
border-bottom: 2rpx solid #A7A7A8;
}
#eyesightTitle{
display: flex;
font-size: 28rpx;
color: #4F5051;
background: #A7A7A8;
border-radius: 100rpx;
padding: 20rpx 30rpx;
}
.eyesightItem{
display: flex;
font-size: 28rpx;
color: #A7A7A8;
padding: 20rpx 30rpx;
}
.eyesightItemLeft{
width: 42%;
}
.eyesightItemRight{
width: 58%;
}
.eyesightItemRight>text{
width: 35%;
display: inline-block;
padding-left: 15%;
}
.pieChart {
width: 100%;
height: 400rpx;
}
/* 分享 */
#shareBox{
text-align: right;
border-bottom: 2rpx solid #A7A7A8;
}
#share{
font-size: 28rpx;
padding: 10rpx 30rpx;
}
/* 常用应用 */
#commonList{
display: flex;
padding: 40rpx;
}
#commonTitle{
padding: 10rpx 30rpx;
}
.commonItem{
display: flex;
align-items: center;
flex-direction: column;
font-size: 26rpx;
color: #A7A7A8;
/* padding: 0 20rpx; */
width: 20%;
}
.commonItem>image{
width: 60rpx;
height: 60rpx;
margin-bottom: 10rpx;
}
\ No newline at end of file
Page({
data: {
idea: '',
contentLength: 0
},
onReady() {
},
// 提交
submit() {
console.log('提交')
console.log(this.data.idea)
if(this.data.idea==''){
wx.showModal({
title: '提示',
showCancel: false,
content: '请填写反馈信息!'
})
return
}
wx.redirectTo({
url: '/pages/mine/mine'
})
},
// 输入
inputchange(e) {
this.setData({
idea: e.detail.value,
contentLength: this.data.idea.length
})
},
})
\ No newline at end of file
{
"navigationBarTitleText": "意见反馈",
"usingComponents": {}
}
\ No newline at end of file
<view id="ideaBox">
<textarea class='areaInput' placeholder-style="font-size: 28rpx;color: #999;" value="{{idea}}" bindinput='inputchange' maxlength="1000" placeholder="请简要描述你的问题和意见" />
</view>
<view id="conLength">还可以输入{{1000-contentLength}}个字符</view>
<view id="submitBtn">
<button id="submit" bindtap='submit'>提交</button>
</view>
\ No newline at end of file
/* 提交 */
#submitBtn{
padding: 75rpx 30rpx 80rpx;
}
#submit{
background: #33D1C4;
border-radius: 10rpx;
font-size: 36rpx;
color: #FFFFFF;
height: 94rpx;
line-height: 94rpx;
}
#ideaBox{
padding: 25rpx;
}
#conLength{
font-size: 28rpx;
color: #999;
text-align: right;
padding-right: 25rpx;
}
.areaInput{
width: auto;
height: 350rpx;
border: 1rpx solid #ccc;
border-radius: 8rpx;
padding: 25rpx;
font-size: 28rpx
}
//index.js
//获取应用实例
const app = getApp()
var app = getApp();
import * as echarts from '../../component/ec-canvas/echarts';
// 柱状图
let chartWeek = null;
function weekInitChart(canvas, width, height) {
chartWeek = echarts.init(canvas, null, {
width: width,
height: height
});
canvas.setChart(chartWeek);
var option = {
color: ['#54585f'],
tooltip: {
show: false
},
grid: {
left: 5,
right: 5,
bottom: 15,
top: 30,
height: 150,
// show: true,
containLabel: true,
// borderColor: '#c9f1ce'
},
xAxis: [
{
type: 'category',
data: ['周日\n5.11', '周一\n5.12', '周二\n5.13', '周三\n5.14', '周四\n5.15', '周五\n5.16', '周六\n5.17'],
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),
barBorderRadius: [3, 3, 0, 0] //(顺时针左上,右上,右下,左下)
}
},
data: [30, 3, 35, 45, 17, 22, 0]
}
]
};
chartWeek.setOption(option);
return chartWeek;
}
// 饼状图
let chartPie = null;
function pieInitChart(canvas, width, height) {
chartPie = echarts.init(canvas, null, {
width: width,
height: height
});
canvas.setChart(chartPie);
var option = {
tooltip: {
show: false
},
color:['#6debc2','#5bc8ee','#5c7ce7'],
legend: {
left: 'center',
top: 'center',
orient: 'vertical',
// top: 10,
textStyle:{
color: '#4f5051',
fontSize: 11
},
icon: "circle",
itemWidth: 8,
itemHeight: 8,
itemGap: 15,//图例间隔
data: ['静态训练','动态训练','单词训练']
},
series: [
{
// silent: true,//不响应和触发鼠标事件
hoverAnimation: false,//是否开启 hover 在拐点标志上的提示动画效果。
type: 'pie',
// radius : '80%',
radius: ['52%', '100%'],
// center: ['50%', '60%'],
data:[
{value:48, name:'静态训练'},
{value:28, name:'动态训练'},
{value:24, name:'单词训练'}
],
label:{//饼图图形上的文本标签
normal:{
  show: true,
position: 'inner', //标签的位置
textStyle : {
fontWeight : 300 ,
fontSize : 14//文字的字体大小
    },
formatter: '{d}%'
}
    }
}
]
};
chartPie.setOption(option);
return chartPie;
}
// 左眼视力图
let leftEyeChart = null;
function leftEyeInitChart(canvas, width, height) {
leftEyeChart = echarts.init(canvas, null, {
width: width,
height: height
});
canvas.setChart(leftEyeChart);
var option = {
tooltip: {
show: false
},
grid: {
bottom: 25,
top: 20,
right: 10
},
xAxis: {
type: 'category',
boundaryGap: false,
axisLine: {
lineStyle: {
color: '#c9f1ce'
}
},
axisTick:{
length: 0,
},
axisLabel:{
color: '#333',
fontSize: 11
},
boundaryGap: true,
data: ["12.31", "1.1", "1.2", "1.3", "1.4", "1.5", "1.5"]
},
yAxis: {
type: 'value',
interval: 0.2,//强制间隔
axisTick: { show: false },
axisLine: {
show: false //是否显示轴线
},
splitLine:{//网格横线
lineStyle:{
color: ['#c9f1ce'],
width: 1
}
},
axisLabel: {
color: '#333',
fontSize: 10,
showMinLabel: false //显示最小值
},
min: function(value) {
return value.min - 0.2;
},
max: function(value) {
return value.max + 0.2;
}
},
series: [
{
name: '训练后',
// silent: true,//不响应和触发鼠标事件
hoverAnimation: false,//是否开启 hover 在拐点标志上的提示动画效果。
type:'line',
color:['#33d1c4'],
symbolSize: 13,
lineStyle: {
width: 4
},
itemStyle:{
borderWidth: 2//拐点圆边框
},
data:[4.7, 4.7, 4.9, 4.9, 5.1, 5.1, 5.1]
},
{
name: '未训练',
symbol:'circle',//实心圆点
// silent: true,//不响应和触发鼠标事件
hoverAnimation: false,//是否开启 hover 在拐点标志上的提示动画效果。
type:'line',
color:['#f7b500'],
symbolSize: 6,//拐点圆的大小
lineStyle: {
width: 2
},
itemStyle:{
normal:{
borderColor:'#f7b500', //拐点边框颜色
}
},
data:[4.7, 4.5, 4.5, 4.3, 4.3, 4.1, 4.1]
}
]
};
leftEyeChart.setOption(option);
return leftEyeChart;
}
// 右眼视力图
let rightEyeChart = null;
function rightEyeInitChart(canvas, width, height) {
rightEyeChart = echarts.init(canvas, null, {
width: width,
height: height
});
canvas.setChart(rightEyeChart);
var option = {
tooltip: {
show: false
},
grid: {
bottom: 25,
top: 20,
right: 10
},
xAxis: {
type: 'category',
boundaryGap: false,
axisLine: {
lineStyle: {
color: '#c9f1ce'
}
},
axisTick:{
length:0,
},
axisLabel:{
color: '#333',
fontSize: 11
},
boundaryGap: true,
data: ["12.31", "1.1", "1.2", "1.3", "1.4", "1.5", "1.5"]
},
yAxis: {
type: 'value',
interval: 0.2,//强制间隔
axisTick: { show: false },
axisLine: {
show: false //是否显示轴线
},
splitLine:{//网格横线
lineStyle:{
color: ['#c9f1ce'],
width: 1
}
},
axisLabel: {
color: '#333',
fontSize: 10,
showMinLabel: false //显示最小值
},
min: function(value) {
return value.min - 0.2;
},
max: function(value) {
return value.max + 0.2;
}
},
series: [
{
name: '训练后',
// silent: true,//不响应和触发鼠标事件
hoverAnimation: false,//是否开启 hover 在拐点标志上的提示动画效果。
type:'line',
color:['#33d1c4'],
symbolSize: 13,
lineStyle: {
width: 4
},
itemStyle:{
borderWidth: 2
},
data:[4.7, 4.7, 4.9, 4.9, 5.1, 5.1, 5.1]
},
{
name: '未训练',
symbol:'circle',//实心圆点
// silent: true,//不响应和触发鼠标事件
hoverAnimation: false,//是否开启 hover 在拐点标志上的提示动画效果。
type:'line',
color:['#f7b500'],
symbolSize: 6,//拐点圆的大小
lineStyle: {
width: 2
},
itemStyle:{
normal:{
borderColor:'#f7b500', //拐点边框颜色
}
},
data:[4.7, 4.5, 4.5, 4.3, 4.3, 4.1, 4.1]
}
]
};
rightEyeChart.setOption(option);
return rightEyeChart;
}
Page({
data: {
motto: 'Hello World',
userInfo: {},
hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo')
teenageName: '',
gender: '',
age: '',
className: '',
avatar: '',
imgUrls: [
'../../assets/h1.jpg',
'../../assets/h2.jpg'
],
indicatorDots: true,
autoplay: false,
interval: 5000,
circular: true,
weekChart: {
onInit: weekInitChart
},
//事件处理函数
bindViewTap: function() {
wx.navigateTo({
url: '../logs/logs'
pieChart: {
onInit: pieInitChart
},
leftEyeChart: {
onInit: leftEyeInitChart
},
rightEyeChart: {
onInit: rightEyeInitChart
},
leftYear: '2018',
rightYear: '2019',
trainSortList:[
{ id: 14, name: "豆包", self: false, time: '283分钟' },
{ 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
iswifi: true,
checkImg: '../../assets/h2.jpg',
mustUpdate: true,
status: 1,
},
onShow() {
let me = this;
console.log('从子页面返回首页')
// this.setData({
// status: 1,
// mustUpdate: false
// })
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'Users/index',
method: 'POST',
data: {
token: wx.getStorageSync('token')
},
onLoad: function () {
if (app.globalData.userInfo) {
this.setData({
userInfo: app.globalData.userInfo,
hasUserInfo: true
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
teenageName: res.data.data.teenageName,
gender: res.data.data.gender,
age: res.data.data.age,
avatar: res.data.data.avatar,
})
} else if (this.data.canIUse){
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
app.userInfoReadyCallback = res => {
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
if(res.data.data.schoolName||res.data.data.classesName){
me.setData({
className: res.data.data.schoolName+res.data.data.classesName
})
}else{
me.setData({
className: '无'
})
}
} else {
// 在没有 open-type=getUserInfo 版本的兼容处理
wx.getUserInfo({
success: res => {
app.globalData.userInfo = res.userInfo
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
// 获取网络类型
wx.getNetworkType({
success (res) {
console.log(res.networkType)
// wifi : wifi 网络显示提示
if(res.networkType == 'wifi'){
me.setData({
iswifi: true
})
// WiFi环境 5秒刷新一次
me.timeImg(5000);
}else{
me.setData({
iswifi: false
})
// 非WiFi环境 10秒刷新一次
me.timeImg(10000);
}
}
})
},
getUserInfo: function(e) {
console.log(e)
app.globalData.userInfo = e.detail.userInfo
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
onReady() {
// setTimeout(function () {
// // 获取 chartWeek 实例的方式
// console.log(chartWeek)
// }, 2000);
},
onHide() {
// 切换页面时,关闭定时器
console.log(this.data.timerId);
clearInterval(this.data.timerId);
},
// 权限设置
ruleSet:function(){
wx.navigateTo({
url: '/pages/setting/setting'
})
},
// 设置
set:function(){
wx.navigateTo({
url: '/pages/ruleSet/ruleSet'
})
},
// 训练计划
plan:function(){
wx.navigateTo({
url: '/pages/plan/plan'
})
},
// 小目标
target:function(){
wx.navigateTo({
url: '/pages/targetList/targetList'
})
},
// 立即关机
PowerOff: function () {
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'devices/close',
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
});
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
},
// 定时获取设备屏幕图片
timeImg: function (delay) {
let me = this;
clearInterval(timer);
var timer = setInterval(function () {
// 暂时不加loading 影响操作(用户体验)
// // 请求前加Loading
// wx.showLoading({
// title: '加载中',
// mask: true
// })
//获取当前时间戳
var timestamp = Date.parse(new Date());
timestamp = timestamp / 1000;
console.log("当前时间戳为:" + timestamp);
wx.request({
url: app.globalData.apiUrl + 'devices/watchingPic',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
nowTime: timestamp // 当前时间戳,服务端会获取大于当前时间戳的图片信息
},
success: function (res) {
// // 请求成功后关闭Loading
// wx.hideLoading();
if(res.data.errno==200){
console.log(res.data.data.trainingStatus)//训练状态,1正在训练、0:未训练
console.log(res.data.data.thumb)
me.setData({
checkImg: res.data.data.thumb
})
// wx.showToast({
// title: '关机成功!',
// mask: true,
// // icon: 'none',
// duration: 2000
// });
}else{
clearInterval(timer);
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
}, delay);
me.setData({
timerId: timer
})
},
preventTouchMove() {},
// 个人中心
toMine() {
wx.navigateTo({
url: '/pages/mine/mine'
})
},
// 稍后前往
lastGo: function () {
// 关闭当前页面
this.setData({
mustUpdate: true
})
},
// 一键前往
nowGo: function () {
// 关闭当前页面,跳转到 "训练计划"
wx.navigateTo({
url: '/pages/plan/plan'
})
},
})
\ No newline at end of file
{
"usingComponents": {}
"usingComponents": {
"ec-canvas": "../../component/ec-canvas/ec-canvas"
}
}
\ No newline at end of file
<!--index.wxml-->
<view class="container">
<view class="userinfo">
<button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
<block wx:else>
<image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
<text class="userinfo-nickname">{{userInfo.nickName}}</text>
<view>
<!-- 轮播 -->
<swiper indicator-dots="{{indicatorDots}}" class="swiperBox" indicator-color="rgba(0,0,0,0.5)" indicator-active-color="#000"
autoplay="{{autoplay}}" interval="{{interval}}" circular="{{ circular }}">
<block wx:for="{{imgUrls}}" wx:key="{{index}}">
<swiper-item class="swiperCon">
<image src="{{item}}" class="slideImage"/>
</swiper-item>
</block>
</swiper>
<!-- 头像、设置 -->
<view id="userBox">
<view id="userHead" bindtap="toMine">
<image id="userHead" src="{{ avatar }}" />
</view>
<view id="userInfo" bindtap="toMine">
<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>
<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 class="checkCon">
<view class="checkDes">
<text id="trainTime">训练中,已训练5分钟32秒</text>
<view id="powerBox">
<image src="../../assets/power.png" />
<text class="PowerOff" bindtap="PowerOff">立即关机</text>
</view>
</view>
<view class="checkImg">
<image src="{{checkImg}}" />
<view class="wifi" hidden="{{iswifi}}">当前您使用的是非WIFI网络,系统已为您降低刷新频率</view>
</view>
</view>
<!-- 灰色间隔start -->
<view class="grayBlock"></view>
<!-- 灰色间隔end -->
<!-- 适合的目标 -->
<view class="target" bindtap="target">
<text>适合【佩奇】的小目标</text>
<view class="targetDes">
<image src="../../assets/cup.png" />
<view>接下来的一周按要求完成训练任务,瓜分<text>9999</text>积分</view>
</view>
</view>
<view class="grayBlock"></view>
<!-- 训练报告 -->
<view class="report">
<view class="reportTitle">
<view class="reportTitleLeft">训练报告</view>
<view class="targetHistory">
<text>历史报告</text>
<image src="../../assets/arrow_right.png"></image>
</view>
</view>
<view class="reportDes">
<view id="taskCompleteWrap" hidden="{{false}}">
<view id="taskComplete">
<image src="../../assets/task_complete.png" />
上周训练计划完成
</view>
<view id="taskCompleteDes">连续<text>3</text>周完成训练,超过<text>85%</text>的人</view>
</view>
<view id="taskNocompleteWrap" hidden="{{true}}">
<view id="taskNocomplete">
<image src="../../assets/task_incomplete.png" />
训练计划未完成
</view>
<view id="taskNocompleteDes">请坚持完成训练哦</view>
</view>
</view>
<view class="reprotChart">
<view class="reprotChartTitle">上周(5月12日~5月18日)共训练<text>125</text>分钟</view>
<view class="reprotWeekChart">
<ec-canvas ec="{{ weekChart }}"></ec-canvas>
</view>
<view class="reprotPieChart">
<ec-canvas ec="{{ pieChart }}"></ec-canvas>
</view>
<view class="reprotChartSuggest">
<view class="reprotChartSuggestTitle">训练建议</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 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>
<!-- 灰色间隔start -->
<view class="grayBlock"></view>
<!-- 灰色间隔end -->
<!-- 训练成就 -->
<view id="achieve">
<view class="achieveTitle">
<text>训练成就</text>
<image src="../../assets/arrow_right.png"></image>
</view>
<view class="achieveTime">累计训练<text>365</text>天</view>
<view class="achieveChange">视力从<text>4.5</text>提升到<text>4.7</text>度</view>
<view id="leftEyeChartBox">
<view class="eyeChartName">左眼视力</view>
<view class="legend_box">
<view class="legend_over">
<image src="../../assets/legend_over.png" />
<text>训练后</text>
</view>
<view class="legend_no">
<image src="../../assets/legend_no.png" />
<text>未训练</text>
</view>
</view>
</view>
<view class="leftEyeChart">
<ec-canvas ec="{{ leftEyeChart }}"></ec-canvas>
<text id="leftYear">{{leftYear}}</text>
</view>
<view id="rightEyeChartBox">
<view class="eyeChartName">右眼视力</view>
<view class="legend_box">
<view class="legend_over">
<image src="../../assets/legend_over.png" />
<text>训练后</text>
</view>
<view class="legend_no">
<image src="../../assets/legend_no.png" />
<text>未训练</text>
</view>
</view>
</view>
<view class="rightEyeChart">
<ec-canvas ec="{{ rightEyeChart }}"></ec-canvas>
<text id="rightYear">{{rightYear}}</text>
</view>
</view>
<!-- 灰色间隔start -->
<view class="grayBlock"></view>
<!-- 灰色间隔end -->
<!-- 效果排行 -->
<view id="resultSort">
<view class="resultSortTitle">
<view class="resultSortTitleLeft">效果排行</view>
<view class="resultSortTitleRight">
<text>完整排行</text>
<image src="../../assets/arrow_right.png"></image>
</view>
</view>
<view id="resultSortList">
<view class="resultSortListItemWrap {{item.self?'resultSortListItemSelf':''}}" wx:for="{{resultSortList}}" wx:key="{{index}}">
<view class="resultSortListItem">
<view class="resultSortListItemLeft">
<text>{{item.id}}</text>
<view class="resultSortListItemInfo">
<image src="../../assets/sort_common.png" />
<text>{{item.name}}</text>
</view>
</view>
<view class="resultSortListItemRight">
<image wx:if="{{item.type=='up'}}" src="../../assets/up.png" />
<image wx:elif="{{item.type=='down'}}" src="../../assets/down.png" />
<image wx:else src="../../assets/none.png" />
<view class="resultSortListItemRightEyeBox">
<text>{{item.num}}</text>
<text class="resultSortListItemRightEye">{{item.eye}}</text>
</view>
</view>
</view>
</view>
</view>
<view id="indexBottom"></view>
<!-- 更新训练计划弹窗 -->
<view id="mustUpdate" catchtouchmove="preventTouchMove" hidden="{{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>
<view class="usermotto">
<text class="user-motto">{{motto}}</text>
</view>
</view>
/**index.wxss**/
.userinfo {
.grayBlock{
background: #efeff4;
width: 100%;
height: 20rpx;
}
.swiperBox{
padding: 30rpx 25rpx;
height: 180rpx;
}
.swiperCon{
border-radius:20rpx;
}
.slideImage{
width: 100%;
height: 100%;
}
/* 头像设置 */
#userBox{
display: flex;
position: relative;
padding-left: 50rpx;
}
#setBtn{
height: 36rpx;
width: 36rpx;
position: absolute;
top: 0;
right: 25rpx;
}
#userHead{
display: block;
height: 120rpx;
width: 120rpx;
margin-right: 30rpx;
border-radius: 50%;
/* overflow: hidden; */
}
#userInfo{
display: flex;
flex-direction: column;
justify-content: center;
}
#username{
color: #4f5051;
font-size: 38rpx;
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;
}
.userinfo-avatar {
width: 128rpx;
height: 128rpx;
margin: 20rpx;
/* 训练计划按钮 */
#userBtnBox{
padding: 0 25rpx;
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;
align-items: center;
}
.btnIcon{
display: block;
width: 64rpx;
height: 64rpx;
margin-right: 6rpx;
}
#userBtnBoxLine{
height: 42rpx;
width: 2rpx;
background: #fff;
margin: 0 60rpx;
}
/* 监控 */
.checkCon{
padding: 50rpx 25rpx 30rpx;
}
.checkDes{
display: flex;
justify-content: space-between;
}
#trainTime{
color: #4f5051;
font-size: 28rpx;
}
#powerBox{
display: flex;
align-items: center;
}
#powerBox>image{
display: block;
width: 36rpx;
height: 36rpx;
margin-right: 6rpx;
}
.PowerOff{
color: #fa6400;
font-size: 32rpx;
/* text-decoration: underline; */
}
.checkImg{
position: relative;
}
.checkImg>image{
margin-top: 20rpx;
display: block;
width: 100%;
height: 392rpx;
}
.wifi{
width: 100%;
color: #bababa;
font-size: 26rpx;
height: 60rpx;
line-height: 60rpx;
text-align: center;
position: absolute;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
}
/* 目标 */
.target{
padding: 20rpx;
}
.target>text{
color: #555;
font-size: 24rpx;
}
.targetDes{
height: 80rpx;
background: #d7d7d7;
display: flex;
justify-content: center;
align-items: center;
border-radius: 80rpx;
margin-top: 8rpx;
}
.targetDes>image{
width: 40rpx;
height: 36rpx;
margin-right: 8rpx;
}
.targetDes>view{
color: #333;
font-size: 24rpx;
}
.targetDes>view>text{
font-size: 40rpx;
}
/* 训练报告 */
.report{
padding: 0 25rpx;
}
.reportTitle{
display: flex;
justify-content: space-between;
padding: 25rpx 0;
}
.reportTitleLeft,.trainSortTitleLeft,.resultSortTitleLeft{
font-size: 38rpx;
display: flex;
align-items:center;
color: #4f5051;
}
.targetHistory,.trainSortTitleRight,.resultSortTitleRight{
display: flex;
align-items: center;
}
.targetHistory>text,.trainSortTitleRight>text,.resultSortTitleRight>text{
color: #888;
font-size: 32rpx;
margin-right: 10rpx;
}
.targetHistory>image,.trainSortTitleRight>image,.resultSortTitleRight>image{
width: 36rpx;
height: 36rpx;
display: block;
}
/* 训练报告 */
.reportDes{
border-bottom: 2rpx solid #E5E5E5;
padding-bottom: 30rpx;
margin-top: 30rpx;
}
#taskComplete{
display: flex;
align-items: center;
color: #F7B500;
font-size: 32rpx;
margin-bottom: 10rpx;
}
#taskComplete>image{
width: 48rpx;
height: 48rpx;
margin-right: 10rpx;
}
#taskNocomplete{
display: flex;
align-items: center;
color: #fa6400;
margin-bottom: 10rpx;
font-size: 32rpx;
}
#taskNocomplete>image{
width: 48rpx;
height: 48rpx;
margin-right: 10rpx;
}
#taskNocompleteDes{
color: #4f5051;
font-size: 28rpx;
margin-left: 60rpx;
}
#taskCompleteDes{
color: #4f5051;
font-size: 28rpx;
margin-left: 60rpx;
}
#taskCompleteDes>text{
font-size: 36rpx;
margin: 0 6rpx;
}
.reprotChart{
padding-top: 30rpx;
}
.reprotChartTitle{
color: #4f5051;
font-size: 28rpx;
text-align: center;
}
.reprotChartTitle>text{
font-size: 36rpx;
margin: 0 6rpx;
}
.reprotWeekChart {
width: 100%;
height: 380rpx;
}
.reprotPieChart {
width: 100%;
height: 540rpx;
margin-top: 20rpx;
}
.reprotChartSuggest{
border-top: 2rpx solid #E5E5E5;
margin-top: 20rpx;
color: #888;
font-size: 28rpx;
padding-top: 30rpx;
}
.reprotChartSuggestTitle{
font-size: 38rpx;
color: #4f5051;
margin-bottom: 30rpx;
}
.adviseItem{
display: flex;
margin-bottom: 30rpx;
}
.adviseItem>image{
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
padding-top:7rpx;
}
/* 训练排行 效果排行 */
#trainSort,#resultSort{
color: #4f5051;
font-size: 34rpx;
}
.trainSortTitle,.resultSortTitle{
display: flex;
justify-content: space-between;
padding: 25rpx;
}
.trainSortListItemWrap,.resultSortListItemWrap{
padding-left: 25rpx;
}
.trainSortListItemLeft, .resultSortListItemLeft{
display: flex;
align-items: center;
}
.trainSortListItemLeft>text, .resultSortListItemLeft>text{
min-width: 65rpx;
}
.trainSortListItem,.resultSortListItem{
display: flex;
justify-content: space-between;
align-items: center;
border-top: 2rpx solid #E5E5E5;
padding: 20rpx 25rpx 20rpx 0;
}
.trainSortListItemInfo,.resultSortListItemInfo{
display: flex;
align-items: center;
}
.trainSortListItemSelf, .resultSortListItemSelf{
color: #fff;
background: linear-gradient(to right, #60d4c6, #6be89b);
}
.trainSortListItemSelf .trainSortListItem,.resultSortListItemSelf .resultSortListItem{
border: 0;
}
.trainSortListItemInfo>image, .resultSortListItemInfo>image{
width: 50rpx;
height: 50rpx;
margin-right: 20rpx;
border-radius: 50%;
}
.resultSortListItemRight{
display: flex;
align-items: center;
}
.resultSortListItemRight>image{
width: 24rpx;
height: 32rpx;
margin-right: 12rpx;
}
.resultSortListItemRightEyeBox{
display: flex;
align-items: center;
}
.resultSortListItemRightEye{
font-size: 28rpx;
margin-left: 8rpx;
}
/* 底部灰色 */
#indexBottom{
height: 115rpx;
width: 100%;
background: #efeff4;
}
/* 训练成就 */
#achieve{
color: #555;
padding: 0 25rpx;
}
.achieveTitle{
display: flex;
justify-content: space-between;
font-size: 38rpx;
align-items:center;
color: #4f5051;
padding: 25rpx 0;
}
.achieveTitle>image{
width: 36rpx;
height: 36rpx;
display: block;
}
.achieveTime, .achieveChange{
font-size: 28rpx;
padding-top: 10rpx;
}
.achieveTime>text, .achieveChange>text{
font-size: 36rpx;
margin: 0 10rpx;
}
.achieveChange{
padding-bottom: 35rpx;
border-bottom: 2rpx solid #e5e5e5;
}
.leftEyeChart{
position: relative;
width: 100%;
height: 480rpx;
padding-bottom: 40rpx;
border-bottom: 2rpx solid #e5e5e5;
}
.rightEyeChart{
position: relative;
width: 100%;
height: 480rpx;
}
#leftEyeChartBox,#rightEyeChartBox{
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx 0 0rpx;
}
.legend_box{
display: flex;
justify-content: center;
align-items: center;
}
.legend_over,.legend_no{
display: flex;
align-items: center;
}
.legend_over{
margin-right: 30rpx;
}
.legend_over>image,.legend_no>image{
width: 28rpx;
height: 28rpx;
margin-right: 5rpx;
}
.legend_over>text{
color: #33d1c4;
font-size: 22rpx;
}
.legend_no>text{
color: #f7b500;
font-size: 22rpx;
}
.eyeChartName{
text-align: center;
font-size: 34rpx;
color: #4f5051;
}
.rightEyeChart{
padding-bottom: 10rpx;
}
.userinfo-nickname {
color: #aaa;
#leftYear{
font-size: 18rpx;
height: 22rpx;
line-height: 22rpx;
background: #888;
border-radius: 4rpx;
color: #fff;
padding: 0 5rpx;
position: absolute;
left: 20rpx;
bottom: 52rpx;
}
#rightYear{
font-size: 18rpx;
height: 22rpx;
line-height: 22rpx;
background: #888;
border-radius: 4rpx;
padding: 0 5rpx;
color: #fff;
position: absolute;
left: 20rpx;
bottom: 22rpx;
}
.usermotto {
margin-top: 200px;
/* 更新训练计划弹窗 */
#mustUpdate{
background: rgba(0,0,0,0.5);
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
#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();
Page({
data: {
text: '获取验证码',
disabled: false,
phone: '',
code: '',
flag: true,// 弹窗是否显示
},
onLoad: function () {
// console.log(app.globalData.apiUrl)
},
phoneChange: function (e){
this.setData({
phone: e.detail.value
})
},
getCode: function (e){
let me = this,
phone = me.data.phone,
warn = null; //warn为当手机号为空或格式不正确时提示用户的文字,默认为空
me.setData({
disabled: true
})
if(phone == ''){
warn = '请输入手机号码!';
} else if(phone.trim().length != 11 || ! /^1[0-9]{10}$/.test(phone)){
warn = '手机号码格式不正确!';
} else{
//当手机号正确的时候提示用户短信验证码已经发送
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'users/send',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
phone: phone
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
wx.showToast({
title: '短信验证码已发送',
mask: true,
// icon: 'none',
duration: 2000
});
// 设置60s的倒计时
let num = 60;
let timer = setInterval(function () {
num--;
if (num <= 0) {
clearInterval(timer);
me.setData({
text: '重新发送',
disabled: false
})
} else {
me.setData({
text: num+'秒',
disabled: true
})
}
}, 1000)
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
me.setData({
disabled: false
})
}
}
})
}
//判断 当错误信息不为空时弹窗,并将按钮恢复可用
if (warn != null) {
wx.showModal({
title: '提示',
showCancel: false,
content: warn
})
me.setData({
disabled: false
})
return;
}
},
codeChange: function (e){
this.setData({
code: e.detail.value
})
},
toLogin: function (e){
// 授权
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,
phone = me.data.phone,
code = me.data.code,
warn = null;// 手机号和验证码校验错误信息
if(phone.trim().length != 11 || ! /^1[0-9]{10}$/.test(phone)){
warn = '手机号码格式不正确!';
} else if(code.length<4){
warn = '短信验证码错误!'
} else{
// 手机号和验证码格式正确
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'users/login',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
phone: phone,
verification: code
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
wx.showToast({
title: '登录成功',
mask: true,
// icon: 'none',
duration: 2000
});
// 关闭所有页面,打开首页
wx.reLaunch({
// url: '/pages/index/index'
url: '/pages/getCodeIndex/getCodeIndex'
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
me.setData({
disabled: false
})
}
}
})
}
//判断 当错误信息不为空时弹窗
if (warn != null) {
wx.showModal({
title: '提示',
showCancel: false,
content: warn
})
return;
}
},
// 显示验证码弹窗
showCodePopup: function (e) {
this.setData({
flag: false
})
},
// 验证码弹窗知道
codePopupKnow: function (e) {
this.setData({
flag: true
})
}
})
{
"navigationBarTitleText": "登录",
"usingComponents": {}
}
\ No newline at end of file
<view id="login">
<!-- 输入框 -->
<view id="loginCon">
<view class="loginConItem loginPhone">
<text class="loginLabel">手机号</text>
<input id="phoneInput" bindinput="phoneChange" maxlength="11" type="number" placeholder="输入手机号" />
</view>
<view class="loginConItem loginCode">
<text class="loginLabel">验证码</text>
<view id="codeRight">
<input id="codeInput" maxlength="4" bindinput="codeChange" type="number" placeholder="输入验证码" />
<button id="code" disabled="{{disabled}}" bindtap='getCode'>{{text}}</button>
</view>
</view>
</view>
<!-- 登录按钮 -->
<view id="loginBtn">
<button id="toLogin" open-type="getUserInfo" lang="zh_CN" bindgetuserinfo='toLogin'>无需注册,立即登录</button>
</view>
<!-- 提示 -->
<view id="loginTip">
<image src="../../assets/tips.png" />
<text bindtap="showCodePopup">收不到验证码?</text>
</view>
<!-- 验证码弹窗 -->
<view id="codePopup" hidden="{{flag}}">
<view id="codePopupCon">
<view id="codePopupTop">
<text id="codePopupTitle">收不到验证码?</text>
<text class="codePopupItme">•请确认您当前使用的手机号是否欠费</text>
<text class="codePopupItme">•请前往短信列表查看是否已经收到验证码</text>
<text class="codePopupItme">•您所处的位置是否网络不好造成信号延迟,请移动到相对开阔的位置再次尝试</text>
</view>
<view id="codePopupKnow" bindtap="codePopupKnow">知道了</view>
</view>
</view>
</view>
#login{
background: #EFEFF4;
min-height: 100vh;
}
/* 输入框 */
#loginCon{
padding-top: 30rpx;
font-size: 34rpx;
}
.loginConItem{
background: #fff;
display: flex;
align-items: center;
}
.loginLabel{
color: #4F5051;
width:30%;
}
.loginPhone{
border-bottom: 2rpx solid #E5E5E5;
}
#codeRight{
display: flex;
align-items: center;
width:70%;
}
#code{
font-size: 30rpx;
width: 200rpx;
height: 68rpx;
line-height: 68rpx;
color: #33D1C4;
border-radius: 4rpx;
margin: 0;
padding: 0;
border: 2rpx solid #33D1C4;
background: #fff;
}
button::after {
border: none;
}
#phoneInput{
width: 70%;
}
#codeInput{
width: 58%;
}
.loginPhone{
padding: 31rpx 35rpx;
}
.loginCode{
padding: 21rpx 35rpx;
}
/* 登录按钮 */
#loginBtn{
padding: 61rpx 60rpx 0;
}
#toLogin{
height: 94rpx;
line-height: 94rpx;
color: #fff;
font-size: 36rpx;
background: #fff;
background: #33D1C4;
border-radius: 10rpx;
}
/* 提示 */
#loginTip{
display: flex;
justify-content: center;
align-items: center;
margin-top: 32rpx;
}
#loginTip>image{
width: 29rpx;
height: 29rpx;
margin-right: 7rpx;
}
#loginTip>text{
font-size: 32rpx;
color: #4F5051;
text-decoration: underline;
}
/* 弹窗 */
#codePopup{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .5);
}
#codePopupCon{
position: absolute;
left: 50%;
top: 45%;
width: 560rpx;
border-radius: 8rpx;
transform: translate(-50%, -50%);
overflow: hidden;
background: #fff;
}
#codePopupTop{
font-size: 30rpx;
color: #888888;
padding: 0 40rpx;
display: flex;
flex-direction: column;
}
#codePopupTitle{
font-size: 36rpx;
color: #000000;
text-align: center;
padding: 50rpx 0 18rpx;
}
#codePopupTop .codePopupItme{
line-height: 40rpx;
}
#codePopupKnow{
text-align: center;
border-top: 2rpx solid #E5E5E5;
padding: 25rpx 0;
margin-top: 30rpx;
font-size: 36rpx;
color: #33D1C4;
}
\ No newline at end of file
//logs.js
const util = require('../../utils/util.js')
Page({
data: {
logs: []
},
onLoad: function () {
this.setData({
logs: (wx.getStorageSync('logs') || []).map(log => {
return util.formatTime(new Date(log))
})
})
}
})
<!--logs.wxml-->
<view class="container log-list">
<block wx:for="{{logs}}" wx:for-item="log">
<text class="log-item">{{index + 1}}. {{log}}</text>
</block>
</view>
.log-list {
display: flex;
flex-direction: column;
padding: 40rpx;
}
.log-item {
margin: 10rpx;
}
Page({
data: {
teenageName: '小明',
gender: '男',
age: 9,
className: '',
avatar: "https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJgjIlZNw29LLpbQJYlmjib7AuaqROweKxUib78ibPbp0M6mGKvRXNnpT1M4XkwDwFPAypwOFLXko0zQ/132",
sn: 'sn123541341'
},
onReady() {
this.setData({
className: '无'
})
// setTimeout(function () {
// // 获取 chartWeek 实例的方式
// console.log(chartWeek)
// }, 2000);
},
// 解绑
unbundle() {
console.log('解绑')
},
// 意见与反馈
idea() {
wx.redirectTo({
url: '/pages/idea/idea'
})
}
})
\ No newline at end of file
{
"navigationBarTitleText": "个人中心",
"usingComponents": {}
}
\ No newline at end of file
<view id="userBox">
<view id="userHead">
<image id="userHead" src="{{ avatar }}" />
</view>
<view id="userInfo">
<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 class="useSettingBox">
<view class="use">
<image src="../../assets/account_pn.png"></image>
<text>设备ID:{{sn}}</text>
</view>
<text bindtap="unbundle">解绑</text>
</view>
<view class="useSettingBox" bindtap="idea">
<view class="use">
<image src="../../assets/account_pn.png"></image>
<text>意见反馈</text>
</view>
<image class="arrowDown" src="../../assets/arrow_right.png" />
</view>
\ No newline at end of file
/* 头像设置 */
#userBox{
display: flex;
position: relative;
padding: 50rpx 0 30rpx 25rpx;
}
#userHead{
display: block;
height: 120rpx;
width: 120rpx;
margin-right: 30rpx;
border-radius: 50%;
/* overflow: hidden; */
}
#userInfo{
display: flex;
flex-direction: column;
justify-content: center;
}
#username{
color: #4f5051;
font-size: 38rpx;
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;
}
.useSettingBox{
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28rpx;
color: #A7A7A8;
padding: 25rpx;
}
.use{
display: flex;
align-items: center;
}
.use>image{
width: 50rpx;
height: 36rpx;
margin-right: 10rpx;
}
.arrowDown{
width: 36rpx;
height: 36rpx;
margin-left: 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'
})
},
})
{
"navigationBarTitleText": "更新数据",
"usingComponents": {}
}
\ No newline at end of file
<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
Page({
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<web-view src="https://seex.dev.iouou.cn/Wechat/WechatIot/wxDeviceWifi#wechat_redirect"></web-view>
\ No newline at end of file
/* pages/out/out.wxss */
\ No newline at end of file
var app = getApp();
Page({
data: {
},
onLoad: function () {
},
// 更新计划
update: function () {
wx.navigateTo({
url: '/pages/updatePlan/updatePlan'
})
},
})
{
"navigationBarTitleText": "训练计划",
"usingComponents": {
"ec-canvas": "../../component/ec-canvas/ec-canvas"
}
}
\ No newline at end of file
<view id="plan">
<!-- 顶部数据 -->
<view id="planWrap">
<view id="planCon">
<view id="planConTitle">训练计划</view>
<view class="planConDes">本周(x月x日~x月x日)</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>
<!-- 按钮组 -->
<view id="planBtn">
<button id="updatePlan" bindtap='update'>更新计划</button>
</view>
</view>
#plan{
background: #EFEFF4;
min-height: 100vh;
}
/* 顶部 */
#planWrap{
padding: 30rpx;
}
#planCon{
background: #ccc;
padding: 25rpx;
font-size: 28rpx;
color: #4F5051;
border-radius: 10rpx;
}
#planConTitle{
font-size: 32rpx;
text-align: center;
}
.planConDes>text{
font-size: 40rpx;
}
#planConTip{
padding-top: 30rpx;
font-size: 24rpx;
}
/* 列表 */
#history{
color: #4F5051;
}
#historyTitle{
text-align: center;
font-size: 26rpx;
}
.historyListItem{
display: flex;
justify-content: space-around;
font-size: 24rpx;
padding-top: 15rpx;
}
/* 折线图 */
#eyeChart{
width: 100%;
height: 380rpx;
padding: 30rpx 0;
}
/* 按钮 */
#planBtn{
padding: 75rpx 30rpx 80rpx;
}
#updatePlan{
background: #33D1C4;
border-radius: 10rpx;
font-size: 36rpx;
color: #FFFFFF;
height: 94rpx;
line-height: 94rpx;
}
\ No newline at end of file
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
<view id="ruleSet">
<!-- 会员卡 -->
<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">
<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 id="logoutWrap">
<view id="logoutBox">
<button id="logoutBtn" bindtap='logout'>退出登录</button>
</view>
</view>
</view>
#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();
Page({
data: {
useArray: ['允许使用','完成当日训练后允许使用','不可使用'],
useIndex: 0,//使用限制
shieldAllArray: ['关闭护眼功能','使用20分钟,强制训练5分钟','使用30分钟,强制训练5分钟','使用40分钟,强制训练5分钟'],
shieldArray: ['关闭护眼功能','使用20分钟,训练5分钟','使用30分钟,训练5分钟','使用40分钟,训练5分钟'],
shieldIndex: 0,//强制护眼
// shieldValue: [0],
// shield: '',
starting: 0, //开机提醒状态,1、允许、0、不允许
installApp: 0, //安装应用状态,1、允许安装、0、不允许安装
trainTip: true,
messageTip: true,
serveTip: true,
isShow: true,
parallaxArray: ['关闭','右眼视差','左眼视差'],
parallaxIndex: 0,//视差训练
weakArray: ['关闭','双眼弱视','右眼弱视','左眼弱视'],
weakIndex: 0,//弱视训练
// shieldAllArray: [{name:'关闭护眼功能'},{name:'使用应用20分钟,强制护眼训练5分钟'},{name:'使用应用30分钟,强制护眼训练5分钟'},{name:'使用应用40分钟,强制护眼训练5分钟'}],//picker 数据
// pickerClo: "1",// picker 几列
},
onLoad: function () {
// this.demopicker = this.selectComponent("#shieldpicker");
let me = this;
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'apps/info',
method: 'POST',
data: {
token: wx.getStorageSync('token')
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
useIndex: res.data.data.appManagement-1,
shieldIndex: res.data.data.eyeProtection-1,
installApp: res.data.data.installApp,
// starting: res.data.data.starting
})
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
},
useChange: function (e) {// 使用限制
let me = this,
useStatus = parseInt(e.detail.value)+1;
console.log('使用限制')
console.log(useStatus)
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'apps/appManagement',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
status: useStatus
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
useIndex: useStatus-1
})
}else{
me.setData({
useIndex: me.data.useIndex
})
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
},
parallaxChange: function (e) {// 视差训练
let me = this,
parallaxStatus = parseInt(e.detail.value)+1;
console.log('视差训练')
console.log(parallaxStatus)
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
// wx.request({
// url: app.globalData.apiUrl + 'apps/appManagement',
// method: 'POST',
// data: {
// token: wx.getStorageSync('token'),
// status: parallaxStatus
// },
// success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
// if(res.data.errno==200){
me.setData({
parallaxIndex: parallaxStatus-1
})
if(parallaxStatus!=1){
wx.showModal({
title: '重要提示',
showCancel: false,
content: '此训练仅适用于双眼视差大于0.2的情况'
})
}
// }else{
// me.setData({
// parallaxIndex: me.data.parallaxIndex
// })
// wx.showModal({
// title: '提示',
// showCancel: false,
// content: res.data.msg
// })
// }
// }
// })
},
weakChange: function (e) {// 弱视训练
let me = this,
weakStatus = parseInt(e.detail.value)+1;
console.log('弱视训练')
console.log(weakStatus)
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
// wx.request({
// url: app.globalData.apiUrl + 'apps/appManagement',
// method: 'POST',
// data: {
// token: wx.getStorageSync('token'),
// status: weakStatus
// },
// success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
// if(res.data.errno==200){
me.setData({
weakIndex: weakStatus-1
})
if(weakStatus!=1){
wx.showModal({
title: '重要提示',
showCancel: false,
content: '如无弱视情况,请勿开启此训练!'
})
}
// }else{
// me.setData({
// weakIndex: me.data.weakIndex
// })
// wx.showModal({
// title: '提示',
// showCancel: false,
// content: res.data.msg
// })
// }
// }
// })
},
shieldChange: function (e) {// 强制护眼
let me = this,
shieldIndex = parseInt(e.detail.value)+1;
console.log('强制护眼')
console.log(shieldIndex)
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'apps/eyeProtection',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
status: shieldIndex
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
shieldIndex: shieldIndex-1
})
}else{
me.setData({
shieldIndex: me.data.shieldIndex
})
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
},
// 训练提醒(总开关)
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) {// 安装应用
console.log('安装应用', e.detail.value)
let me = this,
installAppStatus = 0;
if(e.detail.value){
// 安装应用状态,1、允许安装、0、不允许安装
installAppStatus = 1
}else{
installAppStatus = 0
}
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'apps/installApp',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
status: installAppStatus
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
installApp: installAppStatus
})
}else{
me.setData({
installApp: me.data.installApp
})
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
},
// 使用限制疑问
useLimit: function () {
wx.showModal({
title: '提示',
showCancel: false,
content: '您可以根据情况设置是否完成训练计划才可以使用其他应用或功能'
})
},
// 强制护眼疑问
constraint: function () {
wx.showModal({
title: '提示',
showCancel: false,
content: '您可以根据选项设置使用时长的强制护眼训练'
})
},
// 安装应用疑问
installAppTip: function () {
wx.showModal({
title: '提示',
showCancel: false,
content: '打开该设置可以允许自主下载更多应用'
})
},
toWhiteList: function(e) {
wx.navigateTo({
url: '/pages/whiteList/whiteList?currentType='+e.currentTarget.id
})
},
// 完成设置
settingDone: function (e){
wx.showModal({
title: '重要提示',
showCancel: true,
content: '请确认是否保存',
success (res) {
if (res.confirm) {
// console.log('用户点击确定')
// 跳转首页
wx.reLaunch({
url: '/pages/index/index'
})
} else if (res.cancel) {
// console.log('用户点击取消')
}
}
})
},
// shieldTap: function (e) {
// this.demopicker.showPicker();
// },
// confirm:function(e){
// console.log(e.detail)
// this.setData({
// shieldValue: e.detail
// })
// // this.demopicker.hiddePicker();
// },
})
{
"navigationBarTitleText": "使用设置",
"usingComponents": {
}
}
\ No newline at end of file
<view id="setting">
<view id="settingWrap">
<view class="useSetting">
<view class="useSettingTip" bindtap='useLimit'>
<text class="useSettingTitle">使用限制</text>
<image src="../../assets/tips.png" />
</view>
<picker bindchange="useChange" value="{{useIndex}}" range="{{useArray}}">
<view class="useSettingBox">
<view class="use">{{useArray[useIndex]}}</view>
<image class="arrowDown" src="../../assets/arrow_right.png" />
</view>
</picker>
</view>
<view class="useSetting">
<view class="useSettingTip" bindtap='constraint'>
<text class="useSettingTitle">强制护眼</text>
<image src="../../assets/tips.png" />
</view>
<picker bindchange="shieldChange" value="{{shieldIndex}}" range="{{shieldAllArray}}">
<view class="useSettingBox">
<view class="use">{{shieldArray[shieldIndex]}}</view>
<image class="arrowDown" src="../../assets/arrow_right.png" />
</view>
</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 class="useSetting parallaxBox">
<text class="useSettingTitle">视差训练</text>
<picker bindchange="parallaxChange" value="{{parallaxIndex}}" range="{{parallaxArray}}">
<view class="useSettingBox">
<view class="use">{{parallaxArray[parallaxIndex]}}</view>
<image class="arrowDown" src="../../assets/arrow_right.png" />
</view>
</picker>
</view>
<view class="useSetting parallaxBox">
<text class="useSettingTitle">弱视训练</text>
<picker bindchange="weakChange" value="{{weakIndex}}" range="{{weakArray}}">
<view class="useSettingBox">
<view class="use">{{weakArray[weakIndex]}}</view>
<image class="arrowDown" src="../../assets/arrow_right.png" />
</view>
</picker>
</view>
<view class="useSetting useSettingInstall">
<view class="useSettingTip" bindtap='installAppTip'>
<text class="useSettingTitle">允许自由安装更多应用</text>
<image src="../../assets/tips.png" />
</view>
<switch color="#33D1C4" checked="{{installApp==1}}" bindchange="installApp"/>
</view>
</view>
<view id="whiteListBox">
<view id="whiteListCon">
<view class="toWhiteList">应用白名单</view>
<view id="whiteListTop">
<view id="whiteListTab">
<view bindtap="tabClick" id="entertainment" class="whiteListTabItem" bindtap='toWhiteList'>
<image src="../../assets/manage_video.png" />
<text>娱乐应用</text>
</view>
<view bindtap="tabClick" id="study" class="whiteListTabItem centerTabItem" bindtap='toWhiteList'>
<image src="../../assets/manage_study.png" />
<text>学习应用</text>
</view>
<view bindtap="tabClick" id="game" class="whiteListTabItem" bindtap='toWhiteList'>
<image src="../../assets/manage_game.png" />
<text>游戏应用</text>
</view>
</view>
</view>
</view>
</view>
<view id="settingBtn">
<button id="settingDone" bindtap='settingDone'>保存</button>
</view>
<!-- <navigator hover-class="none" target="miniProgram" open-type="exit"> 退出当前小程序</navigator> -->
</view>
#setting{
background: #EFEFF4;
min-height: 100vh;
}
.useSetting{
display: flex;
justify-content: space-between;
align-items: center;
padding: 32rpx 25rpx;
background: #fff;
margin-bottom: 21rpx;
}
.useSettingTip>image{
width: 29rpx;
height: 29rpx;
margin-left: 7rpx;
}
.parallaxBox{
margin-top: 20rpx;
}
.useSettingInstall{
padding: 25rpx;
margin-top: 20rpx;
}
.useSettingTitle{
font-size: 34rpx;
color: #4F5051;
}
.useSettingBox{
display: flex;
align-items: center;
font-size: 28rpx;
color: #A7A7A8;
}
.arrowDown{
width: 36rpx;
height: 36rpx;
margin-left: 10rpx;
}
switch{
transform:scale(0.9);
}
/* 应用白名单 */
#whiteListTtitle{
font-size: 28rpx;
color: #4F5051;
padding: 4rpx 0 24rpx 25rpx;
}
.toWhiteList{
padding: 30rpx;
font-size: 34rpx;
color: #4F5051;
}
#whiteListCon{
background: #FFFFFF;
}
#whiteListTab{
display: flex;
justify-content: center;
align-items: center;
}
.whiteListTabItem{
font-size: 28rpx;
color: #A7A7A8;
display:flex;
flex-direction:column;
justify-content:center;
align-items:center;
border-bottom: 4rpx solid #E5E5E5;
width:33.2%;
padding: 30rpx 0 25rpx;
}
.currentTab{
color: #33D1C4;
border-bottom: 4rpx solid #33D1C4;
}
.whiteListTabItem>image{
width: 60rpx;
height: 60rpx;
margin-bottom: 6rpx;
}
.centerTabItem{
border-left: 2rpx solid #E5E5E5;
border-right: 2rpx solid #E5E5E5;
}
/* 完成按钮 */
#settingBtn{
padding: 75rpx 30rpx 80rpx;
}
#settingDone{
background: #33D1C4;
border-radius: 10rpx;
font-size: 36rpx;
color: #FFFFFF;
height: 94rpx;
line-height: 94rpx;
}
/* 训练提醒 */
#trainTip{
padding: 30rpx 25rpx;
background: #fff;
}
#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;
}
var app = getApp();
Page({
data: {
},
onLoad: function () {
},
// 稍后前往
lastGo: function () {
// 关闭当前页面,跳转到首页
wx.redirectTo({
url: '/pages/index/index'
})
},
// 一键前往
nowGo: function () {
// 关闭当前页面,跳转到 "训练计划"
wx.redirectTo({
url: '/pages/index/index'
})
},
})
{
"navigationBarTitleText": "小目标计划",
"usingComponents": {}
}
\ No newline at end of file
<view id="targetList">
<!-- 已完成目标 -->
<view class="complete">
</view>
<!-- 适合目标 -->
<view class="suit">
</view>
<!-- 下一目标 -->
<view class="next">
</view>
</view>
#targetList{
background: #EFEFF4;
min-height: 100vh;
}
/* 按钮 */
\ No newline at end of file
var app = getApp();
Page({
data: {
historyList: [
{
id: 0,
date:'5月27日 至 5月20日',
finish: 1,//训练是否完成
minute: 125,// 训练分钟
type: 1,// 视力升高或降低
degrees: '4.5 | 4.4',
dyn: '20%',
static: '60%',
word: '20%'
},
{
id: 1,
date:'5月27日 至 5月20日',
finish: 0,//训练是否完成
minute: 125,// 训练分钟
type: 0,// 视力升高或降低
degrees: '4.0 | 4.2',
dyn: '20%',
static: '60%',
word: '20%',
},
{
id: 2,
date:'5月27日 至 5月20日',
finish: 1,//训练是否完成
minute: 125,// 训练分钟
type: 1,// 视力升高或降低
degrees: '5.0 | 4.9',
dyn: '20%',
static: '60%',
word: '20%',
},
]
},
onLoad: function () {
},
history: function (e) {
console.log(e.currentTarget.dataset.id)
wx.navigateTo({
url: '/pages/historyDetail/historyDetail?historyId='+e.currentTarget.dataset.id
})
}
})
{
"navigationBarTitleText": "训练历史",
"usingComponents": {}
}
\ No newline at end of file
<view id="trainHistory">
<view id="trainHistoryList">
<view class="trainHistoryItem" data-id="{{item.id}}" bindtap="history" wx:for="{{historyList}}" wx:key="historyList">
<view class="trainHistoryItemTitle">
{{item.date}}
<view class="histortStatus">
<image src="../../assets/tips.png" />
<text wx:if="{{item.finish==1}}">目标达成</text>
<text wx:if="{{item.finish==0}}">未达成</text>
</view>
</view>
<view class="trainHistoryItemData">
共训练
<text>{{125}}</text>分钟,
<view wx:if="{{item.type ==1}}">视力提升到<text>{{item.degrees}}</text></view>
<view wx:if="{{item.type ==0}}">视力降低到<text>{{item.degrees}}</text></view>
</view>
<view class="trainHistoryItemType">
动态训练<text>{{item.dyn}}</text>,
静态训练<text>{{item.static}}</text>,
单词训练<text>{{item.word}}</text>;
</view>
<image class="itemArrow" src="../../assets/arrow_right.png" />
</view>
</view>
</view>
#trainHistory{
background: #EFEFF4;
min-height: 100vh;
}
/* 列表项 */
#trainHistoryList{
padding-top: 30rpx;
}
.trainHistoryItem{
padding: 0 40rpx 0 25rpx;
background: #fff;
position: relative;
font-size: 34rpx;
color: #4F5051;
margin-bottom: 30rpx;
}
.trainHistoryItemTitle{
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 30rpx;
}
.histortStatus{
background: #ccc;
font-size: 28rpx;
color: #A7A7A8;
display: flex;
align-items: center;
border-radius: 100rpx;
padding: 2rpx 10rpx;
}
.histortStatus>image{
background: #ccc;
width: 24rpx;
height: 24rpx;
margin-right: 5rpx;
}
.trainHistoryItemData{
padding: 40rpx 0;
}
.trainHistoryItemData text{
font-size: 40rpx;
padding: 0 10rpx;
}
.trainHistoryItemData view{
display: inline;
}
.trainHistoryItemType{
font-size: 28rpx;
padding-bottom: 30rpx;
}
.trainHistoryItemType>text{
padding-left: 10rpx;
}
/* 右侧箭头 */
.itemArrow{
position: absolute;
right: 15rpx;
top: 50%;
transform: translateY(-50%);
height: 50rpx;
width: 30rpx;
}
\ No newline at end of file
var app = getApp();
Page({
data: {
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']
],
luoeyeIndex: [10, 10],
trainArray: ['动态训练','静态训练','单词训练'],
DArray: ['训练11分钟','训练16分钟','训练17分钟','训练19分钟','训练21分钟','训练26分钟'],
JArray: ['每天观看10分钟'],
firstTrainIndex: 0,//第一组训练类型
secondTrainIndex: 0,//第二组训练类型
firstDIndex: 0,//第一组动态详细设置
secondDIndex: 0,//第二组动态详细设置
firstJIndex: 0,//第一组静态详细设置
secondJIndex: 0,//第二组静态详细设置
wordSetShow: false,//单词训练弹窗
},
onLoad: function () {
},
luoeyeChange: function (e) {// 本次裸眼视力
let luoData = {
left: this.data.luoeyeArray[0][e.detail.value[0]],
right: this.data.luoeyeArray[1][e.detail.value[1]]
}
this.setData({
luoeyeIndex: e.detail.value
})
console.log('本次裸眼视力:')
console.log(luoData)
},
// 第一组训练类型
firstTrainChange: function (e) {
console.log('第一组训练类型:'+e.detail.value+this.data.trainArray[e.detail.value])
this.setData({
firstTrainIndex: e.detail.value
})
},
// 第二组训练类型
secondTrainChange: function (e) {
console.log('第二组训练类型:'+e.detail.value+this.data.trainArray[e.detail.value])
this.setData({
secondTrainIndex: e.detail.value
})
},
// 第一组动态详细设置
firstDChange: function (e) {
console.log('第一组动态详细设置:'+e.detail.value+this.data.DArray[e.detail.value])
this.setData({
firstDIndex: e.detail.value
})
},
// 第一组静态详细设置
firstJChange: function (e) {
console.log('第一组静态详细设置:'+e.detail.value+this.data.JArray[e.detail.value])
this.setData({
firstJIndex: e.detail.value
})
},
// 第二组动态详细设置
secondDChange: function (e) {
console.log('第二组动态详细设置:'+e.detail.value+this.data.DArray[e.detail.value])
this.setData({
secondDIndex: e.detail.value
})
},
// 第二组静态详细设置
secondJChange: function (e) {
console.log('第二组静态详细设置:'+e.detail.value+this.data.JArray[e.detail.value])
this.setData({
secondJIndex: e.detail.value
})
},
// 第一组单词训练设置
firstWordSet: function () {
console.log('第一组单词训练设置')
this.setData({
wordSetShow: true
})
},
// 第二组单词训练设置
secondWordSet: function () {
console.log('第二组单词训练设置')
this.setData({
wordSetShow: true
})
},
// 关闭单词训练设置弹窗
close: function () {
this.setData({
wordSetShow: false
})
},
// 完成
updateDone: function () {
// 关闭当前页面,跳转到首页
wx.redirectTo({
url: '/pages/index/index'
})
}
})
{
"navigationBarTitleText": "更新计划",
"usingComponents": {}
}
\ No newline at end of file
<view id="updatePlan">
<!-- 更新视力信息 -->
<view id="sight">
<view id="sightTitle">更新视力信息</view>
<view id="sightInfo">
<view id="sightInfoTop">
<text class="sightInfoLeft">上次裸眼视力</text>
<view id="sightInfoRight">
<text class="sightLeft">左眼:4.2</text>
<text class="sightRight">右眼:4.3</text>
</view>
</view>
<view id="sightInfoBom">
<text class="sightInfoLeft">本次裸眼视力</text>
<picker mode="multiSelector" class="selectorPicker" bindchange="luoeyeChange" value="{{luoeyeIndex}}" range="{{luoeyeArray}}">
<view class="eyesightConRight">
<view class="selItem sightLeft">左眼:{{luoeyeArray[0][luoeyeIndex[0]]}}</view>
<view class="selItem sightRight">右眼:{{luoeyeArray[1][luoeyeIndex[1]]}}</view>
</view>
</picker>
</view>
</view>
</view>
<!-- 更新训练计划 -->
<view id="plan">
<view id="planTitle">更新训练计划</view>
<!-- 第一组 -->
<view class="train">
<view class="trainTitle">
<text>第一组</text>
<picker bindchange="firstTrainChange" value="{{trainIndex}}" range="{{trainArray}}">
<text>选择训练</text>
</picker>
</view>
<view class="trainDes">
<view><image class="trainDesIcon" src="../../assets/appIcon.png" /></view>
<view class="trainDesText" hidden="{{firstTrainIndex!=0}}">
<view>动态训练</view>
<text>动态训练描述文字描述文字描述文字描述文字描述文字描述文字描述文字描述文字</text>
</view>
<view class="trainDesText" hidden="{{firstTrainIndex!=1}}">
<view>静态训练</view>
<text>静态训练描述文字描述文字描述文字描述文字描述文字描述文字描述文字描述文字</text>
</view>
<view class="trainDesText" hidden="{{firstTrainIndex!=2}}">
<view>单词训练</view>
<text>单词训练描述文字描述文字描述文字描述文字描述文字描述文字描述文字描述文字</text>
</view>
</view>
<view class="trainSet" hidden="{{firstTrainIndex!=0}}">
<picker bindchange="firstDChange" value="{{firstDIndex}}" range="{{DArray}}">
<text>详细设置:{{DArray[firstDIndex]}}</text>
</picker>
</view>
<view class="trainSet" hidden="{{firstTrainIndex!=1}}">
<picker bindchange="firstJChange" value="{{firstJIndex}}" range="{{JArray}}">
<text>详细设置:{{JArray[firstJIndex]}}</text>
</picker>
</view>
<view class="trainSet" hidden="{{firstTrainIndex!=2}}">
<text bindtap="firstWordSet">详细设置</text>
</view>
</view>
<!-- 第二组 -->
<view class="train">
<view class="trainTitle">
<text>第二组</text>
<picker bindchange="secondTrainChange" value="{{trainIndex}}" range="{{trainArray}}">
<text>选择训练</text>
</picker>
</view>
<view class="trainDes">
<view><image class="trainDesIcon" src="../../assets/appIcon.png" /></view>
<view class="trainDesText" hidden="{{secondTrainIndex!=0}}">
<view>动态训练</view>
<text>动态训练描述文字描述文字描述文字描述文字描述文字描述文字描述文字描述文字</text>
</view>
<view class="trainDesText" hidden="{{secondTrainIndex!=1}}">
<view>静态训练</view>
<text>静态训练描述文字描述文字描述文字描述文字描述文字描述文字描述文字描述文字</text>
</view>
<view class="trainDesText" hidden="{{secondTrainIndex!=2}}">
<view>单词训练</view>
<text>单词训练描述文字描述文字描述文字描述文字描述文字描述文字描述文字描述文字</text>
</view>
</view>
<view class="trainSet" hidden="{{secondTrainIndex!=0}}">
<picker bindchange="secondDChange" value="{{secondDIndex}}" range="{{DArray}}">
<text>详细设置:{{DArray[secondDIndex]}}</text>
</picker>
</view>
<view class="trainSet" hidden="{{secondTrainIndex!=1}}">
<picker bindchange="secondJChange" value="{{secondJIndex}}" range="{{JArray}}">
<text>详细设置:{{JArray[secondJIndex]}}</text>
</picker>
</view>
<view class="trainSet" hidden="{{secondTrainIndex!=2}}">
<text bindtap="secondWordSet">详细设置</text>
</view>
</view>
</view>
<!-- 单词训练设置弹窗 -->
<view id="wordSet" hidden="{{!wordSetShow}}">
<view id="wordTitleBox"><text id="close" bindtap="close">X</text>单词训练设置</view>
<view id="wordTop">
<view class="wordSetTitle">每日学习新单词个数</view>
<view id="">
<text>10个新词(推荐)</text>
<text>15个新词</text>
<text>20个新词</text>
</view>
</view>
<view id="wordBom">
<view class="wordSetTitle">单词库设置</view>
<view class="wordSetDes">您只要选择孩子要学习的内容,系统会跟随孩子学习的进度自动更新内容。</view>
<view id="">请选择【教材】</view>
<view id="">请选择【课本】</view>
<view id="">请选择【章节】</view>
</view>
</view>
<!-- 完成按钮 -->
<view id="updateBtn">
<button id="updateDone" bindtap='updateDone'>完成</button>
</view>
</view>
#updatePlan{
background: #EFEFF4;
min-height: 100vh;
}
/* 视力信息 */
#sight{
padding: 30rpx 10rpx;
}
#sightInfo{
padding: 0 20rpx;
}
#sightTitle{
color: #4F5051;
font-size: 46rpx;
padding-bottom: 10rpx;
}
#sightInfoTop{
color: #4F5051;
font-size: 28rpx;
display: flex;
background: #ccc;
border-bottom: 2rpx solid #4F5051;
}
#sightInfoBom{
color: #4F5051;
font-size: 28rpx;
display: flex;
background: #ccc;
}
.sightInfoLeft{
padding: 10rpx 20rpx;
border-right: 2rpx solid #4F5051;
}
#sightInfoRight{
display: flex;
width:69%;
padding: 10rpx 0;
justify-content: center;
}
.sightLeft{
border-right: 2rpx solid #4F5051;
padding-right: 40rpx;
width: 50%;
text-align: right;
}
.sightRight{
padding-left: 40rpx;
width: 50%;
}
.selectorPicker{
width:69%;
}
.eyesightConRight{
display: flex;
align-items: center;
justify-content: center;
padding: 10rpx 0;
}
/* 训练计划 */
#plan{
padding: 0 20rpx;
}
#planTitle{
color: #4F5051;
font-size: 46rpx;
padding-bottom: 10rpx;
}
.train{
padding: 0 20rpx;
}
.trainTitle{
color: #4F5051;
font-size: 28rpx;
display: flex;
justify-content: space-between;
padding-bottom: 20rpx;
border-bottom: 2rpx solid #4F5051;
margin-bottom: 20rpx;
}
.trainDes{
color: #4F5051;
font-size: 28rpx;
display: flex;
}
.trainDesIcon{
width: 100rpx;
height: 100rpx;
margin-right: 20rpx;
}
.trainDesText>text{
font-size: 24rpx;
margin-top: 10rpx;
}
.trainSet{
padding-top: 30rpx;
}
/* 单词训练弹窗 */
#wordSet{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .9);
color: #fff;
z-index: 999;
}
#wordTitleBox{
font-size: 40rpx;
text-align: center;
padding: 20rpx 30rpx;
border-bottom: 2rpx solid #fff;
}
#close{
position: absolute;
left: 30rpx;
top: 20rpx;
}
#wordTop{
padding: 20rpx 30rpx;
}
#wordBom{
padding: 20rpx 30rpx;
}
.wordSetTitle{
font-size: 34rpx;
padding-bottom: 20rpx;
}
.wordSetDes{
font-size: 28rpx;
}
/* 完成按钮 */
#updateBtn{
padding: 75rpx 30rpx 80rpx;
}
#updateDone{
background: #33D1C4;
border-radius: 10rpx;
font-size: 36rpx;
color: #FFFFFF;
height: 94rpx;
line-height: 94rpx;
}
\ No newline at end of file
var app = getApp();
Page({
data: {
appList:[],//当前app列表
happyList: [],
studyList: [],
gameList: [],
tabId: 0,
currentType: 'entertainment',// 当前列表类型
},
onLoad: function (options) {
console.log(options.currentType)
this.setData({
currentType: options.currentType
})
if(options.currentType=='entertainment'){
this.setData({
tabId: 0
})
}else if(options.currentType=='study'){
this.setData({
tabId: 1
})
}else{
this.setData({
tabId: 2
})
}
this.appTypeList(options.currentType);
},
// 切换应用类型
tabClick: function (e) {
// console.log(e.currentTarget.dataset.tabid)
this.setData({
tabId: e.currentTarget.dataset.tabid
})
if(e.currentTarget.dataset.tabid==0){
// 娱乐应用
this.setData({
currentType: 'entertainment'
})
// 获取列表
this.appTypeList('entertainment');
}else if(e.currentTarget.dataset.tabid==1){
// 学习应用
this.setData({
currentType: 'study'
})
// 获取列表
this.appTypeList('study');
}else if(e.currentTarget.dataset.tabid==2){
// 游戏应用
this.setData({
currentType: 'game'
})
// 获取列表
this.appTypeList('game');
}
},
appTypeList: function (type) {
let me = this;
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'apps/appList',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
type: type // study:学习应用、entertainment:娱乐应用、game:游戏应用
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
me.setData({
listUpdataStatus: false
})
if(type=='study'){
me.setData({
studyList: res.data.data.appList,
appList: res.data.data.appList
})
}else if(type=='entertainment'){
me.setData({
happyList: res.data.data.appList,
appList: res.data.data.appList
})
} else if(type=='game'){
me.setData({
gameList: res.data.data.appList,
appList: res.data.data.appList
})
}
}else{
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
},
appSwitch: function (e) {// 应用开关
console.log(e.currentTarget.dataset.appid+','+e.detail.value)
console.log('应用开关', e.detail.value)
let me = this,
setAppStatus = 1,
appId = e.currentTarget.dataset.appid;
if(e.detail.value){
// app使用状态,1:启用、0、禁用
setAppStatus = 1
}else{
setAppStatus = 0
}
// 请求前加Loading
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.apiUrl + 'Apps/setApp',
method: 'POST',
data: {
token: wx.getStorageSync('token'),
status: setAppStatus,
appId: appId
},
success: function (res) {
// 请求成功后关闭Loading
wx.hideLoading();
if(res.data.errno==200){
}else{
me.appTypeList(me.data.currentType)
wx.showModal({
title: '提示',
showCancel: false,
content: res.data.msg
})
}
}
})
},
// 完成设置
settingDone: function (e){
// 跳转首页
wx.reLaunch({
url: '/pages/index/index'
})
},
})
\ No newline at end of file
{
"navigationBarTitleText": "应用白名单",
"usingComponents": {}
}
\ No newline at end of file
<view id="whiteListBox">
<view id="whiteListCon">
<view id="whiteListTop">
<view id="whiteListTab">
<view bindtap="tabClick" data-tabid="{{0}}" class="whiteListTabItem {{tabId==0?'currentTab':''}}">
<image hidden="{{tabId!=0}}" src="../../assets/happyIcon.png" />
<image hidden="{{tabId==0}}" src="../../assets/manage_video.png" />
<text>娱乐应用</text>
</view>
<view bindtap="tabClick" data-tabid="{{1}}" class="whiteListTabItem centerTabItem {{tabId==1?'currentTab':''}}">
<image hidden="{{tabId!=1}}" src="../../assets/studyIcon.png" />
<image hidden="{{tabId==1}}" src="../../assets/manage_study.png" />
<text>学习应用</text>
</view>
<view bindtap="tabClick" data-tabid="{{2}}" class="whiteListTabItem {{tabId==2?'currentTab':''}}">
<image hidden="{{tabId!=2}}" src="../../assets/gameIcon.png" />
<image hidden="{{tabId==2}}" src="../../assets/manage_game.png" />
<text>游戏应用</text>
</view>
</view>
</view>
<view id="whiteList">
<view class="whiteListItem" wx:for="{{appList}}" wx:key="{{item.appId}}">
<view class="whiteListItemIcon">
<image src="{{item.icon}}" />
<text>{{item.title}}</text>
</view>
<switch color="#33D1C4" data-appid='{{item.appId}}' checked="{{item.status==1}}" bindchange="appSwitch"/>
</view>
</view>
</view>
<view id="settingBtn">
<button id="settingDone" bindtap='settingDone'>确定</button>
</view>
</view>
\ No newline at end of file
/* 应用白名单 */
#whiteListCon{
background: #FFFFFF;
}
#whiteListTab{
display: flex;
justify-content: center;
align-items: center;
}
.whiteListTabItem{
font-size: 28rpx;
color: #A7A7A8;
display:flex;
flex-direction:column;
justify-content:center;
align-items:center;
border-bottom: 4rpx solid #E5E5E5;
width:33.2%;
padding: 30rpx 0 25rpx;
}
.currentTab{
color: #33D1C4;
border-bottom: 4rpx solid #33D1C4;
}
.whiteListTabItem>image{
width: 60rpx;
height: 60rpx;
margin-bottom: 6rpx;
}
.centerTabItem{
border-left: 2rpx solid #E5E5E5;
border-right: 2rpx solid #E5E5E5;
}
#whiteList{
padding-left: 25rpx;
}
.whiteListItem{
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 2rpx solid #E5E5E5;
padding: 22rpx 25rpx 23rpx 0;
}
.whiteListItemIcon{
display: flex;
align-items: center;
}
.whiteListItemIcon>image{
width: 48rpx;
height: 48rpx;
margin-right: 14rpx;
}
.whiteListItemIcon>text{
font-size: 34rpx;
color: #4F5051;
}
.whiteListItem:last-child{
border: 0;
}
/* 完成按钮 */
#settingBtn{
padding: 75rpx 30rpx 80rpx;
}
#settingDone{
background: #33D1C4;
border-radius: 10rpx;
font-size: 36rpx;
color: #FFFFFF;
height: 94rpx;
line-height: 94rpx;
}
......@@ -9,11 +9,14 @@
"postcss": true,
"minified": true,
"newFeature": true,
"autoAudits": false
"autoAudits": false,
"uglifyFileName": true,
"checkSiteMap": false,
"checkInvalidKey": true
},
"compileType": "miniprogram",
"libVersion": "2.7.2",
"appid": "wx7036f3fb0f8a3e4c",
"libVersion": "2.8.1",
"appid": "wx6d4a1ebceaa45d3e",
"projectname": "wxProgram",
"debugOptions": {
"hidedInDevtools": []
......
......@@ -16,4 +16,4 @@ const formatNumber = n => {
module.exports = {
formatTime: formatTime
}
};
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