This commit is contained in:
caoqianming 2020-05-08 18:23:10 +08:00
parent fdee8192c2
commit 92b3bba694
5 changed files with 41 additions and 14 deletions

View File

@ -16,13 +16,14 @@ App({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
api.request('/crm/consumer/mplogin/','POST', {code:res.code}).then(res=>{
wx.hideLoading()
if(res.code==200){
this.globalData.token = res.data.token
this.globalData.userinfo = res.data.userinfo
wx.hideLoading()
var pages = getCurrentPages() //获取加载的页面
var currentPage = pages[pages.length - 1] //获取当前页面的对象
currentPage.showExp()
if(res.data.userinfo.username == null){
//匿名用户
wx.reLaunch({

View File

@ -13,7 +13,7 @@ Page({
ctms: [],
tm_index: 0,
answerP: false,
page:1
page:1,
},
radioChange: function(e) {
var that = this
@ -65,11 +65,13 @@ Page({
ydtms: wx.getStorageSync('cat' + that.data.questioncat.toString())
}
api.request('/question/question/exercise/?limit=10&page='+that.data.page, 'POST', query).then(res => {
if(res.code>=200){
that.data.tms = that.data.tms.concat(res.data.results)
that.showTm(that.data.tm_index) //展示题目和答案
that.setData({
tmtotal: res.data.count,
})
}
})
},
/**
@ -171,17 +173,27 @@ Page({
},
next: function() {
var that = this
var tm_index = that.data.tm_index + 1
that.setData({
tm_index: tm_index,
answerP: false
})
if (tm_index + 1 > that.data.tms.length) {
that.data.page = that.data.page + 1
that.getTms()
} else {
that.showTm(tm_index)
var tm_index = that.data.tm_index
if (tm_index+1==that.data.tmtotal){
wx.showToast({
title: '没有更多',
icon:'none'
})
}else{
tm_index = tm_index + 1
that.setData({
tm_index: tm_index,
answerP: false
})
if (tm_index + 1 > that.data.tms.length) {
that.data.page = that.data.page + 1
that.getTms()
} else {
that.showTm(tm_index)
}
}
},
previous: function() {

View File

@ -130,7 +130,7 @@ Page({
}
},
isPhone: function(phone){
var phoneReg = /^[1][3,4,5,7,8][0-9]{9}$/;
var phoneReg = /^[1][3,4,5,7,8,9][0-9]{9}$/;
if (phoneReg.test(phone)) {
return true;
} else {

View File

@ -211,4 +211,16 @@ Page({
})
},
Baoming: function (){
wx.navigateToMiniProgram({
appId: 'wxdcf5bbfb50dbbac8',
path: '',
success(res) {
// 打开其他小程序成功同步触发
// wx.showToast({
// title: '跳转成功'
// })
}
})
}
})

View File

@ -57,7 +57,9 @@
</a>
</view>
</view>
<view></view>
<view style="margin-top:6px">
<!-- <a class="weui-btn weui-btn_primary" bindtap="Baoming" >前往正式报名</a> -->
</view>
</view>