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)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
// 获取用户信息
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)
}
let me =this;
// 获取本地缓存的token
wx.getStorage({
key: 'token',
fail (res) {
// 没登录(没有token时)
console.log(res.errMsg)
wx.login({
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
})
}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
}
{
"usingComponents": {}
"usingComponents": {
"ec-canvas": "../../component/ec-canvas/ec-canvas"
}
}
\ No newline at end of file
/**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
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