Commit 06302ddb authored by 吴颖's avatar 吴颖

'登录逻辑修改'

parent 1856b420
......@@ -36,9 +36,6 @@ App({
})
}
},
getToken() {
var that = this
try {
......@@ -109,6 +106,7 @@ App({
})
that.globalData.hasTel = res.data.data.hasTel
that.globalData.userInfo = res.data.data;
console.log(that.globalData.userInfo)
wx.setStorageSync('userInfo', res.data.data)
if (res.data.data.userTel) {
wx.setStorageSync('userTel', res.data.data.userTel)
......@@ -136,6 +134,7 @@ App({
userInfo: '', //微信user信息
userTel: '', // 手机号
token: '',
backurl: '' // 全局跳转页面路径
backurl: '', // 全局跳转页面路径
coach_id: '', // 教练id
}
})
\ No newline at end of file
......@@ -16,6 +16,7 @@ Page({
onLoad: function (options) {
this.setData({
coach_id: app.globalData.coach_id,
class_id: options.class_id,
lesson_id: options.lesson_id
})
......@@ -29,7 +30,7 @@ Page({
let params = {
url: 'coach/lessondetail',
data: {
coach_id: 5,
coach_id: this.data.coach_id,
class_id: this.data.class_id,
lesson_id: this.data.lesson_id
},
......
const app = getApp()
import {
Base
......@@ -6,17 +5,21 @@ import {
const base = new Base()
Page({
data: {
coach_id: -1,
activeIndex: 1,
datalList: [],
locked:false,
classList : [],
locked: false,
classList: [],
},
onLoad: function (options) {
wx.showLoading({
title: '加载中...',
})
})
this.setData({
coach_id: app.globalData.coach_id
})
this.getList()
this.getMyclasslist();
},
......@@ -25,18 +28,17 @@ Page({
wx.showLoading({
title: '加载中',
})
const { coach_id } = this.data;
let params = {
url: 'coach/roblist',
data: {
coach_id : 5
coach_id: this.data.coach_id
},
callback:(data)=>{
callback: (data) => {
console.log(data)
wx.hideLoading();
this.setData({
datalList: data,
locked:false
locked: false
})
}
}
......@@ -47,36 +49,33 @@ Page({
wx.showLoading({
title: '加载中...',
})
const { coach_id } = this.data;
let params = {
url:'coach/myclasses',
data : {
coach_id : 5
url: 'coach/myclasses',
data: {
coach_id: this.data.coach_id
},
callback: (data) =>{
callback: (data) => {
console.log(data)
wx.hideLoading();
this.setData({
this.setData({
classList: data,
locked:false
locked: false
})
}
}
base.newRequest(params)
},
// 抢班-我的班级列表
getrobclass : function () {
const { coach_id, class_id} = this.data
getrobclass: function (e) {
let class_id = e.currentTarget.dataset.id
let params = {
url:'coach/robclass',
data : {
coach_id : 5,
class_id : 16
url: 'coach/robclass',
data: {
coach_id: this.data.coach_id,
class_id: class_id
},
callback : (data) => {
callback: (data) => {
base.toast('抢班成功')
console.log(data)
console.log('1111111111111')
this.setData({
datalList: []
......@@ -94,26 +93,26 @@ Page({
})
}
},
goteamDetail (e) {
goteamDetail(e) {
var class_id = e.currentTarget.dataset.id
wx.navigateTo({
url: '../../team/teamDetail/teamDetail?class_id=' + class_id,
})
},
initData:function(){
initData: function () {
this.setData({
datalList:[],
locked:false
datalList: [],
locked: false
})
},
onPullDownRefresh: function () {
this.initData()
if(!this.data.locked){
if (!this.data.locked) {
this.setData({
locked:true
locked: true
})
this.onLoadFun();
}
wx.stopPullDownRefresh()
},
})
})
\ No newline at end of file
......@@ -13,7 +13,7 @@
<text>上课场馆:{{item.stadium.name}}</text>
<text>上课时间:{{item.course_time.name}}</text>
</view>
<view class="goclass" bindtap="getrobclass">我要上课</view>
<view class="goclass" bindtap="getrobclass" data-id="{{item.id}}">我要上课</view>
</view>
</view>
</block>
......
......@@ -8,7 +8,7 @@ Page({
data: {
activeIndex: 1,
coach_id: '5',
coach_id: '',
role_id: '2',
detail: '',
......@@ -27,6 +27,9 @@ Page({
onLoad: function (options) {
this.setData({
coach_id: app.globalData.coach_id,
})
this.getMoney()
this.getList(1)
this.getList(2)
......
......@@ -11,7 +11,7 @@ Page({
* 页面的初始数据
*/
data: {
coach_id: '5',
coach_id: '',
isOpen: false,
daysColor: [],
today: '', // 今天日期
......@@ -31,7 +31,7 @@ Page({
let year = new Date().getFullYear()
let month = util.formatNumber(new Date().getMonth() + 1)
this.setData({
// coach_id: app.globalData.userInfo.id,
coach_id: app.globalData.coach_id,
today: util.formatTime(new Date()),
curDate: util.formatTime(new Date()),
month: year + month
......
const app = getApp()
import { Base } from '../../..//utils/base.js';
import {
Base
} from '../../..//utils/base.js';
const base = new Base()
Page({
/**
* 页面的初始数据
*/
data: {
showUserInfo: true, //用户信息是否显示
noticeCount: 9, // 家长回复小红点
show:false,
subjectShow: false,
subjectList:[
{
name: '跳绳'
},
{
name: '篮球'
},
{
name: '足球'
},
{
name: '轮滑'
},
{
name: '平衡车'
},
{
name: '跆拳道'
},
]
/**
* 页面的初始数据
*/
data: {
showUserInfo: true, //用户信息是否显示
noticeCount: 9, // 家长回复小红点
show: false,
subjectShow: false,
subjectList: [{
name: '跳绳'
},
{
name: '篮球'
},
{
name: '足球'
},
{
name: '轮滑'
},
{
name: '平衡车'
},
{
name: '跆拳道'
},
]
},
},
onLoad: function (options) {
},
onShow() {
let userInfo = wx.getStorageSync('userInfo');
let userTel = wx.getStorageSync('userTel')
if (userInfo && userTel) {
this.setData({
showUserInfo: true
})
this.getChildInf();
} else {
this.setData({
showUserInfo: false
})
}
},
goLogin() {
wx.navigateTo({ // 登录
url: '/pages/sign/login/login',
})
},
goUserInfo() { // 账户信息修改
wx.navigateTo({
url: '/pages/sign/info/info',
})
},
goparents:function(){
wx.navigateTo({
url: '../../my/parents/parents',
})
},
goteachingArea:function(){
wx.navigateTo({
url: '../../my/teachingArea/teachingArea',
})
},
//教学科目弹窗
tcHold: function (e) {
this.setData({
subjectShow: !this.data.subjectShow
})
},
chooseOne(e) {
let index = e.currentTarget.dataset.index
let list = this.data.subjectList
if (list[index].isChecked){
list[index].isChecked = false
} else {
list[index].isChecked = true
}
this.setData({
subjectList: list
})
},
confirm(){
var arr = []
for (var i=0; i<this.data.subjectList.length;i++) {
if (this.data.subjectList[i].isChecked == true) {
arr.push(this.data.subjectList[i])
}
}
if (arr.length == 0) {
base.toast('教学科目至少选择一项')
} else {
console.log(arr)
}
},
goCall: function(e){
wx.showModal({
content: '确定要拨打电话吗?',
success(res) {
if (res.confirm) {
wx.makePhoneCall({
phoneNumber: '400-181-5358'
})
}
}
})
}
onLoad: function (options) {
},
onShow() {
let userInfo = wx.getStorageSync('userInfo');
let userTel = wx.getStorageSync('userTel')
if (userInfo && userTel) {
this.setData({
showUserInfo: true
})
this.getChildInf();
} else {
this.setData({
showUserInfo: false
})
}
},
goLogin() {
wx.navigateTo({ // 登录
url: '/pages/sign/login/login',
})
},
goUserInfo() { // 账户信息修改
wx.navigateTo({
url: '/pages/sign/info/info',
})
},
goparents: function () {
wx.navigateTo({
url: '../../my/parents/parents',
})
},
goteachingArea: function () {
wx.navigateTo({
url: '../../my/teachingArea/teachingArea',
})
},
//教学科目弹窗
tcHold: function (e) {
this.setData({
subjectShow: !this.data.subjectShow
})
},
chooseOne(e) {
let index = e.currentTarget.dataset.index
let list = this.data.subjectList
if (list[index].isChecked) {
list[index].isChecked = false
} else {
list[index].isChecked = true
}
this.setData({
subjectList: list
})
},
confirm() {
var arr = []
for (var i = 0; i < this.data.subjectList.length; i++) {
if (this.data.subjectList[i].isChecked == true) {
arr.push(this.data.subjectList[i])
}
}
if (arr.length == 0) {
base.toast('教学科目至少选择一项')
} else {
console.log(arr)
}
},
goCall: function (e) {
wx.showModal({
content: '确定要拨打电话吗?',
success(res) {
if (res.confirm) {
wx.makePhoneCall({
phoneNumber: '400-181-5358'
})
}
}
})
}
})
\ No newline at end of file
......@@ -21,6 +21,7 @@ Page({
} else if (data.status == 2) {
status = 2
} else { // 通过
app.globalData.coach_id = data.wxuser.coach.id
status = 1
}
that.getLogin(status)
......@@ -29,8 +30,9 @@ Page({
base.newRequest(params)
},
getLogin(status) {
let userInfo = wx.getStorageSync('userInfo')
let userInfo = wx.getStorageSync('userInfo')
if (userInfo) {
app.globalData.userInfo = userInfo
if (status == 1) {
wx.switchTab({
url: '/pages/tabbar/index/index',
......
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