Commit bea76c16 authored by 吴颖's avatar 吴颖

Merge branch 'wuying' into 'master'

Wuying

See merge request !22
parents e6e94808 1856b420
App({ App({
onLaunch: function () { onLaunch: function () {
this.isReload() // 小程序是否有新版本 this.isReload() // 小程序是否有新版本
this.getLogin()
this.getToken() this.getToken()
}, },
// 小程序是否有新版本 // 小程序是否有新版本
...@@ -38,23 +36,9 @@ App({ ...@@ -38,23 +36,9 @@ App({
}) })
} }
}, },
getLogin() {
let userInfo = wx.getStorageSync('userInfo')
if (userInfo) {
this.globalData.userInfo = 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 {
...@@ -146,7 +130,7 @@ App({ ...@@ -146,7 +130,7 @@ App({
} }
}) })
}, },
globalData: { globalData: {
extAppid: 'wx6e6eaca9cc1c406d', // 当前appid extAppid: 'wx6e6eaca9cc1c406d', // 当前appid
userInfo: '', //微信user信息 userInfo: '', //微信user信息
......
{ {
"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",
......
...@@ -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()
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 { // 通过
status = 1
}
that.getLogin(status)
}
}
base.newRequest(params)
},
getLogin(status) {
let userInfo = wx.getStorageSync('userInfo')
if (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
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