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

View File

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

View File

@ -130,7 +130,7 @@ Page({
} }
}, },
isPhone: function(phone){ 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)) { if (phoneReg.test(phone)) {
return true; return true;
} else { } 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> </a>
</view> </view>
</view> </view>
<view></view> <view style="margin-top:6px">
<!-- <a class="weui-btn weui-btn_primary" bindtap="Baoming" >前往正式报名</a> -->
</view>
</view> </view>