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

'登录逻辑修改'

parent 1856b420
...@@ -36,9 +36,6 @@ App({ ...@@ -36,9 +36,6 @@ App({
}) })
} }
}, },
getToken() { getToken() {
var that = this var that = this
try { try {
...@@ -109,6 +106,7 @@ App({ ...@@ -109,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)
...@@ -136,6 +134,7 @@ App({ ...@@ -136,6 +134,7 @@ App({
userInfo: '', //微信user信息 userInfo: '', //微信user信息
userTel: '', // 手机号 userTel: '', // 手机号
token: '', token: '',
backurl: '' // 全局跳转页面路径 backurl: '', // 全局跳转页面路径
coach_id: '', // 教练id
} }
}) })
\ No newline at end of file
...@@ -16,6 +16,7 @@ Page({ ...@@ -16,6 +16,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
}) })
...@@ -29,7 +30,7 @@ Page({ ...@@ -29,7 +30,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
}, },
......
const app = getApp() const app = getApp()
import { import {
Base Base
...@@ -6,10 +5,11 @@ import { ...@@ -6,10 +5,11 @@ 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: [],
}, },
...@@ -17,6 +17,9 @@ Page({ ...@@ -17,6 +17,9 @@ Page({
wx.showLoading({ wx.showLoading({
title: '加载中...', title: '加载中...',
}) })
this.setData({
coach_id: app.globalData.coach_id
})
this.getList() this.getList()
this.getMyclasslist(); this.getMyclasslist();
}, },
...@@ -25,18 +28,17 @@ Page({ ...@@ -25,18 +28,17 @@ Page({
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',
}) })
const { coach_id } = this.data;
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,36 +49,33 @@ Page({ ...@@ -47,36 +49,33 @@ Page({
wx.showLoading({ wx.showLoading({
title: '加载中...', title: '加载中...',
}) })
const { coach_id } = this.data;
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)
console.log('1111111111111')
this.setData({ this.setData({
datalList: [] datalList: []
...@@ -94,23 +93,23 @@ Page({ ...@@ -94,23 +93,23 @@ 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();
} }
......
...@@ -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,7 +11,7 @@ Page({ ...@@ -11,7 +11,7 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
coach_id: '5', coach_id: '',
isOpen: false, isOpen: false,
daysColor: [], daysColor: [],
today: '', // 今天日期 today: '', // 今天日期
...@@ -31,7 +31,7 @@ Page({ ...@@ -31,7 +31,7 @@ Page({
let year = new Date().getFullYear() let year = new Date().getFullYear()
let month = util.formatNumber(new Date().getMonth() + 1) 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 month: year + month
......
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({
...@@ -9,10 +11,9 @@ Page({ ...@@ -9,10 +11,9 @@ Page({
data: { data: {
showUserInfo: true, //用户信息是否显示 showUserInfo: true, //用户信息是否显示
noticeCount: 9, // 家长回复小红点 noticeCount: 9, // 家长回复小红点
show:false, show: false,
subjectShow: false, subjectShow: false,
subjectList:[ subjectList: [{
{
name: '跳绳' name: '跳绳'
}, },
{ {
...@@ -64,12 +65,12 @@ Page({ ...@@ -64,12 +65,12 @@ Page({
url: '/pages/sign/info/info', url: '/pages/sign/info/info',
}) })
}, },
goparents:function(){ goparents: function () {
wx.navigateTo({ wx.navigateTo({
url: '../../my/parents/parents', url: '../../my/parents/parents',
}) })
}, },
goteachingArea:function(){ goteachingArea: function () {
wx.navigateTo({ wx.navigateTo({
url: '../../my/teachingArea/teachingArea', url: '../../my/teachingArea/teachingArea',
}) })
...@@ -83,7 +84,7 @@ Page({ ...@@ -83,7 +84,7 @@ Page({
chooseOne(e) { chooseOne(e) {
let index = e.currentTarget.dataset.index let index = e.currentTarget.dataset.index
let list = this.data.subjectList let list = this.data.subjectList
if (list[index].isChecked){ if (list[index].isChecked) {
list[index].isChecked = false list[index].isChecked = false
} else { } else {
list[index].isChecked = true list[index].isChecked = true
...@@ -92,9 +93,9 @@ Page({ ...@@ -92,9 +93,9 @@ Page({
subjectList: list subjectList: list
}) })
}, },
confirm(){ confirm() {
var arr = [] var arr = []
for (var i=0; i<this.data.subjectList.length;i++) { for (var i = 0; i < this.data.subjectList.length; i++) {
if (this.data.subjectList[i].isChecked == true) { if (this.data.subjectList[i].isChecked == true) {
arr.push(this.data.subjectList[i]) arr.push(this.data.subjectList[i])
} }
...@@ -105,7 +106,7 @@ Page({ ...@@ -105,7 +106,7 @@ Page({
console.log(arr) console.log(arr)
} }
}, },
goCall: function(e){ goCall: function (e) {
wx.showModal({ wx.showModal({
content: '确定要拨打电话吗?', content: '确定要拨打电话吗?',
success(res) { success(res) {
......
...@@ -21,6 +21,7 @@ Page({ ...@@ -21,6 +21,7 @@ Page({
} else if (data.status == 2) { } else if (data.status == 2) {
status = 2 status = 2
} else { // 通过 } else { // 通过
app.globalData.coach_id = data.wxuser.coach.id
status = 1 status = 1
} }
that.getLogin(status) that.getLogin(status)
...@@ -31,6 +32,7 @@ Page({ ...@@ -31,6 +32,7 @@ Page({
getLogin(status) { getLogin(status) {
let userInfo = wx.getStorageSync('userInfo') let userInfo = wx.getStorageSync('userInfo')
if (userInfo) { if (userInfo) {
app.globalData.userInfo = userInfo
if (status == 1) { if (status == 1) {
wx.switchTab({ wx.switchTab({
url: '/pages/tabbar/index/index', 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