Commit 9decfc16 authored by 石盼盼's avatar 石盼盼

test

parents 4da8ec29 6f020145
App({ App({
onLaunch: function () { onLaunch: function () {
console.log('222222222')
this.isReload() // 小程序是否有新版本 this.isReload() // 小程序是否有新版本
// this.getLogin()
this.getToken() this.getToken()
}, },
// 小程序是否有新版本 // 小程序是否有新版本
...@@ -39,24 +36,6 @@ App({ ...@@ -39,24 +36,6 @@ App({
}) })
} }
}, },
getLogin() {
let userInfo = wx.getStorageSync('userInfo')
if (userInfo) {
this.globalData.userInfo = userInfo
}
console.log(userInfo)
if (userInfo) {
wx.switchTab({
url: '/pages/tabbar/index/index',
})
} else {
if (userInfo) { // 判断有没有申请教练
wx.redirectTo({
url: '/pages/sign/apply/apply',
})
}
}
},
getToken() { getToken() {
var that = this var that = this
try { try {
...@@ -127,6 +106,7 @@ App({ ...@@ -127,6 +106,7 @@ App({
}) })
that.globalData.hasTel = res.data.data.hasTel that.globalData.hasTel = res.data.data.hasTel
that.globalData.userInfo = res.data.data; that.globalData.userInfo = res.data.data;
console.log(that.globalData.userInfo)
wx.setStorageSync('userInfo', res.data.data) wx.setStorageSync('userInfo', res.data.data)
if (res.data.data.userTel) { if (res.data.data.userTel) {
wx.setStorageSync('userTel', res.data.data.userTel) wx.setStorageSync('userTel', res.data.data.userTel)
...@@ -143,19 +123,18 @@ App({ ...@@ -143,19 +123,18 @@ App({
fail: function () {} fail: function () {}
}) })
}, },
fail() {// session_key 已经失效,需要重新执行登录流程 fail() { // session_key 已经失效,需要重新执行登录流程
that.getSessionKey(() => that.saveUserInfo(info, cb)) that.getSessionKey(() => that.saveUserInfo(info, cb))
} }
}) })
}, },
globalData: { globalData: {
extAppid: 'wx6e6eaca9cc1c406d', // 当前appid extAppid: 'wx6e6eaca9cc1c406d', // 当前appid
userInfo: '', //微信user信息 userInfo: '', //微信user信息
userTel: '', // 手机号 userTel: '', // 手机号
token: '', token: '',
backurl: '' // 全局跳转页面路径 backurl: '', // 全局跳转页面路径
coach_id: '', // 教练id
} }
}) })
\ No newline at end of file
{ {
"pages":[ "pages":[
"pages/tabbar/index/index", "pages/transalte/transalte",
"pages/sign/login/login", "pages/sign/login/login",
"pages/sign/bindTel/bindTel", "pages/sign/bindTel/bindTel",
"pages/sign/apply/apply", "pages/sign/apply/apply",
"pages/sign/applyResult/applyResult", "pages/sign/applyResult/applyResult",
"pages/tabbar/index/index",
"pages/tabbar/class/class", "pages/tabbar/class/class",
"pages/tabbar/financial/financial", "pages/tabbar/financial/financial",
"pages/tabbar/personal/personal", "pages/tabbar/personal/personal",
......
import WxCanvas from './wx-canvas';
import * as echarts from './echarts.min.js';
let ctx;
function compareVersion(v1, v2) {
v1 = v1.split('.')
v2 = v2.split('.')
const len = Math.max(v1.length, v2.length)
while (v1.length < len) {
v1.push('0')
}
while (v2.length < len) {
v2.push('0')
}
for (let i = 0; i < len; i++) {
const num1 = parseInt(v1[i])
const num2 = parseInt(v2[i])
if (num1 > num2) {
return 1
} else if (num1 < num2) {
return -1
}
}
return 0
}
Component({
properties: {
canvasId: {
type: String,
value: 'ec-canvas'
},
ec: {
type: Object
},
forceUseOldCanvas: {
type: Boolean,
value: false
}
},
data: {
isUseNewCanvas: false
},
ready: function () {
// Disable prograssive because drawImage doesn't support DOM as parameter
// See https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html
echarts.registerPreprocessor(option => {
if (option && option.series) {
if (option.series.length > 0) {
option.series.forEach(series => {
series.progressive = 0;
});
}
else if (typeof option.series === 'object') {
option.series.progressive = 0;
}
}
});
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.getSystemInfoSync().SDKVersion
const canUseNewCanvas = compareVersion(version, '2.9.0') >= 0;
const forceUseOldCanvas = this.data.forceUseOldCanvas;
const isUseNewCanvas = canUseNewCanvas && !forceUseOldCanvas;
this.setData({ isUseNewCanvas });
if (forceUseOldCanvas && canUseNewCanvas) {
console.warn('开发者强制使用旧canvas,建议关闭');
}
if (isUseNewCanvas) {
// console.log('微信基础库版本大于2.9.0,开始使用<canvas type="2d"/>');
// 2.9.0 可以使用 <canvas type="2d"></canvas>
this.initByNewWay(callback);
} else {
const isValid = compareVersion(version, '1.9.91') >= 0
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;
} else {
console.warn('建议将微信基础库调整大于等于2.9.0版本。升级后绘图将有更好性能');
this.initByOldWay(callback);
}
}
},
initByOldWay(callback) {
// 1.9.91 <= version < 2.9.0:原来的方式初始化
ctx = wx.createCanvasContext(this.data.canvasId, this);
const canvas = new WxCanvas(ctx, this.data.canvasId, false);
echarts.setCanvasCreator(() => {
return canvas;
});
// const canvasDpr = wx.getSystemInfoSync().pixelRatio // 微信旧的canvas不能传入dpr
const canvasDpr = 1
var query = wx.createSelectorQuery().in(this);
query.select('.ec-canvas').boundingClientRect(res => {
if (typeof callback === 'function') {
this.chart = callback(canvas, res.width, res.height, canvasDpr);
}
else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
this.chart = this.data.ec.onInit(canvas, res.width, res.height, canvasDpr);
}
else {
this.triggerEvent('init', {
canvas: canvas,
width: res.width,
height: res.height,
canvasDpr: canvasDpr // 增加了dpr,可方便外面echarts.init
});
}
}).exec();
},
initByNewWay(callback) {
// version >= 2.9.0:使用新的方式初始化
const query = wx.createSelectorQuery().in(this)
query
.select('.ec-canvas')
.fields({ node: true, size: true })
.exec(res => {
const canvasNode = res[0].node
this.canvasNode = canvasNode
const canvasDpr = wx.getSystemInfoSync().pixelRatio
const canvasWidth = res[0].width
const canvasHeight = res[0].height
const ctx = canvasNode.getContext('2d')
const canvas = new WxCanvas(ctx, this.data.canvasId, true, canvasNode)
echarts.setCanvasCreator(() => {
return canvas
})
if (typeof callback === 'function') {
this.chart = callback(canvas, canvasWidth, canvasHeight, canvasDpr)
} else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
this.chart = this.data.ec.onInit(canvas, canvasWidth, canvasHeight, canvasDpr)
} else {
this.triggerEvent('init', {
canvas: canvas,
width: canvasWidth,
height: canvasHeight,
dpr: canvasDpr
})
}
})
},
canvasToTempFilePath(opt) {
if (this.data.isUseNewCanvas) {
// 新版
const query = wx.createSelectorQuery().in(this)
query
.select('.ec-canvas')
.fields({ node: true, size: true })
.exec(res => {
const canvasNode = res[0].node
opt.canvas = canvasNode
wx.canvasToTempFilePath(opt)
})
} else {
// 旧的
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;
}
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!-- 新的:接口对其了H5 -->
<canvas wx:if="{{isUseNewCanvas}}" type="2d" class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas>
<!-- 旧的 -->
<canvas wx:else class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas>
\ No newline at end of file
.ec-canvas {
width: 100%;
height: 100%;
}
\ No newline at end of file
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, isNew, canvasNode) {
this.ctx = ctx;
this.canvasId = canvasId;
this.chart = null;
this.isNew = isNew
if (isNew) {
this.canvasNode = canvasNode;
}
else {
this._initStyle(ctx);
}
// this._initCanvas(zrender, 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
});
};
});
}
set width(w) {
if (this.canvasNode) this.canvasNode.width = w
}
set height(h) {
if (this.canvasNode) this.canvasNode.height = h
}
get width() {
if (this.canvasNode)
return this.canvasNode.width
return 0
}
get height() {
if (this.canvasNode)
return this.canvasNode.height
return 0
}
}
\ No newline at end of file
{
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"@vant/weapp": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/@vant/weapp/-/weapp-1.0.7.tgz",
"integrity": "sha512-F7gkcVKLTh4Pt17ukZnpZmn78CbtfmUtxSZif02ysyXZmqtAf1aAUffL3i1y+qzGWCXF4y/OVkOBVQVrKHI4MA=="
},
"vant-weapp": {
"version": "0.5.27",
"resolved": "https://registry.npmjs.org/vant-weapp/-/vant-weapp-0.5.27.tgz",
"integrity": "sha512-wmbpPWbpIk/Nl022Yfu0LNV+rSBPxnWTsZePVo6De4FxY3SWw47+Ip6rxLgdnG00/FntbymgvVw4xlaW+WmC+Q=="
}
}
}
...@@ -18,6 +18,7 @@ Page({ ...@@ -18,6 +18,7 @@ Page({
onLoad: function (options) { onLoad: function (options) {
this.setData({ this.setData({
coach_id: app.globalData.coach_id,
class_id: options.class_id, class_id: options.class_id,
lesson_id: options.lesson_id, lesson_id: options.lesson_id,
...@@ -32,7 +33,7 @@ Page({ ...@@ -32,7 +33,7 @@ Page({
let params = { let params = {
url: 'coach/lessondetail', url: 'coach/lessondetail',
data: { data: {
coach_id: 5, coach_id: this.data.coach_id,
class_id: this.data.class_id, class_id: this.data.class_id,
lesson_id: this.data.lesson_id lesson_id: this.data.lesson_id
}, },
...@@ -58,7 +59,7 @@ Page({ ...@@ -58,7 +59,7 @@ Page({
}, },
gocourseinstant: function () { gocourseinstant: function () {
wx.navigateTo({ wx.navigateTo({
url: '../../index/courseInstant/courseInstant', url: '../../index/courseInstant/courseInstant?type=check&lesson_id=' + this.data.lesson_id,
}) })
}, },
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<view class="item flex-h flex-vc flex-hb" wx:for="{{stuList}}" wx:key="index" data-id="{{item.id}}"> <view class="item flex-h flex-vc flex-hb" wx:for="{{stuList}}" wx:key="index" data-id="{{item.id}}">
<view class="flex-h flex-vc"> <view class="flex-h flex-vc">
<image src="/images/default_head.png" wx:if="{{item.child.thumb == null}}"></image> <image src="/images/default_head.png" wx:if="{{item.child.thumb == null}}"></image>
<image src="{{item.child.thumb}}" wx:else></image> <image src="{{item.child.thumb}}" wx:else></image>
<view> <view>
<view class="name">{{item.child.nick_name !=null ? item.child.nick_name : ''}}</view> <view class="name">{{item.child.nick_name !=null ? item.child.nick_name : ''}}</view>
<view class="big_name">{{item.child.child_name}}</view> <view class="big_name">{{item.child.child_name}}</view>
......
...@@ -8,6 +8,7 @@ var qiniuUploader = require("../../../utils/qiniuUploader"); ...@@ -8,6 +8,7 @@ var qiniuUploader = require("../../../utils/qiniuUploader");
Page({ Page({
data: { data: {
lesson_id: '', lesson_id: '',
type: '', // 查看还是修改
videoBox: [], videoBox: [],
videoShow: true, videoShow: true,
imgBox: [], imgBox: [],
...@@ -20,12 +21,12 @@ Page({ ...@@ -20,12 +21,12 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
this.setData({ this.setData({
lesson_id: options.lesson_id ? options.lesson_id : '' lesson_id: options.lesson_id ? options.lesson_id : '',
type: options.type ? options.type : '',
}) })
if (this.data.lesson_id) { if (this.data.lesson_id) {
this.getDetail() this.getDetail()
} }
}, },
getDetail() { getDetail() {
let params = { let params = {
...@@ -34,6 +35,22 @@ Page({ ...@@ -34,6 +35,22 @@ Page({
lesson_id: this.data.lesson_id lesson_id: this.data.lesson_id
}, },
callback:(data)=>{ callback:(data)=>{
console.log(JSON.parse(data.class_moment))
let class_moment = JSON.parse(data.class_moment)
let arr1 = [], arr2 = []
for(var i=0; i< class_moment.length; i++) {
if (class_moment[i].type == 'video') {
arr1.push(class_moment[i])
} else {
arr2.push(class_moment[i])
}
}
this.setData({
videoBox: arr1,
imgBox: arr2
})
console.log(arr1)
console.log(arr2)
console.log(data) console.log(data)
} }
} }
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
<view class="imgBox flex-h"> <view class="imgBox flex-h">
<view class="img videoBox" wx:for="{{videoBox}}" wx:for-item="item" wx:key="idx"> <view class="img videoBox" wx:for="{{videoBox}}" wx:for-item="item" wx:key="idx">
<video src="{{item.url}}" data-index="{{index}}"></video> <video src="{{item.url}}" data-index="{{index}}"></video>
<view class="delete-btn" data-index="{{index}}" catchtap="deleteVideo"> <view class="delete-btn" data-index="{{index}}" catchtap="deleteVideo" wx:if="{{type != 'check'}}">
<text class='iconfont iconguanbi'></text> <text class='iconfont iconguanbi'></text>
</view> </view>
</view> </view>
<view class='addBox flex-h flex-vc flex-hc' bindtap="chooseVideo" wx:if="{{videoShow}}"> <view class='addBox flex-h flex-vc flex-hc' bindtap="chooseVideo" wx:if="{{imgBox.length < 1}}">
<text class='iconfont iconshipin'></text> <text class='iconfont iconshipin'></text>
</view> </view>
</view> </view>
...@@ -23,15 +23,15 @@ ...@@ -23,15 +23,15 @@
<view class="imgBox flex-h flex-hw"> <view class="imgBox flex-h flex-hw">
<view class="img" wx:for="{{imgBox}}" wx:for-item="item" wx:key="idx"> <view class="img" wx:for="{{imgBox}}" wx:for-item="item" wx:key="idx">
<image src="{{item.url}}" data-index="{{index}}" mode="aspectFill" bindtap="previewImg"></image> <image src="{{item.url}}" data-index="{{index}}" mode="aspectFill" bindtap="previewImg"></image>
<view class="delete-btn" data-index="{{index}}" catchtap="deleteImg"> <view class="delete-btn" data-index="{{index}}" catchtap="deleteImg" wx:if="{{type != 'check'}}">
<text class='iconfont iconguanbi'></text> <text class='iconfont iconguanbi'></text>
</view> </view>
</view> </view>
<view class='addBox flex-h flex-vc flex-hc' bindtap="chooseImg" wx:if="{{imgBox.length < 9}}"> <view class='addBox flex-h flex-vc flex-hc' bindtap="chooseImg" wx:if="{{imgBox.length < 9 && type != 'check' }}">
<text class='iconfont iconxiangji'></text> <text class='iconfont iconxiangji'></text>
</view> </view>
</view> </view>
</view> </view>
<view class="button"> <view class="button" wx:if="{{type != 'check'}}">
<view class="submit" catchtap="save">提交</view> <view class="submit" catchtap="save">提交</view>
</view> </view>
\ No newline at end of file
...@@ -27,7 +27,6 @@ page { ...@@ -27,7 +27,6 @@ page {
.img { .img {
width: 210rpx; width: 210rpx;
height: 210rpx; height: 210rpx;
border: 1px solid #EBEBEB;
border-radius: 5rpx; border-radius: 5rpx;
margin-right: 30rpx; margin-right: 30rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
......
const app = getApp() const app = getApp()
let Charts = require('../../../utils/wxcharts-min.js'); import {
var lineChart = null; Base
import {Base} from '../../../utils/base.js'; } from '../../../utils/base.js';
const base = new Base() const base = new Base()
import * as echarts from '../../../ec-canvas/echarts.min.js';
let chartLine;
Page({ Page({
data: { data: {
windowWidth: '', windowWidth: '',
windowHeight: '', windowHeight: '',
coach : '', coach: '',
scoreList: [], scoreList: [],
coachcomment:'', coachcomment: '',
awardList: [], awardList: [],
arr1: [], class_id: '',
arr2:[], lesson_id: '',
class_id:'', child_id: '',
lesson_id :'', class_single_id: '',
child_id :'', ec: null,
class_single_id : ''
}, },
onLoad: function (options) { onLoad: function (options) {
console.log(options) this.init()
this.setData({ this.setData({
class_id : options.class_id, coach_id: app.globalData.coach_id,
lesson_id : options.lesson_id, class_id: options.class_id,
child_id : options.child_id, lesson_id: options.lesson_id,
class_single_id : options.class_single_id child_id: options.child_id,
class_single_id: options.class_single_id
}) })
console.log(options.class_single_id)
this.getRpx()
this.getcomment() this.getcomment()
this.getbadges() this.getbadges()
}, },
getRpx() { init() {
var res = wx.getSystemInfoSync(); //试图获取屏幕宽高数据 const getPixelRatio = () => {
let pixelRatio = 0
wx.getSystemInfo({
success: function (res) {
pixelRatio = res.pixelRatio
},
fail: function () {
pixelRatio = 0
}
})
return pixelRatio
}
var dpr = getPixelRatio()
this.setData({ this.setData({
windowWidth: res.windowWidth / 750 * 690 , ec: {
windowHeight: res.windowWidth / 750 * 605 onInit: function (canvas, width, height) {
}) chartLine = echarts.init(canvas, null, {
}, width: width,
getCharts() { height: height,
lineChart = new Charts({ devicePixelRatio: dpr
canvasId: 'radarCanvas', });
type: 'radar', canvas.setChart(chartLine);
categories: this.data.arr1,
legend: false,
series: [{
data: this.data.arr2,
}],
width: this.data.windowWidth,
height: this.data.windowHeight,
extra: {
radar: {
max: 150
} }
} }
}); })
}, },
getcomment : function () { getcomment: function () {
let params = { let params = {
url: 'coach/comment', url: 'coach/comment',
data:{ data: {
coach_id : 5, coach_id: this.data.coach_id,
class_id : this.data.class_id, class_id: this.data.class_id,
lesson_id : this.data.lesson_id, lesson_id: this.data.lesson_id,
child_id : this.data.child_id, child_id: this.data.child_id,
// coach_id: 5,
// class_id: 16,
// lesson_id: 69,
// child_id: 303,
}, },
callback : (data) => { callback: (data) => {
console.log(data)
this.setData({ this.setData({
coach : data.coach, coach: data.coach,
coachcomment : data, coachcomment: data,
scoreList : data.comment_score, scoreList: data.comment_score,
}) })
var arrs = []; var arrs = [];
var newArrs =[]; var newArrs = [];
for(var i = 0 ; i<this.data.scoreList.length; i++) { for (var i = 0; i < this.data.scoreList.length; i++) {
// console.log(this.data.scoreList) let option = {
arrs.push(this.data.scoreList[i].comment_norm.name) name: this.data.scoreList[i].comment_norm.name + ' ' + this.data.scoreList[i].score,
// console.log(arrs) max: 100
}
arrs.push(option)
newArrs.push(this.data.scoreList[i].score) newArrs.push(this.data.scoreList[i].score)
// console.log(newArrs)
} }
this.setData({ this.getOption(arrs, newArrs)
arr1:arrs,
arr2: newArrs
})
console.log(this.data.arr1)
console.log(this.data.arr2)
this.getCharts()
}, },
} }
base.newRequest(params) base.newRequest(params)
}, },
getbadges : function () { getOption(xData, data_cur) {
var option = {
backgroundColor: "#ffffff",
color: ["#00E2BB"],
xAxis: {
show: false
},
yAxis: {
show: false
},
radar: {
// radius: 100
center: ['52%', '50%'],
shape: 'circle',
splitNumber: 4, // 分割段数
indicator: xData, // 数据
textStyle: {
borderColor: '#00E2BB',
borderWidth: 2
},
name: { // 文本样式
textStyle: {
color: '#1A1A1A',
fontSize: 12
}
},
axisLine: { //配置雷达图的射线样式颜色
lineStyle: {
color: '#E0E0E0',
width: 1
},
},
splitLine: { // 分割线样式
lineStyle: {
color: '#E0E0E0',
width: 1,
type: 'dashed'
},
},
splitArea: { // 分割区域样式
areaStyle: {
color: ['#fff']
}
},
},
series: [{
type: 'radar',
data: [{
value: data_cur
}],
itemStyle: { //此属性的颜色和下面areaStyle属性的颜色都设置成相同色即可实现
color: '#00E2BB',
borderColor: '#00E2BB'
},
lineStyle: { // 线条样式
width: 2
},
symbol: 'circle', // 拐点的样式,还可以取值'rect','angle'等
symbolSize: 4, // 拐点的大小
areaStyle: { // 覆盖区域颜色
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: '#00E24A'
},
{
offset: 1,
color: '#00E3BC' // 100% 处的颜色
}
]
}
},
}]
};
chartLine.setOption(option);
},
getbadges: function () {
let params = { let params = {
url: 'badges', url: 'badges',
data : { data: {
user_child_id : this.data.child_id, user_child_id: this.data.child_id,
class_id : this.data.class_id , class_id: this.data.class_id,
class_single_id : this.data.class_single_id, class_single_id: this.data.class_single_id,
}, },
callback : (data) =>{ callback: (data) => {
console.log(data)
this.setData({ this.setData({
awardList : data awardList: data
}) })
} }
} }
......
{ {
"usingComponents": {}, "usingComponents": {
"ec-canvas": "../../../ec-canvas/ec-canvas"
},
"navigationBarTitleText": "运动评价" "navigationBarTitleText": "运动评价"
} }
\ No newline at end of file
<view class="top"> <view class="canvasbox">
<view class="title">运动表现</view> <view class="canvas_title">运动表现</view>
<view class="canvasbox"> <view class="canvasbox1">
<canvas canvas-id="radarCanvas" disable-scroll="true" class="canvas"></canvas> <ec-canvas id="mychart" class="canvas" canvas-id="mychart-bar" ec="{{ ec }}"></ec-canvas>
</view> </view>
</view> </view>
<view class="one"> <view class="one">
......
page { page {
background: #F7F8FA; background: #F7F8FA;
padding: 20rpx 30rpx 60rpx 30rpx; padding: 20rpx 30rpx 60rpx 30rpx;
...@@ -9,15 +10,25 @@ page { ...@@ -9,15 +10,25 @@ page {
margin-bottom: 20rpx; margin-bottom: 20rpx;
padding: 50rpx 30rpx; padding: 50rpx 30rpx;
} }
.top .canvasbox { .canvasbox {
width: 100%; width: 100%;
height: 605rpx; height: 635rpx;
background: #FFFFFF; background: #FFFFFF;
border-radius: 15rpx; border-radius: 15rpx;
position: relative;
margin-bottom: 20rpx;
}
.canvas_title {
padding-left: 30rpx;
padding-top: 50rpx;
font-size: 26rpx;
font-weight: bold;
color: #1A1A1A;
z-index: 100;
} }
.top .canvasbox .canvas { .canvasbox .canvasbox1 {
width: 100%; width: 100%;
height: 100%; height: 555rpx;
} }
.one { .one {
padding: 49rpx 28rpx 32rpx 28rpx; padding: 49rpx 28rpx 32rpx 28rpx;
......
...@@ -12,20 +12,53 @@ Page({ ...@@ -12,20 +12,53 @@ Page({
}, },
onLoad: function (options) { onLoad: function (options) {
this.setData({
user_id: wx.getStorageSync('userInfo').id
})
console.log(this.data.user_id)
}, },
getPhoneNumber: function (e) {
var that = this
if (e.detail.errMsg == 'getPhoneNumber:ok') {
let params = {
url: 'user/switchPhone',
data: {
encryptedData: e.detail.encryptedData,
iv: e.detail.iv
},
type: "POST",
callback: (data) => {
this.setData({
telPhone: data.phoneNumber
})
app.globalData.userTel = data.phoneNumber
wx.setStorageSync('userTel', data.phoneNumber)
that.apply()
},
}
base.newRequest(params)
} else {
base.toast('授权失败,无法查看')
}
},
apply() { apply() {
let params = { let params = {
url: 'apply', url: 'apply',
type: 'POST', type: 'POST',
data: { data: {
wx_user_id: this.data.user_id,
role_type: this.data.role_type, role_type: this.data.role_type,
mobile: this.data.telPhone mobile: this.data.telPhone
}, },
callback:(data)=>{ callback:(data)=>{
console.log(data) wx.redirectTo({
url: '/pages/sign/applyResult/applyResult?type=success',
})
},
confirmback:()=>{
wx.redirectTo({
url: '/pages/sign/applyResult/applyResult?type=fail',
})
} }
} }
base.newRequest(params) base.newRequest(params)
......
<view> <view>
<view class="save" catchtap="apply">申请成为教练</view> <button class="save" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">申请成为教练</button>
</view> </view>
\ No newline at end of file
...@@ -3,12 +3,13 @@ ...@@ -3,12 +3,13 @@
bottom: 33rpx; bottom: 33rpx;
left: 50rpx; left: 50rpx;
right: 50rpx; right: 50rpx;
width: 650rpx; width: 650rpx !important;
height: 80rpx; height: 80rpx !important;
line-height: 80rpx; line-height: 80rpx !important;
text-align: center; text-align: center;
background: linear-gradient(-70deg, #FFC600 0%, #FFD400 100%); background: linear-gradient(-70deg, #FFC600 0%, #FFD400 100%);
border-radius: 40rpx; border-radius: 40rpx;
font-size: 30rpx; font-size: 30rpx;
color: #000000; color: #000000;
padding: 0 !important;
} }
\ No newline at end of file
...@@ -4,9 +4,7 @@ ...@@ -4,9 +4,7 @@
</view> </view>
<view class="text">申请成功</view> <view class="text">申请成功</view>
<view class="cont"> <view class="cont">
<view class="title" wx:if='{{type == 1}}'>添加审核人员,更快成为团长!</view> <view class="title">添加审核人员,更快管理场馆!</view>
<view class="title" wx:if='{{type == 2}}'>添加审核人员,更快成为教练!</view>
<view class="title" wx:if='{{type == 3}}'>添加审核人员,更快管理场馆!</view>
<view class="code" catchtap="prevImage"> <view class="code" catchtap="prevImage">
<image src="{{curImage}}"></image> <image src="{{curImage}}"></image>
</view> </view>
......
...@@ -11,36 +11,41 @@ Page({ ...@@ -11,36 +11,41 @@ Page({
if (e.detail.errMsg == 'getUserInfo:ok') { if (e.detail.errMsg == 'getUserInfo:ok') {
app.saveUserInfo(e.detail, this.showUserInfo) app.saveUserInfo(e.detail, this.showUserInfo)
} else { } else {
base.toast('请先授权,才能验证身份') base.toast('请先授权,才能验证身份')
} }
}, },
showUserInfo: function () { showUserInfo: function () {
if (app.globalData.hasTel) { let params = {
base.toast('登录成功') url: 'apply/get_coach_apply',
setTimeout(() => { callback: (data) => {
if (app.globalData.backurl) { let status;
if (app.globalData.backurl.indexOf('/pages/tabbar') != -1) { if (data.length == 0) { // 没有申请过
wx.switchTab({ status = 1
url: app.globalData.backurl, } else if (data.status_display == '待审核') {
}) status = 2
} else { } else {
wx.redirectTo({ status = 3
url: app.globalData.backurl }
}) this.getLogin(status)
} }
} else { }
wx.switchTab({ base.newRequest(params)
url: '/pages/tabbar/personal/personal', },
}) getLogin(status) {
} if (status == 3) {
}, 800) wx.switchTab({
url: '/pages/tabbar/index/index',
} else { })
wx.navigateTo({ } else if (status == 2) {
url: '../bindTel/bindTel', wx.redirectTo({
url: '/pages/sign/applyResult/applyResult',
})
} else if (status == 1) {
wx.redirectTo({
url: '/pages/sign/apply/apply',
}) })
} }
}, },
checkVisions: function () { checkVisions: function () {
if (wx.canIUse !== undefined && wx.canIUse('button.open-type.getUserInfo')) { if (wx.canIUse !== undefined && wx.canIUse('button.open-type.getUserInfo')) {
this.setData({ this.setData({
......
const app = getApp() const app = getApp()
import { import {
Base Base
...@@ -6,17 +5,21 @@ import { ...@@ -6,17 +5,21 @@ import {
const base = new Base() const base = new Base()
Page({ Page({
data: { data: {
coach_id: -1,
activeIndex: 1, activeIndex: 1,
datalList: [], datalList: [],
locked:false, locked: false,
classList : [], classList: [],
}, },
onLoad: function (options) { onLoad: function (options) {
wx.showLoading({ wx.showLoading({
title: '加载中...', title: '加载中...',
}) })
this.setData({
coach_id: app.globalData.coach_id
})
this.getList() this.getList()
this.getMyclasslist(); this.getMyclasslist();
}, },
...@@ -28,14 +31,14 @@ Page({ ...@@ -28,14 +31,14 @@ Page({
let params = { let params = {
url: 'coach/roblist', url: 'coach/roblist',
data: { data: {
coach_id : 5 coach_id: this.data.coach_id
}, },
callback:(data)=>{ callback: (data) => {
console.log(data) console.log(data)
wx.hideLoading(); wx.hideLoading();
this.setData({ this.setData({
datalList: data, datalList: data,
locked:false locked: false
}) })
} }
} }
...@@ -47,33 +50,32 @@ Page({ ...@@ -47,33 +50,32 @@ Page({
title: '加载中...', title: '加载中...',
}) })
let params = { let params = {
url:'coach/myclasses', url: 'coach/myclasses',
data : { data: {
coach_id : 5 coach_id: this.data.coach_id
}, },
callback: (data) =>{ callback: (data) => {
console.log(data) console.log(data)
wx.hideLoading(); wx.hideLoading();
this.setData({ this.setData({
classList: data, classList: data,
locked:false locked: false
}) })
} }
} }
base.newRequest(params) base.newRequest(params)
}, },
// 抢班-我的班级列表 // 抢班-我的班级列表
getrobclass : function () { getrobclass: function (e) {
const { coach_id, class_id} = this.data let class_id = e.currentTarget.dataset.id
let params = { let params = {
url:'coach/robclass', url: 'coach/robclass',
data : { data: {
coach_id : 5, coach_id: this.data.coach_id,
class_id : 16 class_id: class_id
}, },
callback : (data) => { callback: (data) => {
base.toast('抢班成功') base.toast('抢班成功')
console.log(data)
this.setData({ this.setData({
datalList: [] datalList: []
...@@ -91,26 +93,26 @@ Page({ ...@@ -91,26 +93,26 @@ Page({
}) })
} }
}, },
goteamDetail (e) { goteamDetail(e) {
var class_id = e.currentTarget.dataset.id var class_id = e.currentTarget.dataset.id
wx.navigateTo({ wx.navigateTo({
url: '../../team/teamDetail/teamDetail?class_id=' + class_id, url: '../../team/teamDetail/teamDetail?class_id=' + class_id,
}) })
}, },
initData:function(){ initData: function () {
this.setData({ this.setData({
datalList:[], datalList: [],
locked:false locked: false
}) })
}, },
onPullDownRefresh: function () { onPullDownRefresh: function () {
this.initData() this.initData()
if(!this.data.locked){ if (!this.data.locked) {
this.setData({ this.setData({
locked:true locked: true
}) })
this.onLoadFun(); this.onLoadFun();
} }
wx.stopPullDownRefresh() wx.stopPullDownRefresh()
}, },
}) })
\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<text>上课场馆:{{item.stadium.name}}</text> <text>上课场馆:{{item.stadium.name}}</text>
<text>上课时间:{{item.course_time.name}}</text> <text>上课时间:{{item.course_time.name}}</text>
</view> </view>
<view class="goclass" bindtap="getrobclass">我要上课</view> <view class="goclass" bindtap="getrobclass" data-id="{{item.id}}">我要上课</view>
</view> </view>
</view> </view>
</block> </block>
......
...@@ -8,7 +8,7 @@ Page({ ...@@ -8,7 +8,7 @@ Page({
data: { data: {
activeIndex: 1, activeIndex: 1,
coach_id: '5', coach_id: '',
role_id: '2', role_id: '2',
detail: '', detail: '',
...@@ -27,6 +27,9 @@ Page({ ...@@ -27,6 +27,9 @@ Page({
onLoad: function (options) { onLoad: function (options) {
this.setData({
coach_id: app.globalData.coach_id,
})
this.getMoney() this.getMoney()
this.getList(1) this.getList(1)
this.getList(2) this.getList(2)
......
...@@ -11,13 +11,14 @@ Page({ ...@@ -11,13 +11,14 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
coach_id: '5', coach_id: '',
isOpen: false, isOpen: false,
daysColor: [], daysColor: [],
today: '', // 今天日期 today: '', // 今天日期
curDate: '', curDate: '',
list: [], list: [],
allList: [] allList: [],
month: ''
}, },
/** /**
...@@ -27,21 +28,26 @@ Page({ ...@@ -27,21 +28,26 @@ Page({
wx.showLoading({ wx.showLoading({
title: '加载中...', title: '加载中...',
}) })
console.log(app.globalData) let year = new Date().getFullYear()
let month = util.formatNumber(new Date().getMonth() + 1)
this.setData({ this.setData({
// coach_id: app.globalData.userInfo.id, coach_id: app.globalData.coach_id,
today: util.formatTime(new Date()), today: util.formatTime(new Date()),
curDate: util.formatTime(new Date()) curDate: util.formatTime(new Date()),
month: year + month
}) })
console.log(this.data.today == this.data.curDate)
this.getAllList() this.getAllList()
this.getList() this.getList()
}, },
getAllList() { getAllList() {
wx.showLoading({
title: '加载中...',
})
let params = { let params = {
url: 'coach/timetable', url: 'coach/timetable',
data: { data: {
coach_id: this.data.coach_id, coach_id: this.data.coach_id,
month: this.data.month
}, },
callback: (data) => { callback: (data) => {
console.log(data) console.log(data)
...@@ -80,20 +86,19 @@ Page({ ...@@ -80,20 +86,19 @@ Page({
} }
} }
base.newRequest(params) base.newRequest(params)
}, },
prev: function (event) { prev: function (event) {
let currentMonth = util.formatNumber(event.detail.currentMonth) let currentMonth = util.formatNumber(event.detail.currentMonth)
this.setData({ this.setData({
month: event.detail.currentYear + '-' + currentMonth month: event.detail.currentYear + currentMonth
}) })
this.getAllList(); this.getAllList();
}, },
next: function (event) { next: function (event) {
let currentMonth = util.formatNumber(event.detail.currentMonth) let currentMonth = util.formatNumber(event.detail.currentMonth)
this.setData({ this.setData({
month: event.detail.currentYear + '-' + currentMonth month: event.detail.currentYear + currentMonth
}) })
this.getAllList(); this.getAllList();
}, },
......
...@@ -15,9 +15,6 @@ ...@@ -15,9 +15,6 @@
var hour = getDate().getHours() var hour = getDate().getHours()
var minute = getDate().getMinutes() var minute = getDate().getMinutes()
var time = hour + ':' + minute var time = hour + ':' + minute
console.log(hour)
console.log(minute)
return time return time
} }
module.exports = { module.exports = {
......
const app = getApp() const app = getApp()
import { Base } from '../../..//utils/base.js'; import {
Base
} from '../../..//utils/base.js';
const base = new Base() const base = new Base()
Page({ Page({
...@@ -11,9 +13,30 @@ Page({ ...@@ -11,9 +13,30 @@ Page({
noticeCount: 9, // 家长回复小红点 noticeCount: 9, // 家长回复小红点
show: false, show: false,
subjectShow: false, subjectShow: false,
subjectList: [], subjectList:[],
}, // subjectList:[
// {
// name: '跳绳'
// },
// {
// name: '篮球'
// },
// {
// name: '足球'
// },
// {
// name: '轮滑'
// },
// {
// name: '平衡车'
// },
// {
// name: '跆拳道'
// },
// ]
},
onLoad: function (options) { onLoad: function (options) {
......
const app = getApp()
import { Base } from '../../utils/base.js';
const base = new Base()
Page({
data: {
},
onLoad: function (options) {
this.getAuthor()
},
getAuthor() {
var that = this
let params = {
url: 'apply/get_coach_apply',
callback:(data)=>{
let status;
if (data.length == 0) { // 没有申请过
status = 3
} else if (data.status == 2) {
status = 2
} else { // 通过
app.globalData.coach_id = data.wxuser.coach.id
status = 1
}
that.getLogin(status)
}
}
base.newRequest(params)
},
getLogin(status) {
let userInfo = wx.getStorageSync('userInfo')
if (userInfo) {
app.globalData.userInfo = userInfo
if (status == 1) {
wx.switchTab({
url: '/pages/tabbar/index/index',
})
} else if (status == 2) {
wx.redirectTo({
url: '/pages/sign/applyResult/applyResult',
})
} else if (status == 3) {
wx.redirectTo({
url: '/pages/sign/apply/apply',
})
}
} else {
wx.redirectTo({
url: '/pages/sign/login/login',
})
}
},
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<view class="box flex-v flex-hc flex-vc">
<image src="/images/course_login.png"></image>
<view>豌豆成长</view>
</view>
\ No newline at end of file
page {
height: 100%;
}
.box{
height: 100%;
font-size: 32rpx;
}
.box image{
width: 204rpx;
height: 204rpx;
margin-bottom: 40rpx;
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
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